PATCH: PR gas/1874: mwait/monitor don't work in 64bit

H. J. Lu hjl@lucon.org
Wed Nov 16 07:34:00 GMT 2005


On Tue, Nov 15, 2005 at 04:08:18PM -0800, H. J. Lu wrote:
> This patch adds 64bit support to mwait/monitor.
> 
> 

I checked icc. We only need 64bit monitor with 64bit address. Here is
the updated patch.


H.J.
---
gas/testsuite/

2005-11-15  H.J. Lu  <hongjiu.lu@intel.com>

	PR gas/1874
	* gas/i386/i386.exp: Add x86-64-prescott for 64bit.

	* gas/i386/x86-64-prescott.d: New file.
	* gas/i386/x86-64-prescott.s: Likewise.

include/opcode/

2005-11-15  H.J. Lu  <hongjiu.lu@intel.com>

	PR gas/1874
	* i386.h (i386_optab): Add 64bit monitor.

--- binutils/gas/testsuite/gas/i386/i386.exp.pni	2005-11-11 10:48:53.000000000 -0800
+++ binutils/gas/testsuite/gas/i386/i386.exp	2005-11-15 15:37:50.000000000 -0800
@@ -131,6 +131,7 @@ if [expr ([istarget "i*86-*-*"] || [ista
     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*"]
--- binutils/gas/testsuite/gas/i386/x86-64-prescott.d.pni	2005-11-15 15:33:49.000000000 -0800
+++ binutils/gas/testsuite/gas/i386/x86-64-prescott.d	2005-11-15 23:29:48.000000000 -0800
@@ -0,0 +1,36 @@
+#objdump: -dw
+#name: x86-64 prescott
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+000 <foo>:
+   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,%ecx,%edx
+  4b:	0f 01 c8 [ 	]*monitor %rax,%ecx,%edx
+  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  %eax,%ecx
+  69:	0f 01 c9 [ 	]*mwait  %eax,%ecx
+  6c:	00 00 [ 	]*add    %al,\(%rax\)
+	...
--- binutils/gas/testsuite/gas/i386/x86-64-prescott.s.pni	2005-11-15 15:33:47.000000000 -0800
+++ binutils/gas/testsuite/gas/i386/x86-64-prescott.s	2005-11-15 23:29:39.000000000 -0800
@@ -0,0 +1,32 @@
+#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,%ecx,%edx
+	movddup		%xmm7,%xmm6
+	movddup		(%rax),%xmm7
+	movshdup	(%rcx),%xmm0
+	movshdup	%xmm2,%xmm1
+	movsldup	(%rbx),%xmm2
+	movsldup	%xmm4,%xmm3
+	mwait
+	mwait		%eax,%ecx
+
+	.p2align	4,0
--- binutils/include/opcode/i386.h.pni	2005-07-27 08:41:15.000000000 -0700
+++ binutils/include/opcode/i386.h	2005-11-15 22:38:57.000000000 -0800
@@ -1347,7 +1347,9 @@ static const template i386_optab[] =
 {"lddqu",     2, 0xf20ff0,  X, CpuPNI, NoSuf|IgnoreSize|Modrm,	{ LLongMem, RegXMM, 0 } },
 {"monitor",   0, 0x0f01, 0xc8, CpuPNI, NoSuf|ImmExt,	{ 0, 0, 0} },
 /* Need to ensure only "monitor %eax,%ecx,%edx" is accepted. */
-{"monitor",   3, 0x0f01, 0xc8, CpuPNI, NoSuf|ImmExt,	{ Reg32, Reg32, Reg32} },
+{"monitor",   3, 0x0f01, 0xc8, CpuPNI|CpuNo64, NoSuf|ImmExt,	{ Reg32, Reg32, Reg32 } },
+/* Need to ensure only "monitor %rax,%ecx,%edx" is accepted. */
+{"monitor",   3, 0x0f01, 0xc8, CpuPNI|Cpu64, NoSuf|ImmExt|NoRex64,	{ Reg64, Reg32, Reg32 } },
 {"movddup",   2, 0xf20f12,  X, CpuPNI, NoSuf|IgnoreSize|Modrm,	{ RegXMM|LLongMem, RegXMM, 0 } },
 {"movshdup",  2, 0xf30f16,  X, CpuPNI, NoSuf|IgnoreSize|Modrm,	{ RegXMM|LLongMem, RegXMM, 0 } },
 {"movsldup",  2, 0xf30f12,  X, CpuPNI, NoSuf|IgnoreSize|Modrm,	{ RegXMM|LLongMem, RegXMM, 0 } },



More information about the Binutils mailing list