Closed
Description
int f(int a, int b)
{
return (a ^ b) | ~(a | b);
}
When compiled with -O3 -target mips64el -fomit-frame-pointer
, LLVM outputs:
f(int, int): # @f(int, int)
and $1, $5, $4
sll $1, $1, 0
not $1, $1
jr $ra
sll $2, $1, 0
whereas GCC manages (with -O3
):
f(int, int):
and $4,$4,$5
jr $31
nor $2,$0,$4
The sll
instructions seem entirely unnecessary as they are just nop
s from what I understand, and they don't seem required for any particular reason (using -target mipsel
instead of -target mips64el
also gets them removed, so this seems quite specific to 64-bit MIPS)