From 5641ec015a191e0584fd4cae57bb3262f7a51735 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Mon, 1 Jul 2019 08:35:08 +0200 Subject: x86: optimize AND/OR with twice the same register It seems to be not uncommon for people to use AND or OR in this form for just setting the status flags. TEST, which doesn't write to any register other than EFLAGS, ought to be preferred. Make the change only for -O2 and above though, at least for now. --- gas/doc/c-i386.texi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gas/doc') diff --git a/gas/doc/c-i386.texi b/gas/doc/c-i386.texi index 2ceb594..e0d0bc9 100644 --- a/gas/doc/c-i386.texi +++ b/gas/doc/c-i386.texi @@ -477,7 +477,8 @@ instructions with 128-bit/256-bit VEX packed integer logical. EVEX vector register clearing instructions. In 64-bit mode VEX encoded instructions with commutative source operands will also have their source operands swapped if this allows using the 2-byte VEX prefix form -instead of the 3-byte one. +instead of the 3-byte one. Certain forms of AND as well as OR with the +same (register) operand specified twice will also be changed to TEST. @samp{-Os} includes @samp{-O2} optimization plus encodes 16-bit, 32-bit and 64-bit register tests with immediate as 8-bit register test with -- cgit v1.1