Skip to content

Commit 1ee8fe8

Browse files
authored
[Mips] Fix clang compile error when -march=p5600 with -mmsa (#132679)
When -march=p5600 with -mmsa, the result of getISARev is 0, so report error. Append p5600 to cases mips32r5. Fix #91948.
1 parent 17ac7e0 commit 1ee8fe8

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

clang/lib/Basic/Targets/Mips.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ void MipsTargetInfo::fillValidCPUList(
6969

7070
unsigned MipsTargetInfo::getISARev() const {
7171
return llvm::StringSwitch<unsigned>(getCPU())
72-
.Cases("mips32", "mips64", 1)
73-
.Cases("mips32r2", "mips64r2", "octeon", "octeon+", 2)
74-
.Cases("mips32r3", "mips64r3", 3)
75-
.Cases("mips32r5", "mips64r5", 5)
76-
.Cases("mips32r6", "mips64r6", 6)
77-
.Default(0);
72+
.Cases("mips32", "mips64", 1)
73+
.Cases("mips32r2", "mips64r2", "octeon", "octeon+", 2)
74+
.Cases("mips32r3", "mips64r3", 3)
75+
.Cases("mips32r5", "mips64r5", "p5600", 5)
76+
.Cases("mips32r6", "mips64r6", 6)
77+
.Default(0);
7878
}
7979

8080
void MipsTargetInfo::getTargetDefines(const LangOptions &Opts,

clang/test/Driver/mips-abi.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,20 @@
115115
// MIPS-ARCH-P5600: "-target-cpu" "p5600"
116116
// MIPS-ARCH-P5600: "-target-abi" "o32"
117117
//
118+
// RUN: %clang --target=mips-linux-gnu -### -c %s \
119+
// RUN: -march=p5600 -mmsa -mnan=2008 2>&1 \
120+
// RUN: | FileCheck -check-prefix=MIPS-ARCH-P5600-MSA %s
121+
// MIPS-ARCH-P5600-MSA: "-target-cpu" "p5600"
122+
// MIPS-ARCH-P5600-MSA: "-target-feature" "+msa"
123+
// MIPS-ARCH-P5600-MSA: "-target-feature" "+fp64"
124+
//
125+
// RUN: %clang --target=mips-linux-gnu -### -c %s \
126+
// RUN: -march=p5600 -mmsa -mnan=2008 2>&1 \
127+
// RUN: | FileCheck -check-prefix=MIPS-ARCH-P5600-NAN2008 %s
128+
// MIPS-ARCH-P5600-NAN2008: "-target-cpu" "p5600"
129+
// MIPS-ARCH-P5600-NAN2008: "-target-feature" "+nan2008"
130+
// MIPS-ARCH-P5600-NAN2008: "-target-feature" "+abs2008"
131+
//
118132
// RUN: not %clang --target=mips-linux-gnu -c %s \
119133
// RUN: -march=p5600 -mabi=64 2>&1 \
120134
// RUN: | FileCheck -check-prefix=MIPS-ARCH-P5600-N64 %s

0 commit comments

Comments
 (0)