[project @ 2000-09-28 13:04:14 by simonpj]
[ghc-hetmet.git] / ghc / compiler / prelude / PrelRules.lhs
index 0b54318..d13ee7f 100644 (file)
@@ -32,12 +32,11 @@ import DataCon              ( dataConTag, dataConTyCon, dataConId, fIRST_TAG )
 import CoreUtils       ( exprIsValue, cheapEqExpr, exprIsConApp_maybe )
 import Type            ( splitTyConApp_maybe )
 import OccName         ( occNameUserString)
-import PrelNames       ( unpackCStringFoldr_RDR )
-import Unique          ( unpackCStringFoldrIdKey, hasKey )
+import PrelNames       ( unpackCStringFoldr_RDR, unpackCStringFoldrIdKey, hasKey )
 import Bits            ( Bits(..) )
 import Word            ( Word64 )
 import Outputable
-import CmdLineOpts      ( opt_SimplStrictFP )
+import CmdLineOpts      ( opt_SimplExcessPrecision )
 \end{code}
 
 
@@ -286,9 +285,7 @@ intResult name result
 type RuleFun = [CoreExpr] -> Maybe (RuleName, CoreExpr)
 
 or_rule :: RuleFun -> RuleFun -> RuleFun
-or_rule r1 r2 args = case r1 args of
-                  Just stuff -> Just stuff
-                  Nothing    -> r2 args
+or_rule r1 r2 args = maybe (r2 args) Just (r1 args) -- i.e.: r1 args `mplus` r2 args
 
 twoLits :: (Literal -> Literal -> Maybe (RuleName, CoreExpr)) -> RuleFun
 twoLits rule [Lit l1, Lit l2] = rule (convFloating l1) (convFloating l2)
@@ -298,13 +295,13 @@ oneLit :: (Literal -> Maybe (RuleName, CoreExpr)) -> RuleFun
 oneLit rule [Lit l1] = rule (convFloating l1)
 oneLit rule other    = Nothing
 
--- When we strictfp is requested, cut down the precision of the Rational value
--- to that of Float/Double. We confuse host architecture and target architecture
--- here, but it's convenient (and wrong :-).
+-- When excess precision is not requested, cut down the precision of the
+-- Rational value to that of Float/Double. We confuse host architecture
+-- and target architecture here, but it's convenient (and wrong :-).
 convFloating :: Literal -> Literal
-convFloating (MachFloat  f) | opt_SimplStrictFP =
+convFloating (MachFloat  f) | not opt_SimplExcessPrecision =
    MachFloat  (toRational ((fromRational f) :: Float ))
-convFloating (MachDouble d) | opt_SimplStrictFP =
+convFloating (MachDouble d) | not opt_SimplExcessPrecision =
    MachDouble (toRational ((fromRational d) :: Double))
 convFloating l = l