| ... | @@ -1740,6 +1740,24 @@ fn store(self: *Self, ptr: MCValue, value: MCValue, ptr_ty: Type, value_ty: Type | ... | @@ -1740,6 +1740,24 @@ fn store(self: *Self, ptr: MCValue, value: MCValue, ptr_ty: Type, value_ty: Type |
| 1740 | .data = .{ .payload = payload }, | 1740 | .data = .{ .payload = payload }, |
| 1741 | }); | 1741 | }); |
| 1742 | }, | 1742 | }, |
| | 1743 | 8 => { |
| | 1744 | // TODO: optimization: if the imm is only using the lower |
| | 1745 | // 4 bytes and can be sign extended we can use a normal mov |
| | 1746 | // with indirect addressing (mov [reg64], imm32). |
| | 1747 | |
| | 1748 | // movabs does not support indirect register addressing |
| | 1749 | // so we need an extra register and an extra mov. |
| | 1750 | const tmp_reg = try self.copyToTmpRegister(value_ty, value); |
| | 1751 | _ = try self.addInst(.{ |
| | 1752 | .tag = .mov, |
| | 1753 | .ops = (Mir.Ops{ |
| | 1754 | .reg1 = reg.to64(), |
| | 1755 | .reg2 = tmp_reg.to64(), |
| | 1756 | .flags = 0b10, |
| | 1757 | }).encode(), |
| | 1758 | .data = .{ .imm = 0 }, |
| | 1759 | }); |
| | 1760 | }, |
| 1743 | else => { | 1761 | else => { |
| 1744 | return self.fail("TODO implement set pointee with immediate of ABI size {d}", .{abi_size}); | 1762 | return self.fail("TODO implement set pointee with immediate of ABI size {d}", .{abi_size}); |
| 1745 | }, | 1763 | }, |