Merge test 539 into test 538-checker-embed-constants.
Change-Id: I3bb468f287b7aab36a3868ea43d83ba98eca1dcc
diff --git a/test/538-checker-embed-constants/src/Main.java b/test/538-checker-embed-constants/src/Main.java
index d8618e3..979c4c8 100644
--- a/test/538-checker-embed-constants/src/Main.java
+++ b/test/538-checker-embed-constants/src/Main.java
@@ -260,6 +260,29 @@
return arg ^ 0xf00000000000000fL;
}
+ /**
+ * Test that the `-1` constant is not synthesized in a register and that we
+ * instead simply switch between `add` and `sub` instructions with the
+ * constant embedded.
+ * We need two uses (or more) of the constant because the compiler always
+ * defers to immediate value handling to VIXL when it has only one use.
+ */
+
+ /// CHECK-START-ARM64: long Main.addM1(long) register (after)
+ /// CHECK: <<Arg:j\d+>> ParameterValue
+ /// CHECK: <<ConstM1:j\d+>> LongConstant -1
+ /// CHECK-NOT: ParallelMove
+ /// CHECK: Add [<<Arg>>,<<ConstM1>>]
+ /// CHECK: Sub [<<Arg>>,<<ConstM1>>]
+
+ /// CHECK-START-ARM64: long Main.addM1(long) disassembly (after)
+ /// CHECK: sub x{{\d+}}, x{{\d+}}, #0x1
+ /// CHECK: add x{{\d+}}, x{{\d+}}, #0x1
+
+ public static long addM1(long arg) {
+ return (arg + (-1)) | (arg - (-1));
+ }
+
public static void main(String[] args) {
int arg = 0x87654321;
assertIntEquals(and255(arg), 0x21);
@@ -286,5 +309,7 @@
assertLongEquals(xorNot15(longArg), 0xedcba987789abcd1L);
assertLongEquals(xor0xfffffff00000000f(longArg), 0xedcba9888765432eL);
assertLongEquals(xor0xf00000000000000f(longArg), 0xe23456788765432eL);
+
+ assertLongEquals(14, addM1(7));
}
}
diff --git a/test/539-checker-arm64-encodable-immediates/expected.txt b/test/539-checker-arm64-encodable-immediates/expected.txt
deleted file mode 100644
index e69de29..0000000
--- a/test/539-checker-arm64-encodable-immediates/expected.txt
+++ /dev/null
diff --git a/test/539-checker-arm64-encodable-immediates/info.txt b/test/539-checker-arm64-encodable-immediates/info.txt
deleted file mode 100644
index efeef33..0000000
--- a/test/539-checker-arm64-encodable-immediates/info.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-Basic tests that check the compiler recognizes when constant values can be
-encoded in the immediate field of instructions.
diff --git a/test/539-checker-arm64-encodable-immediates/src/Main.java b/test/539-checker-arm64-encodable-immediates/src/Main.java
deleted file mode 100644
index 7e3ff9f..0000000
--- a/test/539-checker-arm64-encodable-immediates/src/Main.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-public class Main {
-
- public static void assertLongEquals(long expected, long result) {
- if (expected != result) {
- throw new Error("Expected: " + expected + ", found: " + result);
- }
- }
-
- /**
- * Test that the `-1` constant is not synthesized in a register and that we
- * instead simply switch between `add` and `sub` instructions with the
- * constant embedded.
- * We need two uses (or more) of the constant because the compiler always
- * delegates the immediate value handling to VIXL when there is only one use.
- */
-
- /// CHECK-START-ARM64: long Main.addM1(long) register (after)
- /// CHECK: <<Arg:j\d+>> ParameterValue
- /// CHECK: <<ConstM1:j\d+>> LongConstant -1
- /// CHECK-NOT: ParallelMove
- /// CHECK: Add [<<Arg>>,<<ConstM1>>]
- /// CHECK: Sub [<<Arg>>,<<ConstM1>>]
-
- /// CHECK-START-ARM64: long Main.addM1(long) disassembly (after)
- /// CHECK: sub x{{\d+}}, x{{\d+}}, #0x1
- /// CHECK: add x{{\d+}}, x{{\d+}}, #0x1
-
- public static long addM1(long arg) {
- return (arg + (-1)) | (arg - (-1));
- }
-
- public static void main(String[] args) {
- assertLongEquals(14, addM1(7));
- }
-}