* config/bfin-parse.y (asm_1): Only PREG and DREG are allowed
authorJie Zhang <jie.zhang@analog.com>
Tue, 1 Sep 2009 07:21:42 +0000 (07:21 +0000)
committerJie Zhang <jie.zhang@analog.com>
Tue, 1 Sep 2009 07:21:42 +0000 (07:21 +0000)
in comparison.

testsuite/
* gas/bfin/expected_comparison_errors.s: Add more cases.
* gas/bfin/expected_comparison_errors.l: Update accordingly.

gas/ChangeLog
gas/config/bfin-parse.y
gas/testsuite/ChangeLog
gas/testsuite/gas/bfin/expected_comparison_errors.l
gas/testsuite/gas/bfin/expected_comparison_errors.s

index c4fa8bbd418ac49f936b8fe3af6f74717c1cdcf0..de02970404a0b5f04b66bba145ec4a2014929e45 100644 (file)
@@ -1,3 +1,8 @@
+2009-09-01  Jie Zhang  <jie.zhang@analog.com>
+
+       * config/bfin-parse.y (asm_1): Only PREG and DREG are allowed
+       in comparison.
+
 2009-09-01  Jie Zhang  <jie.zhang@analog.com>
 
        2007-09-28  Bernd Schmidt  <bernd.schmidt@analog.com>
index d22f774b1c850ffcf38038a5f604917f22267a80..66978f7d945995b050bc264a8da84071e74faa21 100644 (file)
@@ -1623,16 +1623,20 @@ asm_1:
        }
        | CCREG ASSIGN REG LESS_THAN REG iu_or_nothing
        {
-         if (REG_CLASS($3) == REG_CLASS($5))
+         if ((IS_DREG ($3) && IS_DREG ($5))
+             || (IS_PREG ($3) && IS_PREG ($5)))
            {
              notethat ("CCflag: CC = dpregs < dpregs\n");
              $$ = CCFLAG (&$3, $5.regno & CODE_MASK, $6.r0, 0, IS_PREG ($3) ? 1 : 0);
            }
          else
-           return yyerror ("Compare only of same register class");
+           return yyerror ("Bad register in comparison");
        }
        | CCREG ASSIGN REG LESS_THAN expr iu_or_nothing
        {
+         if (!IS_DREG ($3) && !IS_PREG ($3))
+           return yyerror ("Bad register in comparison");
+
          if (($6.r0 == 1 && IS_IMM ($5, 3))
              || ($6.r0 == 3 && IS_UIMM ($5, 3)))
            {
@@ -1644,16 +1648,20 @@ asm_1:
        }
        | CCREG ASSIGN REG _ASSIGN_ASSIGN REG
        {
-         if (REG_CLASS($3) == REG_CLASS($5))
+         if ((IS_DREG ($3) && IS_DREG($5))
+             || (IS_PREG ($3) && IS_PREG ($3)))
            {
              notethat ("CCflag: CC = dpregs == dpregs\n");
              $$ = CCFLAG (&$3, $5.regno & CODE_MASK, 0, 0, IS_PREG ($3) ? 1 : 0);
            }
          else
-           return yyerror ("Compare only of same register class");
+           return yyerror ("Bad register in comparison");
        }
        | CCREG ASSIGN REG _ASSIGN_ASSIGN expr
        {
+         if (!IS_DREG ($3) && !IS_PREG ($3))
+           return yyerror ("Bad register in comparison");
+
          if (IS_IMM ($5, 3))
            {
              notethat ("CCflag: CC = dpregs == imm3\n");
@@ -1674,34 +1682,26 @@ asm_1:
        }
        | CCREG ASSIGN REG _LESS_THAN_ASSIGN REG iu_or_nothing
        {
-         if (REG_CLASS($3) == REG_CLASS($5))
+         if ((IS_DREG ($3) && IS_DREG ($5))
+             || (IS_PREG ($3) && IS_PREG ($5)))
            {
-             notethat ("CCflag: CC = pregs <= pregs (..)\n");
+             notethat ("CCflag: CC = dpregs <= dpregs (..)\n");
              $$ = CCFLAG (&$3, $5.regno & CODE_MASK,
                           1 + $6.r0, 0, IS_PREG ($3) ? 1 : 0);
            }
          else
-           return yyerror ("Compare only of same register class");
+           return yyerror ("Bad register in comparison");
        }
        | CCREG ASSIGN REG _LESS_THAN_ASSIGN expr iu_or_nothing
        {
+         if (!IS_DREG ($3) && !IS_PREG ($3))
+           return yyerror ("Bad register in comparison");
+
          if (($6.r0 == 1 && IS_IMM ($5, 3))
              || ($6.r0 == 3 && IS_UIMM ($5, 3)))
            {
-             if (IS_DREG ($3))
-               {
-                 notethat ("CCflag: CC = dregs <= (u)imm3\n");
-                 /*    x       y     opc     I     G   */
-                 $$ = CCFLAG (&$3, imm3 ($5), 1 + $6.r0, 1, 0);
-               }
-             else if (IS_PREG ($3))
-               {
-                 notethat ("CCflag: CC = pregs <= (u)imm3\n");
-                 /*    x       y     opc     I     G   */
-                 $$ = CCFLAG (&$3, imm3 ($5), 1 + $6.r0, 1, 1);
-               }
-             else
-               return yyerror ("Dreg or Preg expected");
+             notethat ("CCflag: CC = dpregs <= (u)imm3\n");
+             $$ = CCFLAG (&$3, imm3 ($5), 1 + $6.r0, 1, IS_PREG ($3) ? 1 : 0);
            }
          else
            return yyerror ("Bad constant value");
index 708912226e790a302b08eceeacaaab57890fc0f7..051d53c3624105d03b1654e3befc3c1550128deb 100644 (file)
@@ -1,3 +1,8 @@
+2009-09-01  Jie Zhang  <jie.zhang@analog.com>
+
+       * gas/bfin/expected_comparison_errors.s: Add more cases.
+       * gas/bfin/expected_comparison_errors.l: Update accordingly.
+
 2009-09-01  Jie Zhang  <jie.zhang@analog.com>
 
        * gas/bfin/stack2.s: Add pop multiple instruction with a label
index 12569f3c11f0362f3430ae5cbefbb14d590cb8b6..0582ecd28143cf34aa77cf7e46d79397faacf919 100644 (file)
@@ -8,9 +8,14 @@
 .*:7: Error: AREGs are in bad order or same. Input text was a0.
 .*:8: Error: AREGs are in bad order or same. Input text was a1.
 .*:9: Error: AREGs are in bad order or same. Input text was a0.
-.*:10: Error: Compare only of same register class. Input text was P0.
-.*:11: Error: Compare only of same register class.
-.*:12: Error: Compare only of same register class.
-.*:13: Error: Compare only of same register class. Input text was R0.
-.*:14: Error: Compare only of same register class.
-.*:15: Error: Compare only of same register class.
+.*:10: Error: Bad register in comparison. Input text was P0.
+.*:11: Error: Bad register in comparison.
+.*:12: Error: Bad register in comparison.
+.*:14: Error: Bad register in comparison.
+.*:15: Error: Bad register in comparison.
+.*:16: Error: Bad register in comparison.
+.*:17: Error: Bad register in comparison. Input text was I0.
+.*:18: Error: Bad register in comparison.
+.*:19: Error: Bad register in comparison.
+.*:20: Error: Bad register in comparison.
+.*:21: Error: Bad register in comparison.
index d08967b2cdfd26db868e3cd2164ef7d0dc382833..99a93596c13178cd153b77e848d04eac251de72b 100644 (file)
@@ -13,3 +13,9 @@
        CC = P0 == R0;
        CC = P0 < R0;
        CC = P0 <= R0;
+       CC = I0 == 0;
+       CC = I0 == I0;
+       CC = I0 < 0;
+       CC = I0 < I0;
+       CC = I0 <= 0;
+       CC = I0 <= I0;
This page took 0.029358 seconds and 4 git commands to generate.