From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E33A3385841D; Wed, 17 Jul 2024 20:13:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E33A3385841D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1721247197; bh=4b2e3YUdV9Y9Jc+YzhOgyJ5+woqL8eBAc+kl0cDk0Xw=; h=From:To:Subject:Date:From; b=TyKGi5eaBbA9+uVx/4syjGkDKoPTC/FTaAkkNwbWLQptuyZO7Q2DnGMKR4joeg8JN wvWRejnMeSvc4lIK8ZkGw0bx+1Ciao+n6o+ue2ih2s0JPbPowL2a5/5+PnGBXpOSxT ATZJhfVsIu9xeqNuINr7y3Nh1dOqNWPPMGshUXu8= From: "jens.seifert at de dot ibm.com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/115973] New: PPCLE: Inefficient code for __builtin_uaddll_overflow and __builtin_addcll Date: Wed, 17 Jul 2024 20:13:17 +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: 14.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jens.seifert at de dot ibm.com 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=3D115973 Bug ID: 115973 Summary: PPCLE: Inefficient code for __builtin_uaddll_overflow and __builtin_addcll Product: gcc Version: 14.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: jens.seifert at de dot ibm.com Target Milestone: --- unsigned long long add(unsigned long long a, unsigned long long b, unsigned long long *ovf) { return __builtin_addcll(a,b,0,ovf); } creates mr 9,3 add 3,3,4 subfc 9,9,3 subfe 9,9,9 neg 9,9 std 9,0(5) blr Expected to addc + addze unsigned long long add4(unsigned long long a, unsigned long long b, unsigned long long *ovf) { unsigned long long t, res; __asm__("li %0, 0; addc %1,%2,%3; addze %0,%0":"=3D&r"(res),"=3Dr"(t):"r"(a),"r"(b):"xer"); *ovf =3D res; return t; } Expected assembly li 9, 0 addc 3,3,4 addze 9,9 std 9,0(5) blr=