brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · 72dcd92 Raw
73 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -passes=instcombine -S | FileCheck %s3 4define <4 x i32> @insert_known_idx(<4 x i32> %x) {5; CHECK-LABEL: @insert_known_idx(6; CHECK-NEXT:    [[V1:%.*]] = and <4 x i32> [[X:%.*]], <i32 poison, i32 7, i32 7, i32 7>7; CHECK-NEXT:    [[V2:%.*]] = insertelement <4 x i32> [[V1]], i32 6, i64 08; CHECK-NEXT:    ret <4 x i32> [[V2]]9;10  %v1 = and <4 x i32> %x, <i32 7, i32 7, i32 7, i32 7>11  %v2 = insertelement <4 x i32> %v1, i32 6, i32 012  %v3 = and <4 x i32> %v2, <i32 7, i32 7, i32 7, i32 7>13  ret <4 x i32> %v314}15 16define <4 x i32> @insert_unknown_idx(<4 x i32> %x, i32 %idx) {17; CHECK-LABEL: @insert_unknown_idx(18; CHECK-NEXT:    [[V1:%.*]] = and <4 x i32> [[X:%.*]], splat (i32 7)19; CHECK-NEXT:    [[V2:%.*]] = insertelement <4 x i32> [[V1]], i32 6, i32 [[IDX:%.*]]20; CHECK-NEXT:    ret <4 x i32> [[V2]]21;22  %v1 = and <4 x i32> %x, <i32 7, i32 7, i32 7, i32 7>23  %v2 = insertelement <4 x i32> %v1, i32 6, i32 %idx24  %v3 = and <4 x i32> %v2, <i32 7, i32 7, i32 7, i32 7>25  ret <4 x i32> %v326}27 28define <2 x i8> @insert_known_any_idx(<2 x i8> %xx, i8 %yy, i32 %idx) {29; CHECK-LABEL: @insert_known_any_idx(30; CHECK-NEXT:    ret <2 x i8> splat (i8 16)31;32  %x = or <2 x i8> %xx, <i8 16, i8 16>33  %y = or i8 %yy, 1634 35  %ins = insertelement <2 x i8> %x, i8 %y, i32 %idx36  %r = and <2 x i8> %ins, <i8 16, i8 16>37  ret <2 x i8> %r38}39 40define <2 x i8> @insert_known_any_idx_fail1(<2 x i8> %xx, i8 %yy, i32 %idx) {41; CHECK-LABEL: @insert_known_any_idx_fail1(42; CHECK-NEXT:    [[X:%.*]] = or <2 x i8> [[XX:%.*]], <i8 17, i8 33>43; CHECK-NEXT:    [[Y:%.*]] = or i8 [[YY:%.*]], 1644; CHECK-NEXT:    [[INS:%.*]] = insertelement <2 x i8> [[X]], i8 [[Y]], i32 [[IDX:%.*]]45; CHECK-NEXT:    [[R:%.*]] = and <2 x i8> [[INS]], splat (i8 16)46; CHECK-NEXT:    ret <2 x i8> [[R]]47;48  %x = or <2 x i8> %xx, <i8 17, i8 33>49  %y = or i8 %yy, 1650 51  %ins = insertelement <2 x i8> %x, i8 %y, i32 %idx52  %r = and <2 x i8> %ins, <i8 16, i8 16>53  ret <2 x i8> %r54}55 56 57define <2 x i8> @insert_known_any_idx_fail2(<2 x i8> %xx, i8 %yy, i32 %idx) {58; CHECK-LABEL: @insert_known_any_idx_fail2(59; CHECK-NEXT:    [[X:%.*]] = or <2 x i8> [[XX:%.*]], <i8 17, i8 31>60; CHECK-NEXT:    [[Y:%.*]] = or i8 [[YY:%.*]], 1561; CHECK-NEXT:    [[INS:%.*]] = insertelement <2 x i8> [[X]], i8 [[Y]], i32 [[IDX:%.*]]62; CHECK-NEXT:    [[R:%.*]] = and <2 x i8> [[INS]], splat (i8 16)63; CHECK-NEXT:    ret <2 x i8> [[R]]64;65  %x = or <2 x i8> %xx, <i8 17, i8 31>66  %y = or i8 %yy, 1567 68  %ins = insertelement <2 x i8> %x, i8 %y, i32 %idx69  %r = and <2 x i8> %ins, <i8 16, i8 16>70  ret <2 x i8> %r71}72 73