Skip to content

Commit 56c5822

Browse files
committed
Add support for -march=bdver4.
llvm-svn: 207848
1 parent 6004573 commit 56c5822

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed

clang/lib/Basic/Targets.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,6 +1768,7 @@ class X86TargetInfo : public TargetInfo {
17681768
CK_BDVER1,
17691769
CK_BDVER2,
17701770
CK_BDVER3,
1771+
CK_BDVER4,
17711772
//@}
17721773

17731774
/// This specification is deprecated and will be removed in the future.
@@ -1911,6 +1912,7 @@ class X86TargetInfo : public TargetInfo {
19111912
.Case("bdver1", CK_BDVER1)
19121913
.Case("bdver2", CK_BDVER2)
19131914
.Case("bdver3", CK_BDVER3)
1915+
.Case("bdver4", CK_BDVER4)
19141916
.Case("x86-64", CK_x86_64)
19151917
.Case("geode", CK_Geode)
19161918
.Default(CK_Generic);
@@ -1980,6 +1982,7 @@ class X86TargetInfo : public TargetInfo {
19801982
case CK_BDVER1:
19811983
case CK_BDVER2:
19821984
case CK_BDVER3:
1985+
case CK_BDVER4:
19831986
case CK_x86_64:
19841987
return true;
19851988
}
@@ -2182,6 +2185,10 @@ void X86TargetInfo::getDefaultFeatures(llvm::StringMap<bool> &Features) const {
21822185
setFeatureEnabledImpl(Features, "prfchw", true);
21832186
setFeatureEnabledImpl(Features, "cx16", true);
21842187
break;
2188+
case CK_BDVER4:
2189+
setFeatureEnabledImpl(Features, "avx2", true);
2190+
setFeatureEnabledImpl(Features, "bmi2", true);
2191+
// FALLTHROUGH
21852192
case CK_BDVER2:
21862193
case CK_BDVER3:
21872194
setFeatureEnabledImpl(Features, "xop", true);
@@ -2685,6 +2692,9 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts,
26852692
case CK_BDVER3:
26862693
defineCPUMacros(Builder, "bdver3");
26872694
break;
2695+
case CK_BDVER4:
2696+
defineCPUMacros(Builder, "bdver4");
2697+
break;
26882698
case CK_Geode:
26892699
defineCPUMacros(Builder, "geode");
26902700
break;

clang/test/Preprocessor/predefined-arch-macros.c

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,6 +1437,76 @@
14371437
// CHECK_BDVER3_M64: #define __tune_bdver3__ 1
14381438
// CHECK_BDVER3_M64: #define __x86_64 1
14391439
// CHECK_BDVER3_M64: #define __x86_64__ 1
1440+
// RUN: %clang -march=bdver4 -m32 -E -dM %s -o - 2>&1 \
1441+
// RUN: -target i386-unknown-linux \
1442+
// RUN: | FileCheck %s -check-prefix=CHECK_BDVER4_M32
1443+
// CHECK_BDVER4_M32-NOT: #define __3dNOW_A__ 1
1444+
// CHECK_BDVER4_M32-NOT: #define __3dNOW__ 1
1445+
// CHECK_BDVER4_M32: #define __AES__ 1
1446+
// CHECK_BDVER4_M32: #define __AVX2__ 1
1447+
// CHECK_BDVER4_M32: #define __AVX__ 1
1448+
// CHECK_BDVER4_M32: #define __BMI2__ 1
1449+
// CHECK_BDVER4_M32: #define __BMI__ 1
1450+
// CHECK_BDVER4_M32: #define __F16C__ 1
1451+
// CHECK_BDVER4_M32: #define __FMA4__ 1
1452+
// CHECK_BDVER4_M32: #define __FMA__ 1
1453+
// CHECK_BDVER4_M32: #define __LZCNT__ 1
1454+
// CHECK_BDVER4_M32: #define __MMX__ 1
1455+
// CHECK_BDVER4_M32: #define __PCLMUL__ 1
1456+
// CHECK_BDVER4_M32: #define __POPCNT__ 1
1457+
// CHECK_BDVER4_M32: #define __PRFCHW__ 1
1458+
// CHECK_BDVER4_M32: #define __SSE2_MATH__ 1
1459+
// CHECK_BDVER4_M32: #define __SSE2__ 1
1460+
// CHECK_BDVER4_M32: #define __SSE3__ 1
1461+
// CHECK_BDVER4_M32: #define __SSE4A__ 1
1462+
// CHECK_BDVER4_M32: #define __SSE4_1__ 1
1463+
// CHECK_BDVER4_M32: #define __SSE4_2__ 1
1464+
// CHECK_BDVER4_M32: #define __SSE_MATH__ 1
1465+
// CHECK_BDVER4_M32: #define __SSE__ 1
1466+
// CHECK_BDVER4_M32: #define __SSSE3__ 1
1467+
// CHECK_BDVER4_M32: #define __TBM__ 1
1468+
// CHECK_BDVER4_M32: #define __XOP__ 1
1469+
// CHECK_BDVER4_M32: #define __bdver4 1
1470+
// CHECK_BDVER4_M32: #define __bdver4__ 1
1471+
// CHECK_BDVER4_M32: #define __i386 1
1472+
// CHECK_BDVER4_M32: #define __i386__ 1
1473+
// CHECK_BDVER4_M32: #define __tune_bdver4__ 1
1474+
// RUN: %clang -march=bdver4 -m64 -E -dM %s -o - 2>&1 \
1475+
// RUN: -target i386-unknown-linux \
1476+
// RUN: | FileCheck %s -check-prefix=CHECK_BDVER4_M64
1477+
// CHECK_BDVER4_M64-NOT: #define __3dNOW_A__ 1
1478+
// CHECK_BDVER4_M64-NOT: #define __3dNOW__ 1
1479+
// CHECK_BDVER4_M64: #define __AES__ 1
1480+
// CHECK_BDVER4_M64: #define __AVX2__ 1
1481+
// CHECK_BDVER4_M64: #define __AVX__ 1
1482+
// CHECK_BDVER4_M64: #define __BMI2__ 1
1483+
// CHECK_BDVER4_M64: #define __BMI__ 1
1484+
// CHECK_BDVER4_M64: #define __F16C__ 1
1485+
// CHECK_BDVER4_M64: #define __FMA4__ 1
1486+
// CHECK_BDVER4_M64: #define __FMA__ 1
1487+
// CHECK_BDVER4_M64: #define __LZCNT__ 1
1488+
// CHECK_BDVER4_M64: #define __MMX__ 1
1489+
// CHECK_BDVER4_M64: #define __PCLMUL__ 1
1490+
// CHECK_BDVER4_M64: #define __POPCNT__ 1
1491+
// CHECK_BDVER4_M64: #define __PRFCHW__ 1
1492+
// CHECK_BDVER4_M64: #define __SSE2_MATH__ 1
1493+
// CHECK_BDVER4_M64: #define __SSE2__ 1
1494+
// CHECK_BDVER4_M64: #define __SSE3__ 1
1495+
// CHECK_BDVER4_M64: #define __SSE4A__ 1
1496+
// CHECK_BDVER4_M64: #define __SSE4_1__ 1
1497+
// CHECK_BDVER4_M64: #define __SSE4_2__ 1
1498+
// CHECK_BDVER4_M64: #define __SSE_MATH__ 1
1499+
// CHECK_BDVER4_M64: #define __SSE__ 1
1500+
// CHECK_BDVER4_M64: #define __SSSE3__ 1
1501+
// CHECK_BDVER4_M64: #define __TBM__ 1
1502+
// CHECK_BDVER4_M64: #define __XOP__ 1
1503+
// CHECK_BDVER4_M64: #define __amd64 1
1504+
// CHECK_BDVER4_M64: #define __amd64__ 1
1505+
// CHECK_BDVER4_M64: #define __bdver4 1
1506+
// CHECK_BDVER4_M64: #define __bdver4__ 1
1507+
// CHECK_BDVER4_M64: #define __tune_bdver4__ 1
1508+
// CHECK_BDVER4_M64: #define __x86_64 1
1509+
// CHECK_BDVER4_M64: #define __x86_64__ 1
14401510
//
14411511
// End X86/GCC/Linux tests ------------------
14421512

0 commit comments

Comments
 (0)