@@ -10,9 +10,7 @@ declare <2 x i31> @llvm.fshl.v2i31(<2 x i31>, <2 x i31>, <2 x i31>)
10
10
11
11
define i32 @fshl_mask_simplify1 (i32 %x , i32 %y , i32 %sh ) {
12
12
; CHECK-LABEL: @fshl_mask_simplify1(
13
- ; CHECK-NEXT: [[MASKEDSH:%.*]] = and i32 [[SH:%.*]], 32
14
- ; CHECK-NEXT: [[R:%.*]] = call i32 @llvm.fshl.i32(i32 [[X:%.*]], i32 [[Y:%.*]], i32 [[MASKEDSH]])
15
- ; CHECK-NEXT: ret i32 [[R]]
13
+ ; CHECK-NEXT: ret i32 [[X:%.*]]
16
14
;
17
15
%maskedsh = and i32 %sh , 32
18
16
%r = call i32 @llvm.fshl.i32 (i32 %x , i32 %y , i32 %maskedsh )
@@ -21,9 +19,7 @@ define i32 @fshl_mask_simplify1(i32 %x, i32 %y, i32 %sh) {
21
19
22
20
define <2 x i32 > @fshr_mask_simplify2 (<2 x i32 > %x , <2 x i32 > %y , <2 x i32 > %sh ) {
23
21
; CHECK-LABEL: @fshr_mask_simplify2(
24
- ; CHECK-NEXT: [[MASKEDSH:%.*]] = and <2 x i32> [[SH:%.*]], <i32 64, i32 64>
25
- ; CHECK-NEXT: [[R:%.*]] = call <2 x i32> @llvm.fshr.v2i32(<2 x i32> [[X:%.*]], <2 x i32> [[Y:%.*]], <2 x i32> [[MASKEDSH]])
26
- ; CHECK-NEXT: ret <2 x i32> [[R]]
22
+ ; CHECK-NEXT: ret <2 x i32> [[Y:%.*]]
27
23
;
28
24
%maskedsh = and <2 x i32 > %sh , <i32 64 , i32 64 >
29
25
%r = call <2 x i32 > @llvm.fshr.v2i32 (<2 x i32 > %x , <2 x i32 > %y , <2 x i32 > %maskedsh )
@@ -43,7 +39,7 @@ define i32 @fshl_mask_simplify3(i32 %x, i32 %y, i32 %sh) {
43
39
ret i32 %r
44
40
}
45
41
46
- ; Check again with weird bitwidths; log2(33) means we demand the low 6 bits .
42
+ ; Check again with weird bitwidths - the analysis is invalid with non-power-of-2 .
47
43
48
44
define i33 @fshr_mask_simplify1 (i33 %x , i33 %y , i33 %sh ) {
49
45
; CHECK-LABEL: @fshr_mask_simplify1(
@@ -56,7 +52,7 @@ define i33 @fshr_mask_simplify1(i33 %x, i33 %y, i33 %sh) {
56
52
ret i33 %r
57
53
}
58
54
59
- ; Check again with weird bitwidths; log2(31) means we demand the low 5 bits .
55
+ ; Check again with weird bitwidths - the analysis is invalid with non-power-of-2 .
60
56
61
57
define <2 x i31 > @fshl_mask_simplify2 (<2 x i31 > %x , <2 x i31 > %y , <2 x i31 > %sh ) {
62
58
; CHECK-LABEL: @fshl_mask_simplify2(
@@ -69,7 +65,7 @@ define <2 x i31> @fshl_mask_simplify2(<2 x i31> %x, <2 x i31> %y, <2 x i31> %sh)
69
65
ret <2 x i31 > %r
70
66
}
71
67
72
- ; Negative test .
68
+ ; Check again with weird bitwidths - the analysis is invalid with non-power-of-2 .
73
69
74
70
define i33 @fshr_mask_simplify3 (i33 %x , i33 %y , i33 %sh ) {
75
71
; CHECK-LABEL: @fshr_mask_simplify3(
@@ -86,8 +82,7 @@ define i33 @fshr_mask_simplify3(i33 %x, i33 %y, i33 %sh) {
86
82
87
83
define i32 @fshl_mask_not_required (i32 %x , i32 %y , i32 %sh ) {
88
84
; CHECK-LABEL: @fshl_mask_not_required(
89
- ; CHECK-NEXT: [[MASKEDSH:%.*]] = and i32 [[SH:%.*]], 31
90
- ; CHECK-NEXT: [[R:%.*]] = call i32 @llvm.fshl.i32(i32 [[X:%.*]], i32 [[Y:%.*]], i32 [[MASKEDSH]])
85
+ ; CHECK-NEXT: [[R:%.*]] = call i32 @llvm.fshl.i32(i32 [[X:%.*]], i32 [[Y:%.*]], i32 [[SH:%.*]])
91
86
; CHECK-NEXT: ret i32 [[R]]
92
87
;
93
88
%maskedsh = and i32 %sh , 31
@@ -99,7 +94,7 @@ define i32 @fshl_mask_not_required(i32 %x, i32 %y, i32 %sh) {
99
94
100
95
define i32 @fshl_mask_reduce_constant (i32 %x , i32 %y , i32 %sh ) {
101
96
; CHECK-LABEL: @fshl_mask_reduce_constant(
102
- ; CHECK-NEXT: [[MASKEDSH:%.*]] = and i32 [[SH:%.*]], 33
97
+ ; CHECK-NEXT: [[MASKEDSH:%.*]] = and i32 [[SH:%.*]], 1
103
98
; CHECK-NEXT: [[R:%.*]] = call i32 @llvm.fshl.i32(i32 [[X:%.*]], i32 [[Y:%.*]], i32 [[MASKEDSH]])
104
99
; CHECK-NEXT: ret i32 [[R]]
105
100
;
@@ -125,15 +120,16 @@ define i32 @fshl_mask_negative(i32 %x, i32 %y, i32 %sh) {
125
120
126
121
define <2 x i32 > @fshr_set_but_not_demanded_vec (<2 x i32 > %x , <2 x i32 > %y , <2 x i32 > %sh ) {
127
122
; CHECK-LABEL: @fshr_set_but_not_demanded_vec(
128
- ; CHECK-NEXT: [[BOGUSBITS:%.*]] = or <2 x i32> [[SH:%.*]], <i32 32, i32 32>
129
- ; CHECK-NEXT: [[R:%.*]] = call <2 x i32> @llvm.fshr.v2i32(<2 x i32> [[X:%.*]], <2 x i32> [[Y:%.*]], <2 x i32> [[BOGUSBITS]])
123
+ ; CHECK-NEXT: [[R:%.*]] = call <2 x i32> @llvm.fshr.v2i32(<2 x i32> [[X:%.*]], <2 x i32> [[Y:%.*]], <2 x i32> [[SH:%.*]])
130
124
; CHECK-NEXT: ret <2 x i32> [[R]]
131
125
;
132
126
%bogusbits = or <2 x i32 > %sh , <i32 32 , i32 32 >
133
127
%r = call <2 x i32 > @llvm.fshr.v2i32 (<2 x i32 > %x , <2 x i32 > %y , <2 x i32 > %bogusbits )
134
128
ret <2 x i32 > %r
135
129
}
136
130
131
+ ; Check again with weird bitwidths - the analysis is invalid with non-power-of-2.
132
+
137
133
define <2 x i31 > @fshl_set_but_not_demanded_vec (<2 x i31 > %x , <2 x i31 > %y , <2 x i31 > %sh ) {
138
134
; CHECK-LABEL: @fshl_set_but_not_demanded_vec(
139
135
; CHECK-NEXT: [[BOGUSBITS:%.*]] = or <2 x i31> [[SH:%.*]], <i31 32, i31 32>
0 commit comments