From f9a627f7b7703d6f2a9db8ead651db7683ef4825 Mon Sep 17 00:00:00 2001 From: Douglas Leung Date: Wed, 8 Apr 2015 15:53:58 -0700 Subject: Add test cases to make sure GenDivRemLit() handles 16-bit constants correctly. Change-Id: Idb4aee8b98dc908cb28887e96254f8c254ad7d4d --- test/107-int-math2/src/Main.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/107-int-math2/src/Main.java b/test/107-int-math2/src/Main.java index f0fe934..6a6227c 100644 --- a/test/107-int-math2/src/Main.java +++ b/test/107-int-math2/src/Main.java @@ -379,7 +379,7 @@ class Main extends IntMathBase { */ static int lit16Test(int x) { - int[] results = new int[8]; + int[] results = new int[10]; /* try to generate op-int/lit16" instructions */ results[0] = x + 1000; @@ -390,6 +390,9 @@ class Main extends IntMathBase { results[5] = x & 1000; results[6] = x | -1000; results[7] = x ^ -1000; + /* use an 16-bit constant that has its MSB (bit-15) set */ + results[8] = x / 32769; + results[9] = x / -32769; if (results[0] != 78777) { return 1; } if (results[1] != -76777) { return 2; } @@ -399,6 +402,8 @@ class Main extends IntMathBase { if (results[5] != 960) { return 6; } if (results[6] != -39) { return 7; } if (results[7] != -76855) { return 8; } + if (results[8] != 2) { return 9; } + if (results[9] != -2) { return 10; } return 0; } -- cgit v1.1