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>
Sun, 21 Jan 2018 16:56:11 +0000 (11:56 -0500)
commitf855769690eb998ea25818ee794714957852af48
tree969d0c0bafa72929f5ec50f1794d51e6e1799840
parent5e8ea6a62e948bcc0da1279f06844fd1d8e979bd
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
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]