From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 712F63858D33; Mon, 9 Jan 2023 06:35:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 712F63858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1673246141; bh=08sE2jKjUeTbuOldXVB7Kou61mKMMzKit0R/0nLFIZA=; h=From:To:Subject:Date:From; b=wDgxURTyUZs/I9OFSyjO/bNos9snhkPiH//7P44+co4Qb9yiFx238Zrz2NPcH1P6U IlJ6QxEcK+0Nb00aVyZf5TpihqbSWoNwdwG0vgzHu9XngBXqFvqmo1Tkyg/2w4BWxM 8yDF6JSANOkIVC+LCkZGY+wAzawowbcfoh6HwqbI= From: "guojiufu at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/108338] New: use mtvsrws for lowpart DI->SF conversion on P9 Date: Mon, 09 Jan 2023 06:35:40 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: guojiufu at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108338 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 Seg= her 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 =3D l; float f =3D *(float*)(buff); return f; } float sf_from_di_off4 (long l) { char buff[16]; *(long*)buff =3D l; float f =3D *(float*)(buff + 4); return f; } With trunk, -O2 -mcpu=3Dpower9, the asm code could be optimized. sldi 9,3,32 mtvsrd 1,9 xscvspdpn 1,1 blr =3D=3D> mtvsrws;xscvspdpn (p9 LE) lowpart srdi 3,3,32 sldi 9,3,32 mtvsrd 1,9 xscvspdpn 1,1 blr =3D=3D> (+ clean lowpart to 0) mtvsrd;xscvspdpn highpart=