]> granicus.if.org Git - clang/commitdiff
[AVX-512] Make VBMI instruction set enabling imply that the BWI instruction set is...
authorCraig Topper <craig.topper@gmail.com>
Wed, 9 Nov 2016 04:51:03 +0000 (04:51 +0000)
committerCraig Topper <craig.topper@gmail.com>
Wed, 9 Nov 2016 04:51:03 +0000 (04:51 +0000)
Summary: This is needed to make the v64i8 and v32i16 types legal for the 512-bit VBMI instructions. Fixes PR30912.

Reviewers: delena, zvi

Subscribers: RKSimon, cfe-commits

Differential Revision: https://reviews.llvm.org/D26306

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@286340 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Targets.cpp
test/Preprocessor/x86_target_features.c

index 5c62b31d32e71e1823f31a64b0ca7a0c64bb7b30..ad1e5d9502b58155fbd7de97348b07e39ab0d178 100644 (file)
@@ -3351,6 +3351,12 @@ void X86TargetInfo::setFeatureEnabledImpl(llvm::StringMap<bool> &Features,
              Name == "avx512vbmi" || Name == "avx512ifma") {
     if (Enabled)
       setSSELevel(Features, AVX512F, Enabled);
+    // Enable BWI instruction if VBMI is being enabled.
+    if (Name == "avx512vbmi" && Enabled)
+      Features["avx512bw"] = true;
+    // Also disable VBMI if BWI is being disabled.
+    if (Name == "avx512bw" && !Enabled)
+      Features["avx512vbmi"] = false;
   } else if (Name == "fma") {
     if (Enabled)
       setSSELevel(Features, AVX, Enabled);
index ff79a699ae8d432e1dd714b510a9d28ae733cdde..43cf615546b1a78e8d1f1c477653176c5f51c145 100644 (file)
 // RUN: %clang -target i386-unknown-unknown -march=atom -mavx512vbmi -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=AVX512VBMI %s
 
 // AVX512VBMI: #define __AVX2__ 1
+// AVX512VBMI: #define __AVX512BW__ 1
 // AVX512VBMI: #define __AVX512F__ 1
 // AVX512VBMI: #define __AVX512VBMI__ 1
 // AVX512VBMI: #define __AVX__ 1
 // AVX512VBMI: #define __SSE__ 1
 // AVX512VBMI: #define __SSSE3__ 1
 
+// RUN: %clang -target i386-unknown-unknown -march=atom -mavx512vbmi -mno-avx512bw -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=AVX512VBMINOAVX512BW %s
+
+// AVX512VBMINOAVX512BW-NOT: #define __AVX512BW__ 1
+// AVX512VBMINOAVX512BW-NOT: #define __AVX512VBMI__ 1
+
 // RUN: %clang -target i386-unknown-unknown -march=atom -msse4.2 -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=SSE42POPCNT %s
 
 // SSE42POPCNT: #define __POPCNT__ 1