authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-08-19 01:31:33-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-09-19 09:37:53-07:00
log401de6dd2f3137569bf7a03f596ffe51ce343169
treef1668c6ce2b4cf665c76c460b9250b8179a6ff5d
parent17e3fcc3a5accb31b9ea15f64bd9e968245000c2

compiler_rt: fix arm hard-float f16 abi

Closes #16848

6 files changed, 7 insertions(+), 26 deletions(-)

lib/compiler_rt/common.zig+7
......@@ -84,6 +84,13 @@ pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace, _: ?
8484/// here in compiler-rt.
8585pub fn F16T(comptime other_type: type) type {
8686 return switch (builtin.cpu.arch) {
87 .arm, .armeb, .thumb, .thumbeb => if (std.Target.arm.featureSetHas(builtin.cpu.features, .has_v8))
88 switch (builtin.abi.floatAbi()) {
89 .soft => u16,
90 .hard => f16,
91 }
92 else
93 u16,
8794 .aarch64, .aarch64_be, .aarch64_32 => f16,
8895 .riscv64 => if (builtin.zig_backend == .stage1) u16 else f16,
8996 .x86, .x86_64 => if (builtin.target.isDarwin()) switch (other_type) {
lib/std/target.zig-1
......@@ -1473,7 +1473,6 @@ pub const Target = struct {
14731473 pub const FloatAbi = enum {
14741474 hard,
14751475 soft,
1476 soft_fp,
14771476 };
14781477
14791478 pub inline fn getFloatAbi(self: Target) FloatAbi {
test/behavior/floatop.zig-5
......@@ -722,11 +722,6 @@ test "@floor f128" {
722722 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
723723 if (builtin.zig_backend == .stage2_c and comptime builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest;
724724
725 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isARM()) {
726 // https://github.com/ziglang/zig/issues/16848
727 return error.SkipZigTest;
728 }
729
730725 try testFloorLegacy(f128, 12.0);
731726 try comptime testFloorLegacy(f128, 12.0);
732727}
test/behavior/muladd.zig-10
......@@ -57,11 +57,6 @@ test "@mulAdd f80" {
5757 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
5858 if (builtin.zig_backend == .stage2_c and comptime builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest;
5959
60 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isARM()) {
61 // https://github.com/ziglang/zig/issues/16848
62 return error.SkipZigTest;
63 }
64
6560 try comptime testMulAdd80();
6661 try testMulAdd80();
6762}
......@@ -81,11 +76,6 @@ test "@mulAdd f128" {
8176 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
8277 if (builtin.zig_backend == .stage2_c and comptime builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest;
8378
84 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isARM()) {
85 // https://github.com/ziglang/zig/issues/16848
86 return error.SkipZigTest;
87 }
88
8979 try comptime testMulAdd128();
9080 try testMulAdd128();
9181}
test/behavior/usingnamespace/import_segregation.zig-5
......@@ -12,11 +12,6 @@ test "no clobbering happened" {
1212 return error.SkipZigTest;
1313 }
1414
15 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isARM()) {
16 // https://github.com/ziglang/zig/issues/16848
17 return error.SkipZigTest;
18 }
19
2015 @This().foo_function();
2116 @This().bar_function();
2217 try expect(@This().saw_foo_function);
test/behavior/widening.zig-5
......@@ -66,11 +66,6 @@ test "float widening f16 to f128" {
6666 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
6767 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
6868
69 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isARM()) {
70 // https://github.com/ziglang/zig/issues/16848
71 return error.SkipZigTest;
72 }
73
7469 var x: f16 = 12.34;
7570 var y: f128 = x;
7671 try expect(x == y);