i386: Also check R12-R15 registers when optimizing testq to testb
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 12 Dec 2019 20:25:48 +0000 (12:25 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 12 Dec 2019 20:31:26 +0000 (12:31 -0800)
commitac0ab1842de0e4522248ff9805c5c4e3267c8ae7
treed07205df31a85cd5658dec5ff14032bc6174a221
parent8493b6651af3d2130d5f5f050905cd3d6e8a9c27
i386: Also check R12-R15 registers when optimizing testq to testb

Similar to SP, BP, SI and DI registers, R12-R15 registers must use REX
prefix for the low byte register when optimizing

test $imm7, %r64/%r32/%r16 -> test $imm7, %r8

PR gas/25274
* config/tc-i386.c (optimize_encoding): Also check R12-R15
registers for "test $imm7, %r64/%r32/%r16 -> test $imm7, %r8"
optimization.
* testsuite/gas/i386/x86-64-optimize-3.s: Add tests for test
with r12.
* testsuite/gas/i386/x86-64-optimize-3.d: Updated.
* testsuite/gas/i386/x86-64-optimize-3b.d: Likewise.
gas/ChangeLog
gas/config/tc-i386.c
gas/testsuite/gas/i386/x86-64-optimize-3.d
gas/testsuite/gas/i386/x86-64-optimize-3.s
gas/testsuite/gas/i386/x86-64-optimize-3b.d