< prev index next >

src/cpu/aarch64/vm/aarch64.ad

Print this page
rev 10277 : 8149733: AArch64: refactor array_equals/string_equals
Summary: combine similar code for string_equals/char_array_equals/byte_array_equals into same implemenation
Reviewed-by: duke

@@ -14781,23 +14781,23 @@
   %}
   ins_pipe(pipe_class_memory);
 %}
 
 instruct string_equals(iRegP_R1 str1, iRegP_R3 str2, iRegI_R4 cnt,
-                        iRegI_R0 result, iRegP_R10 tmp, rFlagsReg cr)
+                        iRegI_R0 result, rFlagsReg cr)
 %{
   predicate(!CompactStrings);
   match(Set result (StrEquals (Binary str1 str2) cnt));
-  effect(KILL tmp, USE_KILL str1, USE_KILL str2, USE_KILL cnt, KILL cr);
+  effect(USE_KILL str1, USE_KILL str2, USE_KILL cnt, KILL cr);
 
-  format %{ "String Equals $str1,$str2,$cnt -> $result    // KILL $tmp" %}
+  format %{ "String Equals $str1,$str2,$cnt -> $result" %}
   ins_encode %{
     // Count is in 8-bit bytes; non-Compact chars are 16 bits.
     __ asrw($cnt$$Register, $cnt$$Register, 1);
-    __ string_equals($str1$$Register, $str2$$Register,
-                      $cnt$$Register, $result$$Register,
-                      $tmp$$Register);
+    __ generic_array_equals($str1$$Register, $str2$$Register,
+                      $result$$Register, $cnt$$Register,
+                      2, true);
   %}
   ins_pipe(pipe_class_memory);
 %}
 
 instruct array_equalsB(iRegP_R1 ary1, iRegP_R2 ary2, iRegI_R0 result,

@@ -14807,12 +14807,13 @@
   match(Set result (AryEq ary1 ary2));
   effect(KILL tmp, USE_KILL ary1, USE_KILL ary2, KILL cr);
 
   format %{ "Array Equals $ary1,ary2 -> $result    // KILL $tmp" %}
   ins_encode %{
-    __ byte_arrays_equals($ary1$$Register, $ary2$$Register,
-                          $result$$Register, $tmp$$Register);
+    __ generic_array_equals($ary1$$Register, $ary2$$Register,
+                             $result$$Register, $tmp$$Register,
+                             1, false);
   %}
   ins_pipe(pipe_class_memory);
 %}
 
 instruct array_equalsC(iRegP_R1 ary1, iRegP_R2 ary2, iRegI_R0 result,

@@ -14822,16 +14823,18 @@
   match(Set result (AryEq ary1 ary2));
   effect(KILL tmp, USE_KILL ary1, USE_KILL ary2, KILL cr);
 
   format %{ "Array Equals $ary1,ary2 -> $result    // KILL $tmp" %}
   ins_encode %{
-    __ char_arrays_equals($ary1$$Register, $ary2$$Register,
-                          $result$$Register, $tmp$$Register);
+        __ generic_array_equals($ary1$$Register, $ary2$$Register,
+                             $result$$Register, $tmp$$Register,
+                             2, false);
   %}
   ins_pipe(pipe_class_memory);
 %}
 
+
 // encode char[] to byte[] in ISO_8859_1
 instruct encode_iso_array(iRegP_R2 src, iRegP_R1 dst, iRegI_R3 len,
                           vRegD_V0 Vtmp1, vRegD_V1 Vtmp2,
                           vRegD_V2 Vtmp3, vRegD_V3 Vtmp4,
                           iRegI_R0 result, rFlagsReg cr)
< prev index next >