Skip to content

Commit

Permalink
Revert "fbc 64bit (gas/gcc) : use of 32bit registers in case MOD/INTD…
Browse files Browse the repository at this point in the history
…IV/SHL and [u]long/[u]long operands"

This partially reverts commit 63b0fe7.

- remove the changes in src/compiler/ast-node-bop.bas
- to be moved to src/compiler/ast-optimize.bas
- all changes in src/compiler/ir-gas64.bas remain, since this support is needed for the optimizations
  • Loading branch information
jayrm committed Jul 23, 2023
1 parent 63b0fe7 commit b4bea3e
Showing 1 changed file with 8 additions and 35 deletions.
43 changes: 8 additions & 35 deletions src/compiler/ast-node-bop.bas
Expand Up @@ -675,6 +675,7 @@ private sub hConvOperand _
byref dclass as integer, _
byref n as ASTNODE ptr _
)

dtype = typeJoin( dtype, newdtype )
dclass = typeGetClass( newdtype )
n = astNewCONV( dtype, NULL, n )
Expand Down Expand Up @@ -1088,29 +1089,13 @@ function astNewBOP _
intrank = typeGetIntRank( FB_DATATYPE_INTEGER )
uintrank = typeGetIntRank( FB_DATATYPE_UINT )

if( ldclass = FB_DATACLASS_INTEGER ) then
lrank = typeGetIntRank( typeGetRemapType( ldtype ) )
end if
if( rdclass = FB_DATACLASS_INTEGER ) then
rrank = typeGetIntRank( typeGetRemapType( rdtype ) )
end if


'' not for float
if( ldclass = FB_DATACLASS_INTEGER ) then
lrank = typeGetIntRank( typeGetRemapType( ldtype ) )

'' l < INTEGER?
if( lrank < intrank ) then
if( (op = AST_OP_MOD) or (op = AST_OP_INTDIV) or ( op = AST_OP_SHL ) ) then
if( (lrank < typeGetIntRank( FB_DATATYPE_LONG ) ) _
and (rrank < typeGetIntRank( FB_DATATYPE_LONG ) ) ) then
hConvOperand( FB_DATATYPE_LONG, ldtype, ldclass, l )
elseif (rrank > typeGetIntRank( FB_DATATYPE_ULONG ) ) then
hConvOperand( FB_DATATYPE_INTEGER, ldtype, ldclass, l )
end if
else
hConvOperand( FB_DATATYPE_INTEGER, ldtype, ldclass, l )
end if
hConvOperand( FB_DATATYPE_INTEGER, ldtype, ldclass, l )
else
'' INTEGER < l < UINTEGER?
if( (intrank < lrank) and (lrank < uintrank) ) then
Expand All @@ -1125,21 +1110,11 @@ function astNewBOP _

'' not for float
if( rdclass = FB_DATACLASS_INTEGER ) then
rrank = typeGetIntRank( typeGetRemapType( rdtype ) )

'' same for r
if( rrank < intrank ) then
if( (op = AST_OP_MOD) or (op = AST_OP_INTDIV) or ( op = AST_OP_SHL ) ) then

if( (rrank < typeGetIntRank( FB_DATATYPE_LONG ) ) _
and (lrank < typeGetIntRank( FB_DATATYPE_LONG ) ) ) then
hConvOperand( FB_DATATYPE_LONG, rdtype, rdclass, r )
elseif( (rrank > typeGetIntRank( FB_DATATYPE_ULONG ) ) _
or (lrank > typeGetIntRank( FB_DATATYPE_ULONG ) ) ) then
hConvOperand( FB_DATATYPE_INTEGER, rdtype, rdclass, r )
end if
else
hConvOperand( FB_DATATYPE_INTEGER, rdtype, rdclass, r )
end if
hConvOperand( FB_DATATYPE_INTEGER, rdtype, rdclass, r )
else
if( (intrank < rrank) and (rrank < uintrank) ) then
hConvOperand( FB_DATATYPE_UINT, rdtype, rdclass, r )
Expand Down Expand Up @@ -1333,11 +1308,9 @@ function astNewBOP _

if( typeGetDtAndPtrOnly( rdtype ) <> FB_DATATYPE_INTEGER ) then
if( typeGetDtAndPtrOnly( rdtype ) <> FB_DATATYPE_UINT ) then
If rdtype<>FB_DATATYPE_LONG and rdtype<>FB_DATATYPE_ULONG then
rdtype = typeJoin( rdtype, FB_DATATYPE_INTEGER )
r = astNewCONV( rdtype, NULL, r )
rdclass = FB_DATACLASS_INTEGER
end if
rdtype = typeJoin( rdtype, FB_DATATYPE_INTEGER )
r = astNewCONV( rdtype, NULL, r )
rdclass = FB_DATACLASS_INTEGER
end if
end if
end select
Expand Down

0 comments on commit b4bea3e

Please sign in to comment.