[LLVMbugs] [Bug 12590] New: Unnecessary FP multiply by zero generated
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Apr 18 12:30:23 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=12590
Bug #: 12590
Summary: Unnecessary FP multiply by zero generated
Product: clang
Version: 3.0
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: ckmiller at gmail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 8408
--> http://llvm.org/bugs/attachment.cgi?id=8408
Example program
Clang will emit multiply instructions when one of the operands is known to be
zero at compile time. When run on the attached example, clang 3.0 (with -O3)
emits the following:
_dot:
pushq %rbp
movq %rsp,%rbp
pxor %xmm3,%xmm3
mulss %xmm3,%xmm2
mulss %xmm1,%xmm3
addss %xmm3,%xmm0
addss %xmm2,%xmm0
popq %rbp
ret
For comparison, gcc (with -O3) just produces an empty function, leaving the
input value in %xmm0 to be returned:
_dot:
pushq %rbp
movq %rsp,%rbp
leave
ret
Interestingly, clang does catch and eliminate the multiply by 1...
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list