https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108338
Bug ID: 108338 Summary: use mtvsrws for lowpart DI->SF conversion on P9 Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: guojiufu at gcc dot gnu.org Target Milestone: --- In a mail-list discussion, https://gcc.gnu.org/pipermail/gcc-patches/2022-December/609054.html, as Segher points out, we could use 'mtvsrws' for the conversion from lowpart DI to SF on P9; and use 'mtvsrd' for the conversion from highpart of DI to SF. float sf_from_di_off0 (long l) { char buff[16]; *(long*)buff = l; float f = *(float*)(buff); return f; } float sf_from_di_off4 (long l) { char buff[16]; *(long*)buff = l; float f = *(float*)(buff + 4); return f; } With trunk, -O2 -mcpu=power9, the asm code could be optimized. sldi 9,3,32 mtvsrd 1,9 xscvspdpn 1,1 blr ==> mtvsrws;xscvspdpn (p9 LE) lowpart srdi 3,3,32 sldi 9,3,32 mtvsrd 1,9 xscvspdpn 1,1 blr ==> (+ clean lowpart to 0) mtvsrd;xscvspdpn highpart