[aarch64-port-dev ] RFR(S): 8239914: AArch64: Combine add/sub with comparison against zero
Pengfei Li
Pengfei.Li at arm.com
Tue Mar 3 10:12:08 UTC 2020
Hi Andrew Haley,
> I am not sure you're thought about this clearly enough. Try this
> program:
>
> public class DifferenceTest {
>
> static int theTest(int x, int y) {
> int sum = 0;
> while (x - y > 0) {
> sum++;
> y--;
> }
> return sum;
> }
>
> static int n = -0x7000_0000;
> static int m = +0x7000_0000;
>
> void trial() {
> int prev = theTest(n, m);
> for (int i = 0; i < 10_000_000; i++) {
> int result = theTest(n, m);
> if (prev != result) {
> throw new RuntimeException("last sum was " + prev + ", is now " +
> result);
> }
> prev = result;
> }
> }
>
> public static void main(String[] args) {
> new DifferenceTest().trial();
> }
> }
Thanks for reporting this. I just tested the program and found the exception also exists with AArch64 JDK master build (without my patch).
Apologize that I will be on leave and unable to create patches in the following days. But I've reported this to my colleagues. I think someone else will reply you soon.
--
Thanks,
Pengfei
More information about the hotspot-compiler-dev
mailing list