[LLVMbugs] [Bug 17725] New: use the right data type when materializing an FP constant

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Oct 29 09:59:33 PDT 2013


            Bug ID: 17725
           Summary: use the right data type when materializing an FP
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: kkhoo at perfwizard.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

In the following code example, llvm is using the single-precision "xorps" to
materialize an FP double 0.0 constant. 

Intel warns that there may be a performance penalty for mixing data types
("execution domains" in Intel-speak; see related bug 17185). 

It would be better to use "xorpd" here to avoid that penalty:

$ cat addfp0.c 
double foo(double x) {
    return 0.0 + x;

$ ./clang -O3 -fomit-frame-pointer  -o - -S addfp0.c 
    .section    __TEXT,__text,regular,pure_instructions
    .globl    _foo
    .align    4, 0x90
_foo:                                   ## @foo
## BB#0:                                ## %entry
    xorps    %xmm1, %xmm1    <---- use "xorpd" here
    addsd    %xmm0, %xmm1
    movaps    %xmm1, %xmm0


$ ./clang -v 
clang version 3.4 (trunk 193529) (llvm/trunk 193527)
Target: x86_64-apple-darwin11.4.2
Thread model: posix

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20131029/6341217e/attachment.html>

More information about the llvm-bugs mailing list