Index: osprey/be/opt/opt_vn_expr.cxx
===================================================================
--- osprey/be/opt/opt_vn_expr.cxx	(revision 3754)
+++ osprey/be/opt/opt_vn_expr.cxx	(working copy)
@@ -645,15 +645,10 @@
 	 // fix bug 2691: when both are floating-point zero, use integer
 	 // comparison so +0 and -0 will be regarded as different for value
 	 // numbering purpose
-	 else if (this_mty == MTYPE_F8 && 
-	          TCON_R8(other_tcon) == 0 && TCON_R8(_tcon) == 0)
-	    truth = TCON_v1(other_tcon) == TCON_v1(_tcon);
-	 else if (this_mty == MTYPE_F4 && 
-	          TCON_R4(other_tcon) == 0 && TCON_R4(_tcon) == 0)
-	    truth = TCON_word0(other_tcon) == TCON_word0(_tcon);
-	 else if (this_mty == MTYPE_F10 && 
-	          TCON_R10(other_tcon) == 0 && TCON_R10(_tcon) == 0)
-	    truth = TCON_v2(other_tcon) == TCON_v2(_tcon);
+	 else if (Targ_Is_Zero(other_tcon))
+            truth = Targ_Is_Zero(_tcon);
+	 else if (Targ_Is_Neg_Zero(other_tcon))
+            truth = Targ_Is_Neg_Zero(_tcon);
 #endif
          else {
 	    BOOL folded;
Index: osprey/common/com/MIPS/targ_const.cxx
===================================================================
--- osprey/common/com/MIPS/targ_const.cxx	(revision 3754)
+++ osprey/common/com/MIPS/targ_const.cxx	(working copy)
@@ -4636,6 +4636,23 @@
   }
   return FALSE;
 } /* Targ_Is_Zero */
+
+/*----------------------------------------------------------------------------
+ * return TRUE if the target representation of this TCON is negative zero
+ *--------------------------------------------------------------------------*/
+BOOL Targ_Is_Neg_Zero ( TCON t )
+{
+  switch (TCON_ty(t)) {
+    case MTYPE_F4:
+      return (TCON_R4(t) == 0.0 && TCON_v0(t) != 0);
+    case MTYPE_F8:
+      return (TCON_R8(t) == 0.0
+        && (TCON_v0(t)|TCON_v1(t)) != 0);
+    default:
+      return FALSE;
+  }
+}
+
 
 /* ====================================================================
  *
Index: osprey/common/com/NVISA/targ_const.cxx
===================================================================
--- osprey/common/com/NVISA/targ_const.cxx	(revision 3754)
+++ osprey/common/com/NVISA/targ_const.cxx	(working copy)
@@ -4902,6 +4902,23 @@
   }
   return FALSE;
 } /* Targ_Is_Zero */
+
+/*----------------------------------------------------------------------------
+ * return TRUE if the target representation of this TCON is negative zero
+ *--------------------------------------------------------------------------*/
+BOOL Targ_Is_Neg_Zero ( TCON t )
+{
+  switch (TCON_ty(t)) {
+    case MTYPE_F4:
+      return (TCON_R4(t) == 0.0 && TCON_v0(t) != 0);
+    case MTYPE_F8:
+      return (TCON_R8(t) == 0.0
+        && (TCON_v0(t)|TCON_v1(t)) != 0);
+    default:
+      return FALSE;
+  }
+}
+
 
 /* ====================================================================
  *
Index: osprey/common/com/targ_const.h
===================================================================
--- osprey/common/com/targ_const.h	(revision 3754)
+++ osprey/common/com/targ_const.h	(working copy)
@@ -482,6 +482,7 @@
 
 /* Is the given constant a zero? */
 extern BOOL Targ_Is_Zero ( TCON t );
+extern BOOL Targ_Is_Neg_Zero ( TCON t );
 
 /* Determine whether a TCON represents an integral value, and if so
  * return its value in *iv:
Index: osprey/common/com/x8664/targ_const.cxx
===================================================================
--- osprey/common/com/x8664/targ_const.cxx	(revision 3754)
+++ osprey/common/com/x8664/targ_const.cxx	(working copy)
@@ -5730,6 +5730,26 @@
   }
   return FALSE;
 } /* Targ_Is_Zero */
+
+/*----------------------------------------------------------------------------
+ * return TRUE if the target representation of this TCON is negative zero
+ *--------------------------------------------------------------------------*/
+BOOL Targ_Is_Neg_Zero ( TCON t )
+{
+  switch (TCON_ty(t)) {
+    case MTYPE_F4:
+      return (TCON_R4(t) == 0.0 && TCON_v0(t) != 0);
+    case MTYPE_F8:
+      return (TCON_R8(t) == 0.0
+        && (TCON_v0(t)|TCON_v1(t)) != 0);
+    case MTYPE_F10:
+      return (TCON_R10(t) == 0.0 &&
+        (TCON_v0(t)|TCON_v1(t)|TCON_v2(t)|TCON_v3(t)) != 0);
+    default:
+      return FALSE;
+  }
+}
+
 
 /* ====================================================================
  *
Index: osprey/common/com/ia64/targ_const.cxx
===================================================================
--- osprey/common/com/ia64/targ_const.cxx	(revision 3754)
+++ osprey/common/com/ia64/targ_const.cxx	(working copy)
@@ -5152,6 +5152,26 @@
   }
   return FALSE;
 } /* Targ_Is_Zero */
+
+/*----------------------------------------------------------------------------
+ * return TRUE if the target representation of this TCON is negative zero
+ *--------------------------------------------------------------------------*/
+BOOL Targ_Is_Neg_Zero ( TCON t )
+{
+  switch (TCON_ty(t)) {
+    case MTYPE_F4:
+      return (TCON_R4(t) == 0.0 && TCON_v0(t) != 0);
+    case MTYPE_F8:
+      return (TCON_R8(t) == 0.0
+        && (TCON_v0(t)|TCON_v1(t)) != 0);
+    case MTYPE_F10:
+      return (TCON_R16(t) == 0.0 &&
+        (TCON_v0(t)|TCON_v1(t)|TCON_v2(t)|TCON_v3(t)) != 0);
+    default:
+      return FALSE;
+  }
+}
+
 
 /* ====================================================================
  *
Index: osprey/common/com/ppc32/targ_const.cxx
===================================================================
--- osprey/common/com/ppc32/targ_const.cxx	(revision 3754)
+++ osprey/common/com/ppc32/targ_const.cxx	(working copy)
@@ -5104,6 +5104,26 @@
   }
   return FALSE;
 } /* Targ_Is_Zero */
+
+/*----------------------------------------------------------------------------
+ * return TRUE if the target representation of this TCON is negative zero
+ *--------------------------------------------------------------------------*/
+BOOL Targ_Is_Neg_Zero ( TCON t )
+{
+  switch (TCON_ty(t)) {
+    case MTYPE_F4:
+      return (TCON_R4(t) == 0.0 && TCON_v0(t) != 0);
+    case MTYPE_F8:
+      return (TCON_R8(t) == 0.0
+        && (TCON_v0(t)|TCON_v1(t)) != 0);
+    case MTYPE_F10:
+      return (TCON_R16(t) == 0.0 &&
+        (TCON_v0(t)|TCON_v1(t)|TCON_v2(t)|TCON_v3(t)) != 0);
+    default:
+      return FALSE;
+  }
+}
+
 
 /* ====================================================================
  *
Index: osprey/common/com/loongson/targ_const.cxx
===================================================================
--- osprey/common/com/loongson/targ_const.cxx	(revision 3754)
+++ osprey/common/com/loongson/targ_const.cxx	(working copy)
@@ -4861,6 +4861,23 @@
   }
   return FALSE;
 } /* Targ_Is_Zero */
+
+/*----------------------------------------------------------------------------
+ * return TRUE if the target representation of this TCON is negative zero
+ *--------------------------------------------------------------------------*/
+BOOL Targ_Is_Neg_Zero ( TCON t )
+{
+  switch (TCON_ty(t)) {
+    case MTYPE_F4:
+      return (TCON_R4(t) == 0.0 && TCON_v0(t) != 0);
+    case MTYPE_F8:
+      return (TCON_R8(t) == 0.0
+        && (TCON_v0(t)|TCON_v1(t)) != 0);
+    default:
+      return FALSE;
+  }
+}
+
 
 /* ====================================================================
  *
Index: osprey/common/com/SL/targ_const.cxx
===================================================================
--- osprey/common/com/SL/targ_const.cxx	(revision 3754)
+++ osprey/common/com/SL/targ_const.cxx	(working copy)
@@ -4640,6 +4640,23 @@
   }
   return FALSE;
 } /* Targ_Is_Zero */
+
+/*----------------------------------------------------------------------------
+ * return TRUE if the target representation of this TCON is negative zero
+ *--------------------------------------------------------------------------*/
+BOOL Targ_Is_Neg_Zero ( TCON t )
+{
+  switch (TCON_ty(t)) {
+    case MTYPE_F4:
+      return (TCON_R4(t) == 0.0 && TCON_v0(t) != 0);
+    case MTYPE_F8:
+      return (TCON_R8(t) == 0.0
+        && (TCON_v0(t)|TCON_v1(t)) != 0);
+    default:
+      return FALSE;
+  }
+}
+
 
 /* ====================================================================
  *
