<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 - [SystemZ] Cannot select GET_CCMASK with addcarry+addcarry"
   href="https://bugs.llvm.org/show_bug.cgi?id=42606">42606</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[SystemZ] Cannot select GET_CCMASK with addcarry+addcarry
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>All
          </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>Backend: SystemZ
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>nikita.ppv@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>define i64 @test(i64 %lo, i64 %hi) {
start:
  %tmp = tail call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 %lo, i64 1)
  %tmp1 = extractvalue { i64, i1 } %tmp, 0
  %tmp2 = extractvalue { i64, i1 } %tmp, 1
  %tmp3 = zext i1 %tmp2 to i64
  %tmp4 = tail call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 %lo, i64
%tmp1)
  %tmp5 = extractvalue { i64, i1 } %tmp4, 1
  %tmp6 = zext i1 %tmp5 to i64
  %spec.select.i = add i64 0, %hi
  %tmp7 = add i64 %spec.select.i, %tmp3
  %tmp8 = add i64 %tmp7, %tmp6
  ret i64 %tmp8
}

; Function Attrs: nounwind readnone speculatable
declare { i64, i1 } @llvm.uadd.with.overflow.i64(i64, i64) #0

Under -mtriple=s390x fails with:

LLVM ERROR: Cannot select: t29: i32 = SystemZISD::GET_CCMASK t42,
Constant:i32<15>, Constant:i32<3>
  t42: i32 = or t58, t54
    t58: i32 = and t57, Constant:i32<1>
      t57: i32 = srl t55, Constant:i32<28>
        t55: i32 = SystemZISD::IPM t47
          t47: i32 = SystemZISD::ICMP t34, t2, Constant:i32<1>
            t34: i64 = add t2, t2
              t2: i64,ch = CopyFromReg t0, Register:i64 %0
                t1: i64 = Register %0
              t2: i64,ch = CopyFromReg t0, Register:i64 %0
                t1: i64 = Register %0
            t2: i64,ch = CopyFromReg t0, Register:i64 %0
              t1: i64 = Register %0
            t19: i32 = Constant<1>
        t56: i32 = Constant<28>
      t19: i32 = Constant<1>
    t54: i32 = srl t52, Constant:i32<31>
      t52: i32 = add t50, Constant:i32<-268435456>
        t50: i32 = SystemZISD::IPM t43
          t43: i32 = SystemZISD::ICMP t38, Constant:i64<0>, Constant:i32<0>
            t38: i64 = add t34, Constant:i64<1>
              t34: i64 = add t2, t2
                t2: i64,ch = CopyFromReg t0, Register:i64 %0
                  t1: i64 = Register %0
                t2: i64,ch = CopyFromReg t0, Register:i64 %0
                  t1: i64 = Register %0
              t37: i64 = Constant<1>
            t21: i64 = Constant<0>
            t31: i32 = Constant<0>
        t51: i32 = Constant<-268435456>
      t53: i32 = Constant<31>
  t28: i32 = Constant<15>
  t27: i32 = Constant<3>

I initially suspected that this is a regression from
<a href="https://reviews.llvm.org/D64213">https://reviews.llvm.org/D64213</a>, but after backing that out I get:

LLVM ERROR: Cannot select: t34: i32 = SystemZISD::GET_CCMASK Constant:i32<1>,
Constant:i32<15>, Constant:i32<3>
  t19: i32 = Constant<1>
  t28: i32 = Constant<15>
  t27: i32 = Constant<3></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>