[commit: ghc] wip/angerman/llvmng: [bmi] only if enabled. (8427df3)

git at git.haskell.org git at git.haskell.org
Tue Nov 21 02:15:28 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/angerman/llvmng
Link       : http://ghc.haskell.org/trac/ghc/changeset/8427df332d2db338f0fc0c1a1976696227a280f6/ghc

>---------------------------------------------------------------

commit 8427df332d2db338f0fc0c1a1976696227a280f6
Author: Moritz Angermann <moritz.angermann at gmail.com>
Date:   Tue Nov 21 10:10:33 2017 +0800

    [bmi] only if enabled.


>---------------------------------------------------------------

8427df332d2db338f0fc0c1a1976696227a280f6
 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