-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Mips] Fix clang compile error when -march=p5600 with -mmsa #132679
base: main
Are you sure you want to change the base?
Conversation
@llvm/pr-subscribers-clang Author: None (yingopq) ChangesWhen -march=p5600 with -mmsa, the result of getISARev is 0, so report error. Append p5600 to cases mips32r5. Full diff: https://github.com/llvm/llvm-project/pull/132679.diff 2 Files Affected:
diff --git a/clang/lib/Basic/Targets/Mips.cpp b/clang/lib/Basic/Targets/Mips.cpp
index 08f9e3c29d1ed..193a2035873ae 100644
--- a/clang/lib/Basic/Targets/Mips.cpp
+++ b/clang/lib/Basic/Targets/Mips.cpp
@@ -72,7 +72,7 @@ unsigned MipsTargetInfo::getISARev() const {
.Cases("mips32", "mips64", 1)
.Cases("mips32r2", "mips64r2", "octeon", "octeon+", 2)
.Cases("mips32r3", "mips64r3", 3)
- .Cases("mips32r5", "mips64r5", 5)
+ .Cases("mips32r5", "mips64r5", "p5600", 5)
.Cases("mips32r6", "mips64r6", 6)
.Default(0);
}
diff --git a/clang/test/Driver/mips-abi.c b/clang/test/Driver/mips-abi.c
index f131a07888dba..14eb890c74bc0 100644
--- a/clang/test/Driver/mips-abi.c
+++ b/clang/test/Driver/mips-abi.c
@@ -115,6 +115,20 @@
// MIPS-ARCH-P5600: "-target-cpu" "p5600"
// MIPS-ARCH-P5600: "-target-abi" "o32"
//
+// RUN: %clang --target=mips-linux-gnu -### -c %s \
+// RUN: -march=p5600 -mmsa -mnan=2008 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-ARCH-P5600-MSA %s
+// MIPS-ARCH-P5600-MSA: "-target-cpu" "p5600"
+// MIPS-ARCH-P5600-MSA: "-target-feature" "+msa"
+// MIPS-ARCH-P5600-MSA: "-target-feature" "+fp64"
+//
+// RUN: %clang --target=mips-linux-gnu -### -c %s \
+// RUN: -march=p5600 -mmsa -mnan=2008 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-ARCH-P5600-NAN2008 %s
+// MIPS-ARCH-P5600-NAN2008: "-target-cpu" "p5600"
+// MIPS-ARCH-P5600-NAN2008: "-target-feature" "+nan2008"
+// MIPS-ARCH-P5600-NAN2008: "-target-feature" "+abs2008"
+//
// RUN: not %clang --target=mips-linux-gnu -c %s \
// RUN: -march=p5600 -mabi=64 2>&1 \
// RUN: | FileCheck -check-prefix=MIPS-ARCH-P5600-N64 %s
|
@llvm/pr-subscribers-clang-driver Author: None (yingopq) ChangesWhen -march=p5600 with -mmsa, the result of getISARev is 0, so report error. Append p5600 to cases mips32r5. Full diff: https://github.com/llvm/llvm-project/pull/132679.diff 2 Files Affected:
diff --git a/clang/lib/Basic/Targets/Mips.cpp b/clang/lib/Basic/Targets/Mips.cpp
index 08f9e3c29d1ed..193a2035873ae 100644
--- a/clang/lib/Basic/Targets/Mips.cpp
+++ b/clang/lib/Basic/Targets/Mips.cpp
@@ -72,7 +72,7 @@ unsigned MipsTargetInfo::getISARev() const {
.Cases("mips32", "mips64", 1)
.Cases("mips32r2", "mips64r2", "octeon", "octeon+", 2)
.Cases("mips32r3", "mips64r3", 3)
- .Cases("mips32r5", "mips64r5", 5)
+ .Cases("mips32r5", "mips64r5", "p5600", 5)
.Cases("mips32r6", "mips64r6", 6)
.Default(0);
}
diff --git a/clang/test/Driver/mips-abi.c b/clang/test/Driver/mips-abi.c
index f131a07888dba..14eb890c74bc0 100644
--- a/clang/test/Driver/mips-abi.c
+++ b/clang/test/Driver/mips-abi.c
@@ -115,6 +115,20 @@
// MIPS-ARCH-P5600: "-target-cpu" "p5600"
// MIPS-ARCH-P5600: "-target-abi" "o32"
//
+// RUN: %clang --target=mips-linux-gnu -### -c %s \
+// RUN: -march=p5600 -mmsa -mnan=2008 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-ARCH-P5600-MSA %s
+// MIPS-ARCH-P5600-MSA: "-target-cpu" "p5600"
+// MIPS-ARCH-P5600-MSA: "-target-feature" "+msa"
+// MIPS-ARCH-P5600-MSA: "-target-feature" "+fp64"
+//
+// RUN: %clang --target=mips-linux-gnu -### -c %s \
+// RUN: -march=p5600 -mmsa -mnan=2008 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-ARCH-P5600-NAN2008 %s
+// MIPS-ARCH-P5600-NAN2008: "-target-cpu" "p5600"
+// MIPS-ARCH-P5600-NAN2008: "-target-feature" "+nan2008"
+// MIPS-ARCH-P5600-NAN2008: "-target-feature" "+abs2008"
+//
// RUN: not %clang --target=mips-linux-gnu -c %s \
// RUN: -march=p5600 -mabi=64 2>&1 \
// RUN: | FileCheck -check-prefix=MIPS-ARCH-P5600-N64 %s
|
6f4c2dc
to
57facf0
Compare
✅ With the latest revision this PR passed the C/C++ code formatter. |
When -march=p5600 with -mmsa, the result of getISARev is 0, so report error. Append p5600 to cases mips32r5. Fix llvm#91948.
57facf0
to
1d02fed
Compare
When -march=p5600 with -mmsa, the result of getISARev is 0, so report error. Append p5600 to cases mips32r5.
Fix #91948.