[llvm] r370407 - [InstCombine] add possible bswap as widening shuffle test; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 29 13:57:50 PDT 2019
Author: spatel
Date: Thu Aug 29 13:57:50 2019
New Revision: 370407
URL: http://llvm.org/viewvc/llvm-project?rev=370407&view=rev
Log:
[InstCombine] add possible bswap as widening shuffle test; NFC
Goes with the proposal in D66965.
Modified:
llvm/trunk/test/Transforms/InstCombine/bswap.ll
Modified: llvm/trunk/test/Transforms/InstCombine/bswap.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/bswap.ll?rev=370407&r1=370406&r2=370407&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/bswap.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/bswap.ll Thu Aug 29 13:57:50 2019
@@ -283,8 +283,8 @@ define i32 @shuf_4bytes_extra_use(<4 x i
ret i32 %cast
}
-define i128 @shuf_load_16bytes(<16 x i8> %x) {
-; CHECK-LABEL: @shuf_load_16bytes(
+define i128 @shuf_16bytes(<16 x i8> %x) {
+; CHECK-LABEL: @shuf_16bytes(
; 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>
; CHECK-NEXT: [[CAST:%.*]] = bitcast <16 x i8> [[BSWAP]] to i128
; CHECK-NEXT: ret i128 [[CAST]]
@@ -293,3 +293,14 @@ define i128 @shuf_load_16bytes(<16 x i8>
%cast = bitcast <16 x i8> %bswap to i128
ret i128 %cast
}
+
+define i32 @shuf_2bytes_widening(<2 x i8> %x) {
+; CHECK-LABEL: @shuf_2bytes_widening(
+; CHECK-NEXT: [[BSWAP:%.*]] = shufflevector <2 x i8> [[X:%.*]], <2 x i8> undef, <4 x i32> <i32 1, i32 0, i32 undef, i32 undef>
+; CHECK-NEXT: [[CAST:%.*]] = bitcast <4 x i8> [[BSWAP]] to i32
+; CHECK-NEXT: ret i32 [[CAST]]
+;
+ %bswap = shufflevector <2 x i8> %x, <2 x i8> undef, <4 x i32> <i32 1, i32 0, i32 undef, i32 undef>
+ %cast = bitcast <4 x i8> %bswap to i32
+ ret i32 %cast
+}
More information about the llvm-commits
mailing list