2015-10-16 08:14:36 +08:00
|
|
|
// REQUIRES: x86-registered-target
|
2015-10-16 07:47:11 +08:00
|
|
|
// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -S -o -
|
|
|
|
#define __MM_MALLOC_H
|
|
|
|
|
|
|
|
#include <x86intrin.h>
|
|
|
|
|
|
|
|
// No warnings.
|
|
|
|
extern __m256i a;
|
2020-06-24 03:14:09 +08:00
|
|
|
int __attribute__((target("avx"))) bar() {
|
2015-10-16 07:47:11 +08:00
|
|
|
return _mm256_extract_epi32(a, 3);
|
|
|
|
}
|
|
|
|
|
|
|
|
int baz() {
|
2020-06-24 03:14:09 +08:00
|
|
|
return bar();
|
2015-10-16 07:47:11 +08:00
|
|
|
}
|
|
|
|
|
2020-06-24 03:14:09 +08:00
|
|
|
int __attribute__((target("avx"))) qq_avx() {
|
2015-10-16 07:47:11 +08:00
|
|
|
return _mm256_extract_epi32(a, 3);
|
|
|
|
}
|
|
|
|
|
|
|
|
int qq_noavx() {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern __m256i a;
|
|
|
|
int qq() {
|
|
|
|
if (__builtin_cpu_supports("avx"))
|
2020-06-24 03:14:09 +08:00
|
|
|
return qq_avx();
|
2015-10-16 07:47:11 +08:00
|
|
|
else
|
|
|
|
return qq_noavx();
|
|
|
|
}
|
2015-10-27 14:11:03 +08:00
|
|
|
|
|
|
|
// Test that fma and fma4 are both separately and combined valid for an fma intrinsic.
|
|
|
|
__m128 __attribute__((target("fma"))) fma_1(__m128 a, __m128 b, __m128 c) {
|
|
|
|
return __builtin_ia32_vfmaddps(a, b, c);
|
|
|
|
}
|
|
|
|
|
|
|
|
__m128 __attribute__((target("fma4"))) fma_2(__m128 a, __m128 b, __m128 c) {
|
|
|
|
return __builtin_ia32_vfmaddps(a, b, c);
|
|
|
|
}
|
|
|
|
|
|
|
|
__m128 __attribute__((target("fma,fma4"))) fma_3(__m128 a, __m128 b, __m128 c) {
|
|
|
|
return __builtin_ia32_vfmaddps(a, b, c);
|
|
|
|
}
|
2016-05-20 23:21:08 +08:00
|
|
|
|
|
|
|
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");
|
2017-08-09 01:43:44 +08:00
|
|
|
(void)__builtin_cpu_supports("avx5124vnniw");
|
|
|
|
(void)__builtin_cpu_supports("avx5124fmaps");
|
|
|
|
(void)__builtin_cpu_supports("avx512vpopcntdq");
|
2018-10-20 11:51:52 +08:00
|
|
|
(void)__builtin_cpu_supports("avx512vbmi2");
|
|
|
|
(void)__builtin_cpu_supports("gfni");
|
|
|
|
(void)__builtin_cpu_supports("vpclmulqdq");
|
|
|
|
(void)__builtin_cpu_supports("avx512vnni");
|
|
|
|
(void)__builtin_cpu_supports("avx512bitalg");
|
2019-09-05 00:01:43 +08:00
|
|
|
(void)__builtin_cpu_supports("avx512bf16");
|
2020-05-22 09:16:02 +08:00
|
|
|
(void)__builtin_cpu_supports("avx512vp2intersect");
|
2016-05-20 23:21:08 +08:00
|
|
|
}
|
2017-08-11 04:28:30 +08:00
|
|
|
|
|
|
|
void verifycpustrings() {
|
2020-10-25 00:00:33 +08:00
|
|
|
(void)__builtin_cpu_is("alderlake");
|
2017-08-11 04:28:30 +08:00
|
|
|
(void)__builtin_cpu_is("amd");
|
|
|
|
(void)__builtin_cpu_is("amdfam10h");
|
|
|
|
(void)__builtin_cpu_is("amdfam15h");
|
2017-10-12 05:42:02 +08:00
|
|
|
(void)__builtin_cpu_is("amdfam17h");
|
2017-08-11 04:28:30 +08:00
|
|
|
(void)__builtin_cpu_is("atom");
|
|
|
|
(void)__builtin_cpu_is("barcelona");
|
|
|
|
(void)__builtin_cpu_is("bdver1");
|
|
|
|
(void)__builtin_cpu_is("bdver2");
|
|
|
|
(void)__builtin_cpu_is("bdver3");
|
|
|
|
(void)__builtin_cpu_is("bdver4");
|
|
|
|
(void)__builtin_cpu_is("bonnell");
|
|
|
|
(void)__builtin_cpu_is("broadwell");
|
|
|
|
(void)__builtin_cpu_is("btver1");
|
|
|
|
(void)__builtin_cpu_is("btver2");
|
2017-11-19 12:12:33 +08:00
|
|
|
(void)__builtin_cpu_is("cannonlake");
|
2019-02-27 03:20:04 +08:00
|
|
|
(void)__builtin_cpu_is("cascadelake");
|
2020-06-22 02:30:00 +08:00
|
|
|
(void)__builtin_cpu_is("cooperlake");
|
2017-08-11 04:28:30 +08:00
|
|
|
(void)__builtin_cpu_is("core2");
|
|
|
|
(void)__builtin_cpu_is("corei7");
|
2018-10-20 11:51:52 +08:00
|
|
|
(void)__builtin_cpu_is("goldmont");
|
|
|
|
(void)__builtin_cpu_is("goldmont-plus");
|
2017-08-11 04:28:30 +08:00
|
|
|
(void)__builtin_cpu_is("haswell");
|
2018-10-20 11:51:52 +08:00
|
|
|
(void)__builtin_cpu_is("icelake-client");
|
|
|
|
(void)__builtin_cpu_is("icelake-server");
|
2017-08-11 04:28:30 +08:00
|
|
|
(void)__builtin_cpu_is("intel");
|
|
|
|
(void)__builtin_cpu_is("istanbul");
|
|
|
|
(void)__builtin_cpu_is("ivybridge");
|
|
|
|
(void)__builtin_cpu_is("knl");
|
2017-11-19 12:12:33 +08:00
|
|
|
(void)__builtin_cpu_is("knm");
|
2017-08-11 04:28:30 +08:00
|
|
|
(void)__builtin_cpu_is("nehalem");
|
2021-04-13 09:24:34 +08:00
|
|
|
(void)__builtin_cpu_is("rocketlake");
|
2017-08-11 04:28:30 +08:00
|
|
|
(void)__builtin_cpu_is("sandybridge");
|
|
|
|
(void)__builtin_cpu_is("shanghai");
|
|
|
|
(void)__builtin_cpu_is("silvermont");
|
|
|
|
(void)__builtin_cpu_is("skylake");
|
|
|
|
(void)__builtin_cpu_is("skylake-avx512");
|
|
|
|
(void)__builtin_cpu_is("slm");
|
2020-06-22 02:30:00 +08:00
|
|
|
(void)__builtin_cpu_is("tigerlake");
|
[X86] Support -march=sapphirerapids
Support -march=sapphirerapids for x86.
Compare with Icelake Server, it includes 14 more new features. They are
amxtile, amxint8, amxbf16, avx512bf16, avx512vp2intersect, cldemote,
enqcmd, movdir64b, movdiri, ptwrite, serialize, shstk, tsxldtrk, waitpkg.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D86503
2020-08-25 12:27:02 +08:00
|
|
|
(void)__builtin_cpu_is("sapphirerapids");
|
2018-10-20 11:51:52 +08:00
|
|
|
(void)__builtin_cpu_is("tremont");
|
2017-08-11 04:28:30 +08:00
|
|
|
(void)__builtin_cpu_is("westmere");
|
|
|
|
(void)__builtin_cpu_is("znver1");
|
2019-02-27 01:15:36 +08:00
|
|
|
(void)__builtin_cpu_is("znver2");
|
2020-12-06 02:07:09 +08:00
|
|
|
(void)__builtin_cpu_is("znver3");
|
2017-08-11 04:28:30 +08:00
|
|
|
}
|