summaryrefslogtreecommitdiff
path: root/compiler/codeGen
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/codeGen')
-rw-r--r--compiler/codeGen/StgCmmPrim.hs15
1 files changed, 10 insertions, 5 deletions
diff --git a/compiler/codeGen/StgCmmPrim.hs b/compiler/codeGen/StgCmmPrim.hs
index 3a7a456082..6c6005e88a 100644
--- a/compiler/codeGen/StgCmmPrim.hs
+++ b/compiler/codeGen/StgCmmPrim.hs
@@ -498,11 +498,16 @@ emitPrimOp [] SetByteArrayOp [ba,off,len,c] =
doSetByteArrayOp ba off len c
-- Population count
-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 [res] PopCntOp [w] = emitPopCntCall res w wordWidth
+emitPrimOp [res] PopCnt8Op [w] =
+ emitPopCntCall res (CmmMachOp mo_WordTo8 [w]) W8
+emitPrimOp [res] PopCnt16Op [w] =
+ emitPopCntCall res (CmmMachOp mo_WordTo16 [w]) W16
+emitPrimOp [res] PopCnt32Op [w] =
+ emitPopCntCall res (CmmMachOp mo_WordTo32 [w]) W32
+emitPrimOp [res] PopCnt64Op [w] =
+ emitPopCntCall res w W64 -- arg always has type W64, no need to narrow
+emitPrimOp [res] PopCntOp [w] =
+ emitPopCntCall res w wordWidth
-- The rest just translate straightforwardly
emitPrimOp [res] op [arg]