https://github.com/wzssyqa created https://github.com/llvm/llvm-project/pull/92728
Commit: d59bc6b5c75384aa0b1e78cc85e17e8acaccebaf Clang/MIPS: Add +fp64 if MSA and no explicit -mfp option (#91949) added +fp64 for `clang`, while not for `clang -cc1`. So clang -cc1 -triple=mips -target-feature +msa -S will emit an asm source file without ".module fp=64". >From accab3329aa20c80ac4bf360b97c6949cfd82989 Mon Sep 17 00:00:00 2001 From: YunQiang Su <s...@gcc.gnu.org> Date: Mon, 20 May 2024 17:21:01 +0800 Subject: [PATCH] MIPS/Clang: handleTargetFeatures, add +fp64 if +msa and no other +-fp Commit: d59bc6b5c75384aa0b1e78cc85e17e8acaccebaf Clang/MIPS: Add +fp64 if MSA and no explicit -mfp option (#91949) added +fp64 for `clang`, while not for `clang -cc1`. So clang -cc1 -triple=mips -target-feature +msa -S will emit an asm source file without ".module fp=64". --- clang/lib/Basic/Targets/Mips.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/clang/lib/Basic/Targets/Mips.h b/clang/lib/Basic/Targets/Mips.h index f76c6ece8bf48..b6f110249fa78 100644 --- a/clang/lib/Basic/Targets/Mips.h +++ b/clang/lib/Basic/Targets/Mips.h @@ -324,6 +324,7 @@ class LLVM_LIBRARY_VISIBILITY MipsTargetInfo : public TargetInfo { FPMode = getDefaultFPMode(); bool OddSpregGiven = false; bool StrictAlign = false; + bool FpGiven = false; for (const auto &Feature : Features) { if (Feature == "+single-float") @@ -348,13 +349,16 @@ class LLVM_LIBRARY_VISIBILITY MipsTargetInfo : public TargetInfo { HasMSA = true; else if (Feature == "+nomadd4") DisableMadd4 = true; - else if (Feature == "+fp64") + else if (Feature == "+fp64") { FPMode = FP64; - else if (Feature == "-fp64") + FpGiven = true; + } else if (Feature == "-fp64") { FPMode = FP32; - else if (Feature == "+fpxx") + FpGiven = true; + } else if (Feature == "+fpxx") { FPMode = FPXX; - else if (Feature == "+nan2008") + FpGiven = true; + } else if (Feature == "+nan2008") IsNan2008 = true; else if (Feature == "-nan2008") IsNan2008 = false; @@ -381,6 +385,11 @@ class LLVM_LIBRARY_VISIBILITY MipsTargetInfo : public TargetInfo { if (StrictAlign) HasUnalignedAccess = false; + if (HasMSA && !FpGiven) { + FPMode = FP64; + Features.push_back("+fp64"); + } + setDataLayout(); return true; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits