From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 521093858D37; Wed, 30 Sep 2020 11:49:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 521093858D37 From: "vries at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/97254] New: [nvptx] Define PCC_BITFIELD_TYPE_MATTERS Date: Wed, 30 Sep 2020 11:49:54 +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: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vries 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 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, 30 Sep 2020 11:49:54 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97254 Bug ID: 97254 Summary: [nvptx] Define PCC_BITFIELD_TYPE_MATTERS Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: vries at gcc dot gnu.org Target Milestone: --- While debugging gcc/testsuite/gcc.dg/pr94600-1.c, I found that nvptx doesn't define PCC_BITFIELD_TYPE_MATTERS. AFAIU, the theory for offloading is that settings that influence abi should= be compatible with the host. And in i386.h, we find: ... /* If bit field type is int, don't let it cross an int,=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 and give entire struct the alignment of an int. */ /* Required on the 386 since it doesn't have bit-field insns. */ #define PCC_BITFIELD_TYPE_MATTERS 1 ... OTOH, the value may be different for other hosts. On the llvm side, we find this comment in llvm.git/clang/lib/Basic/Targets/ARM.cpp: ... // Do not respect the alignment of bit-field types when laying out=20=20= =20=20=20=20=20=20=20=20=20=20 // structures. This corresponds to PCC_BITFIELD_TYPE_MATTERS in gcc.=20= =20=20=20=20=20=20=20=20=20 UseBitFieldTypeAlignment =3D false; ... and in llvm.git/clang/lib/Basic/Targets/NVPTX.cpp: ... UseBitFieldTypeAlignment =3D HostTarget->useBitFieldTypeAlignment(); ... which seems to confirm that approach. It should be possible to get the host target by looking at the --enable-as-accelerator, and figure out the value from there. OTOH, it's possible that for GCC the nvptx implementation of the hook is mo= ot, given that part of the processing is done in the host compiler. That does not answer the question what to do for the standalone target thou= gh. But probably, given that the value is set for both known offloading hosts x86_64 and ppc, it might be a good idea to have the standalone target do the same.=