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 other/16798] New: PowerPC - Opportunity to use recording form instruction.


Description:
A non-optimal code sequence is illustraded.  The recording form of an instruction could be used allowing for the elimination of a compare.  Duplicate using gcc 3.5 and command line:

gcc -O3 -m64 -c test.c


Testcase:
long int i, j;
int foo ()
{

  j = (i>>52);

  if (j< 0) {
    i = 10;
  } else {
    i = 20;
  };

  return i;

}

Assembly:
.foo:
	ld 11,.LC0@toc(2)
	ld 9,.LC1@toc(2)
	ld 0,0(11)
	sradi 0,0,52 <-- Use the recording form of sradi
	cmpdi 7,0,0  <-- and eliminate this compare.
	std 0,0(9)
	blt- 7,.L7
	li 0,20
	std 0,0(11)
	lwa 3,4(11)
	blr
.L7:
	li 0,10
	std 0,0(11)
	lwa 3,4(11)
	blr



-- 
           Summary: PowerPC - Opportunity to use recording form instruction.
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P1
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: steinmtz at us dot ibm dot com
                CC: gcc-bugs at gcc dot gnu dot org,steinmtz at us dot ibm
                    dot com
 GCC build triplet: powerpc64-linux
  GCC host triplet: powerpc64-linux
GCC target triplet: powerpc64-linux


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


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