Add new mbmi and mbmi2 compiler flags
authorJohn Ky <newhoggy@gmail.com>
Sun, 21 Jan 2018 16:55:45 +0000 (11:55 -0500)
committerBen Gamari <ben@smart-cactus.org>
Mon, 22 Jan 2018 03:24:47 +0000 (22:24 -0500)
commitb75f8d2628a6db74254b34b2c9ca7aa22138e715
tree4187028fc36c4586a4d063a30b1927259ef983aa
parentc1050953b28b0e6ff6a749cea6935cc153b62960
Add new mbmi and mbmi2 compiler flags

This adds support for the bit deposit and extraction operations provided
by the BMI and BMI2 instruction set extensions on modern amd64 machines.

Implement x86 code generator for pdep and pext.  Properly initialise
bmiVersion field.

pdep and pext test cases

Fix pattern match for pdep and pext instructions

Fix build of pdep and pext code for 32-bit architectures

Test Plan: Validate

Reviewers: austin, simonmar, bgamari, angerman

Reviewed By: bgamari

Subscribers: trommler, carter, angerman, thomie, rwbarton, newhoggy

GHC Trac Issues: #14206

Differential Revision: https://phabricator.haskell.org/D4236

(cherry picked from commit f855769690eb998ea25818ee794714957852af48)
23 files changed:
compiler/cmm/CmmMachOp.hs
compiler/cmm/CmmParse.y
compiler/cmm/PprC.hs
compiler/codeGen/StgCmmPrim.hs
compiler/coreSyn/MkCore.hs
compiler/llvmGen/LlvmCodeGen/CodeGen.hs
compiler/main/DriverPipeline.hs
compiler/main/DynFlags.hs
compiler/nativeGen/CPrim.hs
compiler/nativeGen/PPC/CodeGen.hs
compiler/nativeGen/SPARC/CodeGen.hs
compiler/nativeGen/X86/CodeGen.hs
compiler/nativeGen/X86/Instr.hs
compiler/nativeGen/X86/Ppr.hs
compiler/prelude/primops.txt.pp
libraries/ghc-prim/cbits/pdep.c [new file with mode: 0644]
libraries/ghc-prim/cbits/pext.c [new file with mode: 0644]
libraries/ghc-prim/ghc-prim.cabal
testsuite/tests/codeGen/should_run/all.T
testsuite/tests/codeGen/should_run/cgrun075.hs [new file with mode: 0644]
testsuite/tests/codeGen/should_run/cgrun075.stdout [new file with mode: 0644]
testsuite/tests/codeGen/should_run/cgrun076.hs [new file with mode: 0644]
testsuite/tests/codeGen/should_run/cgrun076.stdout [new file with mode: 0644]