https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108073
Bug ID: 108073 Summary: [rs6000] sub-optimal float member accessing on struct parameter Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: guojiufu at gcc dot gnu.org Target Milestone: --- For the below code: typedef struct DF {double a[4]; long l; } DF; double __attribute__ ((noipa)) foo_df (DF arg){return arg.a[3];} At -O2, with gcc trunk(13.0), we get below sequence: std 6,-24(1) ori 2,2,0 lfd 1,-24(1) blr Actually, just one "mtvsrd 1, 6" is enough. In this case, the argument is passed through integer registers. For below code, it is similar: typedef struct SF {float a[4];short l; } SF; float foo (SF arg){return arg.a[3];} std 4,-24(1) ori 2,2,0 lfs 1,-20(1) vs. below seq seems faster. rldicr 4,4,0,31 mtvsrd 1,4 xscvspdpn 1,1