comparison test/compiler/6603011/Test.java @ 1920:2fe998383789

6997311: SIGFPE in new long division asm code Summary: use unsigned DIV instruction Reviewed-by: never
author kvn
date Sat, 06 Nov 2010 18:52:07 -0700
parents c18cbe5936b8
children
comparison
equal deleted inserted replaced
1919:d0895dfaf7cc 1920:2fe998383789
1 /* 1 /*
2 * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
106 long quo0 = s.divl(dividend, divisor()); 106 long quo0 = s.divl(dividend, divisor());
107 long rem0 = s.modl(dividend, divisor()); 107 long rem0 = s.modl(dividend, divisor());
108 108
109 if (quo != quo0 || rem != rem0) { 109 if (quo != quo0 || rem != rem0) {
110 if (VERBOSE) { 110 if (VERBOSE) {
111 System.out.println(" " + dividend + " / " + divisor() + " = " + 111 System.out.println("Computed: " + dividend + " / " + divisor() + " = " +
112 quo + ", " + dividend + " % " + divisor() + " = " + rem); 112 quo + ", " + dividend + " % " + divisor() + " = " + rem );
113 System.out.println("expected: " + dividend + " / " + divisor() + " = " +
114 quo0 + ", " + dividend + " % " + divisor() + " = " + rem0);
113 // Report sign of rem failure 115 // Report sign of rem failure
114 if (rem != 0 && (rem ^ dividend) < 0) { 116 if (rem != 0 && (rem ^ dividend) < 0) {
115 System.out.println(" rem & dividend have different signs"); 117 System.out.println(" rem & dividend have different signs");
116 } 118 }
117 // Report range of rem failure 119 // Report range of rem failure
166 168
167 outerloop: 169 outerloop:
168 for (int i = start; i <= end; i++) { 170 for (int i = start; i <= end; i++) {
169 for (int s = 0; s < 64; s += 4) { 171 for (int s = 0; s < 64; s += 4) {
170 total++; 172 total++;
171 long dividend = i << s; 173 long dividend = ((long)i) << s;
172 if (!checkL(dividend)) { 174 if (!checkL(dividend)) {
173 wrong++; 175 wrong++;
174 // Stop on the first failure 176 // Stop on the first failure
175 // break outerloop; 177 // break outerloop;
176 } 178 }