From ba48c47be52907e872d3aed50406986979e2358b Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 24 Mar 2011 04:20:10 +0000 Subject: [PATCH] gas: blackfin: catch invalid register combinations with SEARCH/BITMUX The destination registers for SEARCH cannot be the same. Same rule for the source registers for BITMUX. Signed-off-by: Mike Frsyinger --- gas/ChangeLog | 6 ++++++ gas/config/bfin-parse.y | 6 ++++++ gas/testsuite/ChangeLog | 5 +++++ gas/testsuite/gas/bfin/expected_errors.l | 2 ++ gas/testsuite/gas/bfin/expected_errors.s | 3 +++ 5 files changed, 22 insertions(+) diff --git a/gas/ChangeLog b/gas/ChangeLog index 3112924c850..e283ac511c2 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2011-03-23 Mike Frysinger + + * config/bfin-parse.y (SEARCH): Return yyerror when dest reg $2 is + the same as dest reg $4. + (BITMUX): Return yyerror when dest reg $3 is the same as dest reg $5. + 2011-03-23 Eric B. Weddington * config/tc-avr.c (mcu_types): Add new xmega devices: atxmega64a1u, diff --git a/gas/config/bfin-parse.y b/gas/config/bfin-parse.y index c43d1b35d12..fcc2ee8b0f8 100644 --- a/gas/config/bfin-parse.y +++ b/gas/config/bfin-parse.y @@ -868,6 +868,9 @@ asm_1: } | LPAREN REG COMMA REG RPAREN ASSIGN SEARCH REG LPAREN searchmod RPAREN { + if (REG_SAME ($2, $4)) + return yyerror ("Illegal dest register combination"); + if (IS_DREG ($2) && IS_DREG ($4) && IS_DREG ($8)) { notethat ("dsp32alu: (dregs , dregs ) = SEARCH dregs (searchmod)\n"); @@ -2388,6 +2391,9 @@ asm_1: | BITMUX LPAREN REG COMMA REG COMMA REG_A RPAREN asr_asl { + if (REG_SAME ($3, $5)) + return yyerror ("Illegal source register combination"); + if (IS_DREG ($3) && IS_DREG ($5) && !IS_A1 ($7)) { notethat ("dsp32shift: BITMUX (dregs , dregs , A0) (ASR)\n"); diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 352966dc185..32073628d02 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-03-23 Mike Frysinger + + * gas/bfin/expected_errors.s: Add invalid SEARCH/BITMUX insns. + * gas/bfin/expected_errors.l: Add expected errors. + 2011-03-18 Alan Modra * gas/elf/bad-size.err: Adjust expected error. diff --git a/gas/testsuite/gas/bfin/expected_errors.l b/gas/testsuite/gas/bfin/expected_errors.l index 25cb6905429..09bfd7fd683 100644 --- a/gas/testsuite/gas/bfin/expected_errors.l +++ b/gas/testsuite/gas/bfin/expected_errors.l @@ -90,3 +90,5 @@ .*:113: Error: Preg expected in address. Input text was \). .*:114: Error: Preg expected in address. Input text was \). .*:115: Error: Dreg expected for destination operand. Input text was \). +.*:117: Error: Illegal dest register combination. Input text was \). +.*:118: Error: Illegal source register combination. Input text was \). diff --git a/gas/testsuite/gas/bfin/expected_errors.s b/gas/testsuite/gas/bfin/expected_errors.s index 812c2d9b5ae..0cea5ffe404 100644 --- a/gas/testsuite/gas/bfin/expected_errors.s +++ b/gas/testsuite/gas/bfin/expected_errors.s @@ -113,3 +113,6 @@ R2 = B [ R0 ++ ] (X); R2 = B [ I0 ++ ] (X); P2 = B [ P0 ++ ] (X); + + (R3, R3) = SEARCH R0 (GE); + BITMUX (R4, R4, A0) (ASR); -- 2.30.2