authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-10-06 11:48:05+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-10-15 19:29:56+02:00
log958f57d65d6c612a391bc72a5cf090c9efc9917b
treef7fccca50112d391ec21df7ea229b4954a63a58d
parent3550cacd73b40cea5cfe3d9613bb4f80b5d42417
signature Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

llvm: Enable native f16 lowering for riscv32.


1 files changed, 6 insertions(+), 6 deletions(-)

src/codegen/llvm.zig+6-6
...@@ -12419,7 +12419,8 @@ fn isScalar(zcu: *Zcu, ty: Type) bool {...@@ -12419,7 +12419,8 @@ fn isScalar(zcu: *Zcu, ty: Type) bool {
12419}12419}
1242012420
12421/// This function returns true if we expect LLVM to lower x86_fp80 correctly12421/// This function returns true if we expect LLVM to lower x86_fp80 correctly
12422/// and false if we expect LLVM to crash if it counters an x86_fp80 type.12422/// and false if we expect LLVM to crash if it encounters an x86_fp80 type,
12423/// or if it produces miscompilations.
12423fn backendSupportsF80(target: std.Target) bool {12424fn backendSupportsF80(target: std.Target) bool {
12424 return switch (target.cpu.arch) {12425 return switch (target.cpu.arch) {
12425 .x86_64, .x86 => !std.Target.x86.featureSetHas(target.cpu.features, .soft_float),12426 .x86_64, .x86 => !std.Target.x86.featureSetHas(target.cpu.features, .soft_float),
...@@ -12428,8 +12429,8 @@ fn backendSupportsF80(target: std.Target) bool {...@@ -12428,8 +12429,8 @@ fn backendSupportsF80(target: std.Target) bool {
12428}12429}
1242912430
12430/// This function returns true if we expect LLVM to lower f16 correctly12431/// This function returns true if we expect LLVM to lower f16 correctly
12431/// and false if we expect LLVM to crash if it counters an f16 type or12432/// and false if we expect LLVM to crash if it encounters an f16 type,
12432/// if it produces miscompilations.12433/// or if it produces miscompilations.
12433fn backendSupportsF16(target: std.Target) bool {12434fn backendSupportsF16(target: std.Target) bool {
12434 return switch (target.cpu.arch) {12435 return switch (target.cpu.arch) {
12435 .hexagon,12436 .hexagon,
...@@ -12443,7 +12444,6 @@ fn backendSupportsF16(target: std.Target) bool {...@@ -12443,7 +12444,6 @@ fn backendSupportsF16(target: std.Target) bool {
12443 .mipsel,12444 .mipsel,
12444 .mips64,12445 .mips64,
12445 .mips64el,12446 .mips64el,
12446 .riscv32,
12447 .s390x,12447 .s390x,
12448 => false,12448 => false,
12449 .arm,12449 .arm,
...@@ -12459,7 +12459,7 @@ fn backendSupportsF16(target: std.Target) bool {...@@ -12459,7 +12459,7 @@ fn backendSupportsF16(target: std.Target) bool {
12459}12459}
1246012460
12461/// This function returns true if we expect LLVM to lower f128 correctly,12461/// This function returns true if we expect LLVM to lower f128 correctly,
12462/// and false if we expect LLVm to crash if it encounters and f128 type12462/// and false if we expect LLVM to crash if it encounters an f128 type,
12463/// or if it produces miscompilations.12463/// or if it produces miscompilations.
12464fn backendSupportsF128(target: std.Target) bool {12464fn backendSupportsF128(target: std.Target) bool {
12465 return switch (target.cpu.arch) {12465 return switch (target.cpu.arch) {
...@@ -12486,7 +12486,7 @@ fn backendSupportsF128(target: std.Target) bool {...@@ -12486,7 +12486,7 @@ fn backendSupportsF128(target: std.Target) bool {
12486}12486}
1248712487
12488/// LLVM does not support all relevant intrinsics for all targets, so we12488/// LLVM does not support all relevant intrinsics for all targets, so we
12489/// may need to manually generate a libc call12489/// may need to manually generate a compiler-rt call.
12490fn intrinsicsAllowed(scalar_ty: Type, target: std.Target) bool {12490fn intrinsicsAllowed(scalar_ty: Type, target: std.Target) bool {
12491 return switch (scalar_ty.toIntern()) {12491 return switch (scalar_ty.toIntern()) {
12492 .f16_type => backendSupportsF16(target),12492 .f16_type => backendSupportsF16(target),