Skip to content

Commit d77c7de

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

File tree

2 files changed

+33
-24
lines changed

2 files changed

+33
-24
lines changed

lib/compiler_rt/common.zig

Lines changed: 17 additions & 13 deletions
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

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12440,29 +12440,30 @@ fn backendSupportsF80(target: std.Target) bool {
1244012440
/// or if it produces miscompilations.
1244112441
fn backendSupportsF16(target: std.Target) bool {
1244212442
return switch (target.cpu.arch) {
12443-
// LoongArch can be removed from this list with LLVM 20.
12444-
.loongarch32,
12445-
.loongarch64,
12443+
// https://github.com/llvm/llvm-project/issues/97981
12444+
.csky,
12445+
// https://github.com/llvm/llvm-project/issues/97981
1244612446
.hexagon,
12447+
// https://github.com/llvm/llvm-project/issues/97981
1244712448
.powerpc,
1244812449
.powerpcle,
1244912450
.powerpc64,
1245012451
.powerpc64le,
12452+
// https://github.com/llvm/llvm-project/issues/97981
1245112453
.wasm32,
1245212454
.wasm64,
12453-
.mips,
12454-
.mipsel,
12455-
.mips64,
12456-
.mips64el,
12455+
// https://github.com/llvm/llvm-project/issues/50374
1245712456
.s390x,
12457+
// https://github.com/llvm/llvm-project/issues/97981
1245812458
.sparc,
1245912459
.sparc64,
1246012460
=> false,
1246112461
.arm,
1246212462
.armeb,
1246312463
.thumb,
1246412464
.thumbeb,
12465-
=> target.abi.float() == .soft or std.Target.arm.featureSetHas(target.cpu.features, .fp_armv8),
12465+
=> target.abi.float() == .soft or std.Target.arm.featureSetHas(target.cpu.features, .fullfp16),
12466+
// https://github.com/llvm/llvm-project/issues/129394
1246612467
.aarch64,
1246712468
.aarch64_be,
1246812469
=> std.Target.aarch64.featureSetHas(target.cpu.features, .fp_armv8),
@@ -12475,11 +12476,18 @@ fn backendSupportsF16(target: std.Target) bool {
1247512476
/// or if it produces miscompilations.
1247612477
fn backendSupportsF128(target: std.Target) bool {
1247712478
return switch (target.cpu.arch) {
12479+
// https://github.com/llvm/llvm-project/issues/121122
1247812480
.amdgcn,
12481+
// Test failures all over the place.
1247912482
.mips64,
1248012483
.mips64el,
12484+
// https://github.com/llvm/llvm-project/issues/95471
12485+
.nvptx,
12486+
.nvptx64,
12487+
// https://github.com/llvm/llvm-project/issues/41838
1248112488
.sparc,
1248212489
=> false,
12490+
// https://github.com/llvm/llvm-project/issues/101545
1248312491
.powerpc,
1248412492
.powerpcle,
1248512493
.powerpc64,
@@ -12490,9 +12498,6 @@ fn backendSupportsF128(target: std.Target) bool {
1249012498
.thumb,
1249112499
.thumbeb,
1249212500
=> target.abi.float() == .soft or std.Target.arm.featureSetHas(target.cpu.features, .fp_armv8),
12493-
.aarch64,
12494-
.aarch64_be,
12495-
=> std.Target.aarch64.featureSetHas(target.cpu.features, .fp_armv8),
1249612501
else => true,
1249712502
};
1249812503
}

0 commit comments

Comments
 (0)