From 4b4fbae24abf1e3c76cde3c41bb33d87688a9482 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Sat, 8 Feb 2020 20:44:41 +0000 Subject: [PATCH] [X86] Test showing inability to combine ROTLI/ROTRI rotations into shuffles One of many things necessary to fix PR44379 (lowering shuffles to rotations) --- .../vector-shuffle-combining-avx512bwvl.ll | 26 +++++++++++++++++++ .../X86/vector-shuffle-combining-xop.ll | 26 +++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/llvm/test/CodeGen/X86/vector-shuffle-combining-avx512bwvl.ll b/llvm/test/CodeGen/X86/vector-shuffle-combining-avx512bwvl.ll index fd41c9f089e6..cd7b8bf4e9db 100644 --- a/llvm/test/CodeGen/X86/vector-shuffle-combining-avx512bwvl.ll +++ b/llvm/test/CodeGen/X86/vector-shuffle-combining-avx512bwvl.ll @@ -75,3 +75,29 @@ define <16 x i16> @combine_vpermt2var_vpermi2var_16i16_as_unpcklwd(<16 x i16> %a %res0 = call <16 x i16> @llvm.x86.avx512.maskz.vpermt2var.hi.256(<16 x i16> , <16 x i16> %a0, <16 x i16> %a1, i16 -1) ret <16 x i16> %res0 } + +define <16 x i8> @combine_shuffle_vrotri_v2i64(<2 x i64> %a0) { +; CHECK-LABEL: combine_shuffle_proti_v2i64: +; CHECK: # %bb.0: +; CHECK-NEXT: vprorq $48, %xmm0, %xmm0 +; CHECK-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0] +; CHECK-NEXT: ret{{[l|q]}} + %1 = call <2 x i64> @llvm.fshr.v2i64(<2 x i64> %a0, <2 x i64> %a0, <2 x i64> ) + %2 = bitcast <2 x i64> %1 to <16 x i8> + %3 = shufflevector <16 x i8> %2, <16 x i8> undef, <16 x i32> + ret <16 x i8> %3 +} +declare <2 x i64> @llvm.fshr.v2i64(<2 x i64>, <2 x i64>, <2 x i64>) + +define <16 x i8> @combine_shuffle_vrotli_v4i32(<4 x i32> %a0) { +; CHECK-LABEL: combine_shuffle_proti_v4i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vprold $8, %xmm0, %xmm0 +; CHECK-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0] +; CHECK-NEXT: ret{{[l|q]}} + %1 = call <4 x i32> @llvm.fshl.v4i32(<4 x i32> %a0, <4 x i32> %a0, <4 x i32> ) + %2 = bitcast <4 x i32> %1 to <16 x i8> + %3 = shufflevector <16 x i8> %2, <16 x i8> undef, <16 x i32> + ret <16 x i8> %3 +} +declare <4 x i32> @llvm.fshl.v4i32(<4 x i32>, <4 x i32>, <4 x i32>) diff --git a/llvm/test/CodeGen/X86/vector-shuffle-combining-xop.ll b/llvm/test/CodeGen/X86/vector-shuffle-combining-xop.ll index 73a8cbe00e8c..7320036149a2 100644 --- a/llvm/test/CodeGen/X86/vector-shuffle-combining-xop.ll +++ b/llvm/test/CodeGen/X86/vector-shuffle-combining-xop.ll @@ -252,6 +252,32 @@ define <4 x i32> @combine_vpperm_10zz32BA(<4 x i32> %a0, <4 x i32> %a1) { ret <4 x i32> %res3 } +define <16 x i8> @combine_shuffle_proti_v2i64(<2 x i64> %a0) { +; CHECK-LABEL: combine_shuffle_proti_v2i64: +; CHECK: # %bb.0: +; CHECK-NEXT: vprotq $16, %xmm0, %xmm0 +; CHECK-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0] +; CHECK-NEXT: ret{{[l|q]}} + %1 = call <2 x i64> @llvm.fshr.v2i64(<2 x i64> %a0, <2 x i64> %a0, <2 x i64> ) + %2 = bitcast <2 x i64> %1 to <16 x i8> + %3 = shufflevector <16 x i8> %2, <16 x i8> undef, <16 x i32> + ret <16 x i8> %3 +} +declare <2 x i64> @llvm.fshr.v2i64(<2 x i64>, <2 x i64>, <2 x i64>) + +define <16 x i8> @combine_shuffle_proti_v4i32(<4 x i32> %a0) { +; CHECK-LABEL: combine_shuffle_proti_v4i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vprotd $8, %xmm0, %xmm0 +; CHECK-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0] +; CHECK-NEXT: ret{{[l|q]}} + %1 = call <4 x i32> @llvm.fshl.v4i32(<4 x i32> %a0, <4 x i32> %a0, <4 x i32> ) + %2 = bitcast <4 x i32> %1 to <16 x i8> + %3 = shufflevector <16 x i8> %2, <16 x i8> undef, <16 x i32> + ret <16 x i8> %3 +} +declare <4 x i32> @llvm.fshl.v4i32(<4 x i32>, <4 x i32>, <4 x i32>) + define void @buildvector_v4f32_0404(float %a, float %b, <4 x float>* %ptr) { ; X86-LABEL: buildvector_v4f32_0404: ; X86: # %bb.0: