On Tue, 2024-01-16 at 09:47 -0800, Alexei Starovoitov wrote: [...] > 2. > case 'w': > if (Size == 32 && HasAlu32) > > This is probably unnecessary as well. > When bpf programmer specifies 'w' constraint, llvm should probably use it > regardless of alu32 flag. > > aarch64 has this comment: > case 'x': > case 'w': > // For now assume that the person knows what they're > // doing with the modifier. > return true; > > I'm reading it as the constraint is a final decision. > Inline assembly shouldn't change with -mcpu flags. llvm-mc -arch=bpf -mcpu=v2 compiles the asm below w/o warnings: .text .file "test-asm-shifts.c" .globl foo .p2align 3 .type foo,@function foo: call bar w0 += 1 exit .Lfunc_end0: .size foo, .Lfunc_end0-foo However, clang would complain about "w" constraint when used for inline assembly when CPUv2 is used: error: couldn't allocate input reg for constraint 'w' As Yonghong notes in the sibling thread, this would probably require enabling 32-bit sub-registers for CPUv2. Will need some time to investigate.