< prev index next >

src/cpu/aarch64/vm/aarch64.ad

Print this page
rev 9428 : 8143219: AArch64 broken by 8141132: JEP 254: Compact Strings
Reviewed-by: kvn


4289   %}
4290 
4291 
4292   // auxiliary used for CompareAndSwapX to set result register
4293   enc_class aarch64_enc_cset_eq(iRegINoSp res) %{
4294     MacroAssembler _masm(&cbuf);
4295     Register res_reg = as_Register($res$$reg);
4296     __ cset(res_reg, Assembler::EQ);
4297   %}
4298 
4299   // prefetch encodings
4300 
4301   enc_class aarch64_enc_prefetchw(memory mem) %{
4302     MacroAssembler _masm(&cbuf);
4303     Register base = as_Register($mem$$base);
4304     int index = $mem$$index;
4305     int scale = $mem$$scale;
4306     int disp = $mem$$disp;
4307     if (index == -1) {
4308       __ prfm(Address(base, disp), PSTL1KEEP);
4309       __ nop();
4310     } else {
4311       Register index_reg = as_Register(index);
4312       if (disp == 0) {
4313         __ prfm(Address(base, index_reg, Address::lsl(scale)), PSTL1KEEP);
4314       } else {
4315         __ lea(rscratch1, Address(base, disp));
4316         __ prfm(Address(rscratch1, index_reg, Address::lsl(scale)), PSTL1KEEP);
4317       }
4318     }
4319   %}
4320 
4321   enc_class aarch64_enc_clear_array_reg_reg(iRegL_R11 cnt, iRegP_R10 base) %{
4322     MacroAssembler _masm(&cbuf);
4323     Register cnt_reg = as_Register($cnt$$reg);
4324     Register base_reg = as_Register($base$$reg);
4325     // base is word aligned
4326     // cnt is count of words
4327 
4328     Label loop;
4329     Label entry;


14150 
14151   ins_cost(1100);  // slightly larger than the next version
14152   format %{ "partialSubtypeCheck $result, $sub, $super == 0" %}
14153 
14154   ins_encode(aarch64_enc_partial_subtype_check(sub, super, temp, result));
14155 
14156   opcode(0x0); // Don't zero result reg on hit
14157 
14158   ins_pipe(pipe_class_memory);
14159 %}
14160 
14161 instruct string_compare(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 cnt2,
14162                         iRegI_R0 result, iRegP_R10 tmp1, rFlagsReg cr)
14163 %{
14164   predicate(!CompactStrings);
14165   match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
14166   effect(KILL tmp1, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL cr);
14167 
14168   format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result   # KILL $tmp1" %}
14169   ins_encode %{



14170     __ string_compare($str1$$Register, $str2$$Register,
14171                       $cnt1$$Register, $cnt2$$Register, $result$$Register,
14172                       $tmp1$$Register);
14173   %}
14174   ins_pipe(pipe_class_memory);
14175 %}
14176 
14177 instruct string_indexof(iRegP_R1 str1, iRegI_R4 cnt1, iRegP_R3 str2, iRegI_R2 cnt2,
14178        iRegI_R0 result, iRegI tmp1, iRegI tmp2, iRegI tmp3, iRegI tmp4, rFlagsReg cr)
14179 %{
14180   predicate(!CompactStrings);
14181   match(Set result (StrIndexOf (Binary str1 cnt1) (Binary str2 cnt2)));
14182   effect(USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2,
14183          TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, KILL cr);
14184   format %{ "String IndexOf $str1,$cnt1,$str2,$cnt2 -> $result" %}
14185 
14186   ins_encode %{
14187     __ string_indexof($str1$$Register, $str2$$Register,
14188                       $cnt1$$Register, $cnt2$$Register,
14189                       $tmp1$$Register, $tmp2$$Register,


14206   ins_encode %{
14207     int icnt2 = (int)$int_cnt2$$constant;
14208     __ string_indexof($str1$$Register, $str2$$Register,
14209                       $cnt1$$Register, zr,
14210                       $tmp1$$Register, $tmp2$$Register,
14211                       $tmp3$$Register, $tmp4$$Register,
14212                       icnt2, $result$$Register);
14213   %}
14214   ins_pipe(pipe_class_memory);
14215 %}
14216 
14217 instruct string_equals(iRegP_R1 str1, iRegP_R3 str2, iRegI_R4 cnt,
14218                         iRegI_R0 result, iRegP_R10 tmp, rFlagsReg cr)
14219 %{
14220   predicate(!CompactStrings);
14221   match(Set result (StrEquals (Binary str1 str2) cnt));
14222   effect(KILL tmp, USE_KILL str1, USE_KILL str2, USE_KILL cnt, KILL cr);
14223 
14224   format %{ "String Equals $str1,$str2,$cnt -> $result    // KILL $tmp" %}
14225   ins_encode %{


14226     __ string_equals($str1$$Register, $str2$$Register,
14227                       $cnt$$Register, $result$$Register,
14228                       $tmp$$Register);
14229   %}
14230   ins_pipe(pipe_class_memory);
14231 %}
14232 
14233 instruct array_equals(iRegP_R1 ary1, iRegP_R2 ary2, iRegI_R0 result,
14234                       iRegP_R10 tmp, rFlagsReg cr)
14235 %{
14236   predicate(((AryEqNode*)n)->encoding() == StrIntrinsicNode::UU);
14237   match(Set result (AryEq ary1 ary2));
14238   effect(KILL tmp, USE_KILL ary1, USE_KILL ary2, KILL cr);
14239 
14240   format %{ "Array Equals $ary1,ary2 -> $result    // KILL $tmp" %}
14241   ins_encode %{
14242     __ char_arrays_equals($ary1$$Register, $ary2$$Register,
14243                           $result$$Register, $tmp$$Register);
14244   %}
14245   ins_pipe(pipe_class_memory);




4289   %}
4290 
4291 
4292   // auxiliary used for CompareAndSwapX to set result register
4293   enc_class aarch64_enc_cset_eq(iRegINoSp res) %{
4294     MacroAssembler _masm(&cbuf);
4295     Register res_reg = as_Register($res$$reg);
4296     __ cset(res_reg, Assembler::EQ);
4297   %}
4298 
4299   // prefetch encodings
4300 
4301   enc_class aarch64_enc_prefetchw(memory mem) %{
4302     MacroAssembler _masm(&cbuf);
4303     Register base = as_Register($mem$$base);
4304     int index = $mem$$index;
4305     int scale = $mem$$scale;
4306     int disp = $mem$$disp;
4307     if (index == -1) {
4308       __ prfm(Address(base, disp), PSTL1KEEP);

4309     } else {
4310       Register index_reg = as_Register(index);
4311       if (disp == 0) {
4312         __ prfm(Address(base, index_reg, Address::lsl(scale)), PSTL1KEEP);
4313       } else {
4314         __ lea(rscratch1, Address(base, disp));
4315         __ prfm(Address(rscratch1, index_reg, Address::lsl(scale)), PSTL1KEEP);
4316       }
4317     }
4318   %}
4319 
4320   enc_class aarch64_enc_clear_array_reg_reg(iRegL_R11 cnt, iRegP_R10 base) %{
4321     MacroAssembler _masm(&cbuf);
4322     Register cnt_reg = as_Register($cnt$$reg);
4323     Register base_reg = as_Register($base$$reg);
4324     // base is word aligned
4325     // cnt is count of words
4326 
4327     Label loop;
4328     Label entry;


14149 
14150   ins_cost(1100);  // slightly larger than the next version
14151   format %{ "partialSubtypeCheck $result, $sub, $super == 0" %}
14152 
14153   ins_encode(aarch64_enc_partial_subtype_check(sub, super, temp, result));
14154 
14155   opcode(0x0); // Don't zero result reg on hit
14156 
14157   ins_pipe(pipe_class_memory);
14158 %}
14159 
14160 instruct string_compare(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 cnt2,
14161                         iRegI_R0 result, iRegP_R10 tmp1, rFlagsReg cr)
14162 %{
14163   predicate(!CompactStrings);
14164   match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
14165   effect(KILL tmp1, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL cr);
14166 
14167   format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result   # KILL $tmp1" %}
14168   ins_encode %{
14169     // Count is in 8-bit bytes; non-Compact chars are 16 bits.
14170     __ asrw($cnt1$$Register, $cnt1$$Register, 1);
14171     __ asrw($cnt2$$Register, $cnt2$$Register, 1);
14172     __ string_compare($str1$$Register, $str2$$Register,
14173                       $cnt1$$Register, $cnt2$$Register, $result$$Register,
14174                       $tmp1$$Register);
14175   %}
14176   ins_pipe(pipe_class_memory);
14177 %}
14178 
14179 instruct string_indexof(iRegP_R1 str1, iRegI_R4 cnt1, iRegP_R3 str2, iRegI_R2 cnt2,
14180        iRegI_R0 result, iRegI tmp1, iRegI tmp2, iRegI tmp3, iRegI tmp4, rFlagsReg cr)
14181 %{
14182   predicate(!CompactStrings);
14183   match(Set result (StrIndexOf (Binary str1 cnt1) (Binary str2 cnt2)));
14184   effect(USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2,
14185          TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, KILL cr);
14186   format %{ "String IndexOf $str1,$cnt1,$str2,$cnt2 -> $result" %}
14187 
14188   ins_encode %{
14189     __ string_indexof($str1$$Register, $str2$$Register,
14190                       $cnt1$$Register, $cnt2$$Register,
14191                       $tmp1$$Register, $tmp2$$Register,


14208   ins_encode %{
14209     int icnt2 = (int)$int_cnt2$$constant;
14210     __ string_indexof($str1$$Register, $str2$$Register,
14211                       $cnt1$$Register, zr,
14212                       $tmp1$$Register, $tmp2$$Register,
14213                       $tmp3$$Register, $tmp4$$Register,
14214                       icnt2, $result$$Register);
14215   %}
14216   ins_pipe(pipe_class_memory);
14217 %}
14218 
14219 instruct string_equals(iRegP_R1 str1, iRegP_R3 str2, iRegI_R4 cnt,
14220                         iRegI_R0 result, iRegP_R10 tmp, rFlagsReg cr)
14221 %{
14222   predicate(!CompactStrings);
14223   match(Set result (StrEquals (Binary str1 str2) cnt));
14224   effect(KILL tmp, USE_KILL str1, USE_KILL str2, USE_KILL cnt, KILL cr);
14225 
14226   format %{ "String Equals $str1,$str2,$cnt -> $result    // KILL $tmp" %}
14227   ins_encode %{
14228     // Count is in 8-bit bytes; non-Compact chars are 16 bits.
14229     __ asrw($cnt$$Register, $cnt$$Register, 1);
14230     __ string_equals($str1$$Register, $str2$$Register,
14231                       $cnt$$Register, $result$$Register,
14232                       $tmp$$Register);
14233   %}
14234   ins_pipe(pipe_class_memory);
14235 %}
14236 
14237 instruct array_equals(iRegP_R1 ary1, iRegP_R2 ary2, iRegI_R0 result,
14238                       iRegP_R10 tmp, rFlagsReg cr)
14239 %{
14240   predicate(((AryEqNode*)n)->encoding() == StrIntrinsicNode::UU);
14241   match(Set result (AryEq ary1 ary2));
14242   effect(KILL tmp, USE_KILL ary1, USE_KILL ary2, KILL cr);
14243 
14244   format %{ "Array Equals $ary1,ary2 -> $result    // KILL $tmp" %}
14245   ins_encode %{
14246     __ char_arrays_equals($ary1$$Register, $ary2$$Register,
14247                           $result$$Register, $tmp$$Register);
14248   %}
14249   ins_pipe(pipe_class_memory);


< prev index next >