gas/
authorJan Beulich <jbeulich@novell.com>
Mon, 31 Jan 2005 10:01:02 +0000 (10:01 +0000)
committerJan Beulich <jbeulich@novell.com>
Mon, 31 Jan 2005 10:01:02 +0000 (10:01 +0000)
2005-01-31  Jan Beulich  <jbeulich@novell.com>

* config/tc-ia64.c (parse_operands): Parse all specified operands,
immediately discarding (but counting) those exceeding the maximum
possible amount. Track whether output and input operand counts ever
matched, and use this to better indicate which of the operands/
operand types was wrong; specifically don't default to pointing to
the first operand.

gas/testsuite/
2005-01-31  Jan Beulich  <jbeulich@novell.com>

* gas/ia64/operands.[ls]: New.
* gas/ia64/ia64.exp: Run new test.

gas/ChangeLog
gas/config/tc-ia64.c
gas/testsuite/ChangeLog
gas/testsuite/gas/ia64/ia64.exp
gas/testsuite/gas/ia64/operands.l [new file with mode: 0644]
gas/testsuite/gas/ia64/operands.s [new file with mode: 0644]

index 0af5769087b3b1d866ac4d08f25e1face911015e..c110fafd013338d7e581ff1bc42fdadb00e94fc8 100644 (file)
@@ -1,3 +1,12 @@
+2005-01-31  Jan Beulich  <jbeulich@novell.com>
+
+       * config/tc-ia64.c (parse_operands): Parse all specified operands,
+       immediately discarding (but counting) those exceeding the maximum
+       possible amount. Track whether output and input operand counts ever
+       matched, and use this to better indicate which of the operands/
+       operand types was wrong; specifically don't default to pointing to
+       the first operand.
+
 2005-01-31  Jan Beulich  <jbeulich@novell.com>
 
        * config/tc-ia64.c (unwind): Remove proc_end (now an automatic
index 7d87cc538b6fce486748db998384fcbe81a3f681..f6a60028d9f573d42b5b22ffeb51952f01fec3ff 100644 (file)
@@ -5956,11 +5956,22 @@ parse_operands (idesc)
       ++num_outputs;
     }
 
-  for (; i < NELEMS (CURR_SLOT.opnd); ++i)
+  for (; ; ++i)
     {
-      sep = parse_operand (CURR_SLOT.opnd + i);
-      if (CURR_SLOT.opnd[i].X_op == O_absent)
-       break;
+      if (i < NELEMS (CURR_SLOT.opnd)) 
+       {
+         sep = parse_operand (CURR_SLOT.opnd + i);
+         if (CURR_SLOT.opnd[i].X_op == O_absent)
+           break;
+       }
+      else
+       {
+         expressionS dummy;
+
+         sep = parse_operand (&dummy);
+         if (dummy.X_op == O_absent)
+           break;
+       }
 
       ++num_operands;
 
@@ -6014,14 +6025,22 @@ parse_operands (idesc)
        }
     }
 
-  highest_unmatched_operand = 0;
+  highest_unmatched_operand = -4;
   curr_out_of_range_pos = -1;
   error_pos = 0;
-  expected_operand = idesc->operands[0];
   for (; idesc; idesc = get_next_opcode (idesc))
     {
       if (num_outputs != idesc->num_outputs)
        continue;               /* mismatch in # of outputs */
+      if (highest_unmatched_operand < 0)
+       highest_unmatched_operand |= 1;
+      if (num_operands > NELEMS (idesc->operands)
+         || (num_operands < NELEMS (idesc->operands)
+          && idesc->operands[num_operands])
+         || (num_operands > 0 && !idesc->operands[num_operands - 1]))
+       continue;               /* mismatch in number of arguments */
+      if (highest_unmatched_operand < 0)
+       highest_unmatched_operand |= 2;
 
       CURR_SLOT.num_fixups = 0;
 
@@ -6074,10 +6093,6 @@ parse_operands (idesc)
          continue;
        }
 
-      if (num_operands < NELEMS (idesc->operands)
-         && idesc->operands[num_operands])
-       continue;               /* mismatch in number of arguments */
-
       break;
     }
   if (!idesc)
@@ -6086,6 +6101,10 @@ parse_operands (idesc)
        as_bad ("Operand %u of `%s' should be %s",
                error_pos + 1, mnemonic,
                elf64_ia64_operands[expected_operand].desc);
+      else if (highest_unmatched_operand < 0 && !(highest_unmatched_operand & 1))
+       as_bad ("Wrong number of output operands");
+      else if (highest_unmatched_operand < 0 && !(highest_unmatched_operand & 2))
+       as_bad ("Wrong number of input operands");
       else
        as_bad ("Operand mismatch");
       return 0;
index 353e3ffa121de67c919a95c6ed519fb298ad5454..860a9a9e7dac93dc37435b46e7b76455e53ff9f3 100644 (file)
@@ -1,3 +1,8 @@
+2005-01-31  Jan Beulich  <jbeulich@novell.com>
+
+       * gas/ia64/operands.[ls]: New.
+       * gas/ia64/ia64.exp: Run new test.
+
 2005-01-31  Jan Beulich  <jbeulich@novell.com>
 
        * gas/ia64/proc.[ls]: New.
index c5dc9e122f217cc455e4cb220e52c3c2122c85ea..89c5d20aecb15b119c3875658ea6a18961cb6a29 100644 (file)
@@ -27,6 +27,7 @@ if [istarget "ia64-*"] then {
     run_dump_test "pseudo"
     run_dump_test "nop_x"
     run_dump_test "mov-ar"
+    run_list_test "operands" ""
 
     run_list_test "dv-raw-err" ""
     run_list_test "dv-waw-err" ""
diff --git a/gas/testsuite/gas/ia64/operands.l b/gas/testsuite/gas/ia64/operands.l
new file mode 100644 (file)
index 0000000..440c78b
--- /dev/null
@@ -0,0 +1,5 @@
+.*: Assembler messages:
+.*:3: Error: .* output .*
+.*:4: Error: .* input .*
+.*:5: Error: .* 1 .*
+.*:6: Error: .* 2 .*
diff --git a/gas/testsuite/gas/ia64/operands.s b/gas/testsuite/gas/ia64/operands.s
new file mode 100644 (file)
index 0000000..08f4ec1
--- /dev/null
@@ -0,0 +1,6 @@
+       .text
+_start:
+       zxt1    r1, r2 = r3
+       zxt2    r4 = r5, r6
+       zxt4    p1 = r8
+       sxt1    r7 = 0