From: Alexei Starovoitov <a...@fb.com>
Date: Tue, 25 Apr 2017 22:31:06 -0700

> On 4/25/17 8:38 PM, David Miller wrote:
> jgt/jge/jsgt/sge was a stumbling block for me as well,
> since it still takes me longer than necessary to disambiguate
> into > vs >= and signed/unsigned

I had this problem while writing Sparc JIT :)

> Though I think Daniel still prefers old classic bpf asm ;)

I do too.

> Anyway, back to the question...
> since BFD and GCC are so much entrenched into canonical style
> of asm code, I don't mind that gnu toolchain will be using it.

Ok.  All data flows from right to left in the instructions so it will
be familiar for x86 assembler hackers.

> I like that you used 'dw' in 'ldxdw' instead of just 'd'
> though 'x' can probably be dropped.

Ok, dropped.

> 'x' should be added here instead:
>  { "stb", BPF_OPC_ST    | BPF_OPC_MEM  | BPF_OPC_B, "[1+O],i" },
>  { "stb", BPF_OPC_STX   | BPF_OPC_MEM  | BPF_OPC_B, "[1+O],2" },

The 'x' really isn't necessary, I would say.  Assembler can tell from
context whether immediate or register variant is wanted and thus:

        stb     [r1+8], 2
        stb     [r1+8], r4

are both assembled correctly.

Reply via email to