projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
eba7b66
)
x86_64: fix case of out-of-range operands to leaq
author
Simon Marlow
<simonmar@microsoft.com>
Thu, 9 Feb 2006 16:22:47 +0000
(16:22 +0000)
committer
Simon Marlow
<simonmar@microsoft.com>
Thu, 9 Feb 2006 16:22:47 +0000
(16:22 +0000)
ghc/compiler/nativeGen/MachCodeGen.hs
patch
|
blob
|
history
diff --git
a/ghc/compiler/nativeGen/MachCodeGen.hs
b/ghc/compiler/nativeGen/MachCodeGen.hs
index
50d886c
..
2d1e6aa
100644
(file)
--- a/
ghc/compiler/nativeGen/MachCodeGen.hs
+++ b/
ghc/compiler/nativeGen/MachCodeGen.hs
@@
-1113,12
+1113,14
@@
getRegister e@(CmmMachOp mop [x, y]) -- dyadic MachOps
--------------------
add_code :: MachRep -> CmmExpr -> CmmExpr -> NatM Register
--------------------
add_code :: MachRep -> CmmExpr -> CmmExpr -> NatM Register
- add_code rep x (CmmLit (CmmInt y _)) = add_int rep x y
+ add_code rep x (CmmLit (CmmInt y _))
+ | not (is64BitInteger y) = add_int rep x y
add_code rep x y = trivialCode rep (ADD rep) (Just (ADD rep)) x y
--------------------
sub_code :: MachRep -> CmmExpr -> CmmExpr -> NatM Register
add_code rep x y = trivialCode rep (ADD rep) (Just (ADD rep)) x y
--------------------
sub_code :: MachRep -> CmmExpr -> CmmExpr -> NatM Register
- sub_code rep x (CmmLit (CmmInt y _)) = add_int rep x (-y)
+ sub_code rep x (CmmLit (CmmInt y _))
+ | not (is64BitInteger (-y)) = add_int rep x (-y)
sub_code rep x y = trivialCode rep (SUB rep) Nothing x y
-- our three-operand add instruction:
sub_code rep x y = trivialCode rep (SUB rep) Nothing x y
-- our three-operand add instruction:
@@
-1972,13
+1974,16
@@
getRegOrMem e = do
return (OpReg reg, code)
#if x86_64_TARGET_ARCH
return (OpReg reg, code)
#if x86_64_TARGET_ARCH
-is64BitLit (CmmInt i I64) = i > 0x7fffffff || i < -0x80000000
+is64BitLit (CmmInt i I64) = is64BitInteger i
-- assume that labels are in the range 0-2^31-1: this assumes the
-- small memory model (see gcc docs, -mcmodel=small).
#endif
is64BitLit x = False
#endif
-- assume that labels are in the range 0-2^31-1: this assumes the
-- small memory model (see gcc docs, -mcmodel=small).
#endif
is64BitLit x = False
#endif
+is64BitInteger :: Integer -> Bool
+is64BitInteger i = i > 0x7fffffff || i < -0x80000000
+
-- -----------------------------------------------------------------------------
-- The 'CondCode' type: Condition codes passed up the tree.
-- -----------------------------------------------------------------------------
-- The 'CondCode' type: Condition codes passed up the tree.