View Issue Details

IDProjectCategoryView StatusLast Update
0038548FPCCompilerpublic2021-02-26 19:16
Reporterrunewalsh Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
Status newResolutionopen 
Summary0038548: FR: optimize bit testing for numbers, just like for sets
Description"ssi in ss" gives
004015F5 0fa3c3 bt %eax,%ebx

"bm and (1 shl bit)" gives
00401652 b801000000 mov $0x1,%eax
00401657 d3e0 shl %cl,%eax
00401659 21d8 and %ebx,%eax

Could it get compiled into BT too UwU
Steps To Reproducetype
    SmallSetItem = (ItemA, ItemB, ItemC);
    SmallSet = set of SmallSetItem;

    ssi: SmallSetItem;
    ss: SmallSet;
    bit, bm: uint32;

    ss := [ItemA, ItemB];
    if random(1) = 0 then ss += [ItemC];
    ssi := SmallSetItem(random(ord(High(SmallSetItem)) + 1));
    if ssi in ss then writeln('ssi in ss');

    bm := %000;
    if random(1) = 0 then bm := %111;
    bit := random(3);
    if bm and (1 shl bit) <> 0 then writeln('bit in bm');
TagsNo tags attached.
Fixed in Revision
Attached Files


There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2021-02-26 19:16 runewalsh New Issue