https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108004
--- Comment #4 from HaoChen Gui <guihaoc at gcc dot gnu.org> ---
$cat asm_test.c
#include <stdio.h>
unsigned long foo() {
unsigned long res;
__asm__ ("li 3,0xffffffffffffffff\n\t"
"li 4,0xfffffffffffffff1\n\t"
"and. 3,3,4\n\t"
"mfcr %0"
: "=r" (res));
return res;
}
void
main()
{
printf ("%lx\n", foo());
}
$ gcc -O1 -o asm_test asm_test.c && ./asm_test
82000482
Use the assembly to test the "and.". The bit32 (cr0 LT bit) is set when the
result is less than 0.