add comment
[ghc-hetmet.git] / compiler / cmm / CmmOpt.hs
index 8a2dd75..379d7a2 100644 (file)
@@ -1,3 +1,10 @@
+{-# OPTIONS -w #-}
+-- The above warning supression flag is a temporary kludge.
+-- While working on this module you are encouraged to remove it and fix
+-- any warnings in the module. See
+--     http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings
+-- for details
+
 -----------------------------------------------------------------------------
 --
 -- Cmm optimisation
@@ -6,13 +13,6 @@
 --
 -----------------------------------------------------------------------------
 
-{-# OPTIONS -w #-}
--- The above warning supression flag is a temporary kludge.
--- While working on this module you are encouraged to remove it and fix
--- any warnings in the module. See
---     http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings
--- for details
-
 module CmmOpt (
        cmmMiniInline,
        cmmMachOpFold,
@@ -341,7 +341,10 @@ cmmMachOpFold cmp [CmmMachOp conv [x], CmmLit (CmmInt i _)]
   = cmmMachOpFold narrow_cmp [x, CmmLit (CmmInt narrow_i rep)]
  where
     maybe_conversion (MO_U_Conv from _) = Just (from, narrowU)
-    maybe_conversion (MO_S_Conv from _) = Just (from, narrowS)
+    maybe_conversion (MO_S_Conv from _)
+        | not (isFloatingRep from) = Just (from, narrowS)
+        -- don't attempt to apply this optimisation when the source
+        -- is a float; see #1916
     maybe_conversion _ = Nothing
     
     maybe_comparison (MO_U_Gt _) rep = Just (MO_U_Gt rep)