]> gcc.gnu.org Git - gcc.git/commit
bitint: Fix up stores to large/huge _BitInt bitfields [PR114329]
authorJakub Jelinek <jakub@redhat.com>
Sat, 16 Mar 2024 14:15:29 +0000 (15:15 +0100)
committerJakub Jelinek <jakub@redhat.com>
Sat, 16 Mar 2024 14:15:29 +0000 (15:15 +0100)
commit3e8323e873c5af5047507d6b2cfbd12706820ee2
tree6f24198cc7e833f98aa3cce4b5179e0aad98ebe2
parentead3075406ece9daaad65a01ae539150aee43f5a
bitint: Fix up stores to large/huge _BitInt bitfields [PR114329]

The verifier requires BIT_FIELD_REFs with INTEGRAL_TYPE_P first operand
to have mode precision.  In most cases for the large/huge _BitInt bitfield
stores the code uses bitfield representatives, which are typically arrays
of chars, but if the bitfield starts at byte boundary on big endian,
the code uses as nlhs in lower_mergeable_store COMPONENT_REF of the
bitfield FIELD_DECL instead, which is fine for the limb accesses,
but when used for the most significant limb can result in invalid
BIT_FIELD_REF because the first operand then has BITINT_TYPE and
usually VOIDmode.

The following patch adds a helper method for the 4 creatikons of
BIT_FIELD_REF which when needed adds a VIEW_CONVERT_EXPR.

2024-03-16  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/114329
* gimple-lower-bitint.cc (struct bitint_large_huge): Declare
build_bit_field_ref method.
(bitint_large_huge::build_bit_field_ref): New method.
(bitint_large_huge::lower_mergeable_stmt): Use it.

* gcc.dg/bitint-101.c: New test.
gcc/gimple-lower-bitint.cc
gcc/testsuite/gcc.dg/bitint-101.c [new file with mode: 0644]
This page took 0.062453 seconds and 5 git commands to generate.