aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2018-07-31 10:58:05 +0200
committerJan Beulich <jbeulich@suse.com>2018-07-31 10:58:05 +0200
commit1424ad867742286be44932bf29720539add19ae0 (patch)
tree5461a39c1b53637faccaf9b1abab4cbf85fa8bf1 /gas/config
parentae2387feae3f0798dd77c98a7107fdec38a99fe3 (diff)
downloadbinutils-1424ad867742286be44932bf29720539add19ae0.zip
binutils-1424ad867742286be44932bf29720539add19ae0.tar.gz
binutils-1424ad867742286be44932bf29720539add19ae0.tar.bz2
x86: also optimize KXOR{D,Q} and KANDN{D,Q}
These can be converted to 2-byte VEX encoding when both source registers are the same, by using KXORW / KANDNW as replacement.
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/tc-i386.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 8761e97..e07056f 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -3942,7 +3942,11 @@ optimize_encoding (void)
|| i.tm.base_opcode == 0x66f8
|| i.tm.base_opcode == 0x66f9
|| i.tm.base_opcode == 0x66fa
- || i.tm.base_opcode == 0x66fb)
+ || i.tm.base_opcode == 0x66fb
+ || i.tm.base_opcode == 0x42
+ || i.tm.base_opcode == 0x6642
+ || i.tm.base_opcode == 0x47
+ || i.tm.base_opcode == 0x6647)
&& i.tm.extension_opcode == None))
{
/* Optimize: -O2:
@@ -3973,6 +3977,12 @@ optimize_encoding (void)
EVEX VOP %ymmM, %ymmM, %ymmN
-> VEX vpxor %xmmM, %xmmM, %xmmN (M and N < 16)
-> EVEX VOP %xmmM, %xmmM, %xmmN (M || N >= 16)
+ VOP, one of kxord and kxorq:
+ VEX VOP %kM, %kM, %kN
+ -> VEX kxorw %kM, %kM, %kN
+ VOP, one of kandnd and kandnq:
+ VEX VOP %kM, %kM, %kN
+ -> VEX kandnw %kM, %kM, %kN
*/
if (is_evex_encoding (&i.tm))
{
@@ -3985,6 +3995,11 @@ optimize_encoding (void)
i.tm.opcode_modifier.evex = 0;
}
}
+ else if (i.tm.operand_types[0].bitfield.regmask)
+ {
+ i.tm.base_opcode &= 0xff;
+ i.tm.opcode_modifier.vexw = VEXW0;
+ }
else
i.tm.opcode_modifier.vex = VEX128;