summaryrefslogtreecommitdiff
path: root/compiler/codeGen
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2012-11-01 14:13:05 +0000
committerIan Lynagh <ian@well-typed.com>2012-11-01 14:29:11 +0000
commit229323898b0809047b19b79c181085430cce9850 (patch)
treebd5475b592138b0a1e8bb38f55938c322fab0a0f /compiler/codeGen
parent7706bee0393a87b543aa2f79ed3479e9aa91fb4c (diff)
downloadhaskell-229323898b0809047b19b79c181085430cce9850.tar.gz
Fix popcnt calls
We don't want to narrow the argument size before making the foreign call: Word8 still gets passed as a Word-sized argument
Diffstat (limited to 'compiler/codeGen')
-rw-r--r--compiler/codeGen/StgCmmPrim.hs15
1 files changed, 5 insertions, 10 deletions
diff --git a/compiler/codeGen/StgCmmPrim.hs b/compiler/codeGen/StgCmmPrim.hs
index 650a12eaf1..fe2a0217e0 100644
--- a/compiler/codeGen/StgCmmPrim.hs
+++ b/compiler/codeGen/StgCmmPrim.hs
@@ -485,16 +485,11 @@ emitPrimOp _ [] SetByteArrayOp [ba,off,len,c] =
doSetByteArrayOp ba off len c
-- Population count
-emitPrimOp dflags [res] PopCnt8Op [w] =
- emitPopCntCall res (CmmMachOp (mo_WordTo8 dflags) [w]) W8
-emitPrimOp dflags [res] PopCnt16Op [w] =
- emitPopCntCall res (CmmMachOp (mo_WordTo16 dflags) [w]) W16
-emitPrimOp dflags [res] PopCnt32Op [w] =
- emitPopCntCall res (CmmMachOp (mo_WordTo32 dflags) [w]) W32
-emitPrimOp _ [res] PopCnt64Op [w] =
- emitPopCntCall res w W64 -- arg always has type W64, no need to narrow
-emitPrimOp dflags [res] PopCntOp [w] =
- emitPopCntCall res w (wordWidth dflags)
+emitPrimOp _ [res] PopCnt8Op [w] = emitPopCntCall res w W8
+emitPrimOp _ [res] PopCnt16Op [w] = emitPopCntCall res w W16
+emitPrimOp _ [res] PopCnt32Op [w] = emitPopCntCall res w W32
+emitPrimOp _ [res] PopCnt64Op [w] = emitPopCntCall res w W64
+emitPrimOp dflags [res] PopCntOp [w] = emitPopCntCall res w (wordWidth dflags)
-- The rest just translate straightforwardly
emitPrimOp dflags [res] op [arg]