<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] LLVM ERROR: Cannot select: v8i16 = vselect v8i16, v8i16, v8i16"
   href="https://bugs.llvm.org/show_bug.cgi?id=37499">37499</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[AVX512] LLVM ERROR: Cannot select: v8i16 = vselect v8i16, v8i16, v8i16
          </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>enhancement
          </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>ilia.taraban@intel.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This test fails at "X86 DAG->DAG Instruction Selection" with error "Cannot
select: 0x1ad76e8: v8i16 = vselect 0x1ad7ea0, undef:v8i16, 0x1ad7548" :

================= nice.c ==============
#include <x86intrin.h>

void foo (void)
{
    __m128i x = _mm_setr_epi16(1, 1, 1, 1, 1, 1, 1, 1);
    __m512i y;
    int mask = 0x1;
    x = _mm512_mask_cvtepi64_epi16(x, mask, y);
    goo(x);
}

=======================================

<span class="quote">>>> clang -v</span >
clang version 7.0.0 (trunk 332600)
Target: x86_64-unknown-linux-gnu
Thread model: posix
...


<span class="quote">>>> clang -c nice.c -O2 -march=knl</span >
fatal error: error in backend: Cannot select: t29: v8i16 = vselect t38,
undef:v8i16, t25
  t38: v8i16 = extract_subvector t37, Constant:i64<0>
    t37: v16i16 = truncate t36
      t36: v16i32 = vselect t32, t34, t35
        t32: v16i1 = insert_subvector undef:v16i1, t19, Constant:i64<0>
          t31: v16i1 = undef
          t19: v8i1 = bitcast Constant:i8<1>
            t5: i8 = Constant<1>
          t30: i64 = Constant<0>
        t34: v16i32 = BUILD_VECTOR Constant:i32<-1>, Constant:i32<-1>,
Constant:i32<-1>, Constant:i32<-1>, Constant:i32<-1>, Constant:i32<-1>,
Constant:i32<-1>, Constant:i32<-1>, Constant:i32<-1>, Constant:i32<-1>,
Constant:i32<-1>, Constant:i32<-1>, Constant:i32<-1>, Constant:i32<-1>,
Constant:i32<-1>, Constant:i32<-1>
          t33: i32 = Constant<-1>
          t33: i32 = Constant<-1>
          t33: i32 = Constant<-1>
          t33: i32 = Constant<-1>
          t33: i32 = Constant<-1>
          t33: i32 = Constant<-1>
          t33: i32 = Constant<-1>
          t33: i32 = Constant<-1>
          t33: i32 = Constant<-1>
          t33: i32 = Constant<-1>
          t33: i32 = Constant<-1>
          t33: i32 = Constant<-1>
          t33: i32 = Constant<-1>
          t33: i32 = Constant<-1>
          t33: i32 = Constant<-1>
          t33: i32 = Constant<-1>
        t35: v16i32 = BUILD_VECTOR Constant:i32<0>, Constant:i32<0>,
Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>,
Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>,
Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>,
Constant:i32<0>, Constant:i32<0>
          t14: i32 = Constant<0>
          t14: i32 = Constant<0>
          t14: i32 = Constant<0>
          t14: i32 = Constant<0>
          t14: i32 = Constant<0>
          t14: i32 = Constant<0>
          t14: i32 = Constant<0>
          t14: i32 = Constant<0>
          t14: i32 = Constant<0>
          t14: i32 = Constant<0>
          t14: i32 = Constant<0>
          t14: i32 = Constant<0>
          t14: i32 = Constant<0>
          t14: i32 = Constant<0>
          t14: i32 = Constant<0>
          t14: i32 = Constant<0>
    t30: i64 = Constant<0>
  t17: v8i16 = undef
  t25: v8i16 = bitcast t24
    t24: v2i64,ch = load<(load 16 from constant-pool)> t0, t27, undef:i64
      t27: i64 = X86ISD::Wrapper TargetConstantPool:i64<<8 x i16> <i16 1, i16
1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>> 0
        t26: i64 = TargetConstantPool<<8 x i16> <i16 1, i16 1, i16 1, i16 1,
i16 1, i16 1, i16 1, i16 1>> 0
      t22: i64 = undef
In function: foo
clang-7: error: clang frontend command failed with exit code 70 (use -v to see
invocation)
clang version 7.0.0 (trunk 332600)
Target: x86_64-unknown-linux-gnu
...


Here is IR reproducer:
================= fine.ll =============
define void @foo()#0 {
  %1 = tail call <8 x i16> @llvm.x86.avx512.mask.pmov.qw.512(<8 x i64> undef,
<8 x i16> <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>, i8 1)
  %2 = tail call i32 @goo(<8 x i16> %1)
  ret void
}

declare i32 @goo(<8 x i16>)

declare <8 x i16> @llvm.x86.avx512.mask.pmov.qw.512(<8 x i64>, <8 x i16>, i8)

attributes #0 = { "target-features"="+avx512f" }
=======================================

<span class="quote">>>> llc fine.ll</span >
LLVM ERROR: Cannot select: t26: v8i16 = vselect t35, undef:v8i16, t22
  t35: v8i16 = extract_subvector t34, Constant:i64<0>
    t34: v16i16 = truncate t33
      t33: v16i32 = vselect t29, t31, t32
        t29: v16i1 = insert_subvector undef:v16i1, t16, Constant:i64<0>
          t28: v16i1 = undef
          t16: v8i1 = bitcast Constant:i8<1>
            t5: i8 = Constant<1>
          t27: i64 = Constant<0>
        t31: v16i32 = BUILD_VECTOR Constant:i32<-1>, Constant:i32<-1>,
Constant:i32<-1>, Constant:i32<-1>, Constant:i32<-1>, Constant:i32<-1>,
Constant:i32<-1>, Constant:i32<-1>, Constant:i32<-1>, Constant:i32<-1>,
Constant:i32<-1>, Constant:i32<-1>, Constant:i32<-1>, Constant:i32<-1>,
Constant:i32<-1>, Constant:i32<-1>
          t30: i32 = Constant<-1>
          t30: i32 = Constant<-1>
          t30: i32 = Constant<-1>
          t30: i32 = Constant<-1>
          t30: i32 = Constant<-1>
          t30: i32 = Constant<-1>
          t30: i32 = Constant<-1>
          t30: i32 = Constant<-1>
          t30: i32 = Constant<-1>
          t30: i32 = Constant<-1>
          t30: i32 = Constant<-1>
          t30: i32 = Constant<-1>
          t30: i32 = Constant<-1>
          t30: i32 = Constant<-1>
          t30: i32 = Constant<-1>
          t30: i32 = Constant<-1>
        t32: v16i32 = BUILD_VECTOR Constant:i32<0>, Constant:i32<0>,
Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>,
Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>,
Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>,
Constant:i32<0>, Constant:i32<0>
          t11: i32 = Constant<0>
          t11: i32 = Constant<0>
          t11: i32 = Constant<0>
          t11: i32 = Constant<0>
          t11: i32 = Constant<0>
          t11: i32 = Constant<0>
          t11: i32 = Constant<0>
          t11: i32 = Constant<0>
          t11: i32 = Constant<0>
          t11: i32 = Constant<0>
          t11: i32 = Constant<0>
          t11: i32 = Constant<0>
          t11: i32 = Constant<0>
          t11: i32 = Constant<0>
          t11: i32 = Constant<0>
          t11: i32 = Constant<0>
    t27: i64 = Constant<0>
  t14: v8i16 = undef
  t22: v8i16 = bitcast t21
    t21: v2i64,ch = load<(load 16 from constant-pool)> t0, t24, undef:i64
      t24: i64 = X86ISD::Wrapper TargetConstantPool:i64<<8 x i16> <i16 1, i16
1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>> 0
        t23: i64 = TargetConstantPool<<8 x i16> <i16 1, i16 1, i16 1, i16 1,
i16 1, i16 1, i16 1, i16 1>> 0
      t19: i64 = undef
In function: foo</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>