summaryrefslogtreecommitdiff
path: root/compiler/nativeGen/X86
diff options
context:
space:
mode:
authorAlexandre <alexandrer_b@outlook.com>2019-03-28 16:21:35 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-04-01 03:32:28 -0400
commit33173a51c77d9960d5009576ad9b67b646dfda3c (patch)
treee9a1e709cefdfdb65516323ed40fbcf3bb8cd0e4 /compiler/nativeGen/X86
parent6f7115dfd4fbb439a309a8381c4d02c450170cdc (diff)
downloadhaskell-33173a51c77d9960d5009576ad9b67b646dfda3c.tar.gz
Add support for bitreverse primop
This commit includes the necessary changes in code and documentation to support a primop that reverses a word's bits. It also includes a test.
Diffstat (limited to 'compiler/nativeGen/X86')
-rw-r--r--compiler/nativeGen/X86/CodeGen.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/nativeGen/X86/CodeGen.hs b/compiler/nativeGen/X86/CodeGen.hs
index abd4995376..0424b1b84f 100644
--- a/compiler/nativeGen/X86/CodeGen.hs
+++ b/compiler/nativeGen/X86/CodeGen.hs
@@ -531,7 +531,7 @@ getRegister' dflags is32Bit (CmmRegOff r n)
getRegister' dflags is32Bit (CmmMachOp (MO_AlignmentCheck align _) [e])
= addAlignmentCheck align <$> getRegister' dflags is32Bit e
--- for 32-bit architectuers, support some 64 -> 32 bit conversions:
+-- for 32-bit architectures, support some 64 -> 32 bit conversions:
-- TO_W_(x), TO_W_(x >> 32)
getRegister' _ is32Bit (CmmMachOp (MO_UU_Conv W64 W32)
@@ -2936,6 +2936,10 @@ outOfLineCmmOp bid mop res args
MO_PopCnt _ -> fsLit "popcnt"
MO_BSwap _ -> fsLit "bswap"
+ {- Here the C implementation is used as there is no x86
+ instruction to reverse a word's bit order.
+ -}
+ MO_BRev w -> fsLit $ bRevLabel w
MO_Clz w -> fsLit $ clzLabel w
MO_Ctz _ -> unsupported