nfp: bpf: add missing return in jne_imm optimization
authorJakub Kicinski <jakub.kicinski@netronome.com>
Thu, 12 Oct 2017 17:34:09 +0000 (10:34 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 14 Oct 2017 18:13:28 +0000 (11:13 -0700)
We optimize comparisons to immediate 0 as if (reg.lo | reg.hi).
The early return statement was missing, however, which means we
would generate two comparisons - optimized one followed by a
normal 2x 32 bit compare.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/netronome/nfp/bpf/jit.c

index cf8a6eb3ec9931d22f144cb42885a2eb09ff4d43..5ac834e91aed59cee95e58bf9522abb6d1b068f8 100644 (file)
@@ -1191,6 +1191,7 @@ static int jne_imm(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
                emit_alu(nfp_prog, reg_none(), reg_a(insn->dst_reg * 2),
                         ALU_OP_OR, reg_b(insn->dst_reg * 2 + 1));
                emit_br(nfp_prog, BR_BNE, insn->off, 0);
+               return 0;
        }
 
        tmp_reg = ur_load_imm_any(nfp_prog, imm & ~0U, imm_b(nfp_prog));