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]

[committed, PATCH] x86: Add tests for -n option of x86 assembler


The -n command-line of x86 assembler disables optimization of alignment
directives, like ".balign 8, 0x90", with multi-byte nop instructions
such as leal 0(%esi),%esi.

	PR gas/22464
	* testsuite/gas/i386/align-1.s: New file.
	* testsuite/gas/i386/align-1a.d: Likewise.
	* testsuite/gas/i386/align-1b.d: Likewise.
	* testsuite/gas/i386/i386.exp: Run align-1a and align-1b.
---
 gas/ChangeLog                     |  8 ++++++++
 gas/testsuite/gas/i386/align-1.s  |  7 +++++++
 gas/testsuite/gas/i386/align-1a.d | 17 +++++++++++++++++
 gas/testsuite/gas/i386/align-1b.d | 24 ++++++++++++++++++++++++
 gas/testsuite/gas/i386/i386.exp   |  2 ++
 5 files changed, 58 insertions(+)
 create mode 100644 gas/testsuite/gas/i386/align-1.s
 create mode 100644 gas/testsuite/gas/i386/align-1a.d
 create mode 100644 gas/testsuite/gas/i386/align-1b.d

diff --git a/gas/ChangeLog b/gas/ChangeLog
index b60b7ea200..fd4f3793f2 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,11 @@
+2017-11-21  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR gas/22464
+	* testsuite/gas/i386/align-1.s: New file.
+	* testsuite/gas/i386/align-1a.d: Likewise.
+	* testsuite/gas/i386/align-1b.d: Likewise.
+	* testsuite/gas/i386/i386.exp: Run align-1a and align-1b.
+
 2017-11-21  Claudiu Zissulescu <claziss@synopsys.com>
 
 	* testsuite/gas/arc/b.d : Update test.
diff --git a/gas/testsuite/gas/i386/align-1.s b/gas/testsuite/gas/i386/align-1.s
new file mode 100644
index 0000000000..69638d2576
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-1.s
@@ -0,0 +1,7 @@
+	.text
+_start:
+	movl	%edi, %eax
+	.balign 8, 0x90
+	movl	$0, %edx
+	.balign 8, 0x90
+	addl	%eax, %edx
diff --git a/gas/testsuite/gas/i386/align-1a.d b/gas/testsuite/gas/i386/align-1a.d
new file mode 100644
index 0000000000..3fc27cb564
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-1a.d
@@ -0,0 +1,17 @@
+#name: i386 balign
+#source: align-1.s
+#as: -mtune=generic32
+#objdump: -dr
+
+.*: +file format .*i386.*
+
+
+Disassembly of section .text:
+
+0+ <_start>:
+[ 	]*[a-f0-9]+:	89 f8                	mov    %edi,%eax
+[ 	]*[a-f0-9]+:	8d b6 00 00 00 00    	lea    0x0\(%esi\),%esi
+[ 	]*[a-f0-9]+:	ba 00 00 00 00       	mov    \$0x0,%edx
+[ 	]*[a-f0-9]+:	8d 76 00             	lea    0x0\(%esi\),%esi
+[ 	]*[a-f0-9]+:	01 c2                	add    %eax,%edx
+#pass
diff --git a/gas/testsuite/gas/i386/align-1b.d b/gas/testsuite/gas/i386/align-1b.d
new file mode 100644
index 0000000000..f8300ea1a6
--- /dev/null
+++ b/gas/testsuite/gas/i386/align-1b.d
@@ -0,0 +1,24 @@
+#name: i386 balign (-n)
+#source: align-1.s
+#as: -mtune=generic32 -n
+#objdump: -dr
+
+.*: +file format .*i386.*
+
+
+Disassembly of section .text:
+
+0+ <_start>:
+[ 	]*[a-f0-9]+:	89 f8                	mov    %edi,%eax
+[ 	]*[a-f0-9]+:	90                   	nop
+[ 	]*[a-f0-9]+:	90                   	nop
+[ 	]*[a-f0-9]+:	90                   	nop
+[ 	]*[a-f0-9]+:	90                   	nop
+[ 	]*[a-f0-9]+:	90                   	nop
+[ 	]*[a-f0-9]+:	90                   	nop
+[ 	]*[a-f0-9]+:	ba 00 00 00 00       	mov    \$0x0,%edx
+[ 	]*[a-f0-9]+:	90                   	nop
+[ 	]*[a-f0-9]+:	90                   	nop
+[ 	]*[a-f0-9]+:	90                   	nop
+[ 	]*[a-f0-9]+:	01 c2                	add    %eax,%edx
+#pass
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
index a053676df8..7e102b621e 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -427,6 +427,8 @@ if [expr ([istarget "i*86-*-*"] ||  [istarget "x86_64-*-*"]) && [gas_32_check]]
     run_dump_test "notrack"
     run_dump_test "notrack-intel"
     run_list_test "notrackbad" "-al"
+    run_dump_test "align-1a"
+    run_dump_test "align-1b"
 
     # These tests require support for 8 and 16 bit relocs,
     # so we only run them for ELF and COFF targets.
-- 
2.14.3


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