From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 987A53944414; Wed, 2 Sep 2020 14:28:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 987A53944414 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1599056888; bh=hCMHYldQFFcDlXblxBLQz4EWvVIVVK4zcCXiKTheBBs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ZAcFk4qUiEgPyHtBX4rHijVMDZghdbgNgV+sMePI22CpBVldNMLgemQ0m9X2oMGES BKYjivS3lgHxJ3ih9HbanW0HHjiH5/dskMyNebHEQ7k4Dqr0/jSf5RpmNhrphl7TeI yC7ylUFpPtyRIbP21UkirWpbTqgvuGoM+tKPahXg= From: "matz at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/96895] ABI of returning V1DF differs between GCC and clang Date: Wed, 02 Sep 2020 14:28:08 +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: 11.0 X-Bugzilla-Keywords: ABI X-Bugzilla-Severity: normal X-Bugzilla-Who: matz 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: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Sep 2020 14:28:08 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96895 --- Comment #7 from Michael Matz --- (In reply to Richard Biener from comment #5) > So vector types with element type T and N, a power-of-two, not otherwise > specified are passes the same as >=20 > struct S { T a[N] }; >=20 > ? No. structs, if they are larger than 16 bytes are of class memory. vector types larger than 16 bytes (which came only after the original psABI was written)= are passed different than the corresponding struct would have been (namely in t= he appropriate vector registers, when those types are native to the hardware!). That also explains your other observation: > Ugh. We pass struct S { double a[4]; } in %rdi _and_ on the stack?! And > return by invisible reference _and_ in %eax? Yes, a double[4] is larger than 16 bytes, hence memory, hence passed on the stack and returned via implicit reference. You're mis-reading the assembler code when you think it's passed in %rdi and stack. %rdi contains the address of the caller allocated return slot, i.e. the implicit reference. %rax contains that same address on return.=