We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
given
double foobar(double x, int y) { unsigned n = y; double p = 1; while (true) { n >>= 1; if (n == 0) return p; } }
gcc produces:
__Z6foobardi: shrl %edi jne __Z6foobardi movsd 0x00000004(%rip),%xmm0 re
clang produces:
__Z6foobardi: shrl %edi testl %edi,%edi jne __Z6foobardi movsd 0x00000002(%rip),%xmm0 ret
The text was updated successfully, but these errors were encountered:
assigned to @majnemer
Sorry, something went wrong.
Hmm...This looks like a job for the Peephole optimizer pass in CodeGen. It's doing something similar for ARM.
This is fixed in r181937.
foobar: .LBB0_1: shrl %edi jne .LBB0_1 movsd .LCPI0_0(%rip), %xmm0 ret
majnemer
No branches or pull requests
Extended Description
given
double foobar(double x, int y) {
unsigned n = y;
double p = 1;
while (true) {
n >>= 1;
if (n == 0)
return p;
}
}
gcc produces:
__Z6foobardi:
shrl %edi
jne __Z6foobardi
movsd 0x00000004(%rip),%xmm0
re
clang produces:
__Z6foobardi:
shrl %edi
testl %edi,%edi
jne __Z6foobardi
movsd 0x00000002(%rip),%xmm0
ret
The text was updated successfully, but these errors were encountered: