r270224 - Add all the avx512 flavors to __builtin_cpu_supports's list.
Benjamin Kramer via cfe-commits
cfe-commits at lists.llvm.org
Fri May 20 08:21:08 PDT 2016
Author: d0k
Date: Fri May 20 10:21:08 2016
New Revision: 270224
URL: http://llvm.org/viewvc/llvm-project?rev=270224&view=rev
Log:
Add all the avx512 flavors to __builtin_cpu_supports's list.
This is matching what trunk gcc is accepting. Also adds a missing ssse3
case. PR27779. The amount of duplication here is annoying, maybe it
should be factored into a separate .def file?
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/test/CodeGen/target-builtin-noerror.c
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=270224&r1=270223&r2=270224&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri May 20 10:21:08 2016
@@ -3753,6 +3753,7 @@ bool X86TargetInfo::validateCpuSupports(
.Case("sse", true)
.Case("sse2", true)
.Case("sse3", true)
+ .Case("ssse3", true)
.Case("sse4.1", true)
.Case("sse4.2", true)
.Case("avx", true)
@@ -3764,6 +3765,16 @@ bool X86TargetInfo::validateCpuSupports(
.Case("avx512f", true)
.Case("bmi", true)
.Case("bmi2", true)
+ .Case("aes", true)
+ .Case("pclmul", true)
+ .Case("avx512vl", true)
+ .Case("avx512bw", true)
+ .Case("avx512dq", true)
+ .Case("avx512cd", true)
+ .Case("avx512er", true)
+ .Case("avx512pf", true)
+ .Case("avx512vbmi", true)
+ .Case("avx512ifma", true)
.Default(false);
}
Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=270224&r1=270223&r2=270224&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Fri May 20 10:21:08 2016
@@ -6336,6 +6336,16 @@ Value *CodeGenFunction::EmitX86BuiltinEx
AVX512F,
BMI,
BMI2,
+ AES,
+ PCLMUL,
+ AVX512VL,
+ AVX512BW,
+ AVX512DQ,
+ AVX512CD,
+ AVX512ER,
+ AVX512PF,
+ AVX512VBMI,
+ AVX512IFMA,
MAX
};
@@ -6346,6 +6356,7 @@ Value *CodeGenFunction::EmitX86BuiltinEx
.Case("sse", X86Features::SSE)
.Case("sse2", X86Features::SSE2)
.Case("sse3", X86Features::SSE3)
+ .Case("ssse3", X86Features::SSSE3)
.Case("sse4.1", X86Features::SSE4_1)
.Case("sse4.2", X86Features::SSE4_2)
.Case("avx", X86Features::AVX)
@@ -6357,6 +6368,16 @@ Value *CodeGenFunction::EmitX86BuiltinEx
.Case("avx512f", X86Features::AVX512F)
.Case("bmi", X86Features::BMI)
.Case("bmi2", X86Features::BMI2)
+ .Case("aes", X86Features::AES)
+ .Case("pclmul", X86Features::PCLMUL)
+ .Case("avx512vl", X86Features::AVX512VL)
+ .Case("avx512bw", X86Features::AVX512BW)
+ .Case("avx512dq", X86Features::AVX512DQ)
+ .Case("avx512cd", X86Features::AVX512CD)
+ .Case("avx512er", X86Features::AVX512ER)
+ .Case("avx512pf", X86Features::AVX512PF)
+ .Case("avx512vbmi", X86Features::AVX512VBMI)
+ .Case("avx512ifma", X86Features::AVX512IFMA)
.Default(X86Features::MAX);
assert(Feature != X86Features::MAX && "Invalid feature!");
Modified: cfe/trunk/test/CodeGen/target-builtin-noerror.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/target-builtin-noerror.c?rev=270224&r1=270223&r2=270224&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/target-builtin-noerror.c (original)
+++ cfe/trunk/test/CodeGen/target-builtin-noerror.c Fri May 20 10:21:08 2016
@@ -42,3 +42,34 @@ __m128 __attribute__((target("fma4"))) f
__m128 __attribute__((target("fma,fma4"))) fma_3(__m128 a, __m128 b, __m128 c) {
return __builtin_ia32_vfmaddps(a, b, c);
}
+
+void verifyfeaturestrings() {
+ (void)__builtin_cpu_supports("cmov");
+ (void)__builtin_cpu_supports("mmx");
+ (void)__builtin_cpu_supports("popcnt");
+ (void)__builtin_cpu_supports("sse");
+ (void)__builtin_cpu_supports("sse2");
+ (void)__builtin_cpu_supports("sse3");
+ (void)__builtin_cpu_supports("ssse3");
+ (void)__builtin_cpu_supports("sse4.1");
+ (void)__builtin_cpu_supports("sse4.2");
+ (void)__builtin_cpu_supports("avx");
+ (void)__builtin_cpu_supports("avx2");
+ (void)__builtin_cpu_supports("sse4a");
+ (void)__builtin_cpu_supports("fma4");
+ (void)__builtin_cpu_supports("xop");
+ (void)__builtin_cpu_supports("fma");
+ (void)__builtin_cpu_supports("avx512f");
+ (void)__builtin_cpu_supports("bmi");
+ (void)__builtin_cpu_supports("bmi2");
+ (void)__builtin_cpu_supports("aes");
+ (void)__builtin_cpu_supports("pclmul");
+ (void)__builtin_cpu_supports("avx512vl");
+ (void)__builtin_cpu_supports("avx512bw");
+ (void)__builtin_cpu_supports("avx512dq");
+ (void)__builtin_cpu_supports("avx512cd");
+ (void)__builtin_cpu_supports("avx512er");
+ (void)__builtin_cpu_supports("avx512pf");
+ (void)__builtin_cpu_supports("avx512vbmi");
+ (void)__builtin_cpu_supports("avx512ifma");
+}
More information about the cfe-commits
mailing list