| From c348abce68ac422bf3842de3943ca7463e3a814f Mon Sep 17 00:00:00 2001 |
| From: Fangrui Song <i@maskray.me> |
| Date: Thu, 22 Dec 2022 11:48:55 -0800 |
| Subject: [PATCH] Revert D138179 "MIPS: fix build from IR files, nan2008 and |
| FpAbi" |
| |
| This reverts commit 9739bb81aed490bfcbcbbac6970da8fb7232fd34. |
| It causes `.module is not permitted after generating code` |
| for Linux kernel's `ARCH=mips 32r1_defconfig` clang+GNU as build. |
| It's confirmed as a defect, but the proper fix needs time to sort out. |
| --- |
| clang/lib/Driver/ToolChains/Arch/Mips.cpp | 5 +++++ |
| clang/test/Driver/mips-as.c | 10 +++++----- |
| clang/test/Driver/mips-integrated-as.s | 6 +++--- |
| llvm/lib/Target/Mips/MipsAsmPrinter.cpp | 8 -------- |
| llvm/test/CodeGen/Mips/abiflags-2008-fp64.ll | 13 ------------- |
| 5 files changed, 13 insertions(+), 29 deletions(-) |
| delete mode 100644 llvm/test/CodeGen/Mips/abiflags-2008-fp64.ll |
| |
| diff --git a/clang/lib/Driver/ToolChains/Arch/Mips.cpp b/clang/lib/Driver/ToolChains/Arch/Mips.cpp |
| index 7da00a885400..088eecf79adb 100644 |
| --- a/clang/lib/Driver/ToolChains/Arch/Mips.cpp |
| +++ b/clang/lib/Driver/ToolChains/Arch/Mips.cpp |
| @@ -467,6 +467,11 @@ bool mips::isFP64ADefault(const llvm::Triple &Triple, StringRef CPUName) { |
| |
| bool mips::isFPXXDefault(const llvm::Triple &Triple, StringRef CPUName, |
| StringRef ABIName, mips::FloatABI FloatABI) { |
| + if (Triple.getVendor() != llvm::Triple::ImaginationTechnologies && |
| + Triple.getVendor() != llvm::Triple::MipsTechnologies && |
| + !Triple.isAndroid()) |
| + return false; |
| + |
| if (ABIName != "32") |
| return false; |
| |
| diff --git a/clang/test/Driver/mips-as.c b/clang/test/Driver/mips-as.c |
| index 14fbb18c9350..f4add636e9e8 100644 |
| --- a/clang/test/Driver/mips-as.c |
| +++ b/clang/test/Driver/mips-as.c |
| @@ -196,7 +196,7 @@ |
| // RUN: %clang -target mips-linux-gnu -mno-mips16 -mips16 -### \ |
| // RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ |
| // RUN: | FileCheck -check-prefix=MIPS-16 %s |
| -// MIPS-16: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" "-mfpxx" "-mips16" |
| +// MIPS-16: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" "-mips16" |
| // |
| // RUN: %clang -target mips-linux-gnu -mips16 -mno-mips16 -### \ |
| // RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ |
| @@ -207,7 +207,7 @@ |
| // RUN: %clang -target mips-linux-gnu -mno-micromips -mmicromips -### \ |
| // RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ |
| // RUN: | FileCheck -check-prefix=MIPS-MICRO %s |
| -// MIPS-MICRO: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" "-mfpxx" "-mmicromips" |
| +// MIPS-MICRO: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" "-mmicromips" |
| // |
| // RUN: %clang -target mips-linux-gnu -mmicromips -mno-micromips -### \ |
| // RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ |
| @@ -218,7 +218,7 @@ |
| // RUN: %clang -target mips-linux-gnu -mno-dsp -mdsp -### \ |
| // RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ |
| // RUN: | FileCheck -check-prefix=MIPS-DSP %s |
| -// MIPS-DSP: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" "-mfpxx" "-mdsp" |
| +// MIPS-DSP: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" "-mdsp" |
| // |
| // RUN: %clang -target mips-linux-gnu -mdsp -mno-dsp -### \ |
| // RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ |
| @@ -229,7 +229,7 @@ |
| // RUN: %clang -target mips-linux-gnu -mno-dspr2 -mdspr2 -### \ |
| // RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ |
| // RUN: | FileCheck -check-prefix=MIPS-DSPR2 %s |
| -// MIPS-DSPR2: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" "-mfpxx" "-mdspr2" |
| +// MIPS-DSPR2: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" "-mdspr2" |
| // |
| // RUN: %clang -target mips-linux-gnu -mdspr2 -mno-dspr2 -### \ |
| // RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ |
| @@ -266,7 +266,7 @@ |
| // RUN: %clang -target mips-linux-gnu -mno-msa -mmsa -### \ |
| // RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ |
| // RUN: | FileCheck -check-prefix=MIPS-MSA %s |
| -// MIPS-MSA: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" "-mfpxx" "-mmsa" |
| +// MIPS-MSA: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" "-mmsa" |
| // |
| // RUN: %clang -target mips-linux-gnu -mmsa -mno-msa -### \ |
| // RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ |
| diff --git a/clang/test/Driver/mips-integrated-as.s b/clang/test/Driver/mips-integrated-as.s |
| index e248ba7f77e9..46ce5b6871f4 100644 |
| --- a/clang/test/Driver/mips-integrated-as.s |
| +++ b/clang/test/Driver/mips-integrated-as.s |
| @@ -160,8 +160,8 @@ |
| // RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ |
| // RUN: FileCheck -check-prefix=FPXX-DEFAULT %s |
| // FPXX-DEFAULT: -cc1as |
| -// FPXX-DEFAULT: "-target-feature" "+fpxx" |
| -// FPXX-DEFAULT: "-target-feature" "+nooddspreg" |
| +// FPXX-DEFAULT-NOT: "-target-feature" "+fpxx" |
| +// FPXX-DEFAULT-NOT: "-target-feature" "+nooddspreg" |
| |
| // RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mfp32 2>&1 | \ |
| // RUN: FileCheck -check-prefix=FP32 %s |
| @@ -182,7 +182,7 @@ |
| // RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ |
| // RUN: FileCheck -check-prefix=ODDSPREG-DEFAULT %s |
| // ODDSPREG-DEFAULT: -cc1as |
| -// ODDSPREG-DEFAULT: "-target-feature" "+nooddspreg" |
| +// ODDSPREG-DEFAULT-NOT: "-target-feature" "{{[+-]}}nooddspreg" |
| |
| // RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -modd-spreg 2>&1 | \ |
| // RUN: FileCheck -check-prefix=ODDSPREG-ON %s |
| diff --git a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp |
| index a1be44851ba8..dd0b384ff53d 100644 |
| --- a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp |
| +++ b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp |
| @@ -399,14 +399,6 @@ const char *MipsAsmPrinter::getCurrentABIString() const { |
| |
| void MipsAsmPrinter::emitFunctionEntryLabel() { |
| MipsTargetStreamer &TS = getTargetStreamer(); |
| - bool IsO32 = (static_cast<const MipsTargetMachine &>(TM)).getABI().IsO32(); |
| - |
| - TS.updateABIInfo(*Subtarget); |
| - if (Subtarget->isNaN2008()) |
| - TS.emitDirectiveNaN2008(); |
| - if ((IsO32 && (Subtarget->isABI_FPXX() || Subtarget->isFP64bit())) || |
| - Subtarget->useSoftFloat()) |
| - TS.emitDirectiveModuleFP(); |
| |
| // NaCl sandboxing requires that indirect call instructions are masked. |
| // This means that function entry points should be bundle-aligned. |
| diff --git a/llvm/test/CodeGen/Mips/abiflags-2008-fp64.ll b/llvm/test/CodeGen/Mips/abiflags-2008-fp64.ll |
| deleted file mode 100644 |
| index f05fc67e0b0f..000000000000 |
| --- a/llvm/test/CodeGen/Mips/abiflags-2008-fp64.ll |
| +++ /dev/null |
| @@ -1,13 +0,0 @@ |
| -; RUN: llc %s -o - | FileCheck %s |
| - |
| -target triple = "mipsel-unknown-linux-gnu" |
| - |
| -define dso_local void @test() #0 { |
| - ret void |
| -} |
| - |
| -attributes #0 = { "target-cpu"="mips32r2" "target-features"="+fp64,+mips32r2,+nan2008" } |
| - |
| - |
| -; CHECK: .nan 2008 |
| -; CHECK: .module fp=64 |
| -- |
| 2.40.0.348.gf938b09366-goog |
| |