[llvm-dev] [iovisor-dev] [PATCH, BPF 5/5] BPF: Add 32-bit and pattern

Richard Henderson via llvm-dev llvm-dev at lists.llvm.org
Thu Jun 16 10:42:30 PDT 2016


On 06/15/2016 10:41 PM, Alexei Starovoitov wrote:
> Do you have further optimizations that take advantage of 32-bit
> subregisters and zero extension?
> Should it be added in more generic way instead of pattern match?

This is the last of the operations that can be implemented with just 64-bit
operands.

A full and proper implementation of 32-bit operations takes quite a bit more
effort.  I started on that one evening last week before realizing quite how
much, and had to put it aside for now.

More important is probably to get signed division working instead of emitting
an error.  I expect it ought to be similar to how Select is expanded, with
multiple blocks:


   if (a < 0)
     a2 = -a
   a3 = phi(a, a2)
   if (b < 0)
     b2 = -b
   b3 = phi(b, b2)
   r = a3 / b3
   if ((a ^ b) < 0)
     r2 = -r
   r3 = phi(r, r2)


r~


More information about the llvm-dev mailing list