Skip to content

Commit edee975

Browse files
committed
gas64 : fix casting ulong (with "negative value") to double/single
1 parent bb84ada commit edee975

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/compiler/ir-gas64.bas

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5081,11 +5081,17 @@ private sub _emitconvert( byval v1 as IRVREG ptr, byval v2 as IRVREG ptr )
50815081
end if
50825082

50835083
case FB_DATATYPE_LONG,FB_DATATYPE_ULONG
5084-
if v1dtype=FB_DATATYPE_DOUBLE then
5084+
if v2dtype=FB_DATATYPE_ULONG then
5085+
asm_code("mov eax, "+prefix2+op2)
5086+
asm_code("cvtsi2sd xmm0, rax")
5087+
else
50855088
asm_code("cvtsi2sd xmm0, "+prefix2+op2)
5089+
end if
5090+
5091+
if v1dtype=FB_DATATYPE_DOUBLE then
50865092
asm_code("movq "+op1+", xmm0")
50875093
else
5088-
asm_code("cvtsi2ss xmm0, "+prefix2+op2)
5094+
asm_code("cvtsd2ss xmm0, xmm0")
50895095
asm_code("movd "+op1+", xmm0")
50905096
end if
50915097

0 commit comments

Comments
 (0)