summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author Goran Jakovljevic <Goran.Jakovljevic@imgtec.com> 2017-02-27 13:14:57 +0100
committer Goran Jakovljevic <Goran.Jakovljevic@imgtec.com> 2017-02-28 13:38:10 +0100
commit64fa84fba1d46afd5a2dc7dc3cc1de77461888bc (patch)
tree30700997eddea7282e07520da9821e84e5e837b7 /test
parent69dcdead8a6271587e0686798a26f95e92629fc1 (diff)
Apply String.equals() optimizations on MIPS32 and MIPS64
Also extended test 536-checker-intrinsic-optimization. Test: mma test-art-target-run-test in QEMU (MIPS64R6 and MIPS32R6) Test: mma test-art-target-run-test on CI20 (MIPS32R2) Change-Id: I6bff42f81dcb05094ac698181df16c56193bb4a8
Diffstat (limited to 'test')
-rw-r--r--test/536-checker-intrinsic-optimization/src/Main.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/536-checker-intrinsic-optimization/src/Main.java b/test/536-checker-intrinsic-optimization/src/Main.java
index 52f3f84406..e395e283e0 100644
--- a/test/536-checker-intrinsic-optimization/src/Main.java
+++ b/test/536-checker-intrinsic-optimization/src/Main.java
@@ -330,6 +330,21 @@ public class Main {
// Terminate the scope for the CHECK-NOT search at the reference or length comparison,
// whichever comes first.
/// CHECK: cmp {{w.*,}} {{w.*|#.*}}
+
+ /// CHECK-START-MIPS: boolean Main.stringArgumentNotNull(java.lang.Object) disassembly (after)
+ /// CHECK: InvokeVirtual {{.*\.equals.*}} intrinsic:StringEquals
+ /// CHECK-NOT: beq r0,
+ /// CHECK-NOT: beqz
+ /// CHECK-NOT: beqzc
+ // Terminate the scope for the CHECK-NOT search at the class field or length comparison,
+ // whichever comes first.
+ /// CHECK: lw
+
+ /// CHECK-START-MIPS64: boolean Main.stringArgumentNotNull(java.lang.Object) disassembly (after)
+ /// CHECK: InvokeVirtual {{.*\.equals.*}} intrinsic:StringEquals
+ /// CHECK-NOT: beqzc
+ // Terminate the scope for the CHECK-NOT search at the reference comparison.
+ /// CHECK: beqc
public static boolean stringArgumentNotNull(Object obj) {
obj.getClass();
return "foo".equals(obj);
@@ -384,6 +399,22 @@ public class Main {
/// CHECK-NOT: ldr {{w\d+}}, [{{x\d+}}]
/// CHECK-NOT: ldr {{w\d+}}, [{{x\d+}}, #0]
/// CHECK: cmp {{w\d+}}, {{w\d+|#.*}}
+
+ // Test is brittle as it depends on the class offset being 0.
+ /// CHECK-START-MIPS: boolean Main.stringArgumentIsString() disassembly (after)
+ /// CHECK: InvokeVirtual intrinsic:StringEquals
+ /// CHECK: beq{{(zc)?}}
+ // Check that we don't try to compare the classes.
+ /// CHECK-NOT: lw {{r\d+}}, +0({{r\d+}})
+ /// CHECK: bne{{c?}}
+
+ // Test is brittle as it depends on the class offset being 0.
+ /// CHECK-START-MIPS64: boolean Main.stringArgumentIsString() disassembly (after)
+ /// CHECK: InvokeVirtual intrinsic:StringEquals
+ /// CHECK: beqzc
+ // Check that we don't try to compare the classes.
+ /// CHECK-NOT: lw {{r\d+}}, +0({{r\d+}})
+ /// CHECK: bnec
public static boolean stringArgumentIsString() {
return "foo".equals(myString);
}