@@ -1691,7 +1691,7 @@ class X86TargetInfo : public TargetInfo {
1691
1691
bool HasTBM;
1692
1692
bool HasFMA;
1693
1693
bool HasF16C;
1694
- bool HasAVX512CD, HasAVX512ER, HasAVX512PF;
1694
+ bool HasAVX512CD, HasAVX512ER, HasAVX512PF, HasAVX512DQ, HasAVX512BW, HasAVX512VL ;
1695
1695
bool HasSHA;
1696
1696
bool HasCX16;
1697
1697
@@ -1783,6 +1783,10 @@ class X86TargetInfo : public TargetInfo {
1783
1783
// / Knights Landing processor.
1784
1784
CK_KNL,
1785
1785
1786
+ // / \name Skylake Server
1787
+ // / Skylake server processor.
1788
+ CK_SKX,
1789
+
1786
1790
// / \name K6
1787
1791
// / K6 architecture processors.
1788
1792
// @{
@@ -1856,7 +1860,8 @@ class X86TargetInfo : public TargetInfo {
1856
1860
HasRDRND(false ), HasBMI(false ), HasBMI2(false ), HasPOPCNT(false ),
1857
1861
HasRTM(false ), HasPRFCHW(false ), HasRDSEED(false ), HasTBM(false ),
1858
1862
HasFMA(false ), HasF16C(false ), HasAVX512CD(false ), HasAVX512ER(false ),
1859
- HasAVX512PF(false ), HasSHA(false ), HasCX16(false ), CPU(CK_Generic),
1863
+ HasAVX512PF(false ), HasAVX512DQ(false ), HasAVX512BW(false ), HasAVX512VL(false ),
1864
+ HasSHA(false ), HasCX16(false ), CPU(CK_Generic),
1860
1865
FPMath(FP_Default) {
1861
1866
BigEndian = false ;
1862
1867
LongDoubleFormat = &llvm::APFloat::x87DoubleExtended;
@@ -1950,6 +1955,7 @@ class X86TargetInfo : public TargetInfo {
1950
1955
.Case (" core-avx-i" , CK_CoreAVXi)
1951
1956
.Case (" core-avx2" , CK_CoreAVX2)
1952
1957
.Case (" knl" , CK_KNL)
1958
+ .Case (" skx" , CK_SKX)
1953
1959
.Case (" k6" , CK_K6)
1954
1960
.Case (" k6-2" , CK_K6_2)
1955
1961
.Case (" k6-3" , CK_K6_3)
@@ -2028,6 +2034,7 @@ class X86TargetInfo : public TargetInfo {
2028
2034
case CK_CoreAVXi:
2029
2035
case CK_CoreAVX2:
2030
2036
case CK_KNL:
2037
+ case CK_SKX:
2031
2038
case CK_Athlon64:
2032
2039
case CK_Athlon64SSE3:
2033
2040
case CK_AthlonFX:
@@ -2176,6 +2183,22 @@ void X86TargetInfo::getDefaultFeatures(llvm::StringMap<bool> &Features) const {
2176
2183
setFeatureEnabledImpl (Features, " rtm" , true );
2177
2184
setFeatureEnabledImpl (Features, " fma" , true );
2178
2185
break ;
2186
+ case CK_SKX:
2187
+ setFeatureEnabledImpl (Features, " avx512f" , true );
2188
+ setFeatureEnabledImpl (Features, " avx512cd" , true );
2189
+ setFeatureEnabledImpl (Features, " avx512dq" , true );
2190
+ setFeatureEnabledImpl (Features, " avx512bw" , true );
2191
+ setFeatureEnabledImpl (Features, " avx512vl" , true );
2192
+ setFeatureEnabledImpl (Features, " aes" , true );
2193
+ setFeatureEnabledImpl (Features, " pclmul" , true );
2194
+ setFeatureEnabledImpl (Features, " lzcnt" , true );
2195
+ setFeatureEnabledImpl (Features, " rdrnd" , true );
2196
+ setFeatureEnabledImpl (Features, " f16c" , true );
2197
+ setFeatureEnabledImpl (Features, " bmi" , true );
2198
+ setFeatureEnabledImpl (Features, " bmi2" , true );
2199
+ setFeatureEnabledImpl (Features, " rtm" , true );
2200
+ setFeatureEnabledImpl (Features, " fma" , true );
2201
+ break ;
2179
2202
case CK_K6:
2180
2203
case CK_WinChipC6:
2181
2204
setFeatureEnabledImpl (Features, " mmx" , true );
@@ -2317,8 +2340,8 @@ void X86TargetInfo::setSSELevel(llvm::StringMap<bool> &Features,
2317
2340
case AVX2:
2318
2341
Features[" avx2" ] = false ;
2319
2342
case AVX512F:
2320
- Features[" avx512f" ] = Features[" avx512cd" ] = Features[" avx512er" ] =
2321
- Features[" avx512pf " ] = false ;
2343
+ Features[" avx512f" ] = Features[" avx512cd" ] = Features[" avx512er" ] = Features[ " avx512pf " ] =
2344
+ Features[ " avx512dq " ] = Features[" avx512bw " ] = Features[ " avx512vl " ] = false ;
2322
2345
}
2323
2346
}
2324
2347
@@ -2417,7 +2440,8 @@ void X86TargetInfo::setFeatureEnabledImpl(llvm::StringMap<bool> &Features,
2417
2440
setSSELevel (Features, AVX2, Enabled);
2418
2441
} else if (Name == " avx512f" ) {
2419
2442
setSSELevel (Features, AVX512F, Enabled);
2420
- } else if (Name == " avx512cd" || Name == " avx512er" || Name == " avx512pf" ) {
2443
+ } else if (Name == " avx512cd" || Name == " avx512er" || Name == " avx512pf"
2444
+ || Name == " avx512dq" || Name == " avx512bw" || Name == " avx512vl" ) {
2421
2445
if (Enabled)
2422
2446
setSSELevel (Features, AVX512F, Enabled);
2423
2447
} else if (Name == " fma" ) {
@@ -2530,6 +2554,21 @@ bool X86TargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
2530
2554
continue ;
2531
2555
}
2532
2556
2557
+ if (Feature == " avx512dq" ) {
2558
+ HasAVX512DQ = true ;
2559
+ continue ;
2560
+ }
2561
+
2562
+ if (Feature == " avx512bw" ) {
2563
+ HasAVX512BW = true ;
2564
+ continue ;
2565
+ }
2566
+
2567
+ if (Feature == " avx512vl" ) {
2568
+ HasAVX512VL = true ;
2569
+ continue ;
2570
+ }
2571
+
2533
2572
if (Feature == " sha" ) {
2534
2573
HasSHA = true ;
2535
2574
continue ;
@@ -2696,6 +2735,9 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts,
2696
2735
case CK_KNL:
2697
2736
defineCPUMacros (Builder, " knl" );
2698
2737
break ;
2738
+ case CK_SKX:
2739
+ defineCPUMacros (Builder, " skx" );
2740
+ break ;
2699
2741
case CK_K6_2:
2700
2742
Builder.defineMacro (" __k6_2__" );
2701
2743
Builder.defineMacro (" __tune_k6_2__" );
@@ -2823,6 +2865,12 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts,
2823
2865
Builder.defineMacro (" __AVX512ER__" );
2824
2866
if (HasAVX512PF)
2825
2867
Builder.defineMacro (" __AVX512PF__" );
2868
+ if (HasAVX512DQ)
2869
+ Builder.defineMacro (" __AVX512DQ__" );
2870
+ if (HasAVX512BW)
2871
+ Builder.defineMacro (" __AVX512BW__" );
2872
+ if (HasAVX512VL)
2873
+ Builder.defineMacro (" __AVX512VL__" );
2826
2874
2827
2875
if (HasSHA)
2828
2876
Builder.defineMacro (" __SHA__" );
@@ -2906,6 +2954,9 @@ bool X86TargetInfo::hasFeature(StringRef Feature) const {
2906
2954
.Case (" avx512cd" , HasAVX512CD)
2907
2955
.Case (" avx512er" , HasAVX512ER)
2908
2956
.Case (" avx512pf" , HasAVX512PF)
2957
+ .Case (" avx512dq" , HasAVX512DQ)
2958
+ .Case (" avx512bw" , HasAVX512BW)
2959
+ .Case (" avx512vl" , HasAVX512VL)
2909
2960
.Case (" bmi" , HasBMI)
2910
2961
.Case (" bmi2" , HasBMI2)
2911
2962
.Case (" cx16" , HasCX16)
0 commit comments