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] | |
>>> "H. J. Lu" <hjl@lucon.org> 18.07.05 16:56:16 >>>
>On Mon, Jul 18, 2005 at 08:06:19AM -0600, Jan Beulich wrote:
>> Until now, it was possible to use, for example (Intel Syntax),
>>
>> shl <byte-reg>, <imm8>
>>
>> where <imm8> was either a forward reference or even an external
>> absolute.
>> However, it wasn't possible to do the same with 16-, 32-, or 64-bit
>> registers, because the immediate's size and the register and/or
suffix
>> didn't match in size. This patch makes this consistent so that all
>> forms
>> get accepted.
>
>A testcase?
Included this time.
Built and tested on i386-pc-linux-gnu and x86_64-unknown-linux-gnu.
Jan
gas/
2005-07-26 Jan Beulich <jbeulich@novell.com>
* config/tc-i386.c (optimize_imm): Calculate candidate
immediates
mask from guessed suffix, but mask out other immediate types
only
if at least on candidate is valid for the insn.
gas/testsuite/
2005-07-26 Jan Beulich <jbeulich@novell.com>
* gas/i386/immed32.[sd]: New.
* gas/i386/immed64.[sd]: New.
* gas/i386/i386.exp: Run new tests.
---
/home/jbeulich/src/binutils/mainline/2005-07-26/gas/config/tc-i386.c 2005-07-26
08:26:47.000000000 +0200
+++ 2005-07-26/gas/config/tc-i386.c 2005-07-26 14:33:34.929241112
+0200
@@ -2087,22 +2087,36 @@ optimize_imm ()
/* Symbols and expressions. */
default:
- /* Convert symbolic operand to proper sizes for matching.
*/
- switch (guess_suffix)
- {
- case QWORD_MNEM_SUFFIX:
- i.types[op] &= Imm64 | Imm32S;
- break;
- case LONG_MNEM_SUFFIX:
- i.types[op] &= Imm32;
- break;
- case WORD_MNEM_SUFFIX:
- i.types[op] &= Imm16;
- break;
- case BYTE_MNEM_SUFFIX:
- i.types[op] &= Imm8 | Imm8S;
- break;
- }
+ /* Convert symbolic operand to proper sizes for matching,
but don't
+ prevent matching a set of insns that only supports sizes
other
+ than those matching the insn suffix. */
+ {
+ unsigned int mask, allowed = 0;
+ const template *t;
+
+ for (t = current_templates->start; t <
current_templates->end; ++t)
+ allowed |= t->operand_types[op];
+ switch (guess_suffix)
+ {
+ case QWORD_MNEM_SUFFIX:
+ mask = Imm64 | Imm32S;
+ break;
+ case LONG_MNEM_SUFFIX:
+ mask = Imm32;
+ break;
+ case WORD_MNEM_SUFFIX:
+ mask = Imm16;
+ break;
+ case BYTE_MNEM_SUFFIX:
+ mask = Imm8;
+ break;
+ default:
+ mask = 0;
+ break;
+ }
+ if (mask & allowed)
+ i.types[op] &= mask;
+ }
break;
}
}
---
/home/jbeulich/src/binutils/mainline/2005-07-26/gas/testsuite/gas/i386/i386.exp 2005-07-26
08:26:47.000000000 +0200
+++ 2005-07-26/gas/testsuite/gas/i386/i386.exp 2005-07-26
14:36:17.697496576 +0200
@@ -62,6 +62,7 @@ if [expr ([istarget "i*86-*-*"] || [ist
run_dump_test "sib"
run_dump_test "vmx"
run_dump_test "suffix"
+ run_dump_test "immed32"
if {![istarget "*-*-aix*"]
&& (![is_elf_format] || [istarget "*-*-linux*"]
@@ -135,6 +136,7 @@ if [expr ([istarget "i*86-*-*"] || [ista
run_dump_test "x86-64-branch"
run_dump_test "svme64"
run_dump_test "x86-64-vmx"
+ run_dump_test "immed64"
# For ELF targets verify that @unwind works.
if { ([istarget "*-*-elf*"] || [istarget "*-*-linux*"]
---
/home/jbeulich/src/binutils/mainline/2005-07-26/gas/testsuite/gas/i386/immed32.d 1970-01-01
01:00:00.000000000 +0100
+++ 2005-07-26/gas/testsuite/gas/i386/immed32.d 2005-07-26
15:42:46.316134376 +0200
@@ -0,0 +1,50 @@
+#objdump: -dw
+#name: i386 immed
+
+.*: +file format .*
+
+Disassembly of section \.text:
+
+0+000 <_start>:
+[ ]*[0-9a-fA-F]+:[ ]+ff 50 04[ ]+calll? +\*0x4\(%eax\)
+[ ]*[0-9a-fA-F]+:[ ]+ff 90 08 00 00 00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jbeulich/src/binutils/mainline/2005-07-26/gas/testsuite/gas/i386/immed32.s 1970-01-01
01:00:00.000000000 +0100
+++ 2005-07-26/gas/testsuite/gas/i386/immed32.s 2005-07-26
14:57:42.819128392 +0200
@@ -0,0 +1,47 @@
+ .equiv early, 4
+
+_start:
+ calll *early(%eax)
+ calll *late(%eax)
+ calll *xtrn(%eax)
+ calll *early(%bx)
+ calll *late(%bx)
+ calll *xtrn(%bx)
+ movb $early, %al
+ movb $late, %al
+ movb $xtrn, %al
+ movw $early, %ax
+ movw $late, %ax
+ movw $xtrn, %ax
+ movl $early, %eax
+ movl $late, %eax
+ movl $xtrn, %eax
+ addb $early, %al
+ addb $late, %al
+ addb $xtrn, %al
+ addw $early, %ax
+ addw $late, %ax
+ addw $xtrn, %ax
+ addl $early, %eax
+ addl $late, %eax
+ addl $xtrn, %eax
+ shlb $early, %al
+ shlb $late, %al
+ shlb $xtrn, %al
+ shlw $early, %ax
+ shlw $late, %ax
+ shlw $xtrn, %ax
+ shll $early, %eax
+ shll $late, %eax
+ shll $xtrn, %eax
+ inb $early, %al
+ inb $late, %al
+ inb $xtrn, %al
+ inw $early, %ax
+ inw $late, %ax
+ inw $xtrn, %ax
+ inl $early, %eax
+ inl $late, %eax
+ inl $xtrn, %eax
+
+ .equiv late, 8
---
/home/jbeulich/src/binutils/mainline/2005-07-26/gas/testsuite/gas/i386/immed64.d 1970-01-01
01:00:00.000000000 +0100
+++ 2005-07-26/gas/testsuite/gas/i386/immed64.d 2005-07-26
16:38:15.000000000 +0200
@@ -0,0 +1,59 @@
+#objdump: -dw
+#name: x86-64 immed
+
+.*: +file format .*
+
+Disassembly of section \.text:
+
+0+000 <_start>:
+[ ]*[0-9a-fA-F]+:[ ]+ff 50 04[ ]+callq? +\*0x4\(%rax\)
+[ ]*[0-9a-fA-F]+:[ ]+ff 90 08 00 00 00[ ]+callq?
+\*0x8\(%rax\)
+[ ]*[0-9a-fA-F]+:[ ]+ff 90 00 00 00 00[ ]+callq?
+\*0x0\(%rax\)
+[ ]*[0-9a-fA-F]+:[ ]+67 ff 50 04[ ]+(addr32 )?callq?
+\*0x4\(%eax\)
+[ ]*[0-9a-fA-F]+:[ ]+67 ff 90 08 00 00 00[
]+(addr32 )?callq? +\*0x8\(%eax\)
+[ ]*[0-9a-fA-F]+:[ ]+67 ff 90 00 00 00 00[
]+(addr32 )?callq? +\*0x0\(%eax\)
+[ ]*[0-9a-fA-F]+:[ ]+b0 04[ ]+movb? +\$0x4,%al
+[ ]*[0-9a-fA-F]+:[ ]+b0 08[ ]+movb? +\$0x8,%al
+[ ]*[0-9a-fA-F]+:[ ]+b0 00[ ]+movb? +\$0x0,%al
+[ ]*[0-9a-fA-F]+:[ ]+66 b8 04 00[ ]+movw? +\$0x4,%ax
+[ ]*[0-9a-fA-F]+:[ ]+66 b8 08 00[ ]+movw? +\$0x8,%ax
+[ ]*[0-9a-fA-F]+:[ ]+66 b8 00 00[ ]+movw? +\$0x0,%ax
+[ ]*[0-9a-fA-F]+:[ ]+b8 04 00 00 00[ ]+movl?
+\$0x4,%eax
+[ ]*[0-9a-fA-F]+:[ ]+b8 08 00 00 00[ ]+movl?
+\$0x8,%eax
+[ ]*[0-9a-fA-F]+:[ ]+b8 00 00 00 00[ ]+movl?
+\$0x0,%eax
+[ ]*[0-9a-fA-F]+:[ ]+48 b8 04 00 00 00 00 00 00 00[
]+movq? +\$0x4,%rax
+[ ]*[0-9a-fA-F]+:[ ]+48 b8 08 00 00 00 00 00 00 00[
]+movq? +\$0x8,%rax
+[ ]*[0-9a-fA-F]+:[ ]+48 b8 00 00 00 00 00 00 00 00[
]+movq? +\$0x0,%rax
+[ ]*[0-9a-fA-F]+:[ ]+04 04[ ]+addb? +\$0x4,%al
+[ ]*[0-9a-fA-F]+:[ ]+04 08[ ]+addb? +\$0x8,%al
+[ ]*[0-9a-fA-F]+:[ ]+04 00[ ]+addb? +\$0x0,%al
+[ ]*[0-9a-fA-F]+:[ ]+66 83 c0 04[ ]+addw? +\$0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]+shlq? +\$0x0,%rax
+[ ]*[0-9a-fA-F]+:[ ]+e4 04[ ]+inb? +\$0x4,%al
+[ ]*[0-9a-fA-F]+:[ ]+e4 08[ ]+inb? +\$0x8,%al
+[ ]*[0-9a-fA-F]+:[ ]+e4 00[ ]+inb? +\$0x0,%al
+[ ]*[0-9a-fA-F]+:[ ]+66 e5 04[ ]+inw? +\$0x4,%ax
+[ ]*[0-9a-fA-F]+:[ ]+66 e5 08[ ]+inw? +\$0x8,%ax
+[ ]*[0-9a-fA-F]+:[ ]+66 e5 00[ ]+inw? +\$0x0,%ax
+[ ]*[0-9a-fA-F]+:[ ]+e5 04[ ]+inl? +\$0x4,%eax
+[ ]*[0-9a-fA-F]+:[ ]+e5 08[ ]+inl? +\$0x8,%eax
+[ ]*[0-9a-fA-F]+:[ ]+e5 00[ ]+inl? +\$0x0,%eax
---
/home/jbeulich/src/binutils/mainline/2005-07-26/gas/testsuite/gas/i386/immed64.s 1970-01-01
01:00:00.000000000 +0100
+++ 2005-07-26/gas/testsuite/gas/i386/immed64.s 2005-07-26
15:48:16.000000000 +0200
@@ -0,0 +1,56 @@
+ .equiv early, 4
+
+_start:
+ callq *early(%rax)
+ callq *late(%rax)
+ callq *xtrn(%rax)
+ callq *early(%eax)
+ callq *late(%eax)
+ callq *xtrn(%eax)
+ movb $early, %al
+ movb $late, %al
+ movb $xtrn, %al
+ movw $early, %ax
+ movw $late, %ax
+ movw $xtrn, %ax
+ movl $early, %eax
+ movl $late, %eax
+ movl $xtrn, %eax
+ movabsq $early, %rax
+ movabsq $late, %rax
+ movabsq $xtrn, %rax
+ addb $early, %al
+ addb $late, %al
+ addb $xtrn, %al
+ addw $early, %ax
+ addw $late, %ax
+ addw $xtrn, %ax
+ addl $early, %eax
+ addl $late, %eax
+ addl $xtrn, %eax
+ addq $early, %rax
+ addq $late, %rax
+ addq $xtrn, %rax
+ shlb $early, %al
+ shlb $late, %al
+ shlb $xtrn, %al
+ shlw $early, %ax
+ shlw $late, %ax
+ shlw $xtrn, %ax
+ shll $early, %eax
+ shll $late, %eax
+ shll $xtrn, %eax
+ shlq $early, %rax
+ shlq $late, %rax
+ shlq $xtrn, %rax
+ inb $early, %al
+ inb $late, %al
+ inb $xtrn, %al
+ inw $early, %ax
+ inw $late, %ax
+ inw $xtrn, %ax
+ inl $early, %eax
+ inl $late, %eax
+ inl $xtrn, %eax
+
+ .equiv late, 8
Attachment:
binutils-mainline-x86-immediates.patch
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |