From 953b9fd37aec20602486b04ba703675d6b3dca78 Mon Sep 17 00:00:00 2001 From: Yonghong Song Date: Wed, 4 Oct 2017 16:11:52 +0000 Subject: [PATCH] bpf: fix an insn encoding issue for neg insn Signed-off-by: Yonghong Song git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314911 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/BPF/BPFInstrInfo.td | 2 -- test/MC/BPF/insn-unit-32.s | 2 +- test/MC/BPF/insn-unit.s | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/Target/BPF/BPFInstrInfo.td b/lib/Target/BPF/BPFInstrInfo.td index 7d4b03deebe..fcd6a604537 100644 --- a/lib/Target/BPF/BPFInstrInfo.td +++ b/lib/Target/BPF/BPFInstrInfo.td @@ -238,9 +238,7 @@ class NEG_RR pattern> : TYPE_ALU_JMP { bits<4> dst; - bits<4> src; - let Inst{55-52} = src; let Inst{51-48} = dst; let BPFClass = Class; } diff --git a/test/MC/BPF/insn-unit-32.s b/test/MC/BPF/insn-unit-32.s index e5911f04cd0..6890b260c02 100644 --- a/test/MC/BPF/insn-unit-32.s +++ b/test/MC/BPF/insn-unit-32.s @@ -7,7 +7,7 @@ w1 -= w2 // BPF_SUB | BPF_X w2 *= w3 // BPF_MUL | BPF_X w3 /= w4 // BPF_DIV | BPF_X -// CHECK: 84 11 00 00 00 00 00 00 w1 = -w1 +// CHECK: 84 01 00 00 00 00 00 00 w1 = -w1 // CHECK: 0c 10 00 00 00 00 00 00 w0 += w1 // CHECK: 1c 21 00 00 00 00 00 00 w1 -= w2 // CHECK: 2c 32 00 00 00 00 00 00 w2 *= w3 diff --git a/test/MC/BPF/insn-unit.s b/test/MC/BPF/insn-unit.s index 68b646262ea..a750facb8b9 100644 --- a/test/MC/BPF/insn-unit.s +++ b/test/MC/BPF/insn-unit.s @@ -118,7 +118,7 @@ // CHECK: 3f 43 00 00 00 00 00 00 r3 /= r4 Llabel0 : - r0 = -r0 // BPF_NEG + r2 = -r2 // BPF_NEG r4 |= r5 // BPF_OR | BPF_X r5 &= r6 // BPF_AND | BPF_X r6 <<= r7 // BPF_LSH | BPF_X @@ -127,7 +127,7 @@ Llabel0 : r9 = r10 // BPF_MOV | BPF_X r10 s>>= r0 // BPF_ARSH | BPF_X // CHECK:Llabel0: -// CHECK: 87 00 00 00 00 00 00 00 r0 = -r0 +// CHECK: 87 02 00 00 00 00 00 00 r2 = -r2 // CHECK: 4f 54 00 00 00 00 00 00 r4 |= r5 // CHECK: 5f 65 00 00 00 00 00 00 r5 &= r6 // CHECK: 6f 76 00 00 00 00 00 00 r6 <<= r7 -- 2.40.0