Inefficient code created for BSRqword
Original Reporter info from Mantis: urhen
-
Reporter name: NoName
Original Reporter info from Mantis: urhen
- Reporter name: NoName
Description:
Compile code below with fpc -MDelphi -O3 x.pas and check the emitted assembly
- for 2 it emits:
call fpc_initializeunits
movl $2,%eax <-- not needed
movl $1,%eax
call fpc_do_exit
- for 0 it emits:
call fpc_initializeunits
xorl %eax,%eax
movl $255,%eax
call fpc_do_exit
Steps to reproduce:
program x;
{$APPTYPE CONSOLE}
uses
SysUtils;
var
i: QWord;
j: cardinal;
begin
i := 2;
j := BSRqword(i);
end.
Additional information:
- tested with FPC 3.2.0-beta-r43619 but it's not possible to select 3.2 in Product Version
- BSRdword creates code as expected:
- for 2 it emits:
call fpc_initializeunits
movl $1,%eax
call fpc_do_exit
- for 0 it emits:
call fpc_initializeunits
movl $255,%eax
call fpc_do_exit
Mantis conversion info:
- Mantis ID: 36845
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 3.1.1