https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116560
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target| |riscv, mips
Component|target |rtl-optimization
Status|UNCONFIRMED |NEW
Keywords| |missed-optimization
Ever confirmed|0 |1
Last reconfirmed| |2024-09-01
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Same bad code can be produced by:
```
typedef unsigned short type1 __attribute__((may_alias, aligned(1)));
unsigned char test_swap1(unsigned char *ptr, unsigned *res)
{
type1 *t = (type1 *)ptr;
unsigned short temp=*t;
temp = __builtin_bswap16(temp);
*res=temp;
if (temp==0) return 1;
return 0;
}
```
The problem only happens on strict aligned targets (MIPS, SPARC, RISCV) which
don't have a 16 byte swap.