Hi! On Thu, Sep 17, 2020 at 10:15:30AM -0700, David Faust via Gcc-patches wrote: > The 'mod' and 'div' operators in eBPF are unsigned, with no signed > counterpart. xBPF adds two new ALU operations, sdiv and smod, for > signed division and modulus, respectively. Update bpf.md with > 'define_insn' blocks for signed div and mod to use them when targetting > xBPF, and add new tests to ensure they are used appropriately.
So why does xBPF have signed versions of the divides? Is it because it is wanted to have it in eBPF eventually? Is it because the libgcc routines are just too slow? Is it because (the generic) libgcc does not trap for MIN_INT / -1 ? Some other reason? (I'm just curious; I cannot figure it out :-) ) Segher