From f8f3b948e3cee23963663f58f424832bd56ac5c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Mon, 19 Jan 2026 20:43:42 +0100 Subject: [PATCH] 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 --- lib/compiler_rt.zig | 23 +---------------------- src/codegen/llvm.zig | 19 ------------------- 2 files changed, 1 insertion(+), 41 deletions(-) diff --git a/lib/compiler_rt.zig b/lib/compiler_rt.zig index 501d35f0a280b79d96ebf0fd7ed993cbeaecdb9c..9e62f047bb732cfd1f604df15ab9c1b721adc01b 100644 --- a/lib/compiler_rt.zig +++ b/lib/compiler_rt.zig @@ -447,29 +447,8 @@ pub const gnu_f16_abi = switch (builtin.cpu.arch) { pub const want_sparc_abi = builtin.cpu.arch.isSPARC(); -/// This seems to mostly correspond to `clang::TargetInfo::HasFloat16`. pub fn F16T(comptime OtherType: type) type { return switch (builtin.cpu.arch) { - .amdgcn, - .arm, - .armeb, - .thumb, - .thumbeb, - .aarch64, - .aarch64_be, - .hexagon, - .loongarch32, - .loongarch64, - .nvptx, - .nvptx64, - .riscv32, - .riscv32be, - .riscv64, - .riscv64be, - .s390x, - .spirv32, - .spirv64, - => f16, .x86, .x86_64 => if (builtin.target.os.tag.isDarwin()) switch (OtherType) { // Starting with LLVM 16, Darwin uses different abi for f16 // depending on the type of the other return/argument..??? @@ -477,7 +456,7 @@ pub fn F16T(comptime OtherType: type) type { f80, f128 => f16, else => unreachable, } else f16, - else => u16, + else => f16, }; } diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 5ba290d05942dfe89cb10a81028bbe8cc853a7f5..d4d879e373cf3384e86b653af57b98800e34615a 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -4641,20 +4641,6 @@ fn toLlvmGlobalAddressSpace(wanted_address_space: std.builtin.AddressSpace, targ /// or if it produces miscompilations. pub fn backendSupportsF16(target: *const std.Target) bool { return switch (target.cpu.arch) { - // https://github.com/llvm/llvm-project/issues/97981 - .csky, - // https://github.com/llvm/llvm-project/issues/97981 - .powerpc, - .powerpcle, - .powerpc64, - .powerpc64le, - // https://github.com/llvm/llvm-project/issues/97981 - .wasm32, - .wasm64, - // https://github.com/llvm/llvm-project/issues/97981 - .sparc, - .sparc64, - => false, .arm, .armeb, .thumb, @@ -4681,11 +4667,6 @@ pub fn backendSupportsF128(target: *const std.Target) bool { return switch (target.cpu.arch) { // https://github.com/llvm/llvm-project/issues/121122 .amdgcn, - // Test failures all over the place. - .mips64, - .mips64el, - // https://github.com/llvm/llvm-project/issues/41838 - .sparc, => false, .arm, .armeb, -- 2.54.0