@@ -25,3 +25,53 @@ define <4 x i32> @insert_unknown_idx(<4 x i32> %x, i32 %idx) {
25
25
%v3 = and <4 x i32 > %v2 , <i32 7 , i32 7 , i32 7 , i32 7 >
26
26
ret <4 x i32 > %v3
27
27
}
28
+
29
+ define <2 x i8 > @insert_known_any_idx (<2 x i8 > %xx , i8 %yy , i32 %idx ) {
30
+ ; CHECK-LABEL: @insert_known_any_idx(
31
+ ; CHECK-NEXT: [[X:%.*]] = or <2 x i8> [[XX:%.*]], <i8 16, i8 16>
32
+ ; CHECK-NEXT: [[Y:%.*]] = or i8 [[YY:%.*]], 16
33
+ ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> [[X]], i8 [[Y]], i32 [[IDX:%.*]]
34
+ ; CHECK-NEXT: [[R:%.*]] = and <2 x i8> [[INS]], <i8 16, i8 16>
35
+ ; CHECK-NEXT: ret <2 x i8> [[R]]
36
+ ;
37
+ %x = or <2 x i8 > %xx , <i8 16 , i8 16 >
38
+ %y = or i8 %yy , 16
39
+
40
+ %ins = insertelement <2 x i8 > %x , i8 %y , i32 %idx
41
+ %r = and <2 x i8 > %ins , <i8 16 , i8 16 >
42
+ ret <2 x i8 > %r
43
+ }
44
+
45
+ define <2 x i8 > @insert_known_any_idx_fail1 (<2 x i8 > %xx , i8 %yy , i32 %idx ) {
46
+ ; CHECK-LABEL: @insert_known_any_idx_fail1(
47
+ ; CHECK-NEXT: [[X:%.*]] = or <2 x i8> [[XX:%.*]], <i8 17, i8 33>
48
+ ; CHECK-NEXT: [[Y:%.*]] = or i8 [[YY:%.*]], 16
49
+ ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> [[X]], i8 [[Y]], i32 [[IDX:%.*]]
50
+ ; CHECK-NEXT: [[R:%.*]] = and <2 x i8> [[INS]], <i8 16, i8 16>
51
+ ; CHECK-NEXT: ret <2 x i8> [[R]]
52
+ ;
53
+ %x = or <2 x i8 > %xx , <i8 17 , i8 33 >
54
+ %y = or i8 %yy , 16
55
+
56
+ %ins = insertelement <2 x i8 > %x , i8 %y , i32 %idx
57
+ %r = and <2 x i8 > %ins , <i8 16 , i8 16 >
58
+ ret <2 x i8 > %r
59
+ }
60
+
61
+
62
+ define <2 x i8 > @insert_known_any_idx_fail2 (<2 x i8 > %xx , i8 %yy , i32 %idx ) {
63
+ ; CHECK-LABEL: @insert_known_any_idx_fail2(
64
+ ; CHECK-NEXT: [[X:%.*]] = or <2 x i8> [[XX:%.*]], <i8 17, i8 31>
65
+ ; CHECK-NEXT: [[Y:%.*]] = or i8 [[YY:%.*]], 15
66
+ ; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> [[X]], i8 [[Y]], i32 [[IDX:%.*]]
67
+ ; CHECK-NEXT: [[R:%.*]] = and <2 x i8> [[INS]], <i8 16, i8 16>
68
+ ; CHECK-NEXT: ret <2 x i8> [[R]]
69
+ ;
70
+ %x = or <2 x i8 > %xx , <i8 17 , i8 31 >
71
+ %y = or i8 %yy , 15
72
+
73
+ %ins = insertelement <2 x i8 > %x , i8 %y , i32 %idx
74
+ %r = and <2 x i8 > %ins , <i8 16 , i8 16 >
75
+ ret <2 x i8 > %r
76
+ }
77
+
0 commit comments