Bug 26505 - Storing float to int into two different pointers requires stack space
Summary: Storing float to int into two different pointers requires stack space
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.2.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: missed-optimization
Depends on:
Blocks:
 
Reported: 2006-03-01 05:21 UTC by Andrew Pinski
Modified: 2022-03-08 16:20 UTC (History)
1 user (show)

See Also:
Host:
Target: powerpc-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2007-07-02 21:33:06


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2006-03-01 05:21:49 UTC
Testcase (modified from testcase which Chris Latter was looking at):
void foo(float a, int *b) { b[0] = b[1] = a; }
----
Currently we get:
        fctiwz f0,f1
        addi r2,r1,-24
        stfiwx f0,0,r2
        lwz r0,-24(r1)
        stw r0,0(r4)
        stw r0,4(r4)

------
We should be able to get:
fctiwz f0,f1
stfiwx f0,0,r4
li r2, 4
stfiwx f0,r2,r4
---- or -----
fctiwz f0,f1
stfiwx f0,0,r4
addi r4, r4, 4
stfiwx f0,0,r4
Depending on a lot of stuff
I don't know how much this shows up in real code.
Comment 1 Andrew Pinski 2006-03-01 05:22:56 UTC
s/Latter/Lattner/
Comment 2 Andrew Pinski 2006-03-06 14:20:02 UTC
Confirmed.  Also happens on x86 too.