[clang] [Mips] Fix clang compile error when -march=p5600 with -mmsa (PR #132679)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Mar 23 23:56:40 PDT 2025
https://github.com/yingopq created https://github.com/llvm/llvm-project/pull/132679
When -march=p5600 with -mmsa, the result of getISARev is 0, so report error. Append p5600 to cases mips32r5.
>From 6f4c2dc2b9815172023ac8bf80347bd293f0647d Mon Sep 17 00:00:00 2001
From: Ying Huang <ying.huang at oss.cipunited.com>
Date: Sun, 23 Mar 2025 23:26:08 -0400
Subject: [PATCH] [Mips] Fix clang compile error when -march=p5600 with -mmsa
When -march=p5600 with -mmsa, the result of getISARev is 0,
so report error. Append p5600 to cases mips32r5.
---
clang/lib/Basic/Targets/Mips.cpp | 2 +-
clang/test/Driver/mips-abi.c | 14 ++++++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
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
More information about the cfe-commits
mailing list