https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124419
Bug ID: 124419
Summary: bpf: adjust PROMOTE_MODE and sign/zero extension
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: jemarch at gcc dot gnu.org
Target Milestone: ---
Currently the PROMOTE_MODE macro defined in config/bpf/bpf.h tells GCC to
promote any value less than 64-bit (modes SI, DI, QI) to DI. This is probably
not optimal given that BPF has instructions to do 32-bit arithmetic, in a very
similar way than x86. Some of the insns related to sign extension from/to
register and memory may not be properly defined in bpf.md. In particular, load
instructions sign-extend up to the entire register whereas register move
instructions do so up to the size of the operand, and then zero extend.