Skip to content

Commit cef838e

Browse files
committed
Revert "[RISCV] Support ABI checking with per function target-features"
This reverts commit 7bc58a7. It breaks EXPENSIVE_CHECKS on Windows
1 parent 6c26d89 commit cef838e

File tree

4 files changed

+13
-35
lines changed

4 files changed

+13
-35
lines changed

llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -194,18 +194,6 @@ class RISCVAsmParser : public MCTargetAsmParser {
194194
Parser.addAliasForDirective(".word", ".4byte");
195195
Parser.addAliasForDirective(".dword", ".8byte");
196196
setAvailableFeatures(ComputeAvailableFeatures(STI.getFeatureBits()));
197-
198-
if (Options.ABIName.back() == 'f' &&
199-
!getSTI().getFeatureBits()[RISCV::FeatureStdExtF]) {
200-
errs() << "Hard-float 'f' ABI can't be used for a target that "
201-
"doesn't support the F instruction set extension (ignoring "
202-
"target-abi)\n";
203-
} else if (Options.ABIName.back() == 'd' &&
204-
!getSTI().getFeatureBits()[RISCV::FeatureStdExtD]) {
205-
errs() << "Hard-float 'd' ABI can't be used for a target that "
206-
"doesn't support the D instruction set extension (ignoring "
207-
"target-abi)\n";
208-
}
209197
}
210198
};
211199

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,6 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
5151
RISCVABI::ABI ABI = Subtarget.getTargetABI();
5252
assert(ABI != RISCVABI::ABI_Unknown && "Improperly initialised target ABI");
5353

54-
if ((ABI == RISCVABI::ABI_ILP32F || ABI == RISCVABI::ABI_LP64F) &&
55-
!Subtarget.hasStdExtF()) {
56-
errs() << "Hard-float 'f' ABI can't be used for a target that "
57-
"doesn't support the F instruction set extension (ignoring "
58-
"target-abi)\n";
59-
ABI = Subtarget.is64Bit() ? RISCVABI::ABI_LP64 : RISCVABI::ABI_ILP32;
60-
} else if ((ABI == RISCVABI::ABI_ILP32D || ABI == RISCVABI::ABI_LP64D) &&
61-
!Subtarget.hasStdExtD()) {
62-
errs() << "Hard-float 'd' ABI can't be used for a target that "
63-
"doesn't support the D instruction set extension (ignoring "
64-
"target-abi)\n";
65-
ABI = Subtarget.is64Bit() ? RISCVABI::ABI_LP64 : RISCVABI::ABI_ILP32;
66-
}
67-
6854
switch (ABI) {
6955
default:
7056
report_fatal_error("Don't know how to lower this ABI");

llvm/lib/Target/RISCV/Utils/RISCVBaseInfo.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,17 @@ ABI computeTargetABI(const Triple &TT, FeatureBitset FeatureBits,
3737
errs() << "64-bit ABIs are not supported for 32-bit targets (ignoring "
3838
"target-abi)\n";
3939
TargetABI = ABI_Unknown;
40+
} else if (ABIName.endswith("f") && !FeatureBits[RISCV::FeatureStdExtF]) {
41+
errs() << "Hard-float 'f' ABI can't be used for a target that "
42+
"doesn't support the F instruction set extension (ignoring "
43+
"target-abi)\n";
44+
TargetABI = ABI_Unknown;
45+
} else if (ABIName.endswith("d") && !FeatureBits[RISCV::FeatureStdExtD]) {
46+
errs() << "Hard-float 'd' ABI can't be used for a target that "
47+
"doesn't support the D instruction set extension (ignoring "
48+
"target-abi)\n";
49+
TargetABI = ABI_Unknown;
4050
} else if (IsRV32E && TargetABI != ABI_ILP32E && TargetABI != ABI_Unknown) {
41-
// TODO: move this checking to RISCVTargetLowering and RISCVAsmParser
4251
errs()
4352
<< "Only the ilp32e ABI is supported for RV32E (ignoring target-abi)\n";
4453
TargetABI = ABI_Unknown;

llvm/test/CodeGen/RISCV/subtarget-features-std-ext.ll

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,12 @@
22
; RUN: | FileCheck -check-prefix=RV32IF-ILP32 %s
33
; RUN: llc -mtriple=riscv32 -target-abi ilp32f < %s 2>&1 \
44
; RUN: | FileCheck -check-prefix=RV32IF-ILP32F %s
5-
; RUN: llc -mtriple=riscv32 -mattr=-f -target-abi ilp32f <%s 2>&1 \
6-
; RUN: | FileCheck -check-prefix=RV32I-ILP32F-FAILED %s
7-
8-
; RV32I-ILP32F-FAILED: Hard-float 'f' ABI can't be used for a target that doesn't support the F instruction set extension
95

6+
; RV32IF-ILP32F: Hard-float 'f' ABI can't be used for a target that doesn't support the F instruction set extension (ignoring target-abi)
107

118
define float @foo(i32 %a) nounwind #0 {
12-
; RV32IF-ILP32: fcvt.s.w ft0, a0
13-
; RV32IF-ILP32-NEXT: fmv.x.w a0, ft0
14-
; RV32IF-ILP32F: fcvt.s.w fa0, a0
15-
; RV32IF-ILP32F-NEXT: ret
9+
; RV32IF-ILP32: # %bb.0:
10+
; RV32IF-ILP32-NEXT: fcvt.s.w ft0, a0
1611
%conv = sitofp i32 %a to float
1712
ret float %conv
1813
}

0 commit comments

Comments
 (0)