https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121419

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |bpf

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
  _40 = __builtin_clz (x_39);

So LLVM inlines clz always while GCC calls out to a function if the target does
not have the optab defined.

Now the bpf backend could define an optab that expands it which is very large
to begin with:
```
        w2 = w1
        w2 >>= 1
        w1 |= w2
        w2 = w1
        w2 >>= 2
        w1 |= w2
        w2 = w1
        w2 >>= 4
        w1 |= w2
        w2 = w1
        w2 >>= 8
        w1 |= w2
        w2 = w1
        w2 >>= 16
        w1 |= w2
        w1 ^= -1
        w2 = w1
        w2 >>= 1
        w2 &= 1431655765
        w1 -= w2
        w0 = w1
        w0 &= 858993459
        w1 >>= 2
        w1 &= 858993459
        w0 += w1
        w1 = w0
        w1 >>= 4
        w0 += w1
        w0 &= 252645135
        w0 *= 16843009
        w0 >>= 24
```


This is why GCC does not inline it if the target does not implement the optab
and has it in the libgcc.

Reply via email to