| ... | ... | @@ -6796,29 +6796,11 @@ pub const FuncGen = struct { |
| 6796 | 6796 | const zcu = pt.zcu; |
| 6797 | 6797 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 6798 | 6798 | |
| 6799 | | const workaround_operand = try self.resolveInst(ty_op.operand); |
| 6799 | const operand = try self.resolveInst(ty_op.operand); |
| 6800 | 6800 | const operand_ty = self.typeOf(ty_op.operand); |
| 6801 | 6801 | const operand_scalar_ty = operand_ty.scalarType(zcu); |
| 6802 | 6802 | const is_signed_int = operand_scalar_ty.isSignedInt(zcu); |
| 6803 | 6803 | |
| 6804 | | const operand = o: { |
| 6805 | | // Work around LLVM bug. See https://github.com/ziglang/zig/issues/17381. |
| 6806 | | const bit_size = operand_scalar_ty.bitSize(zcu); |
| 6807 | | for ([_]u8{ 8, 16, 32, 64, 128 }) |b| { |
| 6808 | | if (bit_size < b) { |
| 6809 | | break :o try self.wip.cast( |
| 6810 | | if (is_signed_int) .sext else .zext, |
| 6811 | | workaround_operand, |
| 6812 | | try o.builder.intType(b), |
| 6813 | | "", |
| 6814 | | ); |
| 6815 | | } else if (bit_size == b) { |
| 6816 | | break :o workaround_operand; |
| 6817 | | } |
| 6818 | | } |
| 6819 | | break :o workaround_operand; |
| 6820 | | }; |
| 6821 | | |
| 6822 | 6804 | const dest_ty = self.typeOfIndex(inst); |
| 6823 | 6805 | const dest_scalar_ty = dest_ty.scalarType(zcu); |
| 6824 | 6806 | const dest_llvm_ty = try o.lowerType(dest_ty); |