Skip to content

Commit 3552d3e

Browse files
committed
[mips] Add octeon+ to the list of CPUs accepted by the driver
1 parent bf996f7 commit 3552d3e

File tree

6 files changed

+23
-3
lines changed

6 files changed

+23
-3
lines changed

clang/lib/Basic/Targets/Mips.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ bool MipsTargetInfo::processorSupportsGPR64() const {
3939
.Case("mips64r5", true)
4040
.Case("mips64r6", true)
4141
.Case("octeon", true)
42+
.Case("octeon+", true)
4243
.Default(false);
4344
return false;
4445
}
@@ -47,7 +48,7 @@ static constexpr llvm::StringLiteral ValidCPUNames[] = {
4748
{"mips1"}, {"mips2"}, {"mips3"}, {"mips4"}, {"mips5"},
4849
{"mips32"}, {"mips32r2"}, {"mips32r3"}, {"mips32r5"}, {"mips32r6"},
4950
{"mips64"}, {"mips64r2"}, {"mips64r3"}, {"mips64r5"}, {"mips64r6"},
50-
{"octeon"}, {"p5600"}};
51+
{"octeon"}, {"octeon+"}, {"p5600"}};
5152

5253
bool MipsTargetInfo::isValidCPUName(StringRef Name) const {
5354
return llvm::find(ValidCPUNames, Name) != std::end(ValidCPUNames);

clang/lib/Basic/Targets/Mips.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ class LLVM_LIBRARY_VISIBILITY MipsTargetInfo : public TargetInfo {
180180
CPU = getCPU();
181181
if (CPU == "octeon")
182182
Features["mips64r2"] = Features["cnmips"] = true;
183+
else if (CPU == "octeon+")
184+
Features["mips64r2"] = Features["cnmips"] = Features["cnmipsp"] = true;
183185
else
184186
Features[CPU] = true;
185187
return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec);

clang/lib/Driver/ToolChains/Gnu.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1393,7 +1393,8 @@ bool clang::driver::findMIPSMultilibs(const Driver &D,
13931393
addMultilibFlag(CPUName == "mips32r6", "march=mips32r6", Flags);
13941394
addMultilibFlag(CPUName == "mips64", "march=mips64", Flags);
13951395
addMultilibFlag(CPUName == "mips64r2" || CPUName == "mips64r3" ||
1396-
CPUName == "mips64r5" || CPUName == "octeon",
1396+
CPUName == "mips64r5" || CPUName == "octeon" ||
1397+
CPUName == "octeon+",
13971398
"march=mips64r2", Flags);
13981399
addMultilibFlag(CPUName == "mips64r6", "march=mips64r6", Flags);
13991400
addMultilibFlag(isMicroMips(Args), "mmicromips", Flags);

clang/test/Driver/mips-abi.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@
153153
// MIPS-ARCH-OCTEON: "-target-cpu" "octeon"
154154
// MIPS-ARCH-OCTEON: "-target-abi" "n64"
155155
//
156+
// RUN: %clang -target mips64-linux-gnu -### -c %s \
157+
// RUN: -march=octeon+ 2>&1 \
158+
// RUN: | FileCheck -check-prefix=MIPS-ARCH-OCTEONP %s
159+
// MIPS-ARCH-OCTEONP: "-target-cpu" "octeon+"
160+
// MIPS-ARCH-OCTEONP: "-target-abi" "n64"
161+
//
156162
// RUN: not %clang -target mips64-linux-gnu -c %s \
157163
// RUN: -march=mips32 2>&1 \
158164
// RUN: | FileCheck -check-prefix=MIPS-ARCH-6432 %s

clang/test/Driver/mips-as.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@
8888
// RUN: | FileCheck -check-prefix=MIPS-OCTEON %s
8989
// MIPS-OCTEON: as{{(.exe)?}}" "-march" "octeon" "-mabi" "64" "-mno-shared" "-EB"
9090
//
91+
// RUN: %clang -target mips64-linux-gnu -march=octeon+ -### \
92+
// RUN: -no-integrated-as -c %s 2>&1 \
93+
// RUN: | FileCheck -check-prefix=MIPS-OCTEONP-PIC %s
94+
// MIPS-OCTEONP-PIC: as{{(.exe)?}}" "-march" "octeon+" "-mabi" "64" "-EB" "-KPIC"
95+
//
96+
// RUN: %clang -target mips64-linux-gnu -march=octeon+ -### \
97+
// RUN: -no-integrated-as -c %s -fno-pic -mno-abicalls 2>&1 \
98+
// RUN: | FileCheck -check-prefix=MIPS-OCTEONP %s
99+
// MIPS-OCTEONP: as{{(.exe)?}}" "-march" "octeon+" "-mabi" "64" "-mno-shared" "-EB"
100+
//
91101
// RUN: %clang -target mips-linux-gnu -mips1 -### \
92102
// RUN: -no-integrated-as -c %s 2>&1 \
93103
// RUN: | FileCheck -check-prefix=MIPS-ALIAS-1 %s

clang/test/Misc/target-invalid-cpu-note.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
// MIPS: error: unknown target CPU 'not-a-cpu'
8989
// MIPS: note: valid target CPU values are: mips1, mips2, mips3, mips4, mips5,
9090
// MIPS-SAME: mips32, mips32r2, mips32r3, mips32r5, mips32r6, mips64, mips64r2,
91-
// MIPS-SAME: mips64r3, mips64r5, mips64r6, octeon, p5600
91+
// MIPS-SAME: mips64r3, mips64r5, mips64r6, octeon, octeon+, p5600
9292

9393
// RUN: not %clang_cc1 -triple lanai--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix LANAI
9494
// LANAI: error: unknown target CPU 'not-a-cpu'

0 commit comments

Comments
 (0)