S12Z: gas: Permit "extend" instructions which don't actually extend.

Message ID 20190115184805.23752-1-john@darrington.wattle.id.au
State New
Headers show
Series
  • S12Z: gas: Permit "extend" instructions which don't actually extend.
Related show

Commit Message

John Darrington Jan. 15, 2019, 6:48 p.m.
Other assemblers permit "extending" a register into a register of a
smaller size or the same size.  It doesn't make much sense to do this
but would appear to be a valid instruction.  So change the error to a
warning.

gas/
	* config/tc-s12z.c (tfr): Change as_bad to as_warn.
	Also fix message typo and semantics.
---
 gas/config/tc-s12z.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

-- 
2.11.0

Comments

Nick Clifton Jan. 16, 2019, 11:53 a.m. | #1
Hi John,

> gas/

> 	* config/tc-s12z.c (tfr): Change as_bad to as_warn.

> 	Also fix message typo and semantics.


Approved - please apply.

Cheers
  Nick

Patch

diff --git a/gas/config/tc-s12z.c b/gas/config/tc-s12z.c
index 800db4fe75..e62f3833f1 100644
--- a/gas/config/tc-s12z.c
+++ b/gas/config/tc-s12z.c
@@ -1317,16 +1317,11 @@  tfr (const struct instruction *insn)
   if (!lex_reg_name (~0, &reg2))
     goto fail;
 
-  if ((0 == strcasecmp ("sex", insn->name))
-      || (0 == strcasecmp ("zex", insn->name)))
-    {
-      if (registers[reg1].bytes >= registers[reg2].bytes)
-	{
-	  as_bad (_("Source register for %s must be smaller that the destination register"),
-		  insn->name);
-	  goto fail;
-	}
-    }
+  if ( ((0 == strcasecmp ("sex", insn->name))
+        || (0 == strcasecmp ("zex", insn->name)))
+       && (registers[reg2].bytes <= registers[reg1].bytes))
+      as_warn (_("Source register for %s is no larger than the destination register"),
+               insn->name);
 
   char *f = s12z_new_insn (1 + insn->page);
   if (insn->page == 2)