<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - use the right data type when materializing an FP constant"
   href="http://llvm.org/bugs/show_bug.cgi?id=17725">17725</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>use the right data type when materializing an FP constant
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: X86
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>kkhoo@perfwizard.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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 <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - match broadcast instruction to data type (int or FP)"
   href="show_bug.cgi?id=17185">bug 17185</a>). 

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
    .cfi_startproc
## BB#0:                                ## %entry
    xorps    %xmm1, %xmm1    <---- use "xorpd" here
    addsd    %xmm0, %xmm1
    movaps    %xmm1, %xmm0
    ret
    .cfi_endproc


.subsections_via_symbols

$ ./clang -v 
clang version 3.4 (trunk 193529) (llvm/trunk 193527)
Target: x86_64-apple-darwin11.4.2
Thread model: posix</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>