Skip to content

Commit 33541fa

Browse files
committed
[InstCombine] add possible bswap as widening shuffle test; NFC
Goes with the proposal in D66965. llvm-svn: 370407
1 parent e5c0994 commit 33541fa

File tree

1 file changed

+13
-2
lines changed
  • llvm/test/Transforms/InstCombine

1 file changed

+13
-2
lines changed

llvm/test/Transforms/InstCombine/bswap.ll

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,8 @@ define i32 @shuf_4bytes_extra_use(<4 x i8> %x) {
283283
ret i32 %cast
284284
}
285285

286-
define i128 @shuf_load_16bytes(<16 x i8> %x) {
287-
; CHECK-LABEL: @shuf_load_16bytes(
286+
define i128 @shuf_16bytes(<16 x i8> %x) {
287+
; CHECK-LABEL: @shuf_16bytes(
288288
; CHECK-NEXT: [[BSWAP:%.*]] = shufflevector <16 x i8> [[X:%.*]], <16 x i8> undef, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
289289
; CHECK-NEXT: [[CAST:%.*]] = bitcast <16 x i8> [[BSWAP]] to i128
290290
; CHECK-NEXT: ret i128 [[CAST]]
@@ -293,3 +293,14 @@ define i128 @shuf_load_16bytes(<16 x i8> %x) {
293293
%cast = bitcast <16 x i8> %bswap to i128
294294
ret i128 %cast
295295
}
296+
297+
define i32 @shuf_2bytes_widening(<2 x i8> %x) {
298+
; CHECK-LABEL: @shuf_2bytes_widening(
299+
; CHECK-NEXT: [[BSWAP:%.*]] = shufflevector <2 x i8> [[X:%.*]], <2 x i8> undef, <4 x i32> <i32 1, i32 0, i32 undef, i32 undef>
300+
; CHECK-NEXT: [[CAST:%.*]] = bitcast <4 x i8> [[BSWAP]] to i32
301+
; CHECK-NEXT: ret i32 [[CAST]]
302+
;
303+
%bswap = shufflevector <2 x i8> %x, <2 x i8> undef, <4 x i32> <i32 1, i32 0, i32 undef, i32 undef>
304+
%cast = bitcast <4 x i8> %bswap to i32
305+
ret i32 %cast
306+
}

0 commit comments

Comments
 (0)