authorgravatar for 81774659+gracefuu@users.noreply.github.comgracefu <81774659+gracefuu@users.noreply.github.com> 2021-04-11 18:46:05+08:00
committergravatar for 81774659+gracefuu@users.noreply.github.comgracefu <81774659+gracefuu@users.noreply.github.com> 2021-04-16 15:21:17+08:00
log62e755623fb02257ac5d8fe85be01f5056469cb5
treee62dbc34fe0edc58c94d17bf8ca4d3d660d273fe
parentb004c3da159645cf4a3387f808ab3e8a6277ba2f
signaturelock-open Commit is signed but in an unrecognized format.

stage2 x86_64: bugfix abi_size == 64 should be abi_size == 8


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

src/codegen.zig+18-18
......@@ -1691,10 +1691,10 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
16911691 .register => |src_reg| {
16921692 // for register, register use mr + 1
16931693 // addressing mode: *r/m16/32/64*, r16/32/64
1694 const operand_size = dst_ty.abiSize(self.target.*);
1694 const abi_size = dst_ty.abiSize(self.target.*);
16951695 const encoder = try X8664Encoder.init(self.code, 3);
16961696 encoder.rex(.{
1697 .w = operand_size == 64,
1697 .w = abi_size == 8,
16981698 .r = src_reg.isExtended(),
16991699 .b = dst_reg.isExtended(),
17001700 });
......@@ -1710,10 +1710,10 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
17101710 // opx = 83: r/m16/32/64, imm8
17111711 const imm32 = @intCast(i32, imm); // This case must be handled before calling genX8664BinMathCode.
17121712 if (imm32 <= math.maxInt(i8)) {
1713 const operand_size = dst_ty.abiSize(self.target.*);
1713 const abi_size = dst_ty.abiSize(self.target.*);
17141714 const encoder = try X8664Encoder.init(self.code, 4);
17151715 encoder.rex(.{
1716 .w = operand_size == 64,
1716 .w = abi_size == 8,
17171717 .b = dst_reg.isExtended(),
17181718 });
17191719 encoder.opcode_1byte(0x83);
......@@ -1723,10 +1723,10 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
17231723 );
17241724 encoder.imm8(@intCast(i8, imm32));
17251725 } else {
1726 const operand_size = dst_ty.abiSize(self.target.*);
1726 const abi_size = dst_ty.abiSize(self.target.*);
17271727 const encoder = try X8664Encoder.init(self.code, 7);
17281728 encoder.rex(.{
1729 .w = operand_size == 64,
1729 .w = abi_size == 8,
17301730 .b = dst_reg.isExtended(),
17311731 });
17321732 encoder.opcode_1byte(0x81);
......@@ -1750,7 +1750,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
17501750 }
17511751 const encoder = try X8664Encoder.init(self.code, 7);
17521752 encoder.rex(.{
1753 .w = abi_size == 64,
1753 .w = abi_size == 8,
17541754 .r = dst_reg.isExtended(),
17551755 });
17561756 encoder.opcode_1byte(mr + 3);
......@@ -1837,7 +1837,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
18371837 const abi_size = dst_ty.abiSize(self.target.*);
18381838 const encoder = try X8664Encoder.init(self.code, 4);
18391839 encoder.rex(.{
1840 .w = abi_size == 64,
1840 .w = abi_size == 8,
18411841 .r = dst_reg.isExtended(),
18421842 .b = src_reg.isExtended(),
18431843 });
......@@ -1866,7 +1866,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
18661866 const abi_size = dst_ty.abiSize(self.target.*);
18671867 const encoder = try X8664Encoder.init(self.code, 4);
18681868 encoder.rex(.{
1869 .w = abi_size == 64,
1869 .w = abi_size == 8,
18701870 .r = dst_reg.isExtended(),
18711871 .b = dst_reg.isExtended(),
18721872 });
......@@ -1880,7 +1880,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
18801880 const abi_size = dst_ty.abiSize(self.target.*);
18811881 const encoder = try X8664Encoder.init(self.code, 7);
18821882 encoder.rex(.{
1883 .w = abi_size == 64,
1883 .w = abi_size == 8,
18841884 .r = dst_reg.isExtended(),
18851885 .b = dst_reg.isExtended(),
18861886 });
......@@ -1923,7 +1923,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
19231923 const abi_size = dst_ty.abiSize(self.target.*);
19241924 const encoder = try X8664Encoder.init(self.code, 4);
19251925 encoder.rex(.{
1926 .w = abi_size == 64,
1926 .w = abi_size == 8,
19271927 .r = dst_reg.isExtended(),
19281928 .b = src_reg.isExtended(),
19291929 });
......@@ -1965,7 +1965,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
19651965 const i_adj_off = -@intCast(i32, adj_off);
19661966 const encoder = try X8664Encoder.init(self.code, 7);
19671967 encoder.rex(.{
1968 .w = abi_size == 64,
1968 .w = abi_size == 8,
19691969 .r = reg.isExtended(),
19701970 });
19711971 encoder.opcode_1byte(opcode);
......@@ -3850,7 +3850,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
38503850 const abi_size = ty.abiSize(self.target.*);
38513851 const encoder = try X8664Encoder.init(self.code, 3);
38523852 encoder.rex(.{
3853 .w = abi_size == 64,
3853 .w = abi_size == 8,
38543854 .r = reg.isExtended(),
38553855 .b = src_reg.isExtended(),
38563856 });
......@@ -3869,7 +3869,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
38693869 // After we encode the instruction, we will know that the displacement bytes
38703870 // for [<offset>] will be at self.code.items.len - 4.
38713871 encoder.rex(.{
3872 .w = abi_size == 64,
3872 .w = abi_size == 8,
38733873 .r = reg.isExtended(),
38743874 });
38753875 encoder.opcode_1byte(0x8D);
......@@ -3891,7 +3891,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
38913891
38923892 // MOV reg, [reg]
38933893 encoder.rex(.{
3894 .w = abi_size == 64,
3894 .w = abi_size == 8,
38953895 .r = reg.isExtended(),
38963896 .b = reg.isExtended(),
38973897 });
......@@ -3908,7 +3908,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
39083908 const abi_size = ty.abiSize(self.target.*);
39093909 const encoder = try X8664Encoder.init(self.code, 8);
39103910 encoder.rex(.{
3911 .w = abi_size == 64,
3911 .w = abi_size == 8,
39123912 .r = reg.isExtended(),
39133913 });
39143914 encoder.opcode_1byte(0x8B);
......@@ -3952,7 +3952,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
39523952 const abi_size = ty.abiSize(self.target.*);
39533953 const encoder = try X8664Encoder.init(self.code, 3);
39543954 encoder.rex(.{
3955 .w = abi_size == 64,
3955 .w = abi_size == 8,
39563956 .r = reg.isExtended(),
39573957 .b = reg.isExtended(),
39583958 });
......@@ -3970,7 +3970,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
39703970 const ioff = -@intCast(i32, off);
39713971 const encoder = try X8664Encoder.init(self.code, 3);
39723972 encoder.rex(.{
3973 .w = abi_size == 64,
3973 .w = abi_size == 8,
39743974 .r = reg.isExtended(),
39753975 });
39763976 encoder.opcode_1byte(0x8B);