diff options
| author | Ian Lynagh <ian@well-typed.com> | 2013-06-09 12:10:35 +0100 |
|---|---|---|
| committer | Ian Lynagh <ian@well-typed.com> | 2013-06-09 12:10:35 +0100 |
| commit | 1c5b0511a89488f5280523569d45ee61c0d09ffa (patch) | |
| tree | ccdb8a6ff90162e4d26318b901c473ab5a7f90cc /compiler/nativeGen/CPrim.hs | |
| parent | 972c044d5da72cee3a43209ccb41e2229914211c (diff) | |
| download | haskell-1c5b0511a89488f5280523569d45ee61c0d09ffa.tar.gz | |
Add support for byte endian swapping for Word 16/32/64.
* Exposes bSwap{,16,32,64}# primops
* Add a new machops MO_BSwap
* Use a Stg implementation (hs_bswap{16,32,64}) for other implementation
in NCG.
* Generate bswap in X86 NCG for 32 and 64 bits, and for 16 bits, bswap+shr
instead of using xchg.
* Generate llvm.bswap intrinsics in llvm codegen.
Patch from Vincent Hanquez.
Diffstat (limited to 'compiler/nativeGen/CPrim.hs')
| -rw-r--r-- | compiler/nativeGen/CPrim.hs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/nativeGen/CPrim.hs b/compiler/nativeGen/CPrim.hs index dd9d38f434..a6f4cab7bd 100644 --- a/compiler/nativeGen/CPrim.hs +++ b/compiler/nativeGen/CPrim.hs @@ -1,6 +1,7 @@ -- | Generating C symbol names emitted by the compiler. module CPrim ( popCntLabel + , bSwapLabel , word2FloatLabel ) where @@ -16,6 +17,14 @@ popCntLabel w = "hs_popcnt" ++ pprWidth w pprWidth W64 = "64" pprWidth w = pprPanic "popCntLabel: Unsupported word width " (ppr w) +bSwapLabel :: Width -> String +bSwapLabel w = "hs_bswap" ++ pprWidth w + where + pprWidth W16 = "16" + pprWidth W32 = "32" + pprWidth W64 = "64" + pprWidth w = pprPanic "bSwapLabel: Unsupported word width " (ppr w) + word2FloatLabel :: Width -> String word2FloatLabel w = "hs_word2float" ++ pprWidth w where |
