<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - [AVX512] cannot select: extract f64 from splatted "movemask""
   href="https://bugs.llvm.org/show_bug.cgi?id=43750">43750</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[AVX512] cannot select: extract f64 from splatted "movemask"
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>9.0
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>andrew@scheidecker.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>craig.topper@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, spatel+llvm@rotateright.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I can reproduce this error in my local build of LLVM 9 and "LLC (trunk)" on
Compiler Explorer, but LLC 8.0.0 on Compiler Explorer does not reproduce the
error.

It also only repros with '-mcpu=skylake-avx512', or some other CPU with AVX-512
support. If I use '-mcpu=skylake' or '-mattr=-avx512f', the error does not
occur.

Repro module: 

  define double @0(<16 x i8>) {
  entry:
    %1 = icmp slt <16 x i8> %0, zeroinitializer
    %2 = bitcast <16 x i1> %1 to i16
    %.splatinsert = insertelement <8 x i16> undef, i16 %2, i32 0
    %.splat = shufflevector <8 x i16> %.splatinsert, <8 x i16> undef, <8 x i32>
<i32 undef, i32 undef, i32 undef, i32 undef, i32 0, i32 0, i32 0, i32 0>
    %3 = bitcast <8 x i16> %.splat to <2 x double>
    %4 = extractelement <2 x double> %3, i64 1
    ret double %4
  }

Run:

  llc -mcpu=skylake-avx512 repro.ll

Output:

  LLVM ERROR: Cannot select: 0x5608e0d8ba08: f64 = bitcast 0x5608e0d8bc78
    0x5608e0d8bc78: v64i1 = concat_vectors 0x5608e0d8c2f8, 0x5608e0d8c2f8
      0x5608e0d8c2f8: v32i1 = concat_vectors 0x5608e0d8bad8, 0x5608e0d8bad8
        0x5608e0d8bad8: v16i1 = setcc 0x5608e0d8b9a0, 0x5608e0d8b8d0, setgt:ch
          0x5608e0d8b9a0: v16i8 = BUILD_VECTOR Constant:i8<0>, Constant:i8<0>,
Constant:i8<0>, Constant:i8<0>, Constant:i8<0>, Constant:i8<0>, Constant:i8<0>,
Constant:i8<0>, Constant:i8<0>, Constant:i8<0>, Constant:i8<0>,
Constant:i8<0>,Constant:i8<0>, Constant:i8<0>, Constant:i8<0>, Constant:i8<0
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
          0x5608e0d8b8d0: v16i8 = bitcast 0x5608e0d8b868
            0x5608e0d8b868: v2i64,ch = CopyFromReg 0x5608e0cf7998,
Register:v2i64 %0
              0x5608e0d8b800: v2i64 = Register %0
        0x5608e0d8bad8: v16i1 = setcc 0x5608e0d8b9a0, 0x5608e0d8b8d0, setgt:ch
          0x5608e0d8b9a0: v16i8 = BUILD_VECTOR Constant:i8<0>, Constant:i8<0>,
Constant:i8<0>, Constant:i8<0>, Constant:i8<0>, Constant:i8<0>, Constant:i8<0>,
Constant:i8<0>, Constant:i8<0>, Constant:i8<0>, Constant:i8<0>,
Constant:i8<0>,Constant:i8<0>, Constant:i8<0>, Constant:i8<0>, Constant:i8<0
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
          0x5608e0d8b8d0: v16i8 = bitcast 0x5608e0d8b868
            0x5608e0d8b868: v2i64,ch = CopyFromReg 0x5608e0cf7998,
Register:v2i64 %0
              0x5608e0d8b800: v2i64 = Register %0
      0x5608e0d8c2f8: v32i1 = concat_vectors 0x5608e0d8bad8, 0x5608e0d8bad8
        0x5608e0d8bad8: v16i1 = setcc 0x5608e0d8b9a0, 0x5608e0d8b8d0, setgt:ch
          0x5608e0d8b9a0: v16i8 = BUILD_VECTOR Constant:i8<0>, Constant:i8<0>,
Constant:i8<0>, Constant:i8<0>, Constant:i8<0>, Constant:i8<0>, Constant:i8<0>,
Constant:i8<0>, Constant:i8<0>, Constant:i8<0>, Constant:i8<0>,
Constant:i8<0>,Constant:i8<0>, Constant:i8<0>, Constant:i8<0>, Constant:i8<0
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
          0x5608e0d8b8d0: v16i8 = bitcast 0x5608e0d8b868
            0x5608e0d8b868: v2i64,ch = CopyFromReg 0x5608e0cf7998,
Register:v2i64 %0
              0x5608e0d8b800: v2i64 = Register %0
        0x5608e0d8bad8: v16i1 = setcc 0x5608e0d8b9a0, 0x5608e0d8b8d0, setgt:ch
          0x5608e0d8b9a0: v16i8 = BUILD_VECTOR Constant:i8<0>, Constant:i8<0>,
Constant:i8<0>, Constant:i8<0>, Constant:i8<0>, Constant:i8<0>, Constant:i8<0>,
Constant:i8<0>, Constant:i8<0>, Constant:i8<0>, Constant:i8<0>,
Constant:i8<0>,Constant:i8<0>, Constant:i8<0>, Constant:i8<0>, Constant:i8<0
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
            0x5608e0d8b938: i8 = Constant<0>
          0x5608e0d8b8d0: v16i8 = bitcast 0x5608e0d8b868
            0x5608e0d8b868: v2i64,ch = CopyFromReg 0x5608e0cf7998,
Register:v2i64 %0
              0x5608e0d8b800: v2i64 = Register %0</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>