[commit: ghc] wip/angerman/llvmng: [bmi] only if enabled. (4aef861)
git at git.haskell.org
git at git.haskell.org
Sat Nov 25 09:14:59 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/angerman/llvmng
Link : http://ghc.haskell.org/trac/ghc/changeset/4aef8614c89a9474027001517b914e0bf876f63e/ghc
>---------------------------------------------------------------
commit 4aef8614c89a9474027001517b914e0bf876f63e
Author: Moritz Angermann <moritz.angermann at gmail.com>
Date: Tue Nov 21 10:10:33 2017 +0800
[bmi] only if enabled.
>---------------------------------------------------------------
4aef8614c89a9474027001517b914e0bf876f63e
compiler/llvmGen-ng/Data/BitCode/LLVM/Gen.hs | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/compiler/llvmGen-ng/Data/BitCode/LLVM/Gen.hs b/compiler/llvmGen-ng/Data/BitCode/LLVM/Gen.hs
index 4222dbd..fd439b0 100644
--- a/compiler/llvmGen-ng/Data/BitCode/LLVM/Gen.hs
+++ b/compiler/llvmGen-ng/Data/BitCode/LLVM/Gen.hs
@@ -895,11 +895,11 @@ genCall blockMap regMap target dsts args = case target of
src' <- bind2 cast (EDSL.i (widthInBits w)) (exprToVar blockMap regMap src)
mask' <- bind2 cast (EDSL.i (widthInBits w)) (exprToVar blockMap regMap mask)
- arch <- platformArch . targetPlatform <$> getDynFlags
+ hasBmi <- isBmiEnabled <$> getDynFlags
f <- let w' = widthInBits w
- fn = case arch of
- ArchX86_64 -> "llvm.x86.bmi.pdep."
- _ -> "hs_pdep"
+ fn = if hasBmi
+ then "llvm.x86.bmi.pdep."
+ else "hs_pdep"
in EDSL.fun (fn ++ show w') =<< [ EDSL.i w', EDSL.i w' ] --> EDSL.i w'
Just ret <- EDSL.ccall f [ src', mask' ]
@@ -915,10 +915,11 @@ genCall blockMap regMap target dsts args = case target of
arch <- platformArch . targetPlatform <$> getDynFlags
+ hasBmi <- isBmiEnabled <$> getDynFlags
f <- let w' = widthInBits w
- fn = case arch of
- ArchX86_64 -> "llvm.x86.bmi.pext."
- _ -> "hs_pext"
+ fn = if hasBmi
+ then "llvm.x86.bmi.pext."
+ else "hs_pext"
in EDSL.fun (fn ++ show w') =<< [ EDSL.i w', EDSL.i w' ] --> EDSL.i w'
Just ret <- EDSL.ccall f [ src', mask' ]
More information about the ghc-commits
mailing list