6833879: Assigning positive zero is ignored when old value is negative zero
authorcfang
Tue, 05 May 2009 11:02:10 -0700
changeset 2745 60853c6a93b7
parent 2744 57f0579fbe09
child 2746 825bfb41920c
child 2862 fad636edf18f
child 2864 1262819e8925
6833879: Assigning positive zero is ignored when old value is negative zero Summary: Don't perform CMOVE identity optimization for floating point types Reviewed-by: kvn, never
hotspot/src/share/vm/opto/connode.cpp
--- a/hotspot/src/share/vm/opto/connode.cpp	Mon May 04 22:06:47 2009 -0700
+++ b/hotspot/src/share/vm/opto/connode.cpp	Tue May 05 11:02:10 2009 -0700
@@ -128,6 +128,10 @@
       // Swapped Cmp is OK
       (phase->eqv(cmp->in(2),f) &&
        phase->eqv(cmp->in(1),t)) ) {
+    // Give up this identity check for floating points because it may choose incorrect
+    // value around 0.0 and -0.0
+    if ( cmp->Opcode()==Op_CmpF || cmp->Opcode()==Op_CmpD )
+      return NULL;
     // Check for "(t==f)?t:f;" and replace with "f"
     if( b->_test._test == BoolTest::eq )
       return f;