https://github.com/yingopq updated 
https://github.com/llvm/llvm-project/pull/132679

>From 57facf0cf984b68d5c186aebe31a859827a2a3e3 Mon Sep 17 00:00:00 2001
From: Ying Huang <ying.hu...@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.

Fix #91948.
---
 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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to