Skip to content

Commit 13bf442

Browse files
committed
Revert "[AArch64] Add soft-float ABI (#74460)"
This reverts commit 9cc98e3.
1 parent 6841395 commit 13bf442

17 files changed

+28
-406
lines changed

clang/include/clang/Basic/DiagnosticCommonKinds.td

-2
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,6 @@ def warn_target_unrecognized_env : Warning<
356356
def warn_knl_knm_isa_support_removed : Warning<
357357
"KNL, KNM related Intel Xeon Phi CPU's specific ISA's supports will be removed in LLVM 19.">,
358358
InGroup<DiagGroup<"knl-knm-isa-support-removed">>;
359-
def err_target_unsupported_abi_with_fpu : Error<
360-
"'%0' ABI is not supported with FPU">;
361359

362360
// Source manager
363361
def err_cannot_open_file : Error<"cannot open file '%0': %1">, DefaultFatal;

clang/include/clang/Basic/DiagnosticSemaKinds.td

-2
Original file line numberDiff line numberDiff line change
@@ -11314,8 +11314,6 @@ def err_omp_wrong_dependency_iterator_type : Error<
1131411314
def err_target_unsupported_type
1131511315
: Error<"%0 requires %select{|%2 bit size}1 %3 %select{|return }4type support,"
1131611316
" but target '%5' does not support it">;
11317-
def err_target_unsupported_type_for_abi
11318-
: Error<"%0 requires %1 type support, but ABI '%2' does not support it">;
1131911317
def err_omp_lambda_capture_in_declare_target_not_to : Error<
1132011318
"variable captured in declare target region must appear in a to clause">;
1132111319
def err_omp_device_type_mismatch : Error<

clang/include/clang/Basic/TargetInfo.h

-8
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ class TargetInfo : public TransferrableTargetInfo,
231231
bool HasIbm128;
232232
bool HasLongDouble;
233233
bool HasFPReturn;
234-
bool HasFPTypes;
235234
bool HasStrictFP;
236235

237236
unsigned char MaxAtomicPromoteWidth, MaxAtomicInlineWidth;
@@ -690,9 +689,6 @@ class TargetInfo : public TransferrableTargetInfo,
690689
/// on this target.
691690
virtual bool hasFPReturn() const { return HasFPReturn; }
692691

693-
/// Determine whether floating point types are supported for this target.
694-
virtual bool hasFPTypes() const { return HasFPTypes; }
695-
696692
/// Determine whether constrained floating point is supported on this target.
697693
virtual bool hasStrictFP() const { return HasStrictFP; }
698694

@@ -1335,10 +1331,6 @@ class TargetInfo : public TransferrableTargetInfo,
13351331
return false;
13361332
}
13371333

1338-
/// Make changes to the supported types which depend on both the target
1339-
/// features and ABI.
1340-
virtual void setSupportedArgTypes() {}
1341-
13421334
/// Use the specified unit for FP math.
13431335
///
13441336
/// \return False on error (invalid unit name).

clang/lib/Basic/TargetInfo.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ TargetInfo::TargetInfo(const llvm::Triple &T) : Triple(T) {
6767
HasFullBFloat16 = false;
6868
HasLongDouble = true;
6969
HasFPReturn = true;
70-
HasFPTypes = true;
7170
HasStrictFP = false;
7271
PointerWidth = PointerAlign = 32;
7372
BoolWidth = BoolAlign = 8;

clang/lib/Basic/Targets.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,6 @@ TargetInfo::CreateTargetInfo(DiagnosticsEngine &Diags,
830830
Target->setSupportedOpenCLOpts();
831831
Target->setCommandLineOpenCLOpts();
832832
Target->setMaxAtomicWidth();
833-
Target->setSupportedArgTypes();
834833

835834
if (!Opts->DarwinTargetVariantTriple.empty())
836835
Target->DarwinTargetVariantTriple =

clang/lib/Basic/Targets/AArch64.cpp

+2-23
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "AArch64.h"
14-
#include "clang/Basic/Diagnostic.h"
1514
#include "clang/Basic/LangOptions.h"
1615
#include "clang/Basic/TargetBuiltins.h"
1716
#include "clang/Basic/TargetInfo.h"
@@ -200,32 +199,13 @@ AArch64TargetInfo::AArch64TargetInfo(const llvm::Triple &Triple,
200199
StringRef AArch64TargetInfo::getABI() const { return ABI; }
201200

202201
bool AArch64TargetInfo::setABI(const std::string &Name) {
203-
if (Name != "aapcs" && Name != "aapcs-soft" && Name != "darwinpcs")
202+
if (Name != "aapcs" && Name != "darwinpcs")
204203
return false;
205204

206205
ABI = Name;
207206
return true;
208207
}
209208

210-
void AArch64TargetInfo::setSupportedArgTypes() {
211-
if (!(FPU & FPUMode) && ABI != "aapcs-soft") {
212-
// When a hard-float ABI is used on a target without an FPU, all
213-
// floating-point argument and return types are rejected because they must
214-
// be passed in FP registers.
215-
HasFPTypes = false;
216-
}
217-
}
218-
219-
bool AArch64TargetInfo::validateTarget(DiagnosticsEngine &Diags) const {
220-
if (hasFeature("fp") && ABI == "aapcs-soft") {
221-
// aapcs-soft is not allowed for targets with an FPU, to avoid there being
222-
// two incomatible ABIs.
223-
Diags.Report(diag::err_target_unsupported_abi_with_fpu) << ABI;
224-
return false;
225-
}
226-
return true;
227-
}
228-
229209
bool AArch64TargetInfo::validateBranchProtection(StringRef Spec, StringRef,
230210
BranchProtectionInfo &BPI,
231211
StringRef &Err) const {
@@ -706,8 +686,7 @@ bool AArch64TargetInfo::hasFeature(StringRef Feature) const {
706686
return llvm::StringSwitch<bool>(Feature)
707687
.Cases("aarch64", "arm64", "arm", true)
708688
.Case("fmv", HasFMV)
709-
.Case("fp", FPU & FPUMode)
710-
.Cases("neon", "simd", FPU & NeonMode)
689+
.Cases("neon", "fp", "simd", FPU & NeonMode)
711690
.Case("jscvt", HasJSCVT)
712691
.Case("fcma", HasFCMA)
713692
.Case("rng", HasRandGen)

clang/lib/Basic/Targets/AArch64.h

-3
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public TargetInfo {
9696

9797
StringRef getABI() const override;
9898
bool setABI(const std::string &Name) override;
99-
void setSupportedArgTypes() override;
10099

101100
bool validateBranchProtection(StringRef Spec, StringRef Arch,
102101
BranchProtectionInfo &BPI,
@@ -200,8 +199,6 @@ class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public TargetInfo {
200199
bool hasInt128Type() const override;
201200

202201
bool hasBitIntType() const override { return true; }
203-
204-
bool validateTarget(DiagnosticsEngine &Diags) const override;
205202
};
206203

207204
class LLVM_LIBRARY_VISIBILITY AArch64leTargetInfo : public AArch64TargetInfo {

clang/lib/CodeGen/CodeGenModule.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,6 @@ createTargetCodeGenInfo(CodeGenModule &CGM) {
145145
Kind = AArch64ABIKind::DarwinPCS;
146146
else if (Triple.isOSWindows())
147147
return createWindowsAArch64TargetCodeGenInfo(CGM, AArch64ABIKind::Win64);
148-
else if (Target.getABI() == "aapcs-soft")
149-
Kind = AArch64ABIKind::AAPCSSoft;
150148

151149
return createAArch64TargetCodeGenInfo(CGM, Kind);
152150
}

clang/lib/CodeGen/TargetInfo.h

-1
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,6 @@ enum class AArch64ABIKind {
416416
AAPCS = 0,
417417
DarwinPCS,
418418
Win64,
419-
AAPCSSoft,
420419
};
421420

422421
std::unique_ptr<TargetCodeGenInfo>

clang/lib/CodeGen/Targets/AArch64.cpp

+5-12
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ class AArch64ABIInfo : public ABIInfo {
5353
Address EmitDarwinVAArg(Address VAListAddr, QualType Ty,
5454
CodeGenFunction &CGF) const;
5555

56-
Address EmitAAPCSVAArg(Address VAListAddr, QualType Ty, CodeGenFunction &CGF,
57-
AArch64ABIKind Kind) const;
56+
Address EmitAAPCSVAArg(Address VAListAddr, QualType Ty,
57+
CodeGenFunction &CGF) const;
5858

5959
Address EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
6060
QualType Ty) const override {
@@ -65,7 +65,7 @@ class AArch64ABIInfo : public ABIInfo {
6565

6666
return Kind == AArch64ABIKind::Win64 ? EmitMSVAArg(CGF, VAListAddr, Ty)
6767
: isDarwinPCS() ? EmitDarwinVAArg(VAListAddr, Ty, CGF)
68-
: EmitAAPCSVAArg(VAListAddr, Ty, CGF, Kind);
68+
: EmitAAPCSVAArg(VAListAddr, Ty, CGF);
6969
}
7070

7171
Address EmitMSVAArg(CodeGenFunction &CGF, Address VAListAddr,
@@ -482,11 +482,6 @@ bool AArch64SwiftABIInfo::isLegalVectorType(CharUnits VectorSize,
482482
}
483483

484484
bool AArch64ABIInfo::isHomogeneousAggregateBaseType(QualType Ty) const {
485-
// For the soft-float ABI variant, no types are considered to be homogeneous
486-
// aggregates.
487-
if (Kind == AArch64ABIKind::AAPCSSoft)
488-
return false;
489-
490485
// Homogeneous aggregates for AAPCS64 must have base types of a floating
491486
// point type or a short-vector type. This is the same as the 32-bit ABI,
492487
// but with the difference that any floating-point type is allowed,
@@ -518,8 +513,7 @@ bool AArch64ABIInfo::isZeroLengthBitfieldPermittedInHomogeneousAggregate()
518513
}
519514

520515
Address AArch64ABIInfo::EmitAAPCSVAArg(Address VAListAddr, QualType Ty,
521-
CodeGenFunction &CGF,
522-
AArch64ABIKind Kind) const {
516+
CodeGenFunction &CGF) const {
523517
ABIArgInfo AI = classifyArgumentType(Ty, /*IsVariadic=*/true,
524518
CGF.CurFnInfo->getCallingConvention());
525519
// Empty records are ignored for parameter passing purposes.
@@ -544,8 +538,7 @@ Address AArch64ABIInfo::EmitAAPCSVAArg(Address VAListAddr, QualType Ty,
544538
BaseTy = ArrTy->getElementType();
545539
NumRegs = ArrTy->getNumElements();
546540
}
547-
bool IsFPR = Kind != AArch64ABIKind::AAPCSSoft &&
548-
(BaseTy->isFloatingPointTy() || BaseTy->isVectorTy());
541+
bool IsFPR = BaseTy->isFloatingPointTy() || BaseTy->isVectorTy();
549542

550543
// The AArch64 va_list type and handling is specified in the Procedure Call
551544
// Standard, section B.4:

clang/lib/Sema/Sema.cpp

-34
Original file line numberDiff line numberDiff line change
@@ -1944,21 +1944,6 @@ Sema::SemaDiagnosticBuilder Sema::Diag(SourceLocation Loc, unsigned DiagID,
19441944
return DB;
19451945
}
19461946

1947-
static bool typeIsOrContainsFloat(const Type &Ty) {
1948-
if (Ty.isFloatingType())
1949-
return true;
1950-
1951-
if (const RecordDecl *Decl = Ty.getAsRecordDecl()) {
1952-
for (const FieldDecl *FD : Decl->fields()) {
1953-
const Type &FieldType = *FD->getType();
1954-
if (typeIsOrContainsFloat(FieldType))
1955-
return true;
1956-
}
1957-
}
1958-
1959-
return false;
1960-
}
1961-
19621947
void Sema::checkTypeSupport(QualType Ty, SourceLocation Loc, ValueDecl *D) {
19631948
if (isUnevaluatedContext() || Ty.isNull())
19641949
return;
@@ -2103,25 +2088,6 @@ void Sema::checkTypeSupport(QualType Ty, SourceLocation Loc, ValueDecl *D) {
21032088
!Builtin::evaluateRequiredTargetFeatures("sme", CallerFeatureMap))
21042089
Diag(D->getLocation(), diag::err_sve_vector_in_non_sve_target) << Ty;
21052090
}
2106-
2107-
// Don't allow any floating-point types (including structs containing
2108-
// floats) for ABIs which do not support them.
2109-
if (!TI.hasFPTypes() && typeIsOrContainsFloat(*UnqualTy)) {
2110-
PartialDiagnostic PD = PDiag(diag::err_target_unsupported_type_for_abi);
2111-
2112-
if (D)
2113-
PD << D;
2114-
else
2115-
PD << "expression";
2116-
2117-
if (Diag(Loc, PD, FD) << Ty << TI.getABI()) {
2118-
if (D)
2119-
D->setInvalidDecl();
2120-
}
2121-
2122-
if (D)
2123-
targetDiag(D->getLocation(), diag::note_defined_here, FD) << D;
2124-
}
21252091
};
21262092

21272093
CheckType(Ty);

clang/test/CodeGen/aarch64-soft-float-abi.c

-56
This file was deleted.

clang/test/CodeGen/attr-target-clones-aarch64.c

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-attributes --check-globals --include-generated-funcs
2-
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature -fp-armv8 -S -emit-llvm -o - %s | FileCheck %s
3-
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature -fp-armv8 -target-feature -fmv -S -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-NOFMV
2+
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -S -emit-llvm -o - %s | FileCheck %s
3+
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature -fmv -S -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-NOFMV
44

55
int __attribute__((target_clones("lse+aes", "sve2"))) ftc(void) { return 0; }
66
int __attribute__((target_clones("sha2", "sha2+memtag2", " default "))) ftc_def(void) { return 1; }
@@ -414,23 +414,23 @@ inline int __attribute__((target_clones("fp16", "sve2-bitperm+fcma", "default"))
414414
// CHECK-NOFMV-NEXT: ret i32 [[ADD5]]
415415
//
416416
//.
417-
// CHECK: attributes #[[ATTR0:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+lse,+neon,-fp-armv8" }
418-
// CHECK: attributes #[[ATTR1:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fullfp16,+neon,+sve,+sve2,-fp-armv8" }
419-
// CHECK: attributes #[[ATTR2:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="-fp-armv8" }
420-
// CHECK: attributes #[[ATTR3:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+neon,+sha2,-fp-armv8" }
421-
// CHECK: attributes #[[ATTR4:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+mte,+neon,+sha2,-fp-armv8" }
422-
// CHECK: attributes #[[ATTR5:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+neon,-fp-armv8" }
423-
// CHECK: attributes #[[ATTR6:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+crc,+dotprod,+neon,-fp-armv8" }
424-
// CHECK: attributes #[[ATTR7:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+neon,+rand,-fp-armv8" }
425-
// CHECK: attributes #[[ATTR8:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+predres,+rcpc,-fp-armv8" }
426-
// CHECK: attributes #[[ATTR9:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fullfp16,+neon,+sve,+sve2,+sve2-aes,+wfxt,-fp-armv8" }
427-
// CHECK: attributes #[[ATTR10:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fullfp16,+neon,-fp-armv8" }
428-
// CHECK: attributes #[[ATTR11:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+complxnum,+fullfp16,+neon,+sve,+sve2,+sve2-bitperm,-fp-armv8" }
429-
// CHECK: attributes #[[ATTR12:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bti,-fp-armv8" }
430-
// CHECK: attributes #[[ATTR13:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fullfp16,+neon,+sb,+sve,-fp-armv8" }
417+
// CHECK: attributes #[[ATTR0:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+lse,+neon" }
418+
// CHECK: attributes #[[ATTR1:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+neon,+sve,+sve2" }
419+
// CHECK: attributes #[[ATTR2:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
420+
// CHECK: attributes #[[ATTR3:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+neon,+sha2" }
421+
// CHECK: attributes #[[ATTR4:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+mte,+neon,+sha2" }
422+
// CHECK: attributes #[[ATTR5:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+neon" }
423+
// CHECK: attributes #[[ATTR6:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+crc,+dotprod,+fp-armv8,+neon" }
424+
// CHECK: attributes #[[ATTR7:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+neon,+rand" }
425+
// CHECK: attributes #[[ATTR8:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+predres,+rcpc" }
426+
// CHECK: attributes #[[ATTR9:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+neon,+sve,+sve2,+sve2-aes,+wfxt" }
427+
// CHECK: attributes #[[ATTR10:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+neon" }
428+
// CHECK: attributes #[[ATTR11:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+complxnum,+fp-armv8,+fullfp16,+neon,+sve,+sve2,+sve2-bitperm" }
429+
// CHECK: attributes #[[ATTR12:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bti" }
430+
// CHECK: attributes #[[ATTR13:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+neon,+sb,+sve" }
431431
//.
432-
// CHECK-NOFMV: attributes #[[ATTR0:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="-fmv,-fp-armv8" }
433-
// CHECK-NOFMV: attributes #[[ATTR1:[0-9]+]] = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="-fmv,-fp-armv8" }
432+
// CHECK-NOFMV: attributes #[[ATTR0:[0-9]+]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="-fmv" }
433+
// CHECK-NOFMV: attributes #[[ATTR1:[0-9]+]] = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="-fmv" }
434434
//.
435435
// CHECK: [[META0:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
436436
// CHECK: [[META1:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"}

0 commit comments

Comments
 (0)