https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66822

--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> ---
X86_TUNE_USE_BT also reduces code size:

[hjl@gnu-tools-1 pr66822]$ cat y.i
void bar (void);

void
foo (int x)
{
  if (x != 2 && x != 3 && x != 10 && x != 11 && x != 17 && x != 18 && x != 23)
    bar ();
}
[hjl@gnu-tools-1 pr66822]$ make y.o
/export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -O2 -m32 -miamcu -mtune=iamcu
-S -o y.s y.i
/export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -O2 -m32 -miamcu -mtune=iamcu
-c -o y.o y.s
rm y.s
[hjl@gnu-tools-1 pr66822]$ objdump -dwr y.o

y.o:     file format elf32-i386


Disassembly of section .text:

00000000 <foo>:
   0:   83 f8 17                cmp    $0x17,%eax
   3:   76 0b                   jbe    10 <foo+0x10>
   5:   e9 fc ff ff ff          jmp    6 <foo+0x6>      6: R_386_PC32   bar
   a:   8d b6 00 00 00 00       lea    0x0(%esi),%esi
  10:   ba 0c 0c 86 00          mov    $0x860c0c,%edx
  15:   88 c1                   mov    %al,%cl
  17:   d3 ea                   shr    %cl,%edx
  19:   83 e2 01                and    $0x1,%edx
  1c:   74 e7                   je     5 <foo+0x5>
  1e:   c3                      ret    
[hjl@gnu-tools-1 pr66822]$ /export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -O2 -m32 -miamcu -mtune=iamcu
-c y.i -mtune-ctrl=use_bt
[hjl@gnu-tools-1 pr66822]$ objdump -dwr y.o

y.o:     file format elf32-i386


Disassembly of section .text:

00000000 <foo>:
   0:   83 f8 17                cmp    $0x17,%eax
   3:   76 0b                   jbe    10 <foo+0x10>
   5:   e9 fc ff ff ff          jmp    6 <foo+0x6>      6: R_386_PC32   bar
   a:   8d b6 00 00 00 00       lea    0x0(%esi),%esi
  10:   ba 0c 0c 86 00          mov    $0x860c0c,%edx
  15:   0f a3 c2                bt     %eax,%edx
  18:   73 eb                   jae    5 <foo+0x5>
  1a:   c3                      ret    
[hjl@gnu-tools-1 pr66822]$

Reply via email to