Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Version 1.06.0
- #841: The unary negation operator gave different result signedness when used on constant instead of non-constant expression. Now the result is always signed.
- Incorrect C++ mangling for BYREF parameters using built-in types
- #844: Fix bug in -gen gcc due to duplicated type (struct) names in the main module and global namespace
- #875: Fix bug where boolean variable to single/double conversion gives wrong sign on -gen gas x86
- #875: Fix bug where boolean variable to single/double conversion gives wrong sign on -gen gas -fpu x87 & sse
- #872: Fix broken boolean bitfield runtime assignments from unsigned values


Expand Down
27 changes: 27 additions & 0 deletions src/compiler/emit_SSE.bas
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include once "symb.bi"
#include once "emit-private.bi"

dim shared _emitLOADB2F_x86 as sub( byval dvreg as IRVREG ptr, byval svreg as IRVREG ptr )

private sub hULONG2DBL _
( _
byval svreg as IRVREG ptr _
Expand All @@ -38,6 +40,29 @@ private sub hULONG2DBL _

end sub

private sub _emitLOADB2F_SSE( byval dvreg as IRVREG ptr, byval svreg as IRVREG ptr )

dim as string dst
dim as integer ddsize = any

'' load source to ST(0)
_emitLOADB2F_x86( dvreg, svreg )

hPrepOperand( dvreg, dst )
ddsize = typeGetSize( dvreg->dtype )

'' pop from FPU STACK and load to SSE register
outp "sub esp" + COMMA + str( ddsize )
if( ddsize > 4 ) then
outp "fstp qword ptr [esp]"
outp "movlpd " + dst + COMMA + "qword ptr [esp]"
else
outp "fstp dword ptr [esp]"
outp "movss " + dst + COMMA + "dword ptr [esp]"
end if
outp "add esp" + COMMA + str( ddsize )

end sub

'':::::
private sub _emitSTORF2L_SSE _
Expand Down Expand Up @@ -2882,11 +2907,13 @@ function _init_opFnTB_SSE _
) as integer

'' load
_emitLOADB2F_x86 = _opFnTB_SSE[EMIT_OP_LOADB2F]
_opFnTB_SSE[EMIT_OP_LOADF2I] = EMIT_CBENTRY(LOADF2I_SSE)
_opFnTB_SSE[EMIT_OP_LOADI2F] = EMIT_CBENTRY(LOADI2F_SSE)
_opFnTB_SSE[EMIT_OP_LOADF2L] = EMIT_CBENTRY(LOADF2L_SSE)
_opFnTB_SSE[EMIT_OP_LOADL2F] = EMIT_CBENTRY(LOADL2F_SSE)
_opFnTB_SSE[EMIT_OP_LOADF2F] = EMIT_CBENTRY(LOADF2F_SSE)
_opFnTB_SSE[EMIT_OP_LOADB2F] = EMIT_CBENTRY(LOADB2F_SSE)

'' store
_opFnTB_SSE[EMIT_OP_STORF2I] = EMIT_CBENTRY(STORF2I_SSE)
Expand Down