diff options
author | Mike Frysinger <vapier@gentoo.org> | 2010-10-15 20:44:46 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2010-10-15 20:44:46 +0000 |
commit | e1791cb8b5fa2b3688101452b11420908224f9bc (patch) | |
tree | 0ed20111dcc0b796c0bd3bdfc39966ee0758e534 | |
parent | 6ccfe592c6fa585688b4be29561e3eb762e77eec (diff) | |
download | gdb-e1791cb8b5fa2b3688101452b11420908224f9bc.zip gdb-e1791cb8b5fa2b3688101452b11420908224f9bc.tar.gz gdb-e1791cb8b5fa2b3688101452b11420908224f9bc.tar.bz2 |
gas: blackfin: fix encoding of BYTEOP2M insn
The BYTEOP2M parser incorrectly calls BYTEOP2P to generate the opcode.
Once we've fixed that, it's easy to see that the disassembler also likes
to decode this insn incorrectly. So fix that and then add some tests.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r-- | gas/ChangeLog | 4 | ||||
-rw-r--r-- | gas/config/bfin-parse.y | 4 | ||||
-rw-r--r-- | gas/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gas/testsuite/gas/bfin/video.d | 10 | ||||
-rw-r--r-- | gas/testsuite/gas/bfin/video.s | 12 | ||||
-rw-r--r-- | gas/testsuite/gas/bfin/video2.d | 24 | ||||
-rwxr-xr-x | gas/testsuite/gas/bfin/video2.s | 46 | ||||
-rw-r--r-- | opcodes/ChangeLog | 4 | ||||
-rw-r--r-- | opcodes/bfin-dis.c | 16 |
9 files changed, 115 insertions, 10 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index d85deb6..8271f91 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,7 @@ +2010-10-15 Mike Frysinger <vapier@gentoo.org> + + * config/bfin-parse.y (BYTEOP2M): Call BYTEOP2M(). + 2010-10-14 H.J. Lu <hongjiu.lu@intel.com> * config/tc-i386.c (match_template): Check checkregsize diff --git a/gas/config/bfin-parse.y b/gas/config/bfin-parse.y index c34e84c..fa7ca34 100644 --- a/gas/config/bfin-parse.y +++ b/gas/config/bfin-parse.y @@ -1064,8 +1064,8 @@ asm_1: return yyerror ("Bad dreg pair"); else { - notethat ("dsp32alu: dregs = BYTEOP2P (dregs_pair , dregs_pair ) (rnd_op)\n"); - $$ = DSP32ALU (22, $13.r0, 0, &$1, &$5, &$9, $13.s0, 0, $13.x0); + notethat ("dsp32alu: dregs = BYTEOP2M (dregs_pair , dregs_pair ) (rnd_op)\n"); + $$ = DSP32ALU (22, $13.r0, 0, &$1, &$5, &$9, $13.s0, $13.x0, $13.aop + 2); } } diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 3000ee6..96152a3 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2010-10-15 Mike Frysinger <vapier@gentoo.org> + * gas/bfin/video.s: Add BYTEOP2M insns. + * gas/bfin/video.d, gas/bfin/video2.s, gas/bfin/video2.d: Likewise. + +2010-10-15 Mike Frysinger <vapier@gentoo.org> + * gas/bfin/video.d: Change addresses to regexps. * gas/bfin/video2.d: Likewise. diff --git a/gas/testsuite/gas/bfin/video.d b/gas/testsuite/gas/bfin/video.d index 0fafc06..ce7362d 100644 --- a/gas/testsuite/gas/bfin/video.d +++ b/gas/testsuite/gas/bfin/video.d @@ -40,6 +40,16 @@ Disassembly of section .text: [ 0-9a-f]+: 16 c4 02 6c R6 = BYTEOP2P \(R1:0, R3:2\) \(TL, R\); [ 0-9a-f]+: 36 c4 02 6e R7 = BYTEOP2P \(R1:0, R3:2\) \(TH, R\); +[0-9a-f]+ <byteop2m>: +[ 0-9a-f]+: 16 c4 02 80 R0 = BYTEOP2M \(R1:0, R3:2\) \(RNDL\); +[ 0-9a-f]+: 36 c4 02 82 R1 = BYTEOP2M \(R1:0, R3:2\) \(RNDH\); +[ 0-9a-f]+: 16 c4 02 c4 R2 = BYTEOP2M \(R1:0, R3:2\) \(TL\); +[ 0-9a-f]+: 36 c4 02 c6 R3 = BYTEOP2M \(R1:0, R3:2\) \(TH\); +[ 0-9a-f]+: 16 c4 02 a8 R4 = BYTEOP2M \(R1:0, R3:2\) \(RNDL, R\); +[ 0-9a-f]+: 36 c4 02 aa R5 = BYTEOP2M \(R1:0, R3:2\) \(RNDH, R\); +[ 0-9a-f]+: 16 c4 02 ec R6 = BYTEOP2M \(R1:0, R3:2\) \(TL, R\); +[ 0-9a-f]+: 36 c4 02 ee R7 = BYTEOP2M \(R1:0, R3:2\) \(TH, R\); + [0-9a-f]+ <bytepack>: [ 0-9a-f]+: 18 c4 03 0a R5 = BYTEPACK \(R0, R3\); diff --git a/gas/testsuite/gas/bfin/video.s b/gas/testsuite/gas/bfin/video.s index b53eb6c..a3f34c0 100644 --- a/gas/testsuite/gas/bfin/video.s +++ b/gas/testsuite/gas/bfin/video.s @@ -49,6 +49,18 @@ byteop2p: R7 = byteop2p (r1:0, R3:2) (TH, r); .text + .global byteop2m +byteop2m: + R0 = BYTEOP2M (R1:0, R3:2) (RNDL); + r1 = byteop2m (r1:0, r3:2) (rndh); + R2 = Byteop2m (R1:0, R3:2) (tL); + R3 = Byteop2m (r1:0, r3:2) (TH); + r4 = ByTEOP2M (r1:0, R3:2) (Rndl, R); + R5 = byTeOp2m (R1:0, r3:2) (rndH, r); + r6 = BYTEop2m (r1:0, r3:2) (tl, R); + R7 = byteop2m (r1:0, R3:2) (TH, r); + + .text .global bytepack bytepack: R5 = BytePack (R0, R3); diff --git a/gas/testsuite/gas/bfin/video2.d b/gas/testsuite/gas/bfin/video2.d index b9830d9..ed5d2fd 100644 --- a/gas/testsuite/gas/bfin/video2.d +++ b/gas/testsuite/gas/bfin/video2.d @@ -103,6 +103,30 @@ Disassembly of section .text: [ 0-9a-f]+: 36 c4 12 2a R5 = BYTEOP2P \(R3:2, R3:2\) \(RNDH, R\); [ 0-9a-f]+: 16 c4 12 6c R6 = BYTEOP2P \(R3:2, R3:2\) \(TL, R\); [ 0-9a-f]+: 36 c4 12 6e R7 = BYTEOP2P \(R3:2, R3:2\) \(TH, R\); +[ 0-9a-f]+: 16 c4 02 86 R3 = BYTEOP2M \(R1:0, R3:2\) \(RNDL\); +[ 0-9a-f]+: 36 c4 02 86 R3 = BYTEOP2M \(R1:0, R3:2\) \(RNDH\); +[ 0-9a-f]+: 16 c4 02 c6 R3 = BYTEOP2M \(R1:0, R3:2\) \(TL\); +[ 0-9a-f]+: 36 c4 02 c6 R3 = BYTEOP2M \(R1:0, R3:2\) \(TH\); +[ 0-9a-f]+: 16 c4 02 a6 R3 = BYTEOP2M \(R1:0, R3:2\) \(RNDL, R\); +[ 0-9a-f]+: 36 c4 02 a6 R3 = BYTEOP2M \(R1:0, R3:2\) \(RNDH, R\); +[ 0-9a-f]+: 16 c4 02 e6 R3 = BYTEOP2M \(R1:0, R3:2\) \(TL, R\); +[ 0-9a-f]+: 36 c4 02 e6 R3 = BYTEOP2M \(R1:0, R3:2\) \(TH, R\); +[ 0-9a-f]+: 16 c4 02 80 R0 = BYTEOP2M \(R1:0, R3:2\) \(RNDL\); +[ 0-9a-f]+: 36 c4 02 82 R1 = BYTEOP2M \(R1:0, R3:2\) \(RNDH\); +[ 0-9a-f]+: 16 c4 02 c4 R2 = BYTEOP2M \(R1:0, R3:2\) \(TL\); +[ 0-9a-f]+: 36 c4 02 c6 R3 = BYTEOP2M \(R1:0, R3:2\) \(TH\); +[ 0-9a-f]+: 16 c4 02 a8 R4 = BYTEOP2M \(R1:0, R3:2\) \(RNDL, R\); +[ 0-9a-f]+: 36 c4 02 aa R5 = BYTEOP2M \(R1:0, R3:2\) \(RNDH, R\); +[ 0-9a-f]+: 16 c4 02 ec R6 = BYTEOP2M \(R1:0, R3:2\) \(TL, R\); +[ 0-9a-f]+: 36 c4 02 ee R7 = BYTEOP2M \(R1:0, R3:2\) \(TH, R\); +[ 0-9a-f]+: 16 c4 12 80 R0 = BYTEOP2M \(R3:2, R3:2\) \(RNDL\); +[ 0-9a-f]+: 36 c4 12 82 R1 = BYTEOP2M \(R3:2, R3:2\) \(RNDH\); +[ 0-9a-f]+: 16 c4 12 c4 R2 = BYTEOP2M \(R3:2, R3:2\) \(TL\); +[ 0-9a-f]+: 36 c4 12 c6 R3 = BYTEOP2M \(R3:2, R3:2\) \(TH\); +[ 0-9a-f]+: 16 c4 12 a8 R4 = BYTEOP2M \(R3:2, R3:2\) \(RNDL, R\); +[ 0-9a-f]+: 36 c4 12 aa R5 = BYTEOP2M \(R3:2, R3:2\) \(RNDH, R\); +[ 0-9a-f]+: 16 c4 12 ec R6 = BYTEOP2M \(R3:2, R3:2\) \(TL, R\); +[ 0-9a-f]+: 36 c4 12 ee R7 = BYTEOP2M \(R3:2, R3:2\) \(TH, R\); [ 0-9a-f]+: 18 c4 00 00 R0 = BYTEPACK \(R0, R0\); [ 0-9a-f]+: 18 c4 13 02 R1 = BYTEPACK \(R2, R3\); [ 0-9a-f]+: 18 c4 2e 08 R4 = BYTEPACK \(R5, R6\); diff --git a/gas/testsuite/gas/bfin/video2.s b/gas/testsuite/gas/bfin/video2.s index 22fb50f..1d27c56 100755 --- a/gas/testsuite/gas/bfin/video2.s +++ b/gas/testsuite/gas/bfin/video2.s @@ -159,6 +159,52 @@ r5 = byteop2p (r3:2, r3:2) (rndh, r) ; r6 = byteop2p (r3:2, r3:2) (tl, r) ; r7 = byteop2p (r3:2, r3:2) (th, r) ; +/* forward byte order operands */ +//Dreg = BYTEOP2M (Dreg_pair, Dreg_pair) (RNDL) ; +/* round into low bytes (b) */ +//Dreg = BYTEOP2M (Dreg_pair, Dreg_pair) (RNDH) ; +/* round into high bytes (b) */ +//Dreg = BYTEOP2M (Dreg_pair, Dreg_pair) (TL) ; +/* truncate into low bytes (b) */ +//Dreg = BYTEOP2M (Dreg_pair, Dreg_pair) (TH) ; +/* truncate into high bytes (b) */ +/* reverse byte order operands */ +//Dreg = BYTEOP2M (Dreg_pair, Dreg_pair) (RNDL, R) ; +/* round into low bytes (b) */ +//Dreg = BYTEOP2M (Dreg_pair, Dreg_pair) (RNDH, R) ; +/* round into high bytes (b) */ +//Dreg = BYTEOP2M (Dreg_pair, Dreg_pair) (TL, R) ; +/* truncate into low bytes (b) */ +//Dreg = BYTEOP2M (Dreg_pair, Dreg_pair) (TH, R) ; +/* truncate into high bytes (b) */ + +r3 = byteop2m (r1:0, r3:2) (rndl) ; +r3 = byteop2m (r1:0, r3:2) (rndh) ; +r3 = byteop2m (r1:0, r3:2) (tl) ; +r3 = byteop2m (r1:0, r3:2) (th) ; +r3 = byteop2m (r1:0, r3:2) (rndl, r) ; +r3 = byteop2m (r1:0, r3:2) (rndh, r) ; +r3 = byteop2m (r1:0, r3:2) (tl, r) ; +r3 = byteop2m (r1:0, r3:2) (th, r) ; + +r0 = byteop2m (r1:0, r3:2) (rndl) ; +r1 = byteop2m (r1:0, r3:2) (rndh) ; +r2 = byteop2m (r1:0, r3:2) (tl) ; +r3 = byteop2m (r1:0, r3:2) (th) ; +r4 = byteop2m (r1:0, r3:2) (rndl, r) ; +r5 = byteop2m (r1:0, r3:2) (rndh, r) ; +r6 = byteop2m (r1:0, r3:2) (tl, r) ; +r7 = byteop2m (r1:0, r3:2) (th, r) ; + +r0 = byteop2m (r3:2, r3:2) (rndl) ; +r1 = byteop2m (r3:2, r3:2) (rndh) ; +r2 = byteop2m (r3:2, r3:2) (tl) ; +r3 = byteop2m (r3:2, r3:2) (th) ; +r4 = byteop2m (r3:2, r3:2) (rndl, r) ; +r5 = byteop2m (r3:2, r3:2) (rndh, r) ; +r6 = byteop2m (r3:2, r3:2) (tl, r) ; +r7 = byteop2m (r3:2, r3:2) (th, r) ; + //Dreg = BYTEPACK ( Dreg, Dreg ) ; /* (b) */ r0 = bytepack (r0,r0) ; r1 = bytepack (r2,r3) ; diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 668eeb7..98dedc3 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,7 @@ +2010-10-15 Mike Frysinger <vapier@gentoo.org> + + * bfin-dis.c (decode_dsp32alu_0): Call imm5d() for BYTEOP2M. + 2010-10-14 H.J. Lu <hongjiu.lu@intel.com> * i386-opc.tbl: Remove CheckRegSize from movq. diff --git a/opcodes/bfin-dis.c b/opcodes/bfin-dis.c index 0aec087..ebacd46 100644 --- a/opcodes/bfin-dis.c +++ b/opcodes/bfin-dis.c @@ -3388,11 +3388,11 @@ decode_dsp32alu_0 (TIword iw0, TIword iw1, disassemble_info *outf) OUTS (outf, " = BYTEOP2M ("); OUTS (outf, dregs (src0 + 1)); OUTS (outf, ":"); - OUTS (outf, imm5 (src0)); + OUTS (outf, imm5d (src0)); OUTS (outf, ", "); OUTS (outf, dregs (src1 + 1)); OUTS (outf, ":"); - OUTS (outf, imm5 (src1)); + OUTS (outf, imm5d (src1)); OUTS (outf, ") (TH"); if (s == 1) OUTS (outf, ", R)"); @@ -3405,11 +3405,11 @@ decode_dsp32alu_0 (TIword iw0, TIword iw1, disassemble_info *outf) OUTS (outf, " = BYTEOP2M ("); OUTS (outf, dregs (src0 + 1)); OUTS (outf, ":"); - OUTS (outf, imm5 (src0)); + OUTS (outf, imm5d (src0)); OUTS (outf, ", "); OUTS (outf, dregs (src1 + 1)); OUTS (outf, ":"); - OUTS (outf, imm5 (src1)); + OUTS (outf, imm5d (src1)); OUTS (outf, ") (TL"); if (s == 1) OUTS (outf, ", R)"); @@ -3422,11 +3422,11 @@ decode_dsp32alu_0 (TIword iw0, TIword iw1, disassemble_info *outf) OUTS (outf, " = BYTEOP2M ("); OUTS (outf, dregs (src0 + 1)); OUTS (outf, ":"); - OUTS (outf, imm5 (src0)); + OUTS (outf, imm5d (src0)); OUTS (outf, ", "); OUTS (outf, dregs (src1 + 1)); OUTS (outf, ":"); - OUTS (outf, imm5 (src1)); + OUTS (outf, imm5d (src1)); OUTS (outf, ") (RNDH"); if (s == 1) OUTS (outf, ", R)"); @@ -3439,11 +3439,11 @@ decode_dsp32alu_0 (TIword iw0, TIword iw1, disassemble_info *outf) OUTS (outf, " = BYTEOP2M ("); OUTS (outf, dregs (src0 + 1)); OUTS (outf, ":"); - OUTS (outf, imm5 (src0)); + OUTS (outf, imm5d (src0)); OUTS (outf, ", "); OUTS (outf, dregs (src1 + 1)); OUTS (outf, ":"); - OUTS (outf, imm5 (src1)); + OUTS (outf, imm5d (src1)); OUTS (outf, ") (RNDL"); if (s == 1) OUTS (outf, ", R)"); |