<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 --- - Regression of llc between LLVM revisions 213897 and 213898."
   href="http://llvm.org/bugs/show_bug.cgi?id=20472">20472</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Regression of llc between LLVM revisions 213897 and 213898.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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>llc
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>anton.mitrokhin@phystech.edu
          </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>Reproducer:
a.ll:
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: nounwind
define void @f_fu(float* noalias nocapture %RET) #1 {
allocas:

  %resultvec.i67 = select <8 x i1> <i1 1, i1 0, i1 0, i1 1, i1 1, i1 1, i1 1,
i1 0>, <8 x i16> <i16 128, i16 128, i16 128, i16 128, i16 128, i16 128, i16
128, i16 128>, <8 x i16> <i16 -500, i16 -500, i16 -500, i16 -500, i16 -500, i16
-500, i16 -500, i16 -500>

  %result_load15_to_int8.i = trunc <8 x i16> %resultvec.i67 to <8 x i8>
  %calltmp_to_float = sitofp <8 x i8> %result_load15_to_int8.i to <8 x float>
  %ptrcast = bitcast float* %RET to <8 x float>*
  store <8 x float> %calltmp_to_float, <8 x float>* %ptrcast, align 4

  ret void
}


test_static.cpp:
#include <stdio.h>
extern "C" {
    extern void f_fu(float *result);
}

int main(int argc, char *argv[]) {
    float returned_result[4];
    f_fu(returned_result);


    printf("\n");
    printf("res[0] = %f\n", returned_result[0]);
    printf("res[1] = %f\n", returned_result[1]);

    return 0;
}


Building:

.../llvm/bin-trunk_r213897/bin/llc a.ll -o old.s --mattr='+sse4.1'
clang++ test_static.cpp old.s -o bin_old

.../llvm/bin-trunk_r213898/bin/llc a.ll -o new.s --mattr='+sse4.1'
clang++ test_static.cpp new.s -o bin_new

right:
./bin_old
res[0] = -128.000000
res[1] = 12.000000

wrong:
./bin_new
res[0] = 128.000000
res[1] = -500.000000</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>