brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · f356dd1 Raw
47 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 32; RUN: opt < %s -passes=instcombine -S | FileCheck %s3 4define i8 @avg_lsb(i8 %a, i8 %b) {5; CHECK-LABEL: define i8 @avg_lsb(6; CHECK-SAME: i8 [[A:%.*]], i8 [[B:%.*]]) {7; CHECK-NEXT:    [[REM:%.*]] = and i8 [[A]], 18; CHECK-NEXT:    [[DIV2:%.*]] = and i8 [[B]], [[REM]]9; CHECK-NEXT:    ret i8 [[DIV2]]10;11  %rem = and i8 %a, 112  %rem1 = and i8 %b, 113  %add = add nuw nsw i8 %rem1, %rem14  %div2 = lshr i8 %add, 115  ret i8 %div216}17 18define i8 @avg_lsb_mismatch(i8 %a, i8 %b) {19; CHECK-LABEL: define i8 @avg_lsb_mismatch(20; CHECK-SAME: i8 [[A:%.*]], i8 [[B:%.*]]) {21; CHECK-NEXT:    [[REM:%.*]] = and i8 [[A]], 122; CHECK-NEXT:    [[REM1:%.*]] = and i8 [[B]], 323; CHECK-NEXT:    [[ADD:%.*]] = add nuw nsw i8 [[REM1]], [[REM]]24; CHECK-NEXT:    [[DIV2:%.*]] = lshr i8 [[ADD]], 125; CHECK-NEXT:    ret i8 [[DIV2]]26;27  %rem = and i8 %a, 128  %rem1 = and i8 %b, 329  %add = add nuw nsw i8 %rem1, %rem30  %div2 = lshr i8 %add, 131  ret i8 %div232}33 34define <2 x i8> @avg_lsb_vector(<2 x i8> %a, <2 x i8> %b) {35; CHECK-LABEL: define <2 x i8> @avg_lsb_vector(36; CHECK-SAME: <2 x i8> [[A:%.*]], <2 x i8> [[B:%.*]]) {37; CHECK-NEXT:    [[REM:%.*]] = and <2 x i8> [[A]], splat (i8 1)38; CHECK-NEXT:    [[DIV2:%.*]] = and <2 x i8> [[B]], [[REM]]39; CHECK-NEXT:    ret <2 x i8> [[DIV2]]40;41  %rem = and <2 x i8> %a, <i8 1, i8 1>42  %rem1 = and <2 x i8> %b, <i8 1, i8 1>43  %add = add nuw nsw <2 x i8> %rem1, %rem44  %div2 = lshr <2 x i8> %add, <i8 1, i8 1>45  ret <2 x i8> %div246}47