Tue, 22 Aug 2017 20:34:55 +0800
Added some tests from aarch64-port/jdk8u
changeset: 7822:b726eba4e35e
branch: aarch64_c1
user: Roman Kennke <rkennke@redhat.com>
date: Tue Mar 19 12:29:50 2013 +0100
summary: Implement long and int shift operations.
changeset: 7823:be70c1b74176
branch: aarch64_c1
user: Roman Kennke <rkennke@redhat.com>
date: Tue Mar 19 16:44:59 2013 +0100
summary: Implement logical ops for long and int.
changeset: 7824:ee546035e395
branch: aarch64_c1
user: Roman Kennke <rkennke@redhat.com>
date: Wed Mar 20 10:32:11 2013 +0100
summary: Implement negate operator.
changeset: 7831:e815d42f9910
branch: aarch64_c1
parent: 7829:b30f63681e7c
user: Roman Kennke <rkennke@redhat.com>
date: Wed Mar 27 14:06:34 2013 +0100
summary: Implement/complete comparison operators.
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/test/aarch64/DoubleArithTests.java Tue Aug 22 20:34:55 2017 +0800 1.3 @@ -0,0 +1,55 @@ 1.4 + /* 1.5 + * @test 1.6 + * @run main/othervm -Xint DoubleArithTests 1.7 + * @run main/othervm -Xcomp DoubleArithTests 1.8 + */ 1.9 + 1.10 +public class DoubleArithTests { 1.11 + 1.12 + private static double test_neg(double a) { 1.13 + return -a; 1.14 + } 1.15 + 1.16 + private static double test_add(double a, double b) { 1.17 + return a + b; 1.18 + } 1.19 + 1.20 + private static double test_sub(double a, double b) { 1.21 + return a - b; 1.22 + } 1.23 + 1.24 + private static double test_mul(double a, double b) { 1.25 + return a * b; 1.26 + } 1.27 + 1.28 + private static double test_div(double a, double b) { 1.29 + return a / b; 1.30 + } 1.31 + 1.32 + private static double test_rem(double a, double b) { 1.33 + return a % b; 1.34 + } 1.35 + 1.36 + private static void assertThat(boolean assertion) { 1.37 + if (! assertion) { 1.38 + throw new AssertionError(); 1.39 + } 1.40 + } 1.41 + 1.42 + public static void main(String[] args) { 1.43 + assertThat(test_neg(10.0) == -10.0); 1.44 + assertThat(test_add(3.0, 2.0) == 5.0); 1.45 + 1.46 + assertThat(test_sub(40.0, 13.0) == 27.0); 1.47 + 1.48 + assertThat(test_mul(5.0, 200.0) == 1000.0); 1.49 + 1.50 + assertThat(test_div(30.0, 3.0) == 10.0); 1.51 + assertThat(test_div(30.0, 0.0) == Double.POSITIVE_INFINITY); 1.52 + 1.53 + assertThat(test_rem(30.0, 3.0) == 0.0); 1.54 + assertThat(test_rem(29.0, 3.0) == 2.0); 1.55 + assertThat(Double.isNaN(test_rem(30.0, 0.0))); 1.56 + 1.57 + } 1.58 +}
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/test/aarch64/DoubleCmpTests.java Tue Aug 22 20:34:55 2017 +0800 2.3 @@ -0,0 +1,108 @@ 2.4 + 2.5 + /* 2.6 + * @test 2.7 + * @run main/othervm -Xint DoubleCmpTests 2.8 + * @run main/othervm -Xcomp DoubleCmpTests 2.9 + */ 2.10 + 2.11 +public class DoubleCmpTests { 2.12 + 2.13 + private static boolean test_isEq(double a, double b) { 2.14 + return a == b; 2.15 + } 2.16 + 2.17 + private static boolean test_isNe(double a, double b) { 2.18 + return a != b; 2.19 + } 2.20 + 2.21 + private static boolean test_isLt(double a, double b) { 2.22 + return a < b; 2.23 + } 2.24 + 2.25 + private static boolean test_isLe(double a, double b) { 2.26 + return a <= b; 2.27 + } 2.28 + 2.29 + private static boolean test_isGe(double a, double b) { 2.30 + return a >= b; 2.31 + } 2.32 + 2.33 + private static boolean test_isGt(double a, double b) { 2.34 + return a > b; 2.35 + } 2.36 + 2.37 + private static boolean test_isEqC(double a) { 2.38 + return a == 7.; 2.39 + } 2.40 + 2.41 + private static boolean test_isNeC(double a) { 2.42 + return a != 7.; 2.43 + } 2.44 + 2.45 + private static boolean test_isLtC(double a) { 2.46 + return a < 7.; 2.47 + } 2.48 + 2.49 + private static boolean test_isLeC(double a) { 2.50 + return a <= 7.; 2.51 + } 2.52 + 2.53 + private static boolean test_isGeC(double a) { 2.54 + return a >= 7.; 2.55 + } 2.56 + 2.57 + private static boolean test_isGtC(double a) { 2.58 + return a > 7.; 2.59 + } 2.60 + 2.61 + private static void assertThat(boolean assertion) { 2.62 + if (! assertion) { 2.63 + throw new AssertionError(); 2.64 + } 2.65 + } 2.66 + 2.67 + public static void main(String[] args) { 2.68 + assertThat(test_isEq(7., 7.)); 2.69 + assertThat(! test_isEq(70., 7.)); 2.70 + assertThat(! test_isNe(7., 7.)); 2.71 + assertThat(test_isNe(70., 7.)); 2.72 + 2.73 + assertThat(test_isLt(7., 70.)); 2.74 + assertThat(! test_isLt(70., 7.)); 2.75 + assertThat(! test_isLt(7., 7.)); 2.76 + 2.77 + assertThat(test_isLe(7., 70.)); 2.78 + assertThat(! test_isLe(70., 7.)); 2.79 + assertThat(test_isLe(7., 7.)); 2.80 + 2.81 + assertThat(!test_isGe(7., 70.)); 2.82 + assertThat(test_isGe(70., 7.)); 2.83 + assertThat(test_isGe(7., 7.)); 2.84 + 2.85 + assertThat(!test_isGt(7., 70.)); 2.86 + assertThat(test_isGt(70., 7.)); 2.87 + assertThat(! test_isGt(7., 7.)); 2.88 + 2.89 + 2.90 + assertThat(test_isEqC(7.)); 2.91 + assertThat(! test_isEqC(70.)); 2.92 + assertThat(! test_isNeC(7.)); 2.93 + assertThat(test_isNeC(70.)); 2.94 + 2.95 + assertThat(test_isLtC(6.)); 2.96 + assertThat(! test_isLtC(70.)); 2.97 + assertThat(! test_isLtC(7.)); 2.98 + 2.99 + assertThat(test_isLeC(6.)); 2.100 + assertThat(! test_isLeC(70.)); 2.101 + assertThat(test_isLeC(7.)); 2.102 + 2.103 + assertThat(!test_isGeC(6.)); 2.104 + assertThat(test_isGeC(70.)); 2.105 + assertThat(test_isGeC(7.)); 2.106 + 2.107 + assertThat(!test_isGtC(6.)); 2.108 + assertThat(test_isGtC(70.)); 2.109 + assertThat(! test_isGtC(7.)); 2.110 + } 2.111 +}
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/test/aarch64/FloatArithTests.java Tue Aug 22 20:34:55 2017 +0800 3.3 @@ -0,0 +1,56 @@ 3.4 + 3.5 + /* 3.6 + * @test 3.7 + * @run main/othervm -Xint FloatArithTests 3.8 + * @run main/othervm -Xcomp FloatArithTests 3.9 + */ 3.10 + 3.11 +public class FloatArithTests { 3.12 + 3.13 + private static float test_neg(float a) { 3.14 + return -a; 3.15 + } 3.16 + 3.17 + private static float test_add(float a, float b) { 3.18 + return a + b; 3.19 + } 3.20 + 3.21 + private static float test_sub(float a, float b) { 3.22 + return a - b; 3.23 + } 3.24 + 3.25 + private static float test_mul(float a, float b) { 3.26 + return a * b; 3.27 + } 3.28 + 3.29 + private static float test_div(float a, float b) { 3.30 + return a / b; 3.31 + } 3.32 + 3.33 + private static float test_rem(float a, float b) { 3.34 + return a % b; 3.35 + } 3.36 + 3.37 + private static void assertThat(boolean assertion) { 3.38 + if (! assertion) { 3.39 + throw new AssertionError(); 3.40 + } 3.41 + } 3.42 + 3.43 + public static void main(String[] args) { 3.44 + assertThat(test_neg(10F) == -10F); 3.45 + assertThat(test_add(3F, 2F) == 5F); 3.46 + 3.47 + assertThat(test_sub(40F, 13F) == 27F); 3.48 + 3.49 + assertThat(test_mul(5F, 200F) == 1000F); 3.50 + 3.51 + assertThat(test_div(30F, 3F) == 10F); 3.52 + assertThat(test_div(30, 0) == Float.POSITIVE_INFINITY); 3.53 + 3.54 + assertThat(test_rem(30F, 3F) == 0); 3.55 + assertThat(test_rem(29F, 3F) == 2F); 3.56 + assertThat(Float.isNaN(test_rem(30F, 0F))); 3.57 + 3.58 + } 3.59 +}
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/test/aarch64/FloatCmpTests.java Tue Aug 22 20:34:55 2017 +0800 4.3 @@ -0,0 +1,107 @@ 4.4 + /* 4.5 + * @test 4.6 + * @run main/othervm -Xint FloatCmpTests 4.7 + * @run main/othervm -Xcomp FloatCmpTests 4.8 + */ 4.9 + 4.10 +public class FloatCmpTests { 4.11 + 4.12 + private static boolean test_isEq(float a, float b) { 4.13 + return a == b; 4.14 + } 4.15 + 4.16 + private static boolean test_isNe(float a, float b) { 4.17 + return a != b; 4.18 + } 4.19 + 4.20 + private static boolean test_isLt(float a, float b) { 4.21 + return a < b; 4.22 + } 4.23 + 4.24 + private static boolean test_isLe(float a, float b) { 4.25 + return a <= b; 4.26 + } 4.27 + 4.28 + private static boolean test_isGe(float a, float b) { 4.29 + return a >= b; 4.30 + } 4.31 + 4.32 + private static boolean test_isGt(float a, float b) { 4.33 + return a > b; 4.34 + } 4.35 + 4.36 + private static boolean test_isEqC(float a) { 4.37 + return a == 7F; 4.38 + } 4.39 + 4.40 + private static boolean test_isNeC(float a) { 4.41 + return a != 7F; 4.42 + } 4.43 + 4.44 + private static boolean test_isLtC(float a) { 4.45 + return a < 7F; 4.46 + } 4.47 + 4.48 + private static boolean test_isLeC(float a) { 4.49 + return a <= 7F; 4.50 + } 4.51 + 4.52 + private static boolean test_isGeC(float a) { 4.53 + return a >= 7F; 4.54 + } 4.55 + 4.56 + private static boolean test_isGtC(float a) { 4.57 + return a > 7F; 4.58 + } 4.59 + 4.60 + private static void assertThat(boolean assertion) { 4.61 + if (! assertion) { 4.62 + throw new AssertionError(); 4.63 + } 4.64 + } 4.65 + 4.66 + public static void main(String[] args) { 4.67 + assertThat(test_isEq(7F, 7F)); 4.68 + assertThat(! test_isEq(70F, 7F)); 4.69 + assertThat(! test_isNe(7F, 7F)); 4.70 + assertThat(test_isNe(70F, 7F)); 4.71 + 4.72 + assertThat(test_isLt(7F, 70F)); 4.73 + assertThat(! test_isLt(70F, 7F)); 4.74 + assertThat(! test_isLt(7F, 7F)); 4.75 + 4.76 + assertThat(test_isLe(7F, 70F)); 4.77 + assertThat(! test_isLe(70F, 7F)); 4.78 + assertThat(test_isLe(7F, 7F)); 4.79 + 4.80 + assertThat(!test_isGe(7F, 70F)); 4.81 + assertThat(test_isGe(70F, 7F)); 4.82 + assertThat(test_isGe(7F, 7F)); 4.83 + 4.84 + assertThat(!test_isGt(7F, 70F)); 4.85 + assertThat(test_isGt(70F, 7F)); 4.86 + assertThat(! test_isGt(7F, 7F)); 4.87 + 4.88 + 4.89 + assertThat(test_isEqC(7F)); 4.90 + assertThat(! test_isEqC(70F)); 4.91 + assertThat(! test_isNeC(7F)); 4.92 + assertThat(test_isNeC(70F)); 4.93 + 4.94 + assertThat(test_isLtC(6F)); 4.95 + assertThat(! test_isLtC(70F)); 4.96 + assertThat(! test_isLtC(7F)); 4.97 + 4.98 + assertThat(test_isLeC(6F)); 4.99 + assertThat(! test_isLeC(70F)); 4.100 + assertThat(test_isLeC(7F)); 4.101 + 4.102 + assertThat(!test_isGeC(6F)); 4.103 + assertThat(test_isGeC(70F)); 4.104 + assertThat(test_isGeC(7F)); 4.105 + 4.106 + assertThat(!test_isGtC(6F)); 4.107 + assertThat(test_isGtC(70F)); 4.108 + assertThat(! test_isGtC(7F)); 4.109 + } 4.110 +}
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/test/aarch64/IntArithTests.java Tue Aug 22 20:34:55 2017 +0800 5.3 @@ -0,0 +1,137 @@ 5.4 + 5.5 + /* 5.6 + * @test 5.7 + * @run main/othervm -Xint IntArithTests 5.8 + * @run main/othervm -Xcomp IntArithTests 5.9 + */ 5.10 +public class IntArithTests { 5.11 + 5.12 + private static final int IIMM12_0 = 0x1; // first imm value 5.13 + private static final int IIMM12_1 = 0xfff; // last 12bit imm value 5.14 + private static final int IIMM12_2 = 0x1001; // Should not encode as imm 5.15 + private static final int IIMM24_3 = 0x1000; // first 12 bit shifted imm 5.16 + private static final int IIMM24_4 = 0xfff000; // Last 12 bit shifted imm 5.17 + private static final int IIMM24_5 = 0x1001000; // Should not encode as imm 5.18 + 5.19 + private static int test_neg(int a) { 5.20 + return -a; 5.21 + } 5.22 + 5.23 + private static int test_addi(int a, int b) { 5.24 + return a + b; 5.25 + } 5.26 + 5.27 + private static int test_addic0(int a) { 5.28 + return a + IIMM12_0; 5.29 + } 5.30 + 5.31 + private static int test_addic1(int a) { 5.32 + return a + IIMM12_1; 5.33 + } 5.34 + 5.35 + private static int test_addic2(int a) { 5.36 + return a + IIMM12_2; 5.37 + } 5.38 + 5.39 + private static int test_addic3(int a) { 5.40 + return a + IIMM24_3; 5.41 + } 5.42 + 5.43 + private static int test_addic4(int a) { 5.44 + return a + IIMM24_4; 5.45 + } 5.46 + 5.47 + private static int test_addic5(int a) { 5.48 + return a + IIMM24_5; 5.49 + } 5.50 + 5.51 + private static int test_subi(int a, int b) { 5.52 + return a - b; 5.53 + } 5.54 + 5.55 + private static int test_subc1(int a) { 5.56 + return a - 11; 5.57 + } 5.58 + 5.59 + private static int test_mulic1(int a) { 5.60 + // Generates shl. 5.61 + return a * 8; 5.62 + } 5.63 + 5.64 + private static int test_mulic2(int a) { 5.65 + // Generates shl followed by add. 5.66 + return a * 9; 5.67 + } 5.68 + 5.69 + private static int test_mulic3(int a) { 5.70 + // Generates shl followed by sub. 5.71 + return a * 7; 5.72 + } 5.73 + 5.74 + private static int test_mulic4(int a) { 5.75 + // Generates normal mul. 5.76 + return a * 10; 5.77 + } 5.78 + 5.79 + private static int test_muli(int a, int b) { 5.80 + // Generates normal mul. 5.81 + return a * b; 5.82 + } 5.83 + 5.84 + private static int test_divi(int a, int b) { 5.85 + return a / b; 5.86 + } 5.87 + 5.88 + private static int test_remi(int a, int b) { 5.89 + return a % b; 5.90 + } 5.91 + 5.92 + private static void assertThat(boolean assertion) { 5.93 + if (! assertion) { 5.94 + throw new AssertionError(); 5.95 + } 5.96 + } 5.97 + 5.98 + public static void main(String[] args) { 5.99 + assertThat(test_neg(10) == -10); 5.100 + assertThat(test_addi(3, 2) == 5); 5.101 + assertThat(test_addi(Integer.MAX_VALUE, 1) == Integer.MIN_VALUE); 5.102 + assertThat(test_addic0(3) == 4); 5.103 + assertThat(test_addic1(3) == 0x1002); 5.104 + assertThat(test_addic2(3) == 0x1004); 5.105 + assertThat(test_addic3(3) == 0x1003); 5.106 + assertThat(test_addic4(3) == 0xfff003); 5.107 + assertThat(test_addic5(3) == 0x1001003); 5.108 + 5.109 + assertThat(test_subi(40, 13) == 27); 5.110 + assertThat(test_subi(Integer.MIN_VALUE, 1) == Integer.MAX_VALUE); 5.111 + assertThat(test_subc1(40) == 29); 5.112 + 5.113 + assertThat(test_mulic1(5) == 40); 5.114 + assertThat(test_mulic2(5) == 45); 5.115 + assertThat(test_mulic3(5) == 35); 5.116 + assertThat(test_mulic4(5) == 50); 5.117 + assertThat(test_muli(5, 200) == 1000); 5.118 + 5.119 + assertThat(test_divi(30, 3) == 10); 5.120 + assertThat(test_divi(29, 3) == 9); 5.121 + assertThat(test_divi(Integer.MIN_VALUE, -1) == Integer.MIN_VALUE); 5.122 + try { 5.123 + test_divi(30, 0); 5.124 + throw new AssertionError(); 5.125 + } catch (ArithmeticException ex) { 5.126 + // Pass. 5.127 + } 5.128 + 5.129 + assertThat(test_remi(30, 3) == 0); 5.130 + assertThat(test_remi(29, 3) == 2); 5.131 + assertThat(test_remi(Integer.MIN_VALUE, -1) == 0); 5.132 + try { 5.133 + test_remi(30, 0); 5.134 + throw new AssertionError(); 5.135 + } catch (ArithmeticException ex) { 5.136 + // Pass. 5.137 + } 5.138 + } 5.139 +} 5.140 +
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/test/aarch64/IntCmpTests.java Tue Aug 22 20:34:55 2017 +0800 6.3 @@ -0,0 +1,107 @@ 6.4 + 6.5 + /* 6.6 + * @test 6.7 + * @run main/othervm -Xint IntCmpTests 6.8 + * @run main/othervm -Xcomp IntCmpTests 6.9 + */ 6.10 +public class IntCmpTests { 6.11 + 6.12 + private static boolean test_isEq(int a, int b) { 6.13 + return a == b; 6.14 + } 6.15 + 6.16 + private static boolean test_isNe(int a, int b) { 6.17 + return a != b; 6.18 + } 6.19 + 6.20 + private static boolean test_isLt(int a, int b) { 6.21 + return a < b; 6.22 + } 6.23 + 6.24 + private static boolean test_isLe(int a, int b) { 6.25 + return a <= b; 6.26 + } 6.27 + 6.28 + private static boolean test_isGe(int a, int b) { 6.29 + return a >= b; 6.30 + } 6.31 + 6.32 + private static boolean test_isGt(int a, int b) { 6.33 + return a > b; 6.34 + } 6.35 + 6.36 + private static boolean test_isEqC(int a) { 6.37 + return a == 7; 6.38 + } 6.39 + 6.40 + private static boolean test_isNeC(int a) { 6.41 + return a != 7; 6.42 + } 6.43 + 6.44 + private static boolean test_isLtC(int a) { 6.45 + return a < 7; 6.46 + } 6.47 + 6.48 + private static boolean test_isLeC(int a) { 6.49 + return a <= 7; 6.50 + } 6.51 + 6.52 + private static boolean test_isGeC(int a) { 6.53 + return a >= 7; 6.54 + } 6.55 + 6.56 + private static boolean test_isGtC(int a) { 6.57 + return a > 7; 6.58 + } 6.59 + 6.60 + private static void assertThat(boolean assertion) { 6.61 + if (! assertion) { 6.62 + throw new AssertionError(); 6.63 + } 6.64 + } 6.65 + 6.66 + public static void main(String[] args) { 6.67 + assertThat(test_isEq(7, 7)); 6.68 + assertThat(! test_isEq(70, 7)); 6.69 + assertThat(! test_isNe(7, 7)); 6.70 + assertThat(test_isNe(70, 7)); 6.71 + 6.72 + assertThat(test_isLt(7, 70)); 6.73 + assertThat(! test_isLt(70, 7)); 6.74 + assertThat(! test_isLt(7, 7)); 6.75 + 6.76 + assertThat(test_isLe(7, 70)); 6.77 + assertThat(! test_isLe(70, 7)); 6.78 + assertThat(test_isLe(7, 7)); 6.79 + 6.80 + assertThat(!test_isGe(7, 70)); 6.81 + assertThat(test_isGe(70, 7)); 6.82 + assertThat(test_isGe(7, 7)); 6.83 + 6.84 + assertThat(!test_isGt(7, 70)); 6.85 + assertThat(test_isGt(70, 7)); 6.86 + assertThat(! test_isGt(7, 7)); 6.87 + 6.88 + assertThat(test_isEqC(7)); 6.89 + assertThat(! test_isEqC(70)); 6.90 + assertThat(! test_isNeC(7)); 6.91 + assertThat(test_isNeC(70)); 6.92 + 6.93 + assertThat(test_isLtC(6)); 6.94 + assertThat(! test_isLtC(70)); 6.95 + assertThat(! test_isLtC(7)); 6.96 + 6.97 + assertThat(test_isLeC(6)); 6.98 + assertThat(! test_isLeC(70)); 6.99 + assertThat(test_isLeC(7)); 6.100 + 6.101 + assertThat(!test_isGeC(6)); 6.102 + assertThat(test_isGeC(70)); 6.103 + assertThat(test_isGeC(7)); 6.104 + 6.105 + assertThat(!test_isGtC(6)); 6.106 + assertThat(test_isGtC(70)); 6.107 + assertThat(! test_isGtC(7)); 6.108 + 6.109 + } 6.110 +}
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/test/aarch64/IntLogicTests.java Tue Aug 22 20:34:55 2017 +0800 7.3 @@ -0,0 +1,72 @@ 7.4 + 7.5 + /* 7.6 + * @test 7.7 + * @run main/othervm -Xint IntLogicTests 7.8 + * @run main/othervm -Xcomp IntLogicTests 7.9 + */ 7.10 +public class IntLogicTests { 7.11 + 7.12 + private static int test_and(int a, int b) { 7.13 + return a & b; 7.14 + } 7.15 + 7.16 + private static int test_andc1(int a) { 7.17 + // Generates immediate instruction. 7.18 + return a & 0xf0f0f0f0; 7.19 + } 7.20 + 7.21 + private static int test_andc2(int a) { 7.22 + // Generates non-immediate instruction. 7.23 + return a & 0x123456d5; 7.24 + } 7.25 + 7.26 + private static int test_or(int a, int b) { 7.27 + return a | b; 7.28 + } 7.29 + 7.30 + private static int test_orc1(int a) { 7.31 + // Generates immediate instruction. 7.32 + return a | 0xf0f0f0f0; 7.33 + } 7.34 + 7.35 + private static int test_orc2(int a) { 7.36 + // Generates non-immediate instruction. 7.37 + return a | 0x123456d5; 7.38 + } 7.39 + 7.40 + private static int test_xor(int a, int b) { 7.41 + return a ^ b; 7.42 + } 7.43 + 7.44 + private static int test_xorc1(int a) { 7.45 + // Generates immediate instruction. 7.46 + return a ^ 0xf0f0f0f0; 7.47 + } 7.48 + 7.49 + private static int test_xorc2(int a) { 7.50 + // Generates non-immediate instruction. 7.51 + return a ^ 0x123456d5; 7.52 + } 7.53 + 7.54 + private static void assertThat(boolean assertion) { 7.55 + if (! assertion) { 7.56 + throw new AssertionError(); 7.57 + } 7.58 + } 7.59 + 7.60 + public static void main(String[] args) { 7.61 + 7.62 + assertThat(test_and(0x21, 0x31) == 0x21); 7.63 + assertThat(test_andc1(0xaaaaaaaa) == 0xa0a0a0a0); 7.64 + assertThat(test_andc2(0xaaaaaaaa) == 0x02200280); 7.65 + 7.66 + assertThat(test_or(0x21, 0x31) == 0x31); 7.67 + assertThat(test_orc1(0xaaaaaaaa) == 0xfafafafa); 7.68 + assertThat(test_orc2(0xaaaaaaaa) == 0xbabefeff); 7.69 + 7.70 + assertThat(test_xor(0x21, 0x31) == 16); 7.71 + assertThat(test_xorc1(0xaaaaaaaa) == 0x5a5a5a5a); 7.72 + assertThat(test_xorc2(0xaaaaaaaa) == 0xb89efc7f); 7.73 + } 7.74 +} 7.75 +
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/test/aarch64/IntShiftTests.java Tue Aug 22 20:34:55 2017 +0800 8.3 @@ -0,0 +1,84 @@ 8.4 + 8.5 + /* 8.6 + * @test 8.7 + * @run main/othervm -Xint IntShiftTests 8.8 + * @run main/othervm -Xcomp IntShiftTests 8.9 + */ 8.10 +public class IntShiftTests { 8.11 + 8.12 + private static int test_shl(int a, int b) { 8.13 + return a << b; 8.14 + } 8.15 + 8.16 + private static int test_shlc1(int a) { 8.17 + return a << 1; 8.18 + } 8.19 + 8.20 + private static int test_shlc33(int a) { 8.21 + return a << 33; 8.22 + } 8.23 + 8.24 + private static int test_shr(int a, int b) { 8.25 + return a >> b; 8.26 + } 8.27 + 8.28 + private static int test_shrc1(int a) { 8.29 + return a >> 1; 8.30 + } 8.31 + 8.32 + private static int test_shrc33(int a) { 8.33 + return a >> 33; 8.34 + } 8.35 + 8.36 + private static int test_ushr(int a, int b) { 8.37 + return a >>> b; 8.38 + } 8.39 + 8.40 + private static int test_ushrc1(int a) { 8.41 + return a >>> 1; 8.42 + } 8.43 + 8.44 + private static int test_ushrc33(int a) { 8.45 + return a >>> 33; 8.46 + } 8.47 + 8.48 + private static void assertThat(boolean assertion) { 8.49 + if (! assertion) { 8.50 + throw new AssertionError(); 8.51 + } 8.52 + } 8.53 + 8.54 + public static void main(String[] args) { 8.55 + 8.56 + assertThat(test_shl(32, 2) == 128); 8.57 + assertThat(test_shl(0x80000000, 1) == 0); 8.58 + assertThat(test_shl(0x40000000, 1) == 0x80000000); 8.59 + assertThat(test_shl(0x40000000, 33) == 0x80000000); 8.60 + 8.61 + assertThat(test_shr(32, 2) == 8); 8.62 + assertThat(test_shr(1, 1) == 0); 8.63 + assertThat(test_shr(0x80000000, 1) == 0xc0000000); 8.64 + assertThat(test_shr(0x40000000, 33) == 0x20000000); 8.65 + 8.66 + assertThat(test_ushr(32, 2) == 8); 8.67 + assertThat(test_ushr(1, 1) == 0); 8.68 + assertThat(test_ushr(0x80000000, 1) == 0x40000000); 8.69 + assertThat(test_ushr(0x40000000, 33) == 0x20000000); 8.70 + 8.71 + assertThat(test_shlc1(32) == 64); 8.72 + assertThat(test_shlc1(0x80000000) == 0); 8.73 + assertThat(test_shlc1(0x40000000) == 0x80000000); 8.74 + assertThat(test_shlc33(0x40000000) == 0x80000000); 8.75 + 8.76 + assertThat(test_shrc1(32) == 16); 8.77 + assertThat(test_shrc1(1) == 0); 8.78 + assertThat(test_shrc1(0x80000000) == 0xc0000000); 8.79 + assertThat(test_shrc33(0x40000000) == 0x20000000); 8.80 + 8.81 + assertThat(test_ushrc1(32) == 16); 8.82 + assertThat(test_ushrc1(1) == 0); 8.83 + assertThat(test_ushrc1(0x80000000) == 0x40000000); 8.84 + assertThat(test_ushrc33(0x40000000) == 0x20000000); 8.85 + } 8.86 +} 8.87 +
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 9.2 +++ b/test/aarch64/LongArithTests.java Tue Aug 22 20:34:55 2017 +0800 9.3 @@ -0,0 +1,138 @@ 9.4 + 9.5 + /* 9.6 + * @test 9.7 + * @run main/othervm -Xint LongArithTests 9.8 + * @run main/othervm -Xcomp LongArithTests 9.9 + */ 9.10 +public class LongArithTests { 9.11 + 9.12 + 9.13 + private static final long IIMM12_0 = 0x1; // first imm value 9.14 + private static final long IIMM12_1 = 0xfff; // last 12bit imm value 9.15 + private static final long IIMM12_2 = 0x1001; // Should not encode as imm 9.16 + private static final long IIMM24_3 = 0x1000; // first 12 bit shifted imm 9.17 + private static final long IIMM24_4 = 0xfff000; // Last 12 bit shifted imm 9.18 + private static final long IIMM24_5 = 0x1001000; // Should not encode as imm 9.19 + 9.20 + private static long test_neg(long a) { 9.21 + return -a; 9.22 + } 9.23 + 9.24 + private static long test_add(long a, long b) { 9.25 + return a + b; 9.26 + } 9.27 + 9.28 + private static long test_addc0(long a) { 9.29 + return a + IIMM12_0; 9.30 + } 9.31 + 9.32 + private static long test_addc1(long a) { 9.33 + return a + IIMM12_1; 9.34 + } 9.35 + 9.36 + private static long test_addc2(long a) { 9.37 + return a + IIMM12_2; 9.38 + } 9.39 + 9.40 + private static long test_addc3(long a) { 9.41 + return a + IIMM24_3; 9.42 + } 9.43 + 9.44 + private static long test_addc4(long a) { 9.45 + return a + IIMM24_4; 9.46 + } 9.47 + 9.48 + private static long test_addc5(long a) { 9.49 + return a + IIMM24_5; 9.50 + } 9.51 + 9.52 + private static long test_sub(long a, long b) { 9.53 + return a - b; 9.54 + } 9.55 + 9.56 + private static long test_subc1(long a) { 9.57 + return a - 11; 9.58 + } 9.59 + 9.60 + private static long test_mulc1(long a) { 9.61 + // Generates shl. 9.62 + return a * 8; 9.63 + } 9.64 + 9.65 + private static long test_mulc2(long a) { 9.66 + // Generates shl followed by add. 9.67 + return a * 9; 9.68 + } 9.69 + 9.70 + private static long test_mulc3(long a) { 9.71 + // Generates shl followed by sub. 9.72 + return a * 7; 9.73 + } 9.74 + 9.75 + private static long test_mulc4(long a) { 9.76 + // Generates normal mul. 9.77 + return a * 10; 9.78 + } 9.79 + 9.80 + private static long test_mul(long a, long b) { 9.81 + // Generates normal mul. 9.82 + return a * b; 9.83 + } 9.84 + 9.85 + private static long test_div(long a, long b) { 9.86 + return a / b; 9.87 + } 9.88 + 9.89 + private static long test_rem(long a, long b) { 9.90 + return a % b; 9.91 + } 9.92 + 9.93 + private static void assertThat(boolean assertion) { 9.94 + if (! assertion) { 9.95 + throw new AssertionError(); 9.96 + } 9.97 + } 9.98 + 9.99 + public static void main(String[] args) { 9.100 + assertThat(test_neg(10) == -10); 9.101 + assertThat(test_add(3, 2) == 5); 9.102 + assertThat(test_add(Long.MAX_VALUE, 1) == Long.MIN_VALUE); 9.103 + assertThat(test_addc0(3) == 4); 9.104 + assertThat(test_addc1(3) == 0x1002); 9.105 + assertThat(test_addc2(3) == 0x1004); 9.106 + assertThat(test_addc3(3) == 0x1003); 9.107 + assertThat(test_addc4(3) == 0xfff003); 9.108 + assertThat(test_addc5(3) == 0x1001003); 9.109 + 9.110 + assertThat(test_sub(40, 13) == 27); 9.111 + assertThat(test_sub(Long.MIN_VALUE, 1) == Long.MAX_VALUE); 9.112 + assertThat(test_subc1(40) == 29); 9.113 + 9.114 + assertThat(test_mulc1(5) == 40); 9.115 + assertThat(test_mulc2(5) == 45); 9.116 + assertThat(test_mulc3(5) == 35); 9.117 + assertThat(test_mulc4(5) == 50); 9.118 + assertThat(test_mul(5, 200) == 1000); 9.119 + 9.120 + assertThat(test_div(30, 3) == 10); 9.121 + assertThat(test_div(29, 3) == 9); 9.122 + assertThat(test_div(Long.MIN_VALUE, -1) == Long.MIN_VALUE); 9.123 + try { 9.124 + test_div(30, 0); 9.125 + throw new AssertionError(); 9.126 + } catch (ArithmeticException ex) { 9.127 + // Pass. 9.128 + } 9.129 + 9.130 + assertThat(test_rem(30, 3) == 0); 9.131 + assertThat(test_rem(29, 3) == 2); 9.132 + assertThat(test_rem(Long.MIN_VALUE, -1) == 0); 9.133 + try { 9.134 + test_rem(30, 0); 9.135 + throw new AssertionError(); 9.136 + } catch (ArithmeticException ex) { 9.137 + // Pass. 9.138 + } 9.139 + 9.140 + } 9.141 +}
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 10.2 +++ b/test/aarch64/LongCmpTests.java Tue Aug 22 20:34:55 2017 +0800 10.3 @@ -0,0 +1,107 @@ 10.4 + 10.5 + /* 10.6 + * @test 10.7 + * @run main/othervm -Xint LongCmpTests 10.8 + * @run main/othervm -Xcomp LongCmpTests 10.9 + */ 10.10 +public class LongCmpTests { 10.11 + 10.12 + private static boolean test_isEq(long a, long b) { 10.13 + return a == b; 10.14 + } 10.15 + 10.16 + private static boolean test_isNe(long a, long b) { 10.17 + return a != b; 10.18 + } 10.19 + 10.20 + private static boolean test_isLt(long a, long b) { 10.21 + return a < b; 10.22 + } 10.23 + 10.24 + private static boolean test_isLe(long a, long b) { 10.25 + return a <= b; 10.26 + } 10.27 + 10.28 + private static boolean test_isGe(long a, long b) { 10.29 + return a >= b; 10.30 + } 10.31 + 10.32 + private static boolean test_isGt(long a, long b) { 10.33 + return a > b; 10.34 + } 10.35 + 10.36 + private static boolean test_isEqC(long a) { 10.37 + return a == 7L; 10.38 + } 10.39 + 10.40 + private static boolean test_isNeC(long a) { 10.41 + return a != 7L; 10.42 + } 10.43 + 10.44 + private static boolean test_isLtC(long a) { 10.45 + return a < 7L; 10.46 + } 10.47 + 10.48 + private static boolean test_isLeC(long a) { 10.49 + return a <= 7L; 10.50 + } 10.51 + 10.52 + private static boolean test_isGeC(long a) { 10.53 + return a >= 7L; 10.54 + } 10.55 + 10.56 + private static boolean test_isGtC(long a) { 10.57 + return a > 7L; 10.58 + } 10.59 + 10.60 + private static void assertThat(boolean assertion) { 10.61 + if (! assertion) { 10.62 + throw new AssertionError(); 10.63 + } 10.64 + } 10.65 + 10.66 + public static void main(String[] args) { 10.67 + assertThat(test_isEq(7L, 7L)); 10.68 + assertThat(! test_isEq(70L, 7L)); 10.69 + assertThat(! test_isNe(7L, 7L)); 10.70 + assertThat(test_isNe(70L, 7L)); 10.71 + 10.72 + assertThat(test_isLt(7L, 70L)); 10.73 + assertThat(! test_isLt(70L, 7L)); 10.74 + assertThat(! test_isLt(7L, 7L)); 10.75 + 10.76 + assertThat(test_isLe(7L, 70L)); 10.77 + assertThat(! test_isLe(70L, 7L)); 10.78 + assertThat(test_isLe(7L, 7L)); 10.79 + 10.80 + assertThat(!test_isGe(7L, 70L)); 10.81 + assertThat(test_isGe(70L, 7L)); 10.82 + assertThat(test_isGe(7L, 7L)); 10.83 + 10.84 + assertThat(!test_isGt(7L, 70L)); 10.85 + assertThat(test_isGt(70L, 7L)); 10.86 + assertThat(! test_isGt(7L, 7L)); 10.87 + 10.88 + assertThat(test_isEqC(7L)); 10.89 + assertThat(! test_isEqC(70L)); 10.90 + assertThat(! test_isNeC(7L)); 10.91 + assertThat(test_isNeC(70L)); 10.92 + 10.93 + assertThat(test_isLtC(6L)); 10.94 + assertThat(! test_isLtC(70L)); 10.95 + assertThat(! test_isLtC(7L)); 10.96 + 10.97 + assertThat(test_isLeC(6L)); 10.98 + assertThat(! test_isLeC(70L)); 10.99 + assertThat(test_isLeC(7L)); 10.100 + 10.101 + assertThat(!test_isGeC(6L)); 10.102 + assertThat(test_isGeC(70L)); 10.103 + assertThat(test_isGeC(7L)); 10.104 + 10.105 + assertThat(!test_isGtC(6L)); 10.106 + assertThat(test_isGtC(70L)); 10.107 + assertThat(! test_isGtC(7L)); 10.108 + 10.109 + } 10.110 +}
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 11.2 +++ b/test/aarch64/LongLogicTests.java Tue Aug 22 20:34:55 2017 +0800 11.3 @@ -0,0 +1,74 @@ 11.4 + 11.5 + /* 11.6 + * @test 11.7 + * @run main/othervm -Xint LongLogicTests 11.8 + * @run main/othervm -Xcomp LongLogicTests 11.9 + */ 11.10 +public class LongLogicTests { 11.11 + 11.12 + private static final long IMM = 0xf0f0f0f0f0f0f0f0L; 11.13 + private static final long NO_IMM = 0x123456d5123456d5L; 11.14 + private static long test_and(long a, long b) { 11.15 + return a & b; 11.16 + } 11.17 + 11.18 + private static long test_andc1(long a) { 11.19 + // Generates immediate instruction. 11.20 + return a & IMM; 11.21 + } 11.22 + 11.23 + private static long test_andc2(long a) { 11.24 + // Generates non-immediate instruction. 11.25 + return a & NO_IMM; 11.26 + } 11.27 + 11.28 + private static long test_or(long a, long b) { 11.29 + return a | b; 11.30 + } 11.31 + 11.32 + private static long test_orc1(long a) { 11.33 + // Generates immediate instruction. 11.34 + return a | IMM; 11.35 + } 11.36 + 11.37 + private static long test_orc2(long a) { 11.38 + // Generates non-immediate instruction. 11.39 + return a | NO_IMM; 11.40 + } 11.41 + 11.42 + private static long test_xor(long a, long b) { 11.43 + return a ^ b; 11.44 + } 11.45 + 11.46 + private static long test_xorc1(long a) { 11.47 + // Generates immediate instruction. 11.48 + return a ^ IMM; 11.49 + } 11.50 + 11.51 + private static long test_xorc2(long a) { 11.52 + // Generates non-immediate instruction. 11.53 + return a ^ NO_IMM; 11.54 + } 11.55 + 11.56 + private static void assertThat(boolean assertion) { 11.57 + if (! assertion) { 11.58 + throw new AssertionError(); 11.59 + } 11.60 + } 11.61 + 11.62 + public static void main(String[] args) { 11.63 + 11.64 + assertThat(test_and(0x21, 0x31) == 0x21); 11.65 + assertThat(test_andc1(0xaaaaaaaaaaaaaaaaL) == 0xa0a0a0a0a0a0a0a0L); 11.66 + assertThat(test_andc2(0xaaaaaaaaaaaaaaaaL) == 0x0220028002200280L); 11.67 + 11.68 + assertThat(test_or(0x21, 0x31) == 0x31); 11.69 + assertThat(test_orc1(0xaaaaaaaaaaaaaaaaL) == 0xfafafafafafafafaL); 11.70 + assertThat(test_orc2(0xaaaaaaaaaaaaaaaaL) == 0xbabefeffbabefeffL); 11.71 + 11.72 + assertThat(test_xor(0x21, 0x31) == 16); 11.73 + assertThat(test_xorc1(0xaaaaaaaaaaaaaaaaL) == 0x5a5a5a5a5a5a5a5aL); 11.74 + assertThat(test_xorc2(0xaaaaaaaaaaaaaaaaL) == 0xb89efc7fb89efc7fL); 11.75 + } 11.76 +} 11.77 +
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 12.2 +++ b/test/aarch64/LongShiftTests.java Tue Aug 22 20:34:55 2017 +0800 12.3 @@ -0,0 +1,82 @@ 12.4 + /* 12.5 + * @test 12.6 + * @run main/othervm -Xint LongShiftTests 12.7 + * @run main/othervm -Xcomp LongShiftTests 12.8 + */ 12.9 +public class LongShiftTests { 12.10 + 12.11 + private static long test_shl(long a, long b) { 12.12 + return a << b; 12.13 + } 12.14 + 12.15 + private static long test_shlc1(long a) { 12.16 + return a << 1; 12.17 + } 12.18 + 12.19 + private static long test_shlc65(long a) { 12.20 + return a << 65; 12.21 + } 12.22 + 12.23 + private static long test_shr(long a, long b) { 12.24 + return a >> b; 12.25 + } 12.26 + 12.27 + private static long test_shrc1(long a) { 12.28 + return a >> 1; 12.29 + } 12.30 + 12.31 + private static long test_shrc65(long a) { 12.32 + return a >> 65; 12.33 + } 12.34 + 12.35 + private static long test_ushr(long a, long b) { 12.36 + return a >>> b; 12.37 + } 12.38 + 12.39 + private static long test_ushrc1(long a) { 12.40 + return a >>> 1; 12.41 + } 12.42 + 12.43 + private static long test_ushrc65(long a) { 12.44 + return a >>> 65; 12.45 + } 12.46 + 12.47 + private static void assertThat(boolean assertion) { 12.48 + if (! assertion) { 12.49 + throw new AssertionError(); 12.50 + } 12.51 + } 12.52 + 12.53 + public static void main(String[] args) { 12.54 + 12.55 + assertThat(test_shl(32, 2) == 128); 12.56 + assertThat(test_shl(0x8000000000000000L, 1) == 0); 12.57 + assertThat(test_shl(0x4000000000000000L, 1) == 0x8000000000000000L); 12.58 + assertThat(test_shl(0x4000000000000000L, 65) == 0x8000000000000000L); 12.59 + 12.60 + assertThat(test_shr(32, 2) == 8); 12.61 + assertThat(test_shr(1, 1) == 0); 12.62 + assertThat(test_shr(0x8000000000000000L, 1) == 0xc000000000000000L); 12.63 + assertThat(test_shr(0x4000000000000000L, 65) == 0x2000000000000000L); 12.64 + 12.65 + assertThat(test_ushr(32, 2) == 8); 12.66 + assertThat(test_ushr(1, 1) == 0); 12.67 + assertThat(test_ushr(0x8000000000000000L, 1) == 0x4000000000000000L); 12.68 + assertThat(test_ushr(0x4000000000000000L, 65) == 0x2000000000000000L); 12.69 + 12.70 + assertThat(test_shlc1(32) == 64); 12.71 + assertThat(test_shlc1(0x8000000000000000L) == 0); 12.72 + assertThat(test_shlc1(0x4000000000000000L) == 0x8000000000000000L); 12.73 + assertThat(test_shlc65(0x4000000000000000L) == 0x8000000000000000L); 12.74 + 12.75 + assertThat(test_shrc1(32) == 16); 12.76 + assertThat(test_shrc1(1) == 0); 12.77 + assertThat(test_shrc1(0x8000000000000000L) == 0xc000000000000000L); 12.78 + assertThat(test_shrc65(0x4000000000000000L) == 0x2000000000000000L); 12.79 + 12.80 + assertThat(test_ushrc1(32) == 16); 12.81 + assertThat(test_ushrc1(1) == 0); 12.82 + assertThat(test_ushrc1(0x8000000000000000L) == 0x4000000000000000L); 12.83 + assertThat(test_ushrc65(0x4000000000000000L) == 0x2000000000000000L); 12.84 + } 12.85 +}