> IIUC, you are annoyed by:
> +#ifndef __RTM__
> +# error "RTM instruction set not enabled"
> +#endif /* __RTM__ */
That, yes, but also
(and see PR44987)
> in the headers. Indeed, this prevents "#pragma GCC target" to be effective.
> But OTOH, intrinsics are internally implemented using code sequences
> that call various __builtin_* functions, so they require correct
> target flags to be set when #included...
... also I'm arguing to remove the target flags for the intrinsics,
because they are not useful for things that the compiler doesn't
auto generate on its own.
> I doubt this can be fixed in any sensible way. Maybe by adding correct
> #pragmas around header #include ?
That doesn't set the defines. I did it before, but it's extremly ugly.
In the end I just gave up and used inline assembler.