https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103383
--- Comment #8 from Rich <rkujoth at motorolasolutions dot com> ---
(In reply to Michael Eager from comment #7)
> Do you have a test case which shows the problem?
It's not difficult to get it to show up if you're using the builtin swap16 and
conditionals. Here's a simple one (the optimizations make writing a simple test
case weird):
main.c:
#include <stdint.h>
#include <stdlib.h>
int main()
{
uint16_t src1 = (uint16_t)rand();
uint16_t src2 = (uint16_t)rand();
if(__builtin_bswap16(src1) != rand())
{
return -1;
}
return 0;
}
Then using the Vivado 2017.1 toolchain...
mb-gcc -O2 -mcpu=v10.0 -mlittle-endian -xl-barrel-shirt main.c
Then I see the following sequence in a.out, which shouldn't happen:
brlid
swapb
swaph