Open
Description
https://godbolt.org/z/4nYe6avsv
unsigned func1(unsigned a, unsigned b)
{
int c = a & b;
return (c ^ a)&1;
}
unsigned func1_2(unsigned a, bool b)
{
int c = a & b;
return (c ^ a)&1;
}
Here, the only bit that matters is the bottom one, hence it should make no difference.
However, we get:
func1(unsigned int, unsigned int):
bic w8, w0, w1
and w0, w8, #0x1
ret
func1_2(unsigned int, bool):
and w8, w0, #0x1
tst w1, #0x1
csel w0, wzr, w8, ne
ret