RFC: Make builtin types only valid for some target features

Segher Boessenkool segher@kernel.crashing.org
Mon Dec 5 16:44:02 GMT 2022

On Mon, Dec 05, 2022 at 07:31:48AM +0000, Richard Sandiford wrote:
> FWIW, the aarch64 fp move patterns emit the error directly.  They then
> expand an integer-mode move, to provide some error recovery.  (The
> alternative would be to make the error fatal.)
> (define_expand "mov<mode>"
>   [(set (match_operand:GPF_TF_F16_MOV 0 "nonimmediate_operand")
> 	(match_operand:GPF_TF_F16_MOV 1 "general_operand"))]
>   ""
>   {
>     if (!TARGET_FLOAT)
>       {
> 	aarch64_err_no_fpadvsimd (<MODE>mode);
> 	machine_mode intmode
> 	  = int_mode_for_size (GET_MODE_BITSIZE (<MODE>mode), 0).require ();
> 	emit_move_insn (gen_lowpart (intmode, operands[0]),
> 			gen_lowpart (intmode, operands[1]));
> 	DONE;
>       }
> This isn't as user-friendly as catching the error directly in the FE,
> but I think in practice it's going to be very hard to trap all invalid
> uses of a type there.  Also, the user error in these situations is likely
> to be forgetting to enable the right architecture feature, rather than
> accidentally using the wrong type.  So an error about missing architecture
> features is probably good enough in most cases.

The obvious problwem with this is you have to write it separately for
each and every such pattern.  But of course the opaque modes only ever
have mov patterns, everything else goes via builtins, so if this is the
best we can easily do, so be it :-)



More information about the Gcc mailing list