diff options
author | Jan Beulich <jbeulich@suse.com> | 2023-07-04 17:07:26 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2023-07-04 17:07:26 +0200 |
commit | eb4031cb20aa710834be891f8638e04dbba81edc (patch) | |
tree | 718e79578a21b150e826d3b0a618364857aeca04 /gas/config | |
parent | 33889538969edd801bdaf5422c863fe2a0b7cf45 (diff) | |
download | gdb-eb4031cb20aa710834be891f8638e04dbba81edc.zip gdb-eb4031cb20aa710834be891f8638e04dbba81edc.tar.gz gdb-eb4031cb20aa710834be891f8638e04dbba81edc.tar.bz2 |
x86: optimize 128-bit VPBROADCASTQ to VPUNPCKLQDQ
The alternative is 1 byte shorter when the source is %xmm0-7, as a
2-byte VEX prefix can then be used.
Diffstat (limited to 'gas/config')
-rw-r--r-- | gas/config/tc-i386.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 8ebeaf1..bc02f8e0 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -4620,6 +4620,33 @@ optimize_encoding (void) i.op[1].regs = i.op[0].regs; } } + else if (optimize_for_space + && i.tm.base_opcode == 0x59 + && i.tm.opcode_space == SPACE_0F38 + && i.operands == i.reg_operands + && i.tm.opcode_modifier.vex + && !(i.op[0].regs->reg_flags & RegRex) + && i.op[0].regs->reg_type.bitfield.xmmword + && i.vec_encoding != vex_encoding_vex3) + { + /* Optimize: -Os: + vpbroadcastq %xmmN, %xmmM -> vpunpcklqdq %xmmN, %xmmN, %xmmM (N < 8) + */ + i.tm.opcode_space = SPACE_0F; + i.tm.base_opcode = 0x6c; + i.tm.opcode_modifier.vexvvvv = 1; + + ++i.operands; + ++i.reg_operands; + ++i.tm.operands; + + i.op[2].regs = i.op[0].regs; + i.types[2] = i.types[0]; + i.flags[2] = i.flags[0]; + i.tm.operand_types[2] = i.tm.operand_types[0]; + + swap_2_operands (1, 2); + } } /* Return non-zero for load instruction. */ |