Skip to content

Commit dce03e3

Browse files
committed
[InstCombine] Tweak funnel by constant tests for better shl/lshr commutation coverage
1 parent 6625892 commit dce03e3

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

llvm/test/Transforms/InstCombine/funnel.ll

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ define i32 @fshl_i32_constant(i32 %x, i32 %y) {
2323

2424
define i42 @fshr_i42_constant(i42 %x, i42 %y) {
2525
; CHECK-LABEL: @fshr_i42_constant(
26-
; CHECK-NEXT: [[SHL:%.*]] = shl i42 [[X:%.*]], 31
27-
; CHECK-NEXT: [[SHR:%.*]] = lshr i42 [[Y:%.*]], 11
26+
; CHECK-NEXT: [[SHR:%.*]] = lshr i42 [[X:%.*]], 31
27+
; CHECK-NEXT: [[SHL:%.*]] = shl i42 [[Y:%.*]], 11
2828
; CHECK-NEXT: [[R:%.*]] = or i42 [[SHR]], [[SHL]]
2929
; CHECK-NEXT: ret i42 [[R]]
3030
;
31-
%shl = shl i42 %x, 31
32-
%shr = lshr i42 %y, 11
31+
%shr = lshr i42 %x, 31
32+
%shl = shl i42 %y, 11
3333
%r = or i42 %shr, %shl
3434
ret i42 %r
3535
}
@@ -79,39 +79,39 @@ define <2 x i16> @fshl_v2i16_constant_splat_undef1(<2 x i16> %x, <2 x i16> %y) {
7979

8080
define <2 x i17> @fshr_v2i17_constant_splat(<2 x i17> %x, <2 x i17> %y) {
8181
; CHECK-LABEL: @fshr_v2i17_constant_splat(
82-
; CHECK-NEXT: [[SHL:%.*]] = shl <2 x i17> [[X:%.*]], <i17 12, i17 12>
83-
; CHECK-NEXT: [[SHR:%.*]] = lshr <2 x i17> [[Y:%.*]], <i17 5, i17 5>
82+
; CHECK-NEXT: [[SHR:%.*]] = lshr <2 x i17> [[X:%.*]], <i17 12, i17 12>
83+
; CHECK-NEXT: [[SHL:%.*]] = shl <2 x i17> [[Y:%.*]], <i17 5, i17 5>
8484
; CHECK-NEXT: [[R:%.*]] = or <2 x i17> [[SHR]], [[SHL]]
8585
; CHECK-NEXT: ret <2 x i17> [[R]]
8686
;
87-
%shl = shl <2 x i17> %x, <i17 12, i17 12>
88-
%shr = lshr <2 x i17> %y, <i17 5, i17 5>
87+
%shr = lshr <2 x i17> %x, <i17 12, i17 12>
88+
%shl = shl <2 x i17> %y, <i17 5, i17 5>
8989
%r = or <2 x i17> %shr, %shl
9090
ret <2 x i17> %r
9191
}
9292

9393
define <2 x i17> @fshr_v2i17_constant_splat_undef0(<2 x i17> %x, <2 x i17> %y) {
9494
; CHECK-LABEL: @fshr_v2i17_constant_splat_undef0(
95-
; CHECK-NEXT: [[SHL:%.*]] = shl <2 x i17> [[X:%.*]], <i17 12, i17 undef>
96-
; CHECK-NEXT: [[SHR:%.*]] = lshr <2 x i17> [[Y:%.*]], <i17 undef, i17 5>
95+
; CHECK-NEXT: [[SHR:%.*]] = lshr <2 x i17> [[X:%.*]], <i17 12, i17 undef>
96+
; CHECK-NEXT: [[SHL:%.*]] = shl <2 x i17> [[Y:%.*]], <i17 undef, i17 5>
9797
; CHECK-NEXT: [[R:%.*]] = or <2 x i17> [[SHR]], [[SHL]]
9898
; CHECK-NEXT: ret <2 x i17> [[R]]
9999
;
100-
%shl = shl <2 x i17> %x, <i17 12, i17 undef>
101-
%shr = lshr <2 x i17> %y, <i17 undef, i17 5>
100+
%shr = lshr <2 x i17> %x, <i17 12, i17 undef>
101+
%shl = shl <2 x i17> %y, <i17 undef, i17 5>
102102
%r = or <2 x i17> %shr, %shl
103103
ret <2 x i17> %r
104104
}
105105

106106
define <2 x i17> @fshr_v2i17_constant_splat_undef1(<2 x i17> %x, <2 x i17> %y) {
107107
; CHECK-LABEL: @fshr_v2i17_constant_splat_undef1(
108-
; CHECK-NEXT: [[SHL:%.*]] = shl <2 x i17> [[X:%.*]], <i17 12, i17 undef>
109-
; CHECK-NEXT: [[SHR:%.*]] = lshr <2 x i17> [[Y:%.*]], <i17 5, i17 undef>
108+
; CHECK-NEXT: [[SHR:%.*]] = lshr <2 x i17> [[X:%.*]], <i17 12, i17 undef>
109+
; CHECK-NEXT: [[SHL:%.*]] = shl <2 x i17> [[Y:%.*]], <i17 5, i17 undef>
110110
; CHECK-NEXT: [[R:%.*]] = or <2 x i17> [[SHR]], [[SHL]]
111111
; CHECK-NEXT: ret <2 x i17> [[R]]
112112
;
113-
%shl = shl <2 x i17> %x, <i17 12, i17 undef>
114-
%shr = lshr <2 x i17> %y, <i17 5, i17 undef>
113+
%shr = lshr <2 x i17> %x, <i17 12, i17 undef>
114+
%shl = shl <2 x i17> %y, <i17 5, i17 undef>
115115
%r = or <2 x i17> %shr, %shl
116116
ret <2 x i17> %r
117117
}
@@ -120,39 +120,39 @@ define <2 x i17> @fshr_v2i17_constant_splat_undef1(<2 x i17> %x, <2 x i17> %y) {
120120

121121
define <2 x i32> @fshr_v2i32_constant_nonsplat(<2 x i32> %x, <2 x i32> %y) {
122122
; CHECK-LABEL: @fshr_v2i32_constant_nonsplat(
123-
; CHECK-NEXT: [[SHL:%.*]] = shl <2 x i32> [[X:%.*]], <i32 17, i32 19>
124-
; CHECK-NEXT: [[SHR:%.*]] = lshr <2 x i32> [[Y:%.*]], <i32 15, i32 13>
123+
; CHECK-NEXT: [[SHR:%.*]] = lshr <2 x i32> [[X:%.*]], <i32 17, i32 19>
124+
; CHECK-NEXT: [[SHL:%.*]] = shl <2 x i32> [[Y:%.*]], <i32 15, i32 13>
125125
; CHECK-NEXT: [[R:%.*]] = or <2 x i32> [[SHL]], [[SHR]]
126126
; CHECK-NEXT: ret <2 x i32> [[R]]
127127
;
128-
%shl = shl <2 x i32> %x, <i32 17, i32 19>
129-
%shr = lshr <2 x i32> %y, <i32 15, i32 13>
128+
%shr = lshr <2 x i32> %x, <i32 17, i32 19>
129+
%shl = shl <2 x i32> %y, <i32 15, i32 13>
130130
%r = or <2 x i32> %shl, %shr
131131
ret <2 x i32> %r
132132
}
133133

134134
define <2 x i32> @fshr_v2i32_constant_nonsplat_undef0(<2 x i32> %x, <2 x i32> %y) {
135135
; CHECK-LABEL: @fshr_v2i32_constant_nonsplat_undef0(
136-
; CHECK-NEXT: [[SHL:%.*]] = shl <2 x i32> [[X:%.*]], <i32 undef, i32 19>
137-
; CHECK-NEXT: [[SHR:%.*]] = lshr <2 x i32> [[Y:%.*]], <i32 15, i32 13>
136+
; CHECK-NEXT: [[SHR:%.*]] = lshr <2 x i32> [[X:%.*]], <i32 undef, i32 19>
137+
; CHECK-NEXT: [[SHL:%.*]] = shl <2 x i32> [[Y:%.*]], <i32 15, i32 13>
138138
; CHECK-NEXT: [[R:%.*]] = or <2 x i32> [[SHL]], [[SHR]]
139139
; CHECK-NEXT: ret <2 x i32> [[R]]
140140
;
141-
%shl = shl <2 x i32> %x, <i32 undef, i32 19>
142-
%shr = lshr <2 x i32> %y, <i32 15, i32 13>
141+
%shr = lshr <2 x i32> %x, <i32 undef, i32 19>
142+
%shl = shl <2 x i32> %y, <i32 15, i32 13>
143143
%r = or <2 x i32> %shl, %shr
144144
ret <2 x i32> %r
145145
}
146146

147147
define <2 x i32> @fshr_v2i32_constant_nonsplat_undef1(<2 x i32> %x, <2 x i32> %y) {
148148
; CHECK-LABEL: @fshr_v2i32_constant_nonsplat_undef1(
149-
; CHECK-NEXT: [[SHL:%.*]] = shl <2 x i32> [[X:%.*]], <i32 17, i32 19>
150-
; CHECK-NEXT: [[SHR:%.*]] = lshr <2 x i32> [[Y:%.*]], <i32 15, i32 undef>
149+
; CHECK-NEXT: [[SHR:%.*]] = lshr <2 x i32> [[X:%.*]], <i32 17, i32 19>
150+
; CHECK-NEXT: [[SHL:%.*]] = shl <2 x i32> [[Y:%.*]], <i32 15, i32 undef>
151151
; CHECK-NEXT: [[R:%.*]] = or <2 x i32> [[SHL]], [[SHR]]
152152
; CHECK-NEXT: ret <2 x i32> [[R]]
153153
;
154-
%shl = shl <2 x i32> %x, <i32 17, i32 19>
155-
%shr = lshr <2 x i32> %y, <i32 15, i32 undef>
154+
%shr = lshr <2 x i32> %x, <i32 17, i32 19>
155+
%shl = shl <2 x i32> %y, <i32 15, i32 undef>
156156
%r = or <2 x i32> %shl, %shr
157157
ret <2 x i32> %r
158158
}

0 commit comments

Comments
 (0)