Commit 94dbd655 authored by ian@well-typed.com's avatar ian@well-typed.com
Browse files

Pass Platform down to halfWordMask

parent 26ebd1b7
...@@ -171,10 +171,11 @@ halfWordWidth _ ...@@ -171,10 +171,11 @@ halfWordWidth _
| wORD_SIZE == 8 = W32 | wORD_SIZE == 8 = W32
| otherwise = panic "MachOp.halfWordRep: Unknown word size" | otherwise = panic "MachOp.halfWordRep: Unknown word size"
halfWordMask :: Integer halfWordMask :: Platform -> Integer
halfWordMask | wORD_SIZE == 4 = 0xFFFF halfWordMask _
| wORD_SIZE == 8 = 0xFFFFFFFF | wORD_SIZE == 4 = 0xFFFF
| otherwise = panic "MachOp.halfWordMask: Unknown word size" | wORD_SIZE == 8 = 0xFFFFFFFF
| otherwise = panic "MachOp.halfWordMask: Unknown word size"
-- cIntRep is the Width for a C-language 'int' -- cIntRep is the Width for a C-language 'int'
cIntWidth, cLongWidth :: Width cIntWidth, cLongWidth :: Width
......
...@@ -568,7 +568,7 @@ emitPrimOp [res_h, res_l] WordAdd2Op [arg_x, arg_y] _ ...@@ -568,7 +568,7 @@ emitPrimOp [res_h, res_l] WordAdd2Op [arg_x, arg_y] _
or x y = CmmMachOp (MO_Or wordWidth) [x, y] or x y = CmmMachOp (MO_Or wordWidth) [x, y]
hww = CmmLit (CmmInt (fromIntegral (widthInBits (halfWordWidth platform))) hww = CmmLit (CmmInt (fromIntegral (widthInBits (halfWordWidth platform)))
wordWidth) wordWidth)
hwm = CmmLit (CmmInt halfWordMask wordWidth) hwm = CmmLit (CmmInt (halfWordMask platform) wordWidth)
stmt = CmmCall (CmmPrim (MO_Add2 wordWidth) (Just genericImpl)) stmt = CmmCall (CmmPrim (MO_Add2 wordWidth) (Just genericImpl))
[CmmHinted res_h NoHint, [CmmHinted res_h NoHint,
CmmHinted res_l NoHint] CmmHinted res_l NoHint]
...@@ -614,7 +614,7 @@ emitPrimOp [res_h, res_l] WordMul2Op [arg_x, arg_y] _ ...@@ -614,7 +614,7 @@ emitPrimOp [res_h, res_l] WordMul2Op [arg_x, arg_y] _
or x y = CmmMachOp (MO_Or wordWidth) [x, y] or x y = CmmMachOp (MO_Or wordWidth) [x, y]
hww = CmmLit (CmmInt (fromIntegral (widthInBits (halfWordWidth platform))) hww = CmmLit (CmmInt (fromIntegral (widthInBits (halfWordWidth platform)))
wordWidth) wordWidth)
hwm = CmmLit (CmmInt halfWordMask wordWidth) hwm = CmmLit (CmmInt (halfWordMask platform) wordWidth)
stmt = CmmCall (CmmPrim (MO_U_Mul2 wordWidth) (Just genericImpl)) stmt = CmmCall (CmmPrim (MO_U_Mul2 wordWidth) (Just genericImpl))
[CmmHinted res_h NoHint, [CmmHinted res_h NoHint,
CmmHinted res_l NoHint] CmmHinted res_l NoHint]
......
...@@ -641,7 +641,7 @@ genericWordAdd2Op [res_h, res_l] [arg_x, arg_y] ...@@ -641,7 +641,7 @@ genericWordAdd2Op [res_h, res_l] [arg_x, arg_y]
or x y = CmmMachOp (MO_Or wordWidth) [x, y] or x y = CmmMachOp (MO_Or wordWidth) [x, y]
hww = CmmLit (CmmInt (fromIntegral (widthInBits (halfWordWidth platform))) hww = CmmLit (CmmInt (fromIntegral (widthInBits (halfWordWidth platform)))
wordWidth) wordWidth)
hwm = CmmLit (CmmInt halfWordMask wordWidth) hwm = CmmLit (CmmInt (halfWordMask platform) wordWidth)
emit $ catAGraphs emit $ catAGraphs
[mkAssign (CmmLocal r1) [mkAssign (CmmLocal r1)
(add (bottomHalf arg_x) (bottomHalf arg_y)), (add (bottomHalf arg_x) (bottomHalf arg_y)),
...@@ -675,7 +675,7 @@ genericWordMul2Op [res_h, res_l] [arg_x, arg_y] ...@@ -675,7 +675,7 @@ genericWordMul2Op [res_h, res_l] [arg_x, arg_y]
or x y = CmmMachOp (MO_Or wordWidth) [x, y] or x y = CmmMachOp (MO_Or wordWidth) [x, y]
hww = CmmLit (CmmInt (fromIntegral (widthInBits (halfWordWidth platform))) hww = CmmLit (CmmInt (fromIntegral (widthInBits (halfWordWidth platform)))
wordWidth) wordWidth)
hwm = CmmLit (CmmInt halfWordMask wordWidth) hwm = CmmLit (CmmInt (halfWordMask platform) wordWidth)
emit $ catAGraphs emit $ catAGraphs
[mkAssign xlyl [mkAssign xlyl
(mul (bottomHalf arg_x) (bottomHalf arg_y)), (mul (bottomHalf arg_x) (bottomHalf arg_y)),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment