From cb712a9ecdc5784b3790aef71852e3bd329a976a Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Tue, 6 Dec 2005 12:40:57 +0000 Subject: gas/ 2005-12-06 H.J. Lu PR gas/1874 * config/tc-i386.c (match_template): Handle monitor. (process_suffix): Likewise. gas/testsuite/ 2005-12-06 H.J. Lu PR gas/1874 * gas/i386/i386.exp: Add x86-64-prescott for 64bit. * gas/i386/prescott.s: Test address size override for monitor. * gas/i386/prescott.d: Updated. * gas/i386/x86-64-prescott.d: New file. * gas/i386/x86-64-prescott.s: Likewise. include/opcode/ 2005-12-06 H.J. Lu PR gas/1874 * i386.h (i386_optab): Add 64bit support for monitor and mwait. opcodes/ 2005-12-06 H.J. Lu PR gas/1874 * i386-dis.c (address_mode): New enum type. (address_mode): New variable. (mode_64bit): Removed. (ckprefix): Updated to check address_mode instead of mode_64bit. (prefix_name): Likewise. (print_insn): Likewise. (putop): Likewise. (print_operand_value): Likewise. (intel_operand_size): Likewise. (OP_E): Likewise. (OP_G): Likewise. (set_op): Likewise. (OP_REG): Likewise. (OP_I): Likewise. (OP_I64): Likewise. (OP_OFF): Likewise. (OP_OFF64): Likewise. (ptr_reg): Likewise. (OP_C): Likewise. (SVME_Fixup): Likewise. (print_insn): Set address_mode. (PNI_Fixup): Add 64bit and address size override support for monitor and mwait. --- gas/ChangeLog | 6 ++++++ gas/config/tc-i386.c | 35 +++++++++++++++++++++--------- gas/testsuite/ChangeLog | 11 ++++++++++ gas/testsuite/gas/i386/i386.exp | 1 + gas/testsuite/gas/i386/prescott.d | 3 ++- gas/testsuite/gas/i386/prescott.s | 3 +++ gas/testsuite/gas/i386/x86-64-prescott.d | 37 ++++++++++++++++++++++++++++++++ gas/testsuite/gas/i386/x86-64-prescott.s | 35 ++++++++++++++++++++++++++++++ 8 files changed, 120 insertions(+), 11 deletions(-) create mode 100644 gas/testsuite/gas/i386/x86-64-prescott.d create mode 100644 gas/testsuite/gas/i386/x86-64-prescott.s (limited to 'gas') diff --git a/gas/ChangeLog b/gas/ChangeLog index 4bd00a3..90b1f99 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2005-12-06 H.J. Lu + + PR gas/1874 + * config/tc-i386.c (match_template): Handle monitor. + (process_suffix): Likewise. + 2005-12-05 John David Anglin Bug gas/1948 diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 1828c48..b95a664 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -2275,10 +2275,15 @@ match_template () overlap1 = i.types[1] & t->operand_types[1]; if (!MATCH (overlap0, i.types[0], t->operand_types[0]) || !MATCH (overlap1, i.types[1], t->operand_types[1]) - || !CONSISTENT_REGISTER_MATCH (overlap0, i.types[0], - t->operand_types[0], - overlap1, i.types[1], - t->operand_types[1])) + /* monitor in SSE3 is a very special case. The first + register and the second register may have differnet + sizes. */ + || !((t->base_opcode == 0x0f01 + && t->extension_opcode == 0xc8) + || CONSISTENT_REGISTER_MATCH (overlap0, i.types[0], + t->operand_types[0], + overlap1, i.types[1], + t->operand_types[1]))) { /* Check if other direction is valid ... */ if ((t->opcode_modifier & (D | FloatD)) == 0) @@ -2546,12 +2551,22 @@ process_suffix (void) /* Now select between word & dword operations via the operand size prefix, except for instructions that will ignore this prefix anyway. */ - if (i.suffix != QWORD_MNEM_SUFFIX - && i.suffix != LONG_DOUBLE_MNEM_SUFFIX - && !(i.tm.opcode_modifier & (IgnoreSize | FloatMF)) - && ((i.suffix == LONG_MNEM_SUFFIX) == (flag_code == CODE_16BIT) - || (flag_code == CODE_64BIT - && (i.tm.opcode_modifier & JumpByte)))) + if (i.tm.base_opcode == 0x0f01 && i.tm.extension_opcode == 0xc8) + { + /* monitor in SSE3 is a very special case. The default size + of AX is the size of mode. The address size override + prefix will change the size of AX. */ + if (i.op->regs[0].reg_type & + (flag_code == CODE_32BIT ? Reg16 : Reg32)) + if (!add_prefix (ADDR_PREFIX_OPCODE)) + return 0; + } + else if (i.suffix != QWORD_MNEM_SUFFIX + && i.suffix != LONG_DOUBLE_MNEM_SUFFIX + && !(i.tm.opcode_modifier & (IgnoreSize | FloatMF)) + && ((i.suffix == LONG_MNEM_SUFFIX) == (flag_code == CODE_16BIT) + || (flag_code == CODE_64BIT + && (i.tm.opcode_modifier & JumpByte)))) { unsigned int prefix = DATA_PREFIX_OPCODE; diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 849c885..43f0588 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2005-12-06 H.J. Lu + + PR gas/1874 + * gas/i386/i386.exp: Add x86-64-prescott for 64bit. + + * gas/i386/prescott.s: Test address size override for monitor. + * gas/i386/prescott.d: Updated. + + * gas/i386/x86-64-prescott.d: New file. + * gas/i386/x86-64-prescott.s: Likewise. + 2005-12-06 Hans-Peter Nilsson * gas/cris/rd-pcplus.s, gas/cris/rd-pcplus.d: New test. diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp index d536da3..718514f 100644 --- a/gas/testsuite/gas/i386/i386.exp +++ b/gas/testsuite/gas/i386/i386.exp @@ -131,6 +131,7 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] t run_dump_test "svme64" run_dump_test "x86-64-vmx" run_dump_test "immed64" + run_dump_test "x86-64-prescott" # For ELF targets verify that @unwind works. if { ([istarget "*-*-elf*"] || [istarget "*-*-linux*"] diff --git a/gas/testsuite/gas/i386/prescott.d b/gas/testsuite/gas/i386/prescott.d index 496bb49..1e66065 100644 --- a/gas/testsuite/gas/i386/prescott.d +++ b/gas/testsuite/gas/i386/prescott.d @@ -32,5 +32,6 @@ Disassembly of section .text: 62: f3 0f 12 dc [ ]*movsldup %xmm4,%xmm3 66: 0f 01 c9 [ ]*mwait %eax,%ecx 69: 0f 01 c9 [ ]*mwait %eax,%ecx - 6c: 00 00 [ ]*add %al,\(%eax\) + 6c: 67 0f 01 c8 [ ]*monitor %ax,%ecx,%edx + 70: 67 0f 01 c8 [ ]*monitor %ax,%ecx,%edx ... diff --git a/gas/testsuite/gas/i386/prescott.s b/gas/testsuite/gas/i386/prescott.s index a70c835..95dacf7 100644 --- a/gas/testsuite/gas/i386/prescott.s +++ b/gas/testsuite/gas/i386/prescott.s @@ -29,4 +29,7 @@ foo: mwait mwait %eax,%ecx + monitor %ax,%ecx,%edx + addr16 monitor + .p2align 4,0 diff --git a/gas/testsuite/gas/i386/x86-64-prescott.d b/gas/testsuite/gas/i386/x86-64-prescott.d new file mode 100644 index 0000000..43a2d28 --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-prescott.d @@ -0,0 +1,37 @@ +#objdump: -dw +#name: x86-64 prescott + +.*: +file format .* + +Disassembly of section .text: + +0+000 : + 0: 66 0f d0 01 [ ]*addsubpd \(%rcx\),%xmm0 + 4: 66 0f d0 ca [ ]*addsubpd %xmm2,%xmm1 + 8: f2 0f d0 13 [ ]*addsubps \(%rbx\),%xmm2 + c: f2 0f d0 dc [ ]*addsubps %xmm4,%xmm3 + 10: df 88 90 90 90 90 [ ]*fisttp 0xffffffff90909090\(%rax\) + 16: db 88 90 90 90 90 [ ]*fisttpl 0xffffffff90909090\(%rax\) + 1c: dd 88 90 90 90 90 [ ]*fisttpll 0xffffffff90909090\(%rax\) + 22: 66 0f 7c 65 00 [ ]*haddpd 0x0\(%rbp\),%xmm4 + 27: 66 0f 7c ee [ ]*haddpd %xmm6,%xmm5 + 2b: f2 0f 7c 37 [ ]*haddps \(%rdi\),%xmm6 + 2f: f2 0f 7c f8 [ ]*haddps %xmm0,%xmm7 + 33: 66 0f 7d c1 [ ]*hsubpd %xmm1,%xmm0 + 37: 66 0f 7d 0a [ ]*hsubpd \(%rdx\),%xmm1 + 3b: f2 0f 7d d2 [ ]*hsubps %xmm2,%xmm2 + 3f: f2 0f 7d 1c 24 [ ]*hsubps \(%rsp\),%xmm3 + 44: f2 0f f0 2e [ ]*lddqu \(%rsi\),%xmm5 + 48: 0f 01 c8 [ ]*monitor %rax,%rcx,%rdx + 4b: 0f 01 c8 [ ]*monitor %rax,%rcx,%rdx + 4e: f2 0f 12 f7 [ ]*movddup %xmm7,%xmm6 + 52: f2 0f 12 38 [ ]*movddup \(%rax\),%xmm7 + 56: f3 0f 16 01 [ ]*movshdup \(%rcx\),%xmm0 + 5a: f3 0f 16 ca [ ]*movshdup %xmm2,%xmm1 + 5e: f3 0f 12 13 [ ]*movsldup \(%rbx\),%xmm2 + 62: f3 0f 12 dc [ ]*movsldup %xmm4,%xmm3 + 66: 0f 01 c9 [ ]*mwait %rax,%rcx + 69: 0f 01 c9 [ ]*mwait %rax,%rcx + 6c: 67 0f 01 c8 [ ]*monitor %eax,%rcx,%rdx + 70: 67 0f 01 c8 [ ]*monitor %eax,%rcx,%rdx + ... diff --git a/gas/testsuite/gas/i386/x86-64-prescott.s b/gas/testsuite/gas/i386/x86-64-prescott.s new file mode 100644 index 0000000..0f03683 --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-prescott.s @@ -0,0 +1,35 @@ +#Prescott New Instructions + + .text +foo: + addsubpd (%rcx),%xmm0 + addsubpd %xmm2,%xmm1 + addsubps (%rbx),%xmm2 + addsubps %xmm4,%xmm3 + fisttp 0x90909090(%rax) + fisttpl 0x90909090(%rax) + fisttpll 0x90909090(%rax) + haddpd 0x0(%rbp),%xmm4 + haddpd %xmm6,%xmm5 + haddps (%rdi),%xmm6 + haddps %xmm0,%xmm7 + hsubpd %xmm1,%xmm0 + hsubpd (%rdx),%xmm1 + hsubps %xmm2,%xmm2 + hsubps (%rsp,1),%xmm3 + lddqu (%rsi),%xmm5 + monitor + monitor %rax,%rcx,%rdx + movddup %xmm7,%xmm6 + movddup (%rax),%xmm7 + movshdup (%rcx),%xmm0 + movshdup %xmm2,%xmm1 + movsldup (%rbx),%xmm2 + movsldup %xmm4,%xmm3 + mwait + mwait %rax,%rcx + + monitor %eax,%rcx,%rdx + addr32 monitor + + .p2align 4,0 -- cgit v1.1