There appears to be a longstanding problem with strict multiplies in C2. It looks like the rule for strict multiplies doesn't work right if src == dst. Here's a test case:
public class strictsqr {
static strictfp double strictsqr(double x) {
return x*x;
}
final static int limit = 10000000;
public static void main(String[] args) {
for (int i = 0; i < 20; i ++) {
double x = i / (double)limit;
System.out.println(strictsqr.strictsqr(x));
}
}
}
java -server -XX:UseSSE=0 -Xcomp strictsqr will output all zeros instead of the correct output in which only the first value is zero. This fails all the way back to 1.4.2.
public class strictsqr {
static strictfp double strictsqr(double x) {
return x*x;
}
final static int limit = 10000000;
public static void main(String[] args) {
for (int i = 0; i < 20; i ++) {
double x = i / (double)limit;
System.out.println(strictsqr.strictsqr(x));
}
}
}
java -server -XX:UseSSE=0 -Xcomp strictsqr will output all zeros instead of the correct output in which only the first value is zero. This fails all the way back to 1.4.2.