This is the mail archive of the binutils@sourceware.org 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]

[PATCH] x86 gas: allow 'rep nop'


There is another 'rep;INSN' form that GCC likes to emit, this one
'rep;nop' as an alias for 'pause'.  It's nicer to accept 'rep nop'
for this one too.

Ok for trunk?


Thanks,
Roland


gas/testsuite/
2012-07-02  Roland McGrath  <mcgrathr@google.com>

	* gas/i386/rep-nop.d: New file.
	* gas/i386/rep-nop.s: New file.
	* gas/i386/i386.exp: Add the new test.

opcodes/
2012-07-02  Roland McGrath  <mcgrathr@google.com>

	* i386-opc.tbl: Add RepPrefixOk to nop.

diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
index 0049000..a954088 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -266,6 +266,7 @@ if [expr ([istarget "i*86-*-*"] ||  [istarget "x86_64-*-*"]) && [gas_32_check]]
     run_dump_test "pr12589-1"
     run_dump_test "rep-bsf"
     run_dump_test "rep-ret"
+    run_dump_test "rep-nop"
 
     set ASFLAGS "$old_ASFLAGS"
 }
diff --git a/gas/testsuite/gas/i386/rep-nop.d b/gas/testsuite/gas/i386/rep-nop.d
new file mode 100644
index 0000000..a269c6e
--- /dev/null
+++ b/gas/testsuite/gas/i386/rep-nop.d
@@ -0,0 +1,10 @@
+#objdump: -d
+#name: rep prefix on nop
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+000 <foo>:
+\s*[0-9a-f]+:\s+f3 90\s+pause\s*
+	\.\.\.
diff --git a/gas/testsuite/gas/i386/rep-nop.s b/gas/testsuite/gas/i386/rep-nop.s
new file mode 100644
index 0000000..ed9d5ad
--- /dev/null
+++ b/gas/testsuite/gas/i386/rep-nop.s
@@ -0,0 +1,3 @@
+	.text
+foo:	rep nop
+	.p2align 4,0
diff --git a/opcodes/i386-opc.tbl b/opcodes/i386-opc.tbl
index 7de61a7..54cc0d1 100644
--- a/opcodes/i386-opc.tbl
+++ b/opcodes/i386-opc.tbl
@@ -504,7 +504,7 @@ nop, 1, 0xf1f, 0x0, 2, CpuNop, Modrm|No_bSuf|No_sSuf|No_ldSuf, { Reg16|Reg32|Reg
 
 // nop is actually "xchg %ax,%ax" in 16bit mode, "xchg %eax,%eax" in
 // 32bit mode and "xchg %rax,%rax" in 64bit mode.
-nop, 0, 0x90, None, 1, 0, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { 0 }
+nop, 0, 0x90, None, 1, 0, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|RepPrefixOk, { 0 }
 
 // Protection control.
 arpl, 2, 0x63, None, 1, Cpu286|CpuNo64, Modrm|IgnoreSize|No_bSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg16, Reg16|Word|Unspecified|BaseIndex|Disp8|Disp16|Disp32 }
diff --git a/opcodes/i386-tbl.h b/opcodes/i386-tbl.h
index 89dfda4..2248c7b 100644
--- a/opcodes/i386-tbl.h
+++ b/opcodes/i386-tbl.h
@@ -4142,7 +4142,7 @@ const insn_template i386_optab[] =
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 
-      1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+      1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 
       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
     { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
 	  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]