From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E48DE3858C60; Mon, 23 Oct 2023 13:54:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E48DE3858C60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1698069289; bh=vfSLg6w2c1ZWMsGW0ElmW7Y5vUwRGCueJmq2Q3ZlkAY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=gstCITap9EUVno6PbvtbBkRqIlft/mZIDSMy3ATmY+4BX7YY6fQjdmxQkQn0ginnU mvqJmkKMNf5C0Ex+XrJG3oPdvRCEz4V9REcsCGoXbqVziQL1K2jYuwmYGVU52GW9rx KYVgDnr3WnBzFESF/S9ZlRixhc3k9/VXXUhJQhnQ= From: "bettio.davide at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/111933] memcpy on Xtensa not optimized when n == sizeof(uint32_t) or sizeof(uint64_t) Date: Mon, 23 Oct 2023 13:54:49 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 11.2.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: bettio.davide at gmail dot 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: 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=3D111933 --- Comment #2 from Davide Bettio --- (In reply to Richard Biener from comment #1) > uint32_t from_unaligned_u32(uint32_t *unaligned) > { > uint32_t tmp; > tmp =3D *unaligned; >=20 > note this isn't an unaligned access since you dereference a uint32_t poin= ter Let me explain better my purpose: I was writing a function for reading uint= 32_t and uint64_t values at any address, including odd ones such as 0x00002345. So as far as I know the only generic way to do this is either casting them = to uint8_t and reading them as 4 or 8 bytes, or using memcpy. My expectation is that memcpy is always replaced with a load instruction wh= en fast unaligned memory access is available. Let me know if I am making any wrong assumptiom.=