From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B204A38582A3; Wed, 6 Mar 2024 12:15:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B204A38582A3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709727359; bh=MsceB/HwgMlgIEhoB8kQTKEYZ9YqeAGpqJkjGcHEjW8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=FKXpzg85ZqSWK0/aP4HtufvJAs6QFkprNCJYlJmhtcsTHWKxoIU948TPzvwJ8fQ4H JJe1/rmqHySWW02592xmf7ZjQ+yreDmzwsInVcp4Z+tsuV3ZUQtGeTgDq9TF0Wrdoz TC0oBg6fMX4OZSXGTXf3xppFyKU5yinIVKaTkv5g= From: "gjl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/114252] Introducing bswapsi reduces code performance Date: Wed, 06 Mar 2024 12:15:59 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: gjl at gcc dot gnu.org X-Bugzilla-Status: NEW 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: Message-ID: In-Reply-To: References: 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=3D114252 --- Comment #3 from Georg-Johann Lay --- (In reply to Richard Biener from comment #1) > but somehow we end up doing a libcall? It's not a libcall in the GCC sense, for the compiler it's just an ordinary insn. The backend then prints this as a transparent call to libgcc. Purpose is that many functions have a small, known footprint as they are implemented in assembly. An ordinary call would clobber all callee-used reg= s, so using a transparent call gives better code than a real call. Notice thi= s is the nsn: (define_insn "*bswapsi2.libgcc" [(set (reg:SI 22) (bswap:SI (reg:SI 22))) (clobber (reg:CC REG_CC))] "reload_completed" "%~call __bswapsi2" [(set_attr "type" "xcall")]) However, for the purpose of this PR, no bswap is needed in the 1st place; j= ust have a look at the v13 code. It just loads the bytes as they belong into the target value; while v14 loads all 32 bits in one chunk and then starts fidd= ling and moving around the constituent bytes.=