Fix regression caused in e553e9e4

In the process of converting the assembly from AT&T syntax to Intel
syntax, bjorn3 made some mistakes. Firstly, `A+B(%reg)` is translated to
`[reg + A + B]`, and not `[reg * B + A]`. I can see how this was
confused because x86 also has an addressing mode that takes up to 4
arguments, where `A(%r1,%r2,B)` is translated to `[r1 + A + r2 * B]`
with the constraints that `B` must be a power of two <= 8, and `A` (if
present), must be an immediate. In this case, the `72+8` and such is
constfolded by the assembler into `80`.

This commit and the previous AT&T syntax version produce the exact same
assembly output now.
This commit is contained in:
Connor-GH
2026-04-02 19:14:42 -05:00
parent 8f9dde924b
commit aecec88fb6
2 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -9,7 +9,7 @@ __sigsetjmp:
mov eax, dword ptr [esp + 4]
pop [eax + 24]
mov dword ptr [eax * 8 + 28], ebx
mov dword ptr [eax + 8 + 28], ebx
mov ebx, eax
.hidden ___setjmp
@@ -17,8 +17,8 @@ __sigsetjmp:
push [ebx + 24]
mov dword ptr [esp + 4], ebx
mov dword ptr [esp + 4], eax
mov ebx, dword ptr [ebx * 8 + 28]
mov dword ptr [esp + 8], eax
mov ebx, dword ptr [ebx + 8 + 28]
.hidden __sigsetjmp_tail
jmp __sigsetjmp_tail
+2 -2
View File
@@ -8,7 +8,7 @@ __sigsetjmp:
jz 1f
pop [rdi + 64]
mov qword ptr [rdi * 8 + 72], rbx
mov qword ptr [rdi + 8 + 72], rbx
mov rbx, rdi
call setjmp
@@ -16,7 +16,7 @@ __sigsetjmp:
push [rbx + 64]
mov rdi, rbx
mov esi, eax
mov rbx, qword ptr [rbx * 8 + 72]
mov rbx, qword ptr [rbx + 8 + 72]
.hidden __sigsetjmp_tail
jmp __sigsetjmp_tail