This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PATCH] Fix for ldm/stm instructions in H8S


Hello Nick,

The patch finds many invalid instructions in the testsuite in './testsuite/gas/h8300/t01_mov.s'. So because of that it generates many FAILS.


However, H8SX supports many register pairs in ldm/stm instructions which are not supported in H8S. For this reason, I have removed test to check register pair validity in this patch. I will create separate patch for register pair's test for ldm/stm instructions as it will involve changes in the testsuite as well.

Please find updated patch as below which tests for operands in ldm/stm instructions. I have tested it with binutils-031111 testsuite and found ok.

Regards,
Asgari Jinia

--------------- start of patch ------------------------------------

2003-11-14  Asgari Jinia  <asgarij@kpitcummins.com>

	* config/tc-h8300.c (md_assemble): Check operands validity for
	ldm/stm.



--- ./config/tc-h8300.c.old	2003-10-17 15:53:34.000000000 +0530
+++ ./config/tc-h8300.c	2003-11-14 15:38:32.000000000 +0530
@@ -1965,6 +1965,32 @@ md_assemble (str)
   *op_end = c;
   prev_instruction = instruction;
 
+  /* Now we have operands from instuction.  Let's check them out for
+     ldm and stm.  */
+  if (OP_KIND (instruction->opcode->how) == O_LDM)
+    {
+      /* The first operand must be @er7+, and the second operand must
+          be a register pair.  */
+      if ((operand[0].mode != RSINC)
+           || (operand[0].reg != 7)
+           || ((operand[1].reg & 0x80000000) == 0))
+        {
+          as_bad (_("invalid operand in ldm"));
+        }
+    }
+
+  if (OP_KIND (instruction->opcode->how) == O_STM)
+    {
+      /* The first operand must be a register pair, and the second
+          operand must be @-er7.  */
+      if (((operand[0].reg & 0x80000000) == 0)
+            || (operand[1].mode != RDDEC)
+            || (operand[1].reg != 7))
+        {
+          as_bad (_("invalid operand in stm"));
+        }
+    }
+
   size = SN;
   if (dot)
     {
------------------------ End of patch --------------------------------------------------

-----Original Message-----
From: Nick Clifton [mailto:nickc@redhat.com]
Sent: Wednesday, November 12, 2003 12:39 AM
To: Asgari J. Jinia
Cc: kazu@cs.umass.edu; binutils@sources.redhat.com
Subject: Re: [PATCH] Fix for ldm/stm instructions in H8S


Applying this patch breaks lots of tests in the h8300 gas testsuite.
Would it be possible for you to investigate this and see whether the
patch or the testcases need to be fixed ?

Cheers
        Nick
        


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]