rsandifo-arm wrote: > > Thinking about it a bit more, maybe we can just do some magic to make > > things work? Say, if you specify `__attribute__((target("sve"))) > > __arm_streaming_compatible`, and the caller is in streaming mode, allow the > > call even if the caller doesn't have SVE proper. > > Thinking a bit more, this is probably not quite what we want: even if the > function body itself is streaming compatible, it might call non-streaming > functions that require SVE. Maybe spell this something like > `__attribute__((target("sve-or-streaming"))) __arm_streaming_compatible`.
I suppose the idea here is that: ``` __attribute__((target("sve"))) void f() { … } void g() { … f(); … } ``` should be diagnosed, on the basis that, when compiled with default flags, `g` doesn't guarantee the availability of SVE, whereas `f` requires it? If so, I don't think we should do that, for two reasons: First, it's IMO valid to do: ``` __attribute__((target("sve"))) void sve_routine() { … } void main_interface() { if (SVE_is_available() && problem_has_certain_characteristics()) sve_routine(); else … } ``` That is, feature gating can be dynamic. It doesn't need to be a load-time thing. Second, at least in GCC, the `target` attribute is not part of a function's type, so it's not an error to do: ``` foo.h: void f(); foo.cc: __attribute__((target("sve"))) void f() { … } ``` And I'd argue that that's a feature rather than a bug. It allows load-time selection of DSOs based on the target. https://github.com/llvm/llvm-project/pull/92427 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits