I want to see how ==
is compiled in C. Thus I try a simple code:
#include <stdio.h>
int f(int a,int b) {
return a==b; // NOTE THIS
}
int main(void) {
int a,b,c;
scanf("%d", &a,&b);
printf("%d", f(a,b));
}
Here is the attempt on Godbolt. It is very counter-intuitive...
Question:
- Why instruction after unconditional jump? IMHO the sltu will never be executed.
- Why one single
xor
enough to express==
? IMHO need xor + sltu together.
Thanks!