On Fri, 5 Jun 2026, Jakub Jelinek wrote:

> On Fri, Jun 05, 2026 at 02:22:25PM +0200, Andreas Schwab wrote:
> > This breaks riscv:
> > 
> > ../../gcc/config/riscv/riscv.md:5297:14: error: bswapsi2 cannot FAIL
> > ../../gcc/config/riscv/bitmanip.md:543:5: note: in expansion of macro 'FAIL'
> >   543 |     FAIL;
> >       |     ^~~~
> 
> wtw mentioned that on IRC.
> In the way IFN_BSWAP/IFN_BITREVERSE are used currently (i.e. only used
> for large/huge _BitInt or in the C++ FE, but not making it to expansion)
> there is no reason why FAIL wouldn't be allowed (like before my changes),
> though I find the riscv hack really ugly.
> 
> So, e.g. following patch could be used to restore riscv build.
> Of course, if we later on use the ifns for vectors, that might change.
> To be precise, BSWAP already I think is vectorized using V*QImode
> VEC_PERM_EXPRs, but BITREVERSE can't be.
> 
> 2026-06-05  Jakub Jelinek  <[email protected]>
> 
>       * genemit.cc (main): Don't mark ifns using DEF_INTERNAL_INTSZ_FN
>       - IFN_BSWAP/IFN_BITREVERSE - as nofail_optabs.
> 
> --- gcc/genemit.cc.jj 2026-03-27 10:17:14.156330380 +0100
> +++ gcc/genemit.cc    2026-06-05 14:30:24.033736559 +0200
> @@ -902,6 +902,8 @@ main (int argc, const char **argv)
>  
>  #define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \
>    nofail_optabs[OPTAB##_optab] = true;
> +  /* BSWAP/BITREVERSE can fail though.  */
> +#define DEF_INTERNAL_INTSZ_FN(NAME, FLAGS, OPTAB, TYPE)

Hmm, it's a bit ugly to keep this in sync, but at least it is consistent
with the default to allow failing and explicitly documenting when not.

So OK.

Thanks,
Richard.

>  #include "internal-fn.def"
>  
>    /* Assign sequential codes to all entries in the machine description
> 
> 
>       Jakub
> 
> 

-- 
Richard Biener <[email protected]>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)

Reply via email to