<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 --- - illegal results with a vector select case"
   href="http://llvm.org/bugs/show_bug.cgi?id=15977">15977</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>illegal results with a vector select case
          </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>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>Backend: X86
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>pekka.jaaskelainen@tut.fi
          </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>Created <span class=""><a href="attachment.cgi?id=10500" name="attach_10500" title="the kernel LLVM assembly">attachment 10500</a> <a href="attachment.cgi?id=10500&action=edit" title="the kernel LLVM assembly">[details]</a></span>
the kernel LLVM assembly

This is a strange flaky bug that seems like a code gen issue because the .ll
seems fine to me. Also, it passes with LLVM 3.2.

~/local/stow/llvm-3.3/bin/clang main.c -O3 parallel.ll -o foo && ./foo
max(a,b)[0] type=uint2 a=0x15b348c9 b=0xf88e7d07 want=0xf88e7d07 got=15b348c9
min(a,b)[0] type=uint2 a=0x15b348c9 b=0xf88e7d07 want=0x15b348c9 got=f88e7d07

~/local/stow/llvm-3.2/bin/clang main.c -O3 parallel.ll -o foo && ./foo
OK

~/local/stow/llvm-3.3/bin/clang main.c -O0 parallel.ll -o foo && ./foo
max(a,b)[0] type=uint2 a=0x15b348c9 b=0xf88e7d07 want=0xf88e7d07 got=15b348c9
min(a,b)[0] type=uint2 a=0x15b348c9 b=0xf88e7d07 want=0x15b348c9 got=f88e7d07

The code originates from a simple OpenCL C kernel:

kernel
void test_min_max() {
    volatile uint2 a = (uint2)(0x15b348c9, 0x15b348c9);
    volatile uint2 b = (uint2)(0xf88e7d07, 0xf88e7d07);
    uint2 max_ = max(a, b);
    uint2 min_ = min(a, b);
    printf("max(a,b)[0] type=uint2 a=0x15b348c9 b=0xf88e7d07 want=0xf88e7d07
got=%x\n", max_[0]);
    printf("min(a,b)[0] type=uint2 a=0x15b348c9 b=0xf88e7d07 want=0x15b348c9
got=%x\n", min_[0]);
}

I just modified it to remove unneeded args and added a C main to call it. I
also removed the LLVM 3.3's attribute markers to make it compile with LLVM 3.2.

Original pocl bug report:
<a href="https://bugs.launchpad.net/pocl/+bug/1179211">https://bugs.launchpad.net/pocl/+bug/1179211</a></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>