Skip to content

Commit eac1c2e

Browse files
author
git apple-llvm automerger
committed
Merge commit 'bde97f2cefba' from llvm.org/release/21.x into stable/21.x
2 parents 1e62149 + bde97f2 commit eac1c2e

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

llvm/lib/Target/Mips/MipsAsmPrinter.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -747,14 +747,18 @@ void MipsAsmPrinter::emitStartOfAsmFile(Module &M) {
747747
if (FS.empty() && M.size() && F->hasFnAttribute("target-features"))
748748
FS = F->getFnAttribute("target-features").getValueAsString();
749749

750+
std::string strFS = FS.str();
751+
if (M.size() && F->getFnAttribute("use-soft-float").getValueAsBool())
752+
strFS += strFS.empty() ? "+soft-float" : ",+soft-float";
753+
750754
// Compute MIPS architecture attributes based on the default subtarget
751755
// that we'd have constructed.
752756
// FIXME: For ifunc related functions we could iterate over and look
753757
// for a feature string that doesn't match the default one.
754758
StringRef CPU = MIPS_MC::selectMipsCPU(TT, TM.getTargetCPU());
755759
const MipsTargetMachine &MTM = static_cast<const MipsTargetMachine &>(TM);
756-
const MipsSubtarget STI(TT, CPU, FS, MTM.isLittleEndian(), MTM,
757-
std::nullopt);
760+
const MipsSubtarget STI(TT, CPU, StringRef(strFS), MTM.isLittleEndian(),
761+
MTM, std::nullopt);
758762

759763
bool IsABICalls = STI.isABICalls();
760764
const MipsABIInfo &ABI = MTM.getABI();
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
; RUN: llc -filetype=obj -mtriple mipsel-unknown-linux -mcpu=mips32 %s -o tmp.o
2+
; RUN: llvm-readobj -A tmp.o | FileCheck %s -check-prefix=OBJ
3+
; RUN: llc -filetype=asm -mtriple mipsel-unknown-linux -mcpu=mips32 %s -o - | \
4+
; RUN: FileCheck %s -check-prefix=ASM
5+
6+
; OBJ: FP ABI: Soft float
7+
; ASM: .module softfloat
8+
9+
define dso_local void @asm_is_null() "use-soft-float"="true" {
10+
call void asm sideeffect "", ""()
11+
ret void
12+
}

0 commit comments

Comments
 (0)