Skip to content
New issue

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

Unnecessary testl #10659

Closed
llvmbot opened this issue Jul 6, 2011 · 3 comments
Closed

Unnecessary testl #10659

llvmbot opened this issue Jul 6, 2011 · 3 comments
Assignees
Labels
backend:X86 bugzilla Issues migrated from bugzilla

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Jul 6, 2011

Bugzilla Link 10287
Resolution FIXED
Resolved on May 15, 2013 18:44
Version trunk
OS All
Reporter LLVM Bugzilla Contributor
CC @lattner,@majnemer

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

@llvmbot
Copy link
Collaborator Author

llvmbot commented Jul 6, 2011

assigned to @majnemer

@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 5, 2011

Hmm...This looks like a job for the Peephole optimizer pass in CodeGen. It's doing something similar for ARM.

@majnemer
Copy link
Mannequin

majnemer mannequin commented May 16, 2013

This is fixed in r181937.

foobar:
.LBB0_1:
shrl %edi
jne .LBB0_1
movsd .LCPI0_0(%rip), %xmm0
ret

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:X86 bugzilla Issues migrated from bugzilla
Projects
None yet
Development

No branches or pull requests

1 participant