compiler_rt: fix arm hard-float f16 abi

Closes #16848
This commit is contained in:
Jacob Young 2023-08-19 01:31:33 -04:00 committed by Andrew Kelley
parent 17e3fcc3a5
commit 401de6dd2f
6 changed files with 7 additions and 26 deletions

View File

@ -84,6 +84,13 @@ pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace, _: ?
/// here in compiler-rt.
pub fn F16T(comptime other_type: type) type {
return switch (builtin.cpu.arch) {
.arm, .armeb, .thumb, .thumbeb => if (std.Target.arm.featureSetHas(builtin.cpu.features, .has_v8))
switch (builtin.abi.floatAbi()) {
.soft => u16,
.hard => f16,
}
else
u16,
.aarch64, .aarch64_be, .aarch64_32 => f16,
.riscv64 => if (builtin.zig_backend == .stage1) u16 else f16,
.x86, .x86_64 => if (builtin.target.isDarwin()) switch (other_type) {

View File

@ -1473,7 +1473,6 @@ pub const Target = struct {
pub const FloatAbi = enum {
hard,
soft,
soft_fp,
};
pub inline fn getFloatAbi(self: Target) FloatAbi {

View File

@ -722,11 +722,6 @@ test "@floor f128" {
if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_c and comptime builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isARM()) {
// https://github.com/ziglang/zig/issues/16848
return error.SkipZigTest;
}
try testFloorLegacy(f128, 12.0);
try comptime testFloorLegacy(f128, 12.0);
}

View File

@ -57,11 +57,6 @@ test "@mulAdd f80" {
if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_c and comptime builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isARM()) {
// https://github.com/ziglang/zig/issues/16848
return error.SkipZigTest;
}
try comptime testMulAdd80();
try testMulAdd80();
}
@ -81,11 +76,6 @@ test "@mulAdd f128" {
if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_c and comptime builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isARM()) {
// https://github.com/ziglang/zig/issues/16848
return error.SkipZigTest;
}
try comptime testMulAdd128();
try testMulAdd128();
}

View File

@ -12,11 +12,6 @@ test "no clobbering happened" {
return error.SkipZigTest;
}
if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isARM()) {
// https://github.com/ziglang/zig/issues/16848
return error.SkipZigTest;
}
@This().foo_function();
@This().bar_function();
try expect(@This().saw_foo_function);

View File

@ -66,11 +66,6 @@ test "float widening f16 to f128" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isARM()) {
// https://github.com/ziglang/zig/issues/16848
return error.SkipZigTest;
}
var x: f16 = 12.34;
var y: f128 = x;
try expect(x == y);