| ... | @@ -11399,16 +11399,6 @@ pub const FuncGen = struct { | ... | @@ -11399,16 +11399,6 @@ pub const FuncGen = struct { |
| 11399 | const payload_llvm_ty = try o.lowerType(pt, payload_ty); | 11399 | const payload_llvm_ty = try o.lowerType(pt, payload_ty); |
| 11400 | const abi_size = payload_ty.abiSize(zcu); | 11400 | const abi_size = payload_ty.abiSize(zcu); |
| 11401 | | 11401 | |
| 11402 | // llvm bug workarounds: | | |
| 11403 | const workaround_explicit_mask = o.target.cpu.arch == .powerpc and abi_size >= 4; | | |
| 11404 | const workaround_disable_truncate = o.target.cpu.arch == .wasm32 and abi_size >= 4; | | |
| 11405 | | | |
| 11406 | if (workaround_disable_truncate) { | | |
| 11407 | // see https://github.com/llvm/llvm-project/issues/64222 | | |
| 11408 | // disable the truncation codepath for larger than 32bits value - with this heuristic, the backend passes the test suite. | | |
| 11409 | return try fg.wip.load(access_kind, payload_llvm_ty, payload_ptr, payload_alignment, ""); | | |
| 11410 | } | | |
| 11411 | | | |
| 11412 | const load_llvm_ty = if (payload_ty.isAbiInt(zcu)) | 11402 | const load_llvm_ty = if (payload_ty.isAbiInt(zcu)) |
| 11413 | try o.builder.intType(@intCast(abi_size * 8)) | 11403 | try o.builder.intType(@intCast(abi_size * 8)) |
| 11414 | else | 11404 | else |
| ... | @@ -11422,14 +11412,7 @@ pub const FuncGen = struct { | ... | @@ -11422,14 +11412,7 @@ pub const FuncGen = struct { |
| 11422 | else | 11412 | else |
| 11423 | loaded; | 11413 | loaded; |
| 11424 | | 11414 | |
| 11425 | const anded = if (workaround_explicit_mask and payload_llvm_ty != load_llvm_ty) blk: { | 11415 | return fg.wip.conv(.unneeded, shifted, payload_llvm_ty, ""); |
| 11426 | // this is rendundant with llvm.trunc. But without it, llvm17 emits invalid code for powerpc. | | |
| 11427 | const mask_val = try o.builder.intValue(payload_llvm_ty, -1); | | |
| 11428 | const zext_mask_val = try fg.wip.cast(.zext, mask_val, load_llvm_ty, ""); | | |
| 11429 | break :blk try fg.wip.bin(.@"and", shifted, zext_mask_val, ""); | | |
| 11430 | } else shifted; | | |
| 11431 | | | |
| 11432 | return fg.wip.conv(.unneeded, anded, payload_llvm_ty, ""); | | |
| 11433 | } | 11416 | } |
| 11434 | | 11417 | |
| 11435 | /// Load a by-ref type by constructing a new alloca and performing a memcpy. | 11418 | /// Load a by-ref type by constructing a new alloca and performing a memcpy. |