Skip to content

Commit

Permalink
gas64 fix : NEW UBYTE/BYTE[count] not handled (other datatypes ok)
Browse files Browse the repository at this point in the history
  • Loading branch information
SARG-FB committed Oct 10, 2023
1 parent ab3afdf commit afdbab3
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions src/compiler/ir-gas64.bas
Expand Up @@ -6507,8 +6507,22 @@ private sub _emitmem(byval op as integer,byval v1 as IRVREG ptr,byval v2 as IRVR
exit sub
end if

if v2->typ=IR_VREGTYPE_REG then ''todo to be replace by repsto
op2=*regstrq(reg_findreal(v2->reg))
if v2->typ=IR_VREGTYPE_REG or v2->typ=IR_VREGTYPE_VAR then ''todo to be replaced by repsto ?

if v2->typ=IR_VREGTYPE_REG then
op2=*regstrq(reg_findreal(v2->reg))
else
if reghandle(KREG_RCX)<>KREGFREE then
asm_code("push rcx")
end if
op2="rcx"
if symbIsStatic(v1->sym) Or symbisshared(v1->sym) then
asm_code("mov rcx, "+*symbGetMangledName(v2->sym)+"[rip+"+Str(v2->ofs)+"]")
else
asm_code("mov rcx, "+Str(v2->ofs)+"[rbp]")
end if
End If

asm_code("test "+op2+", "+op2)
lname2=*symbUniqueLabel( )
''zero byte to clear so skip
Expand All @@ -6520,10 +6534,18 @@ private sub _emitmem(byval op as integer,byval v1 as IRVREG ptr,byval v2 as IRVR
asm_code("inc rax")
asm_code("dec "+op2)
asm_code("jnz "+lname1)

asm_code(lname2+":")

if v2->typ=IR_VREGTYPE_VAR and reghandle(KREG_RCX)<>KREGFREE then
asm_code("pop rcx")
end if

exit sub
end if



if v2->typ<>IR_VREGTYPE_IMM then
asm_error("Memclear without an immediat as size")
exit sub
Expand Down

0 comments on commit afdbab3

Please sign in to comment.