x86-64: optimize certain commutative VEX-encoded insns
authorJan Beulich <jbeulich@suse.com>
Mon, 1 Jul 2019 06:33:56 +0000 (08:33 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 1 Jul 2019 06:33:56 +0000 (08:33 +0200)
commit79dec6b7baa243a4ada018a082491990adb6aec1
treee77adf4f441561605525a616766898d5280192cb
parenta80195f1224aced64392b452d55980b6bbd2a8b9
x86-64: optimize certain commutative VEX-encoded insns

When they're in the 0F opcode space, swapping their source operands may
allow switching from 3-byte to 2-byte VEX prefix encoding. Note that NaN
behavior precludes us doing so for many packed and scalar floating point
insns; such an optimization would need to be done by the compiler
instead in this case, when it knows that NaN-s have undefined behavior
anyway.

While for explicitly specified AVX/AVX2 insns the optimization (for now
at least) gets done only for -O2 and -Os, it is utilized by default in
SSE2AVX mode, as there we're re-writing the programmer's specified insns
anyway.

Rather than introducing a new attribute flag, the change re-uses one
which so far was meaningful only for EVEX-encoded insns.
17 files changed:
gas/ChangeLog
gas/config/tc-i386.c
gas/doc/c-i386.texi
gas/testsuite/gas/i386/i386.exp
gas/testsuite/gas/i386/ilp32/x86-64-sse2avx.d
gas/testsuite/gas/i386/x86-64-avx-swap-2.d [new file with mode: 0644]
gas/testsuite/gas/i386/x86-64-avx-swap-2.s [new file with mode: 0644]
gas/testsuite/gas/i386/x86-64-optimize-2.d
gas/testsuite/gas/i386/x86-64-optimize-2b.d
gas/testsuite/gas/i386/x86-64-optimize-3.d
gas/testsuite/gas/i386/x86-64-optimize-5.d
gas/testsuite/gas/i386/x86-64-optimize-6.d
gas/testsuite/gas/i386/x86-64-sse2avx.d
gas/testsuite/gas/i386/x86-64-sse2avx.s
opcodes/ChangeLog
opcodes/i386-opc.tbl
opcodes/i386-tbl.h