<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 --- - fast vector fneg not optimized like fast scalar fneg"
   href="http://llvm.org/bugs/show_bug.cgi?id=20556">20556</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>fast vector fneg not optimized like fast scalar fneg
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>spatel+llvm@rotateright.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>This is a test for optimizing the "wrong" definition of fneg (one that uses
+0.0 rather than -0.0) when enable-unsafe-fp-math is used.

Using llc built from r214897 on x86-64:

$ cat fast_fneg.ll
define float @fneg(float %x) #0 {
entry:
  %sub = fsub float 0.000000e+00, %x
  ret float %sub
}

define <4 x float> @fneg4(<4 x float> %x) #0 {
entry:
  %sub = fsub <4 x float> zeroinitializer, %x
  ret <4 x float> %sub
}


$ ./llc -enable-unsafe-fp-math fast_fneg.ll -o -
    .section    __TEXT,__text,regular,pure_instructions
    .macosx_version_min 13, 3
    .section    __TEXT,__literal16,16byte_literals
    .align    4
LCPI0_0:
    .long    2147483648              ## float -0.000000e+00
    .long    2147483648              ## float -0.000000e+00
    .long    2147483648              ## float -0.000000e+00
    .long    2147483648              ## float -0.000000e+00
    .section    __TEXT,__text,regular,pure_instructions
    .globl    _fneg
    .align    4, 0x90
_fneg:                                  ## @fneg
    .cfi_startproc
## BB#0:                                ## %entry
    xorps    LCPI0_0(%rip), %xmm0
    retq
    .cfi_endproc

    .globl    _fneg4
    .align    4, 0x90
_fneg4:                                 ## @fneg4
    .cfi_startproc
## BB#0:                                ## %entry
    xorps    %xmm1, %xmm1
    subps    %xmm0, %xmm1
    movaps    %xmm1, %xmm0
    retq
    .cfi_endproc


-------------------------------------

We optimized the scalar case to load a constant 0x80000000 to flip the sign bit
and avoid a subtraction. Shouldn't we do the same thing for the vector case?</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>