I'm using the following C code:
unsigned int d = 5;
return (n >> d)|(n << (32 - d));
Here is the generated assembly using gcc 4.9.2 (target=mips64-elf
, however I assume that the target you use in this case does not matter)
sll $2,$4,27
sra $4,$4,5
or $2,$2,$4
j $31
What should be the C construct to make gcc generate a rotate instruction?