This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] S/390: Fix instruction hash table in gas
- From: "Andreas Krebbel" <krebbel at linux dot vnet dot ibm dot com>
- To: binutils at sourceware dot org
- Cc: schwidefsky at de dot ibm dot com
- Date: Tue, 26 Oct 2010 15:41:11 +0200
- Subject: [PATCH] S/390: Fix instruction hash table in gas
Hi,
the code in md_begin which fills the hash table with the instructions
is broken.
Basically all instructions end up in the hash table even if they are
not available on the specified CPU. Besides of the performance
penalty this also makes it impossible to get an error message for
these instructions.
With the fix the testsuite produces errors for 3 instructions in
esa-g5.s. They seem to be wrongly marked as z900 instructions in the
optable. Fixed with the attached patch as well.
I'll commit the patch in 2 days in order to give Martin a chance to
veto.
No regressions in the binutils testsuite.
Bye,
-Andreas-
2010-10-26 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* config/tc-s390.c (md_begin): Only add to hash table if cpu and
mode mask fit.
2010-10-26 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* s390-opc.txt: cfxr, cfdr and cfer z900 -> g5.
Index: src/gas/config/tc-s390.c
===================================================================
--- src.orig/gas/config/tc-s390.c
+++ src/gas/config/tc-s390.c
@@ -506,13 +506,18 @@ md_begin (void)
break;
op++;
}
- retval = hash_insert (s390_opcode_hash, op->name, (void *) op);
- if (retval != (const char *) NULL)
- {
- as_bad (_("Internal assembler error for instruction %s"),
- op->name);
- dup_insn = TRUE;
+
+ if (op->min_cpu <= current_cpu && (op->modes & current_mode_mask))
+ {
+ retval = hash_insert (s390_opcode_hash, op->name, (void *) 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++;
}
Index: src/opcodes/s390-opc.txt
===================================================================
--- src.orig/opcodes/s390-opc.txt
+++ src/opcodes/s390-opc.txt
@@ -555,9 +555,9 @@ b369 cxr RRE_FF "compare extended hfp" g
b3b6 cxfr RRE_FR "convert from fixed 32 to extended hfp" g5 esa,zarch
b3b5 cdfr RRE_FR "convert from fixed 32 to long hfp" g5 esa,zarch
b3b4 cefr RRE_FR "convert from fixed 32 to short hfp" g5 esa,zarch
-b3ba cfxr RRF_U0RF "convert to fixed extended hfp to 32" z900 esa,zarch
-b3b9 cfdr RRF_U0RF "convert to fixed long hfp to 32" z900 esa,zarch
-b3b8 cfer RRF_U0RF "convert to fixed short hfp to 32" z900 esa,zarch
+b3ba cfxr RRF_U0RF "convert to fixed extended hfp to 32" g5 esa,zarch
+b3b9 cfdr RRF_U0RF "convert to fixed long hfp to 32" g5 esa,zarch
+b3b8 cfer RRF_U0RF "convert to fixed short hfp to 32" g5 esa,zarch
b362 ltxr RRE_FF "load and test extended hfp" g5 esa,zarch
b363 lcxr RRE_FF "load complement extended hfp" g5 esa,zarch
b367 fixr RRE_FF "load fp integer extended hfp" g5 esa,zarch