brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · eff67ed Raw
40 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 52; RUN: opt -S -passes=instcombine < %s | FileCheck %s3 4; Make sure that the result of computeKnownBits for %indvar is correct.5 6define i16 @pr100298() {7; CHECK-LABEL: define i16 @pr100298() {8; CHECK-NEXT:  [[ENTRY:.*]]:9; CHECK-NEXT:    br label %[[FOR_INC:.*]]10; CHECK:       [[FOR_INC]]:11; CHECK-NEXT:    [[INDVAR:%.*]] = phi i32 [ -15, %[[ENTRY]] ], [ [[MASK:%.*]], %[[FOR_INC]] ]12; CHECK-NEXT:    [[ADD:%.*]] = add nsw i32 [[INDVAR]], 913; CHECK-NEXT:    [[MASK]] = and i32 [[ADD]], 6553514; CHECK-NEXT:    [[CMP1:%.*]] = icmp samesign ugt i32 [[MASK]], 515; CHECK-NEXT:    br i1 [[CMP1]], label %[[FOR_INC]], label %[[FOR_END:.*]]16; CHECK:       [[FOR_END]]:17; CHECK-NEXT:    [[CONV:%.*]] = trunc i32 [[ADD]] to i1618; CHECK-NEXT:    [[CMP2:%.*]] = icmp samesign ugt i32 [[MASK]], 319; CHECK-NEXT:    [[SHL:%.*]] = shl nuw i16 [[CONV]], 1420; CHECK-NEXT:    [[RES:%.*]] = select i1 [[CMP2]], i16 [[CONV]], i16 [[SHL]]21; CHECK-NEXT:    ret i16 [[RES]]22;23entry:24  br label %for.inc25 26for.inc:27  %indvar = phi i32 [ -15, %entry ], [ %mask, %for.inc ]28  %add = add nsw i32 %indvar, 929  %mask = and i32 %add, 6553530  %cmp1 = icmp ugt i32 %mask, 531  br i1 %cmp1, label %for.inc, label %for.end32 33for.end:34  %conv = trunc i32 %add to i1635  %cmp2 = icmp ugt i32 %mask, 336  %shl = shl nuw i16 %conv, 1437  %res = select i1 %cmp2, i16 %conv, i16 %shl38  ret i16 %res39}40