View Issue Details

IDProjectCategoryView StatusLast Update
0036845FPCCompilerpublic2020-04-04 23:13
ReporterNoName Assigned ToFlorian  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version3.3.1 
Fixed in Version3.3.1 
Summary0036845: Inefficient code created for BSRqword
DescriptionCompile 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 Reproduceprogram 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
TagsNo tags attached.
Fixed in Revision3.1.1
FPCOldBugId
FPCTarget-
Attached Files

Activities

Florian

2020-04-04 22:30

administrator   ~0121909

Already fixed in trunk. Actually, if you compile with -Oodeadstore in trunk, it gets rid of the complete code.

NoName

2020-04-04 23:13

reporter   ~0121910

Cool, thanks!

Issue History

Date Modified Username Field Change
2020-03-29 15:58 NoName New Issue
2020-04-04 22:30 Florian Assigned To => Florian
2020-04-04 22:30 Florian Status new => resolved
2020-04-04 22:30 Florian Resolution open => fixed
2020-04-04 22:30 Florian Fixed in Version => 3.3.1
2020-04-04 22:30 Florian Fixed in Revision => 3.1.1
2020-04-04 22:30 Florian FPCTarget => -
2020-04-04 22:30 Florian Note Added: 0121909
2020-04-04 23:13 NoName Status resolved => closed
2020-04-04 23:13 NoName Note Added: 0121910