authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-01-19 20:43:42+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-04-22 15:31:57+02:00
logf8f3b948e3cee23963663f58f424832bd56ac5c9
treeba9b33104adb07b96301a8619474ad421731d7a2
parent9627d35990b44b35cf3a6c8222919753586a2023
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

llvm: switch most targets to using half and fp128 IR types

As of LLVM 22, most backends can (finally) handle legalization of these types as necessary, so we don't need to do it ourselves anymore. closes https://github.com/ziglang/zig/issues/23674

2 files changed, 1 insertions(+), 41 deletions(-)

lib/compiler_rt.zig+1-22
...@@ -447,29 +447,8 @@ pub const gnu_f16_abi = switch (builtin.cpu.arch) {...@@ -447,29 +447,8 @@ pub const gnu_f16_abi = switch (builtin.cpu.arch) {
447447
448pub const want_sparc_abi = builtin.cpu.arch.isSPARC();448pub const want_sparc_abi = builtin.cpu.arch.isSPARC();
449449
450/// This seems to mostly correspond to `clang::TargetInfo::HasFloat16`.
451pub fn F16T(comptime OtherType: type) type {450pub fn F16T(comptime OtherType: type) type {
452 return switch (builtin.cpu.arch) {451 return switch (builtin.cpu.arch) {
453 .amdgcn,
454 .arm,
455 .armeb,
456 .thumb,
457 .thumbeb,
458 .aarch64,
459 .aarch64_be,
460 .hexagon,
461 .loongarch32,
462 .loongarch64,
463 .nvptx,
464 .nvptx64,
465 .riscv32,
466 .riscv32be,
467 .riscv64,
468 .riscv64be,
469 .s390x,
470 .spirv32,
471 .spirv64,
472 => f16,
473 .x86, .x86_64 => if (builtin.target.os.tag.isDarwin()) switch (OtherType) {452 .x86, .x86_64 => if (builtin.target.os.tag.isDarwin()) switch (OtherType) {
474 // Starting with LLVM 16, Darwin uses different abi for f16453 // Starting with LLVM 16, Darwin uses different abi for f16
475 // depending on the type of the other return/argument..???454 // depending on the type of the other return/argument..???
...@@ -477,7 +456,7 @@ pub fn F16T(comptime OtherType: type) type {...@@ -477,7 +456,7 @@ pub fn F16T(comptime OtherType: type) type {
477 f80, f128 => f16,456 f80, f128 => f16,
478 else => unreachable,457 else => unreachable,
479 } else f16,458 } else f16,
480 else => u16,459 else => f16,
481 };460 };
482}461}
483462
src/codegen/llvm.zig-19
...@@ -4641,20 +4641,6 @@ fn toLlvmGlobalAddressSpace(wanted_address_space: std.builtin.AddressSpace, targ...@@ -4641,20 +4641,6 @@ fn toLlvmGlobalAddressSpace(wanted_address_space: std.builtin.AddressSpace, targ
4641/// or if it produces miscompilations.4641/// or if it produces miscompilations.
4642pub fn backendSupportsF16(target: *const std.Target) bool {4642pub fn backendSupportsF16(target: *const std.Target) bool {
4643 return switch (target.cpu.arch) {4643 return switch (target.cpu.arch) {
4644 // https://github.com/llvm/llvm-project/issues/97981
4645 .csky,
4646 // https://github.com/llvm/llvm-project/issues/97981
4647 .powerpc,
4648 .powerpcle,
4649 .powerpc64,
4650 .powerpc64le,
4651 // https://github.com/llvm/llvm-project/issues/97981
4652 .wasm32,
4653 .wasm64,
4654 // https://github.com/llvm/llvm-project/issues/97981
4655 .sparc,
4656 .sparc64,
4657 => false,
4658 .arm,4644 .arm,
4659 .armeb,4645 .armeb,
4660 .thumb,4646 .thumb,
...@@ -4681,11 +4667,6 @@ pub fn backendSupportsF128(target: *const std.Target) bool {...@@ -4681,11 +4667,6 @@ pub fn backendSupportsF128(target: *const std.Target) bool {
4681 return switch (target.cpu.arch) {4667 return switch (target.cpu.arch) {
4682 // https://github.com/llvm/llvm-project/issues/1211224668 // https://github.com/llvm/llvm-project/issues/121122
4683 .amdgcn,4669 .amdgcn,
4684 // Test failures all over the place.
4685 .mips64,
4686 .mips64el,
4687 // https://github.com/llvm/llvm-project/issues/41838
4688 .sparc,
4689 => false,4670 => false,
4690 .arm,4671 .arm,
4691 .armeb,4672 .armeb,