mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-23 06:10:01 +00:00
8266028: C2 computes -0.0 for Math.pow(-0.0, 0.5)
Reviewed-by: aph, neliasso, kvn
This commit is contained in:
parent
ca37be1ead
commit
75a2354dc2
@ -1654,7 +1654,7 @@ bool LibraryCallKit::inline_math_pow() {
|
||||
Node* phi = new PhiNode(region, Type::DOUBLE);
|
||||
|
||||
Node* cmp = _gvn.transform(new CmpDNode(base, zero));
|
||||
Node* test = _gvn.transform(new BoolNode(cmp, BoolTest::lt));
|
||||
Node* test = _gvn.transform(new BoolNode(cmp, BoolTest::le));
|
||||
|
||||
Node* if_pow = generate_slow_guard(test, NULL);
|
||||
Node* value_sqrt = _gvn.transform(new SqrtDNode(C, control(), base));
|
||||
|
||||
@ -43,17 +43,6 @@ public class TestPow0Dot5Opt {
|
||||
if (r1 != r2) {
|
||||
throw new RuntimeException("pow(" + a + ", 0.5), expected: " + r1 + ", actual: " + r2);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
for (int j = 1; j < 100000; j++) {
|
||||
test(j * 1.0);
|
||||
test(1.0 / j);
|
||||
}
|
||||
}
|
||||
|
||||
test(0.0);
|
||||
|
||||
// Special case: pow(+0.0, 0.5) = 0.0
|
||||
double r = Math.pow(+0.0, 0.5);
|
||||
@ -86,4 +75,13 @@ public class TestPow0Dot5Opt {
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
for (int j = 1; j < 100000; j++) {
|
||||
test(j * 1.0);
|
||||
test(1.0 / j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user