[llvm-bugs] [Bug 42606] New: [SystemZ] Cannot select GET_CCMASK with addcarry+addcarry

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jul 12 11:42:38 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42606

            Bug ID: 42606
           Summary: [SystemZ] Cannot select GET_CCMASK with
                    addcarry+addcarry
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: SystemZ
          Assignee: unassignedbugs at nondot.org
          Reporter: nikita.ppv at gmail.com
                CC: llvm-bugs at lists.llvm.org

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
https://reviews.llvm.org/D64213, 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>

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190712/47af2628/attachment.html>


More information about the llvm-bugs mailing list