https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123962
Bug ID: 123962
Summary: bpf: bpf_core_lower pass not handling BIT_FIELD_REF
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: vineetg at gcc dot gnu.org
Target Milestone: ---
When tinkering with test in PR/123894 I ran into a reverse issue as in bitfield
extraction is actually generated and missing co-re codegen.
-O2 -gbtf # iimplies -mco-re
typedef struct {
int a;
char b : 5;
} __attribute__((preserve_access_index)) my_t;
char foo(my_t *s)
{
if (s->b)
return 2;
return 5;
}
This starts off as following gimple
```
char foo (struct my_t * s)
{
char D.1949;
_1 = BIT_FIELD_REF <*s, 8, 32>;
_2 = _1 & 31;
if (_2 != 0) goto <D.1947>; else goto <D.1948>;
<D.1947>:
D.1949 = 2;
// predicted unlikely by early return (on trees) predictor.
return D.1949;
<D.1948>:
D.1949 = 5;
return D.1949;
}
```
But then bpy_core_lower: compute_field_expr () currently only handles
COMPONENT_REF, nit BIT_FIELD_REF and misse sout in emitting
__builtin_core_reloc (0);