diff options
author | Jan Beulich <jbeulich@suse.com> | 2024-03-01 09:21:40 +0100 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2024-03-01 09:21:40 +0100 |
commit | c73a37b26800fc542512558f8403f980bb044435 (patch) | |
tree | b8ea425bfa94db8da466908948d7e7e55f97b0bc /gas/config/tc-i386.c | |
parent | 6804f42c67d97401c7ef8438727eba788fc29329 (diff) | |
download | binutils-c73a37b26800fc542512558f8403f980bb044435.zip binutils-c73a37b26800fc542512558f8403f980bb044435.tar.gz binutils-c73a37b26800fc542512558f8403f980bb044435.tar.bz2 |
x86/APX: optimize certain XOR and SUB forms
While most logic in optimize_encoding() is already covering APX by way
of the earlier NDD->REX2 conversion, there's a remaining set of cases
which wants handling separately.
Diffstat (limited to 'gas/config/tc-i386.c')
-rw-r--r-- | gas/config/tc-i386.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index d169274..5e7ebf7 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -4694,6 +4694,34 @@ optimize_encoding (void) } } } + else if (i.reg_operands == 3 + && i.op[0].regs == i.op[1].regs + && i.encoding != encoding_evex + && (i.tm.mnem_off == MN_xor + || i.tm.mnem_off == MN_sub)) + { + /* Optimize: -O: + xorb %rNb, %rNb, %rMb -> xorl %rMd, %rMd + xorw %rNw, %rNw, %rMw -> xorl %rMd, %rMd + xorl %rNd, %rNd, %rMd -> xorl %rMd, %rMd + xorq %rN, %rN, %rM -> xorl %rMd, %rMd + subb %rNb, %rNb, %rMb -> subl %rMd, %rMd + subw %rNw, %rNw, %rMw -> subl %rMd, %rMd + subl %rNd, %rNd, %rMd -> subl %rMd, %rMd + subq %rN, %rN, %rM -> subl %rMd, %rMd + */ + i.tm.opcode_space = SPACE_BASE; + i.tm.opcode_modifier.evex = 0; + i.tm.opcode_modifier.size = SIZE32; + i.types[0].bitfield.byte = 0; + i.types[0].bitfield.word = 0; + i.types[0].bitfield.dword = 1; + i.types[0].bitfield.qword = 0; + i.op[0].regs = i.op[2].regs; + i.types[1] = i.types[0]; + i.op[1].regs = i.op[2].regs; + i.reg_operands = 2; + } else if (optimize > 1 && !optimize_for_space && i.reg_operands == 2 |