ispc / ispc

Intel® Implicit SPMD Program Compiler
BSD 3-Clause "New" or "Revised" License
2.52k stars 315 forks source link

Codegen for varying bytes #2901

Open nurmukhametov opened 5 months ago

nurmukhametov commented 5 months ago

Consider two examples that are same but the second one generates better code:

void SetByte1(int8& dest, int8 src)
{
    dest = src;
}

void SetByte2(int8& dest, int8 src) {
    varying bool mask = __mask;
    unmasked {
        dest = mask ? src : dest;
    }
}

It is not clear why the compiler is unable to generate same code for the first example. See #2821.

pbrubaker commented 4 months ago

This one is very nice to see!