This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] x86-64: don't allow use of %axl as accumulator
- From: "Jan Beulich" <JBeulich at suse dot com>
- To: <binutils at sourceware dot org>
- Cc: "H.J. Lu" <hjl dot tools at gmail dot com>
- Date: Fri, 10 Nov 2017 05:50:25 -0700
- Subject: [PATCH] x86-64: don't allow use of %axl as accumulator
- Authentication-results: sourceware.org; auth=none
Just like %cxl can't be used as shift count register. Otherwise for
consistency %cxl would need to gain "ShiftCount" and use of both ought
to properly cause REX prefixes to be emitted.
gas/
2017-11-10 Jan Beulich <jbeulich@suse.com>
* testsuite/gas/i386/x86-64-reg-bad.{s,l}: New.
* testsuite/gas/i386/i386.exp: Run new test.
opcodes/
2017-11-10 Jan Beulich <jbeulich@suse.com>
* i386-reg.tbl (axl): Remove Acc and Byte.
* i386-tbl.h: Re-generate.
--- 2017-11-10/gas/testsuite/gas/i386/i386.exp
+++ 2017-11-10/gas/testsuite/gas/i386/i386.exp
@@ -628,6 +628,7 @@ if [expr ([istarget "i*86-*-*"] || [ista
run_dump_test "x86-64-mem"
run_dump_test "x86-64-mem-intel"
run_dump_test "x86-64-reg"
+ run_list_test "x86-64-reg-bad" "-al"
run_dump_test "x86-64-reg-intel"
run_dump_test "x86-64-sib"
run_dump_test "x86-64-sib-intel"
--- 2017-11-10/gas/testsuite/gas/i386/x86-64-reg-bad.l
+++ 2017-11-10/gas/testsuite/gas/i386/x86-64-reg-bad.l
@@ -0,0 +1,18 @@
+.*: Assembler messages:
+.*:4: Error: .* mismatch for `movabs'
+.*:6: Error: .* mismatch for `div'
+.*:7: Error: .* mismatch for `in'
+.*:8: Error: .* mismatch for `lods'
+.*:9: Error: .* mismatch for `shl'
+GAS LISTING .*
+
+
+[ ]*[1-9][0-9]*[ ]+\# Check %axl / %cxl aren't permitted as accumulator / shift count
+[ ]*[1-9][0-9]*[ ]+\.text
+[ ]*[1-9][0-9]*[ ]+reg:
+[ ]*[1-9][0-9]*[ ]+movabs -1, %axl
+[ ]*[1-9][0-9]*[ ]+\?* 4080C001[ ]+add \$1, %axl
+[ ]*[1-9][0-9]*[ ]+div %bl, %axl
+[ ]*[1-9][0-9]*[ ]+in %dx, %axl
+[ ]*[1-9][0-9]*[ ]+lods \(%rsi\), %axl
+[ ]*[1-9][0-9]*[ ]+shl %cxl, %eax
--- 2017-11-10/gas/testsuite/gas/i386/x86-64-reg-bad.s
+++ 2017-11-10/gas/testsuite/gas/i386/x86-64-reg-bad.s
@@ -0,0 +1,9 @@
+# Check %axl / %cxl aren't permitted as accumulator / shift count
+ .text
+reg:
+ movabs -1, %axl
+ add $1, %axl
+ div %bl, %axl
+ in %dx, %axl
+ lods (%rsi), %axl
+ shl %cxl, %eax
--- 2017-11-10/opcodes/i386-reg.tbl
+++ 2017-11-10/opcodes/i386-reg.tbl
@@ -29,7 +29,7 @@ ah, Reg8, 0, 4, Dw2Inval, Dw2Inval
ch, Reg8, 0, 5, Dw2Inval, Dw2Inval
dh, Reg8, 0, 6, Dw2Inval, Dw2Inval
bh, Reg8, 0, 7, Dw2Inval, Dw2Inval
-axl, Reg8|Acc|Byte, RegRex64, 0, Dw2Inval, Dw2Inval
+axl, Reg8, RegRex64, 0, Dw2Inval, Dw2Inval
cxl, Reg8, RegRex64, 1, Dw2Inval, Dw2Inval
dxl, Reg8, RegRex64, 2, Dw2Inval, Dw2Inval
bxl, Reg8, RegRex64, 3, Dw2Inval, Dw2Inval