This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR optimization/6822


Richard, hopefully I wasn't too bad a secretary ;-)

Bootstrapped/regtested (C/C++) on i586-pc-linux-gnu (gcc-3_1-branch).


2002-05-30  Richard Henderson  <rth@redhat.com>
            Eric Botcazou  <ebotcazou@multimania.com>

 PR optimization/6822
 * config/i386/i386.c (ix86_expand_int_movcc): When trying to convert
 a LEU or a GTU, use GET_MODE_MASK to check the second operand. Use
 get_int_mode to truncate it to the right mode after incrementing it.


Should the testcase go in torture/compile, or dg to restrict it to i386 ?


/* PR optimization/6822 */

extern unsigned char foo1 (void);
extern unsigned short foo2 (void);

int bar1 (void)
{
  unsigned char q = foo1 ();
  return (q < 0x80) ? 64 : 0;
}

int bar2 (void)
{
  unsigned short h = foo2 ();
  return (h < 0x8000) ? 64 : 0;
}


The assembly output of the testcase exhibits an interesting pattern: (-O2)

.globl bar1
 .type bar1,@function
bar1:
 pushl %ebp
 movl %esp, %ebp
 pushl %eax
 pushl %eax
 call foo1
 cmpb $-128, %al
 sbbl %eax, %eax
 movl %ebp, %esp
 andl $64, %eax
 popl %ebp
 ret

The ifcvt pass has devised a clever way to eliminate the conditional jump,
but it looks like the two stack slots thus freed haven't been deleted.

--
Eric Botcazou
ebotcazou@multimania.com

Attachment: i386.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]