https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118133
Bug ID: 118133 Summary: Consider alternative ways of writing aarch64-simd-pragma-builtins.def Product: gcc Version: 15.0 Status: UNCONFIRMED Keywords: build Severity: enhancement Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: rsandifo at gcc dot gnu.org Target Milestone: --- Target: aarch64*-*-* Created attachment 59927 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59927&action=edit proof of concept patch aarch64-simd-pragma-builtins.def uses a hierarchy of C preprocessor macros to build up the individual definitions. That's probably going to become a bit unwieldly, so it would be good to find an alternative method. One challenge would be to this while staying within the permitted set of required build tools. One idea I had was to use m4. We don't currently require that to build gcc, only to modify it, but that should be enough if we commit the autogenerated output to the repository. For example: nonstreaming_only([FAMINMAX], foreachn([[T],[Q]], [VHSDF], [ENTRY([vamax,Q,_,T], binary, [[T,Q],[T,Q],[T,Q]], UNSPEC_FAMAX, DEFAULT)], [ENTRY([vamin,Q,_,T], binary, [[T,Q],[T,Q],[T,Q]], UNSPEC_FAMIN, DEFAULT)], ), ) nonstreaming_only([FP8], foreachn([[T],[Q]], [VHSDF], [ENTRY([vscale,Q,_,T], binary, [[T,Q],[T,Q],[signed(T),Q]], UNSPEC_FSCALE, DEFAULT)], ), ) could be used to generate: #define REQUIRED_EXTENSIONS nonstreaming_only (AARCH64_FL_FAMINMAX) ENTRY(vamax_f16, binary, f16, f16, f16, none, UNSPEC_FAMAX, DEFAULT) ENTRY(vamin_f16, binary, f16, f16, f16, none, UNSPEC_FAMIN, DEFAULT) ENTRY(vamaxq_f16, binary, f16q, f16q, f16q, none, UNSPEC_FAMAX, DEFAULT) ENTRY(vaminq_f16, binary, f16q, f16q, f16q, none, UNSPEC_FAMIN, DEFAULT) ENTRY(vamax_f32, binary, f32, f32, f32, none, UNSPEC_FAMAX, DEFAULT) ENTRY(vamin_f32, binary, f32, f32, f32, none, UNSPEC_FAMIN, DEFAULT) ENTRY(vamaxq_f32, binary, f32q, f32q, f32q, none, UNSPEC_FAMAX, DEFAULT) ENTRY(vaminq_f32, binary, f32q, f32q, f32q, none, UNSPEC_FAMIN, DEFAULT) ENTRY(vamaxq_f64, binary, f64q, f64q, f64q, none, UNSPEC_FAMAX, DEFAULT) ENTRY(vaminq_f64, binary, f64q, f64q, f64q, none, UNSPEC_FAMIN, DEFAULT) #undef REQUIRED_EXTENSIONS #define REQUIRED_EXTENSIONS nonstreaming_only (AARCH64_FL_FP8) ENTRY(vscale_f16, binary, f16, f16, s16, none, UNSPEC_FSCALE, DEFAULT) ENTRY(vscaleq_f16, binary, f16q, f16q, s16q, none, UNSPEC_FSCALE, DEFAULT) ENTRY(vscale_f32, binary, f32, f32, s32, none, UNSPEC_FSCALE, DEFAULT) ENTRY(vscaleq_f32, binary, f32q, f32q, s32q, none, UNSPEC_FSCALE, DEFAULT) ENTRY(vscaleq_f64, binary, f64q, f64q, s64q, none, UNSPEC_FSCALE, DEFAULT) #undef REQUIRED_EXTENSIONS I've attached a proof of concept patch.