[PATCH] s390 gas: sske with -mesa and -march=z9-109.

Martin Schwidefsky schwidefsky@de.ibm.com
Thu Nov 29 09:36:00 GMT 2007


Hi,
I've added a fix to the s390 assembler to make it possible to compile
a 31 bit kernel for a z9-109. The problem is the sske instruction which
exists in two versions. An old version which is available for all cpu
models and both modes esa & zarch and a new version that only exists for
z9-109 in zarch mode. md_begin adds all instructions to the hash table,
even zarch only instruction for esa assemblies to be able to print a 
suitable warning if an zarch instruction is used in esa mode. The code
only checked for the minimal cpu to decide which version of an instruction
to add. This is wrong for sske. The new code now checks minimum cpu and
mode against all variants of an instruction. Only if all variants do not
match an invalid instruction is added for the warning messages.

-- 
blue skies,
  Martin.

"Reality continues to ruin my life." - Calvin.
---

gas/ChangeLog:
2007-11-29  Martin Schwidefsky  <schwidefsky@de.ibm.com>

	* config/tc-s390.c (md_begin): If the -mesa option is specified
	add zarch opcodes to the hash table only if there is no variant
	that is available for the esa mode as well.

gas/testsuite/ChangeLog:
2007-11-29  Martin Schwidefsky  <schwidefsky@de.ibm.com>

	* gas/s390/esa-z9-109.d: Add check for old version of sske.
	* gas/s390/esa-z9-109.s: Likewise.

diff -urpN src/gas/config/tc-s390.c src-s390/gas/config/tc-s390.c
--- src/gas/config/tc-s390.c	2007-11-29 10:06:22.000000000 +0100
+++ src-s390/gas/config/tc-s390.c	2007-11-29 10:06:44.000000000 +0100
@@ -512,17 +512,22 @@ md_begin ()
 
   op_end = s390_opcodes + s390_num_opcodes;
   for (op = s390_opcodes; op < op_end; op++)
-    if (op->min_cpu <= current_cpu)
-      {
-	retval = hash_insert (s390_opcode_hash, op->name, (PTR) op);
-	if (retval != (const char *) NULL)
-	  {
-	    as_bad (_("Internal assembler error for instruction %s"),
-		    op->name);
-	    dup_insn = TRUE;
-	  }
-	while (op < op_end - 1 && strcmp (op->name, op[1].name) == 0)
+    {
+      while (op < op_end - 1 && strcmp(op->name, op[1].name) == 0)
+	{
+          if (op->min_cpu <= current_cpu && (op->modes & current_mode_mask))
+	    break;
 	  op++;
+        }
+      retval = hash_insert (s390_opcode_hash, op->name, (PTR) op);
+      if (retval != (const char *) NULL)
+        {
+          as_bad (_("Internal assembler error for instruction %s"),
+		  op->name);
+	  dup_insn = TRUE;
+	}
+      while (op < op_end - 1 && strcmp (op->name, op[1].name) == 0)
+	op++;
       }
 
   if (dup_insn)
diff -urpN src/gas/testsuite/gas/s390/esa-z9-109.d src-s390/gas/testsuite/gas/s390/esa-z9-109.d
--- src/gas/testsuite/gas/s390/esa-z9-109.d	2005-08-12 19:44:45.000000000 +0200
+++ src-s390/gas/testsuite/gas/s390/esa-z9-109.d	2007-11-29 10:06:44.000000000 +0100
@@ -10,3 +10,4 @@ Disassembly of section .text:
 .*:	b9 92 f0 69 [	 ]*trot	%r6,%r9,15
 .*:	b9 91 f0 69 [	 ]*trto	%r6,%r9,15
 .*:	b9 90 f0 69 [	 ]*trtt	%r6,%r9,15
+.*:	b2 2b 00 69 [	 ]*sske	%r6,%r9
diff -urpN src/gas/testsuite/gas/s390/esa-z9-109.s src-s390/gas/testsuite/gas/s390/esa-z9-109.s
--- src/gas/testsuite/gas/s390/esa-z9-109.s	2005-08-12 19:44:45.000000000 +0200
+++ src-s390/gas/testsuite/gas/s390/esa-z9-109.s	2007-11-29 10:06:44.000000000 +0100
@@ -4,3 +4,6 @@ foo:
 	trot	%r6,%r9,15
 	trto	%r6,%r9,15
 	trtt	%r6,%r9,15
+# z9-109 z/Architecture mode extended sske with an additional parameter
+# make sure the old version still works for esa
+	sske	%r6,%r9




More information about the Binutils mailing list