diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2018-03-08 06:41:34 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2018-03-08 06:41:34 -0800 |
commit | d3d50934a9101416c3106497d6ea9ce548760253 (patch) | |
tree | 1f8b1ad5d7b7052323ac1a0d51ef61e189a736f2 /gas/config | |
parent | x86: Treat relocation against IFUNC symbol as FUNC (diff) | |
download | binutils-gdb-d3d50934a9101416c3106497d6ea9ce548760253.tar.gz binutils-gdb-d3d50934a9101416c3106497d6ea9ce548760253.tar.bz2 binutils-gdb-d3d50934a9101416c3106497d6ea9ce548760253.zip |
x86-64: Also optimize "clr reg64"
"clr reg" is an alias of "xor reg, reg". We can encode "clr reg64" as
"xor reg32, reg32".
gas/
* config/tc-i386.c (optimize_encoding): Also encode "clr reg64"
as "xor reg32, reg32".
* testsuite/gas/i386/x86-64-optimize-1.s: Add "clr reg64" tests.
* testsuite/gas/i386/x86-64-optimize-1.d: Updated.
opcodes/
* i386-opc.tbl: Add Optimize to clr.
* i386-tbl.h: Regenerated.
Diffstat (limited to 'gas/config')
-rw-r--r-- | gas/config/tc-i386.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 53ac4b4f828..1c64d08ab26 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -3801,7 +3801,8 @@ optimize_encoding (void) } } else if (flag_code == CODE_64BIT - && ((i.reg_operands == 1 + && ((i.types[1].bitfield.qword + && i.reg_operands == 1 && i.imm_operands == 1 && i.op[0].imms->X_op == O_constant && ((i.tm.base_opcode == 0xb0 @@ -3816,12 +3817,16 @@ optimize_encoding (void) || ((i.tm.base_opcode == 0xf6 || i.tm.base_opcode == 0xc6) && i.tm.extension_opcode == 0x0))))) - || (i.reg_operands == 2 - && i.op[0].regs == i.op[1].regs - && ((i.tm.base_opcode == 0x30 - || i.tm.base_opcode == 0x28) - && i.tm.extension_opcode == None))) - && i.types[1].bitfield.qword) + || (i.types[0].bitfield.qword + && ((i.reg_operands == 2 + && i.op[0].regs == i.op[1].regs + && ((i.tm.base_opcode == 0x30 + || i.tm.base_opcode == 0x28) + && i.tm.extension_opcode == None)) + || (i.reg_operands == 1 + && i.operands == 1 + && i.tm.base_opcode == 0x30 + && i.tm.extension_opcode == None))))) { /* Optimize: -O: andq $imm31, %r64 -> andl $imm31, %r32 |