aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2008-01-02 21:43:34 +0000
committerH.J. Lu <hjl.tools@gmail.com>2008-01-02 21:43:34 +0000
commit582d5eddfe4a3e1d644c473f30a1c1e85c665743 (patch)
tree392e6091dd2db1de46a080a8ec797ddc82e07aff /gas
parent6c7ac64e1764d0feff5d87ee849652d69f4381ae (diff)
downloadgdb-582d5eddfe4a3e1d644c473f30a1c1e85c665743.zip
gdb-582d5eddfe4a3e1d644c473f30a1c1e85c665743.tar.gz
gdb-582d5eddfe4a3e1d644c473f30a1c1e85c665743.tar.bz2
gas/
2008-01-02 H.J. Lu <hongjiu.lu@intel.com> PR gas/5534 * config/tc-i386.c (match_template): Handle XMMWORD_MNEM_SUFFIX. Check memory size in Intel mode. (process_suffix): Handle XMMWORD_MNEM_SUFFIX. (intel_e09): Likewise. * config/tc-i386.h (XMMWORD_MNEM_SUFFIX): New. gas/testsuite/ 2008-01-02 H.J. Lu <hongjiu.lu@intel.com> PR gas/5534 * gas/i386/intel.s: Use QWORD on movq instead of DWORD. * gas/i386/inval.s: Add tests for movq. * gas/i386/x86-64-inval.s: Likewise. * gas/i386/inval.l: Updated. * gas/i386/x86-64-inval.l: Likewise. opcodes/ 2008-01-02 H.J. Lu <hongjiu.lu@intel.com> PR gas/5534 * i386-gen.c (opcode_modifiers): Add No_xSuf, CheckSize, Byte, Word, Dword, QWord and Xmmword. * i386-opc.h (No_xSuf): New. (CheckSize): Likewise. (Byte): Likewise. (Word): Likewise. (Dword): Likewise. (QWord): Likewise. (Xmmword): Likewise. (FWait): Updated. (i386_opcode_modifier): Add No_xSuf, CheckSize, Byte, Word, Dword, QWord and Xmmword. * i386-opc.tbl: Add CheckSize|QWord to movq if IgnoreSize is used. * i386-tbl.h: Regenerated.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog10
-rw-r--r--gas/config/tc-i386.c26
-rw-r--r--gas/config/tc-i386.h4
-rw-r--r--gas/testsuite/ChangeLog11
-rw-r--r--gas/testsuite/gas/i386/intel.s2
-rw-r--r--gas/testsuite/gas/i386/inval.l16
-rw-r--r--gas/testsuite/gas/i386/inval.s8
-rw-r--r--gas/testsuite/gas/i386/x86-64-inval.l127
-rw-r--r--gas/testsuite/gas/i386/x86-64-inval.s8
9 files changed, 153 insertions, 59 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 75cc3ce..52f100f 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,13 @@
+2008-01-02 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR gas/5534
+ * config/tc-i386.c (match_template): Handle XMMWORD_MNEM_SUFFIX.
+ Check memory size in Intel mode.
+ (process_suffix): Handle XMMWORD_MNEM_SUFFIX.
+ (intel_e09): Likewise.
+
+ * config/tc-i386.h (XMMWORD_MNEM_SUFFIX): New.
+
2008-01-02 Catherine Moore <clm@codesourcery.com>
* config/tc-mips.c (mips_ip): Check operands on jalr instruction.
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 7bf7661..18e0bb7 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -3047,6 +3047,8 @@ match_template (void)
suffix_check.no_qsuf = 1;
else if (i.suffix == LONG_DOUBLE_MNEM_SUFFIX)
suffix_check.no_ldsuf = 1;
+ else if (i.suffix == XMMWORD_MNEM_SUFFIX)
+ suffix_check.no_xsuf = 1;
for (t = current_templates->start; t < current_templates->end; t++)
{
@@ -3077,6 +3079,18 @@ match_template (void)
|| (t->opcode_modifier.no_ldsuf && suffix_check.no_ldsuf)))
continue;
+ /* Check the memory size in Intel mode when it is provided if
+ needed. */
+ if (intel_syntax
+ && i.suffix
+ && t->opcode_modifier.checksize
+ && (!t->opcode_modifier.byte || !suffix_check.no_bsuf)
+ && (!t->opcode_modifier.word || !suffix_check.no_wsuf)
+ && (!t->opcode_modifier.dword || !suffix_check.no_lsuf)
+ && (!t->opcode_modifier.qword || !suffix_check.no_qsuf)
+ && (!t->opcode_modifier.xmmword || !suffix_check.no_xsuf))
+ continue;
+
for (j = 0; j < MAX_OPERANDS; j++)
operand_types [j] = t->operand_types [j];
@@ -3453,6 +3467,11 @@ process_suffix (void)
if (!check_word_reg ())
return 0;
}
+ else if (i.suffix == XMMWORD_MNEM_SUFFIX)
+ {
+ /* Skip if the instruction has x suffix. match_template
+ should check if it is a valid suffix. */
+ }
else if (intel_syntax && i.tm.opcode_modifier.ignoresize)
/* Do nothing if the instruction is going to ignore the prefix. */
;
@@ -3535,7 +3554,9 @@ process_suffix (void)
/* Change the opcode based on the operand size given by i.suffix;
We don't need to change things for byte insns. */
- if (i.suffix && i.suffix != BYTE_MNEM_SUFFIX)
+ if (i.suffix
+ && i.suffix != BYTE_MNEM_SUFFIX
+ && i.suffix != XMMWORD_MNEM_SUFFIX)
{
/* It's not a byte, select word/dword operation. */
if (i.tm.opcode_modifier.w)
@@ -8166,8 +8187,7 @@ intel_e09 (void)
else if (prev_token.code == T_XMMWORD)
{
- /* XXX ignored for now, but accepted since gcc uses it */
- suffix = 0;
+ suffix = XMMWORD_MNEM_SUFFIX;
}
else
diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h
index bf27842..2feee31 100644
--- a/gas/config/tc-i386.h
+++ b/gas/config/tc-i386.h
@@ -116,12 +116,14 @@ extern const char *i386_comment_chars;
#define IMMEDIATE_PREFIX '$'
#define ABSOLUTE_PREFIX '*'
-/* these are the instruction mnemonic suffixes. */
+/* these are the instruction mnemonic suffixes in AT&T syntax or
+ memory operand size in Intel syntax. */
#define WORD_MNEM_SUFFIX 'w'
#define BYTE_MNEM_SUFFIX 'b'
#define SHORT_MNEM_SUFFIX 's'
#define LONG_MNEM_SUFFIX 'l'
#define QWORD_MNEM_SUFFIX 'q'
+#define XMMWORD_MNEM_SUFFIX 'x'
/* Intel Syntax. Use a non-ascii letter since since it never appears
in instructions. */
#define LONG_DOUBLE_MNEM_SUFFIX '\1'
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 4056866..03e19d0 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+2008-01-02 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR gas/5534
+ * gas/i386/intel.s: Use QWORD on movq instead of DWORD.
+
+ * gas/i386/inval.s: Add tests for movq.
+ * gas/i386/x86-64-inval.s: Likewise.
+
+ * gas/i386/inval.l: Updated.
+ * gas/i386/x86-64-inval.l: Likewise.
+
2008-01-02 Catherine Moore <clm@codesourcery.com>
* gas/mips/jalr.s: New test.
diff --git a/gas/testsuite/gas/i386/intel.s b/gas/testsuite/gas/i386/intel.s
index ef65aa9..061414b 100644
--- a/gas/testsuite/gas/i386/intel.s
+++ b/gas/testsuite/gas/i386/intel.s
@@ -601,7 +601,7 @@ rot5:
1:
jne 1b
- movq mm6, [DWORD PTR .LC5+40]
+ movq mm6, [QWORD PTR .LC5+40]
add edi, dword ptr [ebx+8*eax]
movd mm0, dword ptr [ebx+8*eax+4]
add edi, dword ptr [ebx+8*ecx+((4095+1)*8)]
diff --git a/gas/testsuite/gas/i386/inval.l b/gas/testsuite/gas/i386/inval.l
index 41cb399..94f3c08 100644
--- a/gas/testsuite/gas/i386/inval.l
+++ b/gas/testsuite/gas/i386/inval.l
@@ -53,6 +53,14 @@
.*:56: Error: .*
.*:57: Error: .*
.*:58: Error: .*
+.*:59: Error: .*
+.*:60: Error: .*
+.*:61: Error: .*
+.*:62: Error: .*
+.*:63: Error: .*
+.*:64: Error: .*
+.*:65: Error: .*
+.*:66: Error: .*
GAS LISTING .*
@@ -117,3 +125,11 @@ GAS LISTING .*
[ ]*58[ ]+cvtsi2sdq xmm1,QWORD PTR \[eax\]
+[ ]*59[ ]+movq xmm1, XMMWORD PTR \[esp\]
+[ ]*60[ ]+movq xmm1, DWORD PTR \[esp\]
+[ ]*61[ ]+movq xmm1, WORD PTR \[esp\]
+[ ]*62[ ]+movq xmm1, BYTE PTR \[esp\]
+[ ]*63[ ]+movq XMMWORD PTR \[esp\],xmm1
+[ ]*64[ ]+movq DWORD PTR \[esp\],xmm1
+[ ]*65[ ]+movq WORD PTR \[esp\],xmm1
+[ ]*66[ ]+movq BYTE PTR \[esp\],xmm1
diff --git a/gas/testsuite/gas/i386/inval.s b/gas/testsuite/gas/i386/inval.s
index e108175..2584d0e 100644
--- a/gas/testsuite/gas/i386/inval.s
+++ b/gas/testsuite/gas/i386/inval.s
@@ -56,3 +56,11 @@ foo: jaw foo
cvtsi2sd xmm1,QWORD PTR [eax]
cvtsi2ssq xmm1,QWORD PTR [eax]
cvtsi2sdq xmm1,QWORD PTR [eax]
+ movq xmm1, XMMWORD PTR [esp]
+ movq xmm1, DWORD PTR [esp]
+ movq xmm1, WORD PTR [esp]
+ movq xmm1, BYTE PTR [esp]
+ movq XMMWORD PTR [esp],xmm1
+ movq DWORD PTR [esp],xmm1
+ movq WORD PTR [esp],xmm1
+ movq BYTE PTR [esp],xmm1
diff --git a/gas/testsuite/gas/i386/x86-64-inval.l b/gas/testsuite/gas/i386/x86-64-inval.l
index 87503e5..dcc2f80 100644
--- a/gas/testsuite/gas/i386/x86-64-inval.l
+++ b/gas/testsuite/gas/i386/x86-64-inval.l
@@ -50,60 +50,79 @@
.*:51: Error: .*
.*:52: Error: .*
.*:54: Error: .*
+.*:55: Error: .*
+.*:56: Error: .*
+.*:57: Error: .*
+.*:58: Error: .*
+.*:59: Error: .*
+.*:60: Error: .*
+.*:61: Error: .*
+.*:62: Error: .*
GAS LISTING .*
- 1 [ ]*.text
- 2 [ ]*# All the following should be illegal for x86-64
- 3 [ ]*aaa # illegal
- 4 [ ]*aad # illegal
- 5 [ ]*aam # illegal
- 6 [ ]*aas # illegal
- 7 [ ]*arpl %ax,%ax # illegal
- 8 [ ]*bound %eax,\(%rax\) # illegal
- 9 [ ]*calll \*%eax # 32-bit data size not allowed
- 10 [ ]*calll \*\(%ax\) # 32-bit data size not allowed
- 11 [ ]*calll \*\(%eax\) # 32-bit data size not allowed
- 12 [ ]*calll \*\(%r8\) # 32-bit data size not allowed
- 13 [ ]*calll \*\(%rax\) # 32-bit data size not allowed
- 14 [ ]*callq \*\(%ax\) # 32-bit data size not allowed
- 15 [ ]*callw \*\(%ax\) # no 16-bit addressing
- 16 [ ]*daa # illegal
- 17 [ ]*das # illegal
- 18 [ ]*enterl \$0,\$0 # can't have 32-bit stack operands
- 19 [ ]*into # illegal
- 20 [ ]*foo:[ ]*jcxz foo # No prefix exists to select CX as a counter
- 21 [ ]*jmpl \*%eax # 32-bit data size not allowed
- 22 [ ]*jmpl \*\(%rax\) # 32-bit data size not allowed
- 23 [ ]*lcalll \$0,\$0 # illegal
- 24 [ ]*lcallq \$0,\$0 # illegal
- 25 [ ]*ldsl %eax,\(%rax\) # illegal
- 26 [ ]*ldsq %rax,\(%rax\) # illegal
- 27 [ ]*lesl %eax,\(%rax\) # illegal
- 28 [ ]*lesq %rax,\(%rax\) # illegal
- 29 [ ]*ljmpl \$0,\$0 # illegal
- 30 [ ]*ljmpq \$0,\$0 # illegal
- 31 [ ]*ljmpq \*\(%rax\) # 64-bit data size not allowed
- 32 [ ]*loopw foo # No prefix exists to select CX as a counter
- 33 [ ]*loopew foo # No prefix exists to select CX as a counter
- 34 [ ]*loopnew foo # No prefix exists to select CX as a counter
- 35 [ ]*loopnzw foo # No prefix exists to select CX as a counter
- 36 [ ]*loopzw foo # No prefix exists to select CX as a counter
- 37 [ ]*leavel # can't have 32-bit stack operands
- 38 [ ]*pop %ds # illegal
- 39 [ ]*pop %es # illegal
- 40 [ ]*pop %ss # illegal
- 41 [ ]*popa # illegal
- 42 [ ]*popl %eax # can't have 32-bit stack operands
- 43 [ ]*push %cs # illegal
- 44 [ ]*push %ds # illegal
- 45 [ ]*push %es # illegal
- 46 [ ]*push %ss # illegal
- 47 [ ]*pusha # illegal
- 48 [ ]*pushl %eax # can't have 32-bit stack operands
- 49 [ ]*pushfl # can't have 32-bit stack operands
- 50 [ ]*popfl # can't have 32-bit stack operands
- 51 [ ]*retl # can't have 32-bit stack operands
- 52 [ ]*insertq \$4,\$2,%xmm2,%ebx # The last operand must be XMM register.
- 53 [ ]*.intel_syntax noprefix
- 54 [ ]*cmpxchg16b dword ptr \[rax\] # Must be oword
+[ ]*1[ ]+\.text
+[ ]*2[ ]+\# All the following should be illegal for x86-64
+[ ]*3[ ]+aaa \# illegal
+[ ]*4[ ]+aad \# illegal
+[ ]*5[ ]+aam \# illegal
+[ ]*6[ ]+aas \# illegal
+[ ]*7[ ]+arpl %ax,%ax \# illegal
+[ ]*8[ ]+bound %eax,\(%rax\) \# illegal
+[ ]*9[ ]+calll \*%eax \# 32-bit data size not allowed
+[ ]*10[ ]+calll \*\(%ax\) \# 32-bit data size not allowed
+[ ]*11[ ]+calll \*\(%eax\) \# 32-bit data size not allowed
+[ ]*12[ ]+calll \*\(%r8\) \# 32-bit data size not allowed
+[ ]*13[ ]+calll \*\(%rax\) \# 32-bit data size not allowed
+[ ]*14[ ]+callq \*\(%ax\) \# 32-bit data size not allowed
+[ ]*15[ ]+callw \*\(%ax\) \# no 16-bit addressing
+[ ]*16[ ]+daa \# illegal
+[ ]*17[ ]+das \# illegal
+[ ]*18[ ]+enterl \$0,\$0 \# can't have 32-bit stack operands
+[ ]*19[ ]+into \# illegal
+[ ]*20[ ]+foo: jcxz foo \# No prefix exists to select CX as a counter
+[ ]*21[ ]+jmpl \*%eax \# 32-bit data size not allowed
+[ ]*22[ ]+jmpl \*\(%rax\) \# 32-bit data size not allowed
+[ ]*23[ ]+lcalll \$0,\$0 \# illegal
+[ ]*24[ ]+lcallq \$0,\$0 \# illegal
+[ ]*25[ ]+ldsl %eax,\(%rax\) \# illegal
+[ ]*26[ ]+ldsq %rax,\(%rax\) \# illegal
+[ ]*27[ ]+lesl %eax,\(%rax\) \# illegal
+[ ]*28[ ]+lesq %rax,\(%rax\) \# illegal
+[ ]*29[ ]+ljmpl \$0,\$0 \# illegal
+[ ]*30[ ]+ljmpq \$0,\$0 \# illegal
+[ ]*31[ ]+ljmpq \*\(%rax\) \# 64-bit data size not allowed
+[ ]*32[ ]+loopw foo \# No prefix exists to select CX as a counter
+[ ]*33[ ]+loopew foo \# No prefix exists to select CX as a counter
+[ ]*34[ ]+loopnew foo \# No prefix exists to select CX as a counter
+[ ]*35[ ]+loopnzw foo \# No prefix exists to select CX as a counter
+[ ]*36[ ]+loopzw foo \# No prefix exists to select CX as a counter
+[ ]*37[ ]+leavel \# can't have 32-bit stack operands
+[ ]*38[ ]+pop %ds \# illegal
+[ ]*39[ ]+pop %es \# illegal
+[ ]*40[ ]+pop %ss \# illegal
+[ ]*41[ ]+popa \# illegal
+[ ]*42[ ]+popl %eax \# can't have 32-bit stack operands
+[ ]*43[ ]+push %cs \# illegal
+[ ]*44[ ]+push %ds \# illegal
+[ ]*45[ ]+push %es \# illegal
+[ ]*46[ ]+push %ss \# illegal
+[ ]*47[ ]+pusha \# illegal
+[ ]*48[ ]+pushl %eax \# can't have 32-bit stack operands
+[ ]*49[ ]+pushfl \# can't have 32-bit stack operands
+[ ]*50[ ]+popfl \# can't have 32-bit stack operands
+[ ]*51[ ]+retl \# can't have 32-bit stack operands
+[ ]*52[ ]+insertq \$4,\$2,%xmm2,%ebx \# The last operand must be XMM register\.
+[ ]*53[ ]+\.intel_syntax noprefix
+[ ]*54[ ]+cmpxchg16b dword ptr \[rax\] \# Must be oword
+[ ]*55[ ]+movq xmm1, XMMWORD PTR \[rsp\]
+[ ]*56[ ]+movq xmm1, DWORD PTR \[rsp\]
+[ ]*57[ ]+movq xmm1, WORD PTR \[rsp\]
+ GAS LISTING .*
+
+
+[ ]*58[ ]+movq xmm1, BYTE PTR \[rsp\]
+[ ]*59[ ]+movq XMMWORD PTR \[rsp\],xmm1
+[ ]*60[ ]+movq DWORD PTR \[rsp\],xmm1
+[ ]*61[ ]+movq WORD PTR \[rsp\],xmm1
+[ ]*62[ ]+movq BYTE PTR \[rsp\],xmm1
diff --git a/gas/testsuite/gas/i386/x86-64-inval.s b/gas/testsuite/gas/i386/x86-64-inval.s
index f7a4379..979635f 100644
--- a/gas/testsuite/gas/i386/x86-64-inval.s
+++ b/gas/testsuite/gas/i386/x86-64-inval.s
@@ -52,3 +52,11 @@ foo: jcxz foo # No prefix exists to select CX as a counter
insertq $4,$2,%xmm2,%ebx # The last operand must be XMM register.
.intel_syntax noprefix
cmpxchg16b dword ptr [rax] # Must be oword
+ movq xmm1, XMMWORD PTR [rsp]
+ movq xmm1, DWORD PTR [rsp]
+ movq xmm1, WORD PTR [rsp]
+ movq xmm1, BYTE PTR [rsp]
+ movq XMMWORD PTR [rsp],xmm1
+ movq DWORD PTR [rsp],xmm1
+ movq WORD PTR [rsp],xmm1
+ movq BYTE PTR [rsp],xmm1