This is the mail archive of the gcc-bugs@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]

[Bug optimization/14237] New: suboptimal comparison between long and long long


unsigned long long g;

unsigned long
foo (unsigned long a)
{
  return (a >= g) ? 1 : 0;
}

turns into

foo:
	pushl	%esi           ; we wouldn't need this if %esi were untouched
	movl	g+4, %ecx
	xorl	%esi, %esi
	pushl	%ebx
	cmpl	%ecx, %esi     ; we could use "testl" here because %esi == 0
	movl	12(%esp), %ebx
	movl	$1, %eax
	movl	g, %edx
	jb	.L3
	cmpl	%edx, %ebx
	jae	.L2
.L3:
	xorl	%eax, %eax
.L2:
	popl	%ebx
	popl	%esi
	ret

-- 
           Summary: suboptimal comparison between long and long long
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kazu at cs dot umass dot edu
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14237


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