[PATCH bpf] libbpf: Handle GCC built-in types for Arm NEON

Jean-Philippe Brucker jean-philippe at linaro.org
Wed Aug 12 10:37:46 EDT 2020


On Tue, Aug 11, 2020 at 08:30:06PM -0700, Andrii Nakryiko wrote:
[...]
> > +       /*
> > +        * GCC emits typedefs to its internal __PolyXX_t types when compiling
> > +        * Arm SIMD intrinsics. Alias them to the same standard types as Clang.
> > +        */
> > +       { "__Poly8_t",          "unsigned char" },
> > +       { "__Poly16_t",         "unsigned short" },
> > +       { "__Poly64_t",         "unsigned long" },
> 
> In the diff ([0]) that Daniel referenced, seems like they are adding
> poly64_t to ARM32. What prevents GCC from doing that (or maybe they've
> already done that). So instead of making unreliable assumptions, let's
> define it as "unsigned long long" instead?

Agreed. When writing this I had an older version of the ACLE doc
referenced in [0] and wanted to be consistent with the older clang
typedefs.

Thanks,
Jean

> 
>   [0] https://reviews.llvm.org/D79711
> 
> > +       { "__Poly128_t",        "unsigned __int128" },
> > +};
> > +
> > +static void btf_dump_emit_int_def(struct btf_dump *d, __u32 id,
> > +                                 const struct btf_type *t)
> > +{
> > +       const char *name = btf_dump_type_name(d, id);
> > +       int i;
> > +
> > +       for (i = 0; i < ARRAY_SIZE(builtin_types); i++) {
> > +               if (strcmp(name, builtin_types[i][0]) == 0) {
> > +                       btf_dump_printf(d, "typedef %s %s;\n\n",
> > +                                       builtin_types[i][1], name);
> > +                       break;
> > +               }
> > +       }
> > +}
> > +
> >  static void btf_dump_emit_enum_fwd(struct btf_dump *d, __u32 id,
> >                                    const struct btf_type *t)
> >  {
> > --
> > 2.27.0
> >



More information about the linux-arm-kernel mailing list