Bug 17959 - -mpowerpc64 can cause worse code than without it
Summary: -mpowerpc64 can cause worse code than without it
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.0.0
: P2 enhancement
Target Milestone: 4.2.0
Assignee: Not yet assigned to anyone
URL:
Keywords: missed-optimization
Depends on: 26977
Blocks: spec
  Show dependency treegraph
 
Reported: 2004-10-12 23:01 UTC by Andrew Pinski
Modified: 2006-03-30 21:35 UTC (History)
3 users (show)

See Also:
Host:
Target: powerpc-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-11-26 01:47:45


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2004-10-12 23:01:30 UTC
unsigned long long div16(unsigned long long n) { return n / 16; }

Without -mpowerpc64:
_div16:
        slwi r0,r3,28
        srwi r4,r4,4
        or r4,r0,r4
        srwi r3,r3,4
        blr

With:
_div16:
        li r0,0
        rldimi r0,r3,32,0
        rldimi r0,r4,0,32
        srdi r4,r0,4
        srdi r3,r0,36
        blr
Comment 1 Alan Modra 2004-11-28 08:27:01 UTC
powerpc-linux too.  3.4 is even worse due to needlessly setting up a stack frame.
Comment 2 Roger Sayle 2006-03-30 17:47:52 UTC
Subject: Bug 17959

Author: sayle
Date: Thu Mar 30 17:47:48 2006
New Revision: 112543

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=112543
Log:

	PR target/17959
	* expr.c (emit_group_store):  Optimize group stores into a pseudo
	register by using a paradoxical subreg to initialize the destination
	if the first or last member of the group specifies a "low part".


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/expr.c

Comment 3 roger 2006-03-30 21:35:07 UTC
This is now be fixed on mainline.  With -mpowerpc64, we now generate:

_div16:
        rldimi 3,4,0,32
        srdi 4,3,4
        srdi 3,3,36
        blr