Skip to content

Commit 8ea098b

Browse files
committed
llvm: Update the list of targets that use native f16/f128.
Closes #22003. Closes #22013.
1 parent dcf0e96 commit 8ea098b

File tree

2 files changed

+33
-24
lines changed

2 files changed

+33
-24
lines changed

lib/compiler_rt/common.zig

+17-13
Original file line numberDiff line numberDiff line change
@@ -96,21 +96,25 @@ pub const want_sparc_abi = builtin.cpu.arch.isSPARC();
9696
// we're trying to test compiler-rt.
9797
pub const panic = if (builtin.is_test) std.debug.FullPanic(std.debug.defaultPanic) else std.debug.no_panic;
9898

99-
/// AArch64 is the only ABI (at the moment) to support f16 arguments without the
100-
/// need for extending them to wider fp types.
101-
/// TODO remove this; do this type selection in the language rather than
102-
/// here in compiler-rt.
99+
/// This seems to mostly correspond to `clang::TargetInfo::HasFloat16`.
103100
pub fn F16T(comptime OtherType: type) type {
104101
return switch (builtin.cpu.arch) {
105-
.arm, .armeb, .thumb, .thumbeb => if (std.Target.arm.featureSetHas(builtin.cpu.features, .has_v8))
106-
switch (builtin.abi.float()) {
107-
.soft => u16,
108-
.hard => f16,
109-
}
110-
else
111-
u16,
112-
.aarch64, .aarch64_be => f16,
113-
.riscv32, .riscv64 => f16,
102+
.amdgcn,
103+
.arm,
104+
.armeb,
105+
.thumb,
106+
.thumbeb,
107+
.aarch64,
108+
.aarch64_be,
109+
.nvptx,
110+
.nvptx64,
111+
.riscv32,
112+
.riscv64,
113+
.spirv,
114+
.spirv32,
115+
.spirv64,
116+
=> f16,
117+
.hexagon => if (std.Target.hexagon.featureSetHas(builtin.target.cpu.features, .v68)) f16 else u16,
114118
.x86, .x86_64 => if (builtin.target.os.tag.isDarwin()) switch (OtherType) {
115119
// Starting with LLVM 16, Darwin uses different abi for f16
116120
// depending on the type of the other return/argument..???

src/codegen/llvm.zig

+16-11
Original file line numberDiff line numberDiff line change
@@ -12467,29 +12467,30 @@ fn backendSupportsF80(target: std.Target) bool {
1246712467
/// or if it produces miscompilations.
1246812468
fn backendSupportsF16(target: std.Target) bool {
1246912469
return switch (target.cpu.arch) {
12470-
// LoongArch can be removed from this list with LLVM 20.
12471-
.loongarch32,
12472-
.loongarch64,
12470+
// https://github.com/llvm/llvm-project/issues/97981
12471+
.csky,
12472+
// https://github.com/llvm/llvm-project/issues/97981
1247312473
.hexagon,
12474+
// https://github.com/llvm/llvm-project/issues/97981
1247412475
.powerpc,
1247512476
.powerpcle,
1247612477
.powerpc64,
1247712478
.powerpc64le,
12479+
// https://github.com/llvm/llvm-project/issues/97981
1247812480
.wasm32,
1247912481
.wasm64,
12480-
.mips,
12481-
.mipsel,
12482-
.mips64,
12483-
.mips64el,
12482+
// https://github.com/llvm/llvm-project/issues/50374
1248412483
.s390x,
12484+
// https://github.com/llvm/llvm-project/issues/97981
1248512485
.sparc,
1248612486
.sparc64,
1248712487
=> false,
1248812488
.arm,
1248912489
.armeb,
1249012490
.thumb,
1249112491
.thumbeb,
12492-
=> target.abi.float() == .soft or std.Target.arm.featureSetHas(target.cpu.features, .fp_armv8),
12492+
=> target.abi.float() == .soft or std.Target.arm.featureSetHas(target.cpu.features, .fullfp16),
12493+
// https://github.com/llvm/llvm-project/issues/129394
1249312494
.aarch64,
1249412495
.aarch64_be,
1249512496
=> std.Target.aarch64.featureSetHas(target.cpu.features, .fp_armv8),
@@ -12502,11 +12503,18 @@ fn backendSupportsF16(target: std.Target) bool {
1250212503
/// or if it produces miscompilations.
1250312504
fn backendSupportsF128(target: std.Target) bool {
1250412505
return switch (target.cpu.arch) {
12506+
// https://github.com/llvm/llvm-project/issues/121122
1250512507
.amdgcn,
12508+
// Test failures all over the place.
1250612509
.mips64,
1250712510
.mips64el,
12511+
// https://github.com/llvm/llvm-project/issues/95471
12512+
.nvptx,
12513+
.nvptx64,
12514+
// https://github.com/llvm/llvm-project/issues/41838
1250812515
.sparc,
1250912516
=> false,
12517+
// https://github.com/llvm/llvm-project/issues/101545
1251012518
.powerpc,
1251112519
.powerpcle,
1251212520
.powerpc64,
@@ -12517,9 +12525,6 @@ fn backendSupportsF128(target: std.Target) bool {
1251712525
.thumb,
1251812526
.thumbeb,
1251912527
=> target.abi.float() == .soft or std.Target.arm.featureSetHas(target.cpu.features, .fp_armv8),
12520-
.aarch64,
12521-
.aarch64_be,
12522-
=> std.Target.aarch64.featureSetHas(target.cpu.features, .fp_armv8),
1252312528
else => true,
1252412529
};
1252512530
}

0 commit comments

Comments
 (0)