From b6d43abb7cd9d23c0d1ca55b9865571052a535b6 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Tue, 18 Aug 2015 20:51:15 +0000 Subject: [PATCH] [X86][AVX] Added shuffle concatenation tests git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245351 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CodeGen/X86/vector-shuffle-256-v16.ll | 27 ++++++++++++++++++++++ test/CodeGen/X86/vector-shuffle-256-v4.ll | 26 +++++++++++++++++++++ test/CodeGen/X86/vector-shuffle-256-v8.ll | 27 ++++++++++++++++++++++ 3 files changed, 80 insertions(+) diff --git a/test/CodeGen/X86/vector-shuffle-256-v16.ll b/test/CodeGen/X86/vector-shuffle-256-v16.ll index df4994da693..6683ea2b6a5 100644 --- a/test/CodeGen/X86/vector-shuffle-256-v16.ll +++ b/test/CodeGen/X86/vector-shuffle-256-v16.ll @@ -3261,3 +3261,30 @@ define <16 x i16> @insert_v16i16_0elt_into_zero_vector(i16* %ptr) { ret <16 x i16> %i0 } +define <16 x i16> @concat_v16i16_0_1_2_3_4_5_6_7_24_25_26_27_28_29_30_31(<16 x i16> %a, <16 x i16> %b) { +; ALL-LABEL: concat_v16i16_0_1_2_3_4_5_6_7_24_25_26_27_28_29_30_31: +; ALL: # BB#0: +; ALL-NEXT: vextractf128 $1, %ymm1, %xmm1 +; ALL-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0 +; ALL-NEXT: retq + %alo = shufflevector <16 x i16> %a, <16 x i16> undef, <8 x i32> + %bhi = shufflevector <16 x i16> %b, <16 x i16> undef, <8 x i32> + %shuf = shufflevector <8 x i16> %alo, <8 x i16> %bhi, <16 x i32> + ret <16 x i16> %shuf +} + +define <16 x i16> @concat_v16i16_8_9_10_11_12_13_14_15_24_25_26_27_28_29_30_31_bc(<16 x i16> %a, <16 x i16> %b) { +; ALL-LABEL: concat_v16i16_8_9_10_11_12_13_14_15_24_25_26_27_28_29_30_31_bc: +; ALL: # BB#0: +; ALL-NEXT: vextractf128 $1, %ymm0, %xmm0 +; ALL-NEXT: vextractf128 $1, %ymm1, %xmm1 +; ALL-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0 +; ALL-NEXT: retq + %ahi = shufflevector <16 x i16> %a, <16 x i16> undef, <8 x i32> + %bhi = shufflevector <16 x i16> %b, <16 x i16> undef, <8 x i32> + %bc0hi = bitcast <8 x i16> %ahi to <16 x i8> + %bc1hi = bitcast <8 x i16> %bhi to <16 x i8> + %shuffle8 = shufflevector <16 x i8> %bc0hi, <16 x i8> %bc1hi, <32 x i32> + %shuffle16 = bitcast <32 x i8> %shuffle8 to <16 x i16> + ret <16 x i16> %shuffle16 +} diff --git a/test/CodeGen/X86/vector-shuffle-256-v4.ll b/test/CodeGen/X86/vector-shuffle-256-v4.ll index 62bf288a870..16263728314 100644 --- a/test/CodeGen/X86/vector-shuffle-256-v4.ll +++ b/test/CodeGen/X86/vector-shuffle-256-v4.ll @@ -972,3 +972,29 @@ define <4 x double> @bitcast_v4f64_0426(<4 x double> %a, <4 x double> %b) { %bitcast64 = bitcast <16 x i16> %shuffle16 to <4 x double> ret <4 x double> %bitcast64 } + +define <4 x i64> @concat_v4i64_0167(<4 x i64> %a0, <4 x i64> %a1) { +; ALL-LABEL: concat_v4i64_0167: +; ALL: # BB#0: +; ALL-NEXT: vextractf128 $1, %ymm1, %xmm1 +; ALL-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0 +; ALL-NEXT: retq + %a0lo = shufflevector <4 x i64> %a0, <4 x i64> %a1, <2 x i32> + %a1hi = shufflevector <4 x i64> %a0, <4 x i64> %a1, <2 x i32> + %shuffle64 = shufflevector <2 x i64> %a0lo, <2 x i64> %a1hi, <4 x i32> + ret <4 x i64> %shuffle64 +} + +define <4 x i64> @concat_v4i64_0145_bc(<4 x i64> %a0, <4 x i64> %a1) { +; ALL-LABEL: concat_v4i64_0145_bc: +; ALL: # BB#0: +; ALL-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0 +; ALL-NEXT: retq + %a0lo = shufflevector <4 x i64> %a0, <4 x i64> %a1, <2 x i32> + %a1lo = shufflevector <4 x i64> %a0, <4 x i64> %a1, <2 x i32> + %bc0lo = bitcast <2 x i64> %a0lo to <4 x i32> + %bc1lo = bitcast <2 x i64> %a1lo to <4 x i32> + %shuffle32 = shufflevector <4 x i32> %bc0lo, <4 x i32> %bc1lo, <8 x i32> + %shuffle64 = bitcast <8 x i32> %shuffle32 to <4 x i64> + ret <4 x i64> %shuffle64 +} diff --git a/test/CodeGen/X86/vector-shuffle-256-v8.ll b/test/CodeGen/X86/vector-shuffle-256-v8.ll index bc72e0a6617..5a19bd6c677 100644 --- a/test/CodeGen/X86/vector-shuffle-256-v8.ll +++ b/test/CodeGen/X86/vector-shuffle-256-v8.ll @@ -2098,3 +2098,30 @@ define <8 x i32> @insert_mem_and_zero_v8i32(i32* %ptr) { ret <8 x i32> %shuffle } +define <8 x i32> @concat_v8i32_0123CDEF(<8 x i32> %a, <8 x i32> %b) { +; ALL-LABEL: concat_v8i32_0123CDEF: +; ALL: # BB#0: +; ALL-NEXT: vextractf128 $1, %ymm1, %xmm1 +; ALL-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0 +; ALL-NEXT: retq + %alo = shufflevector <8 x i32> %a, <8 x i32> undef, <4 x i32> + %bhi = shufflevector <8 x i32> %b, <8 x i32> undef, <4 x i32> + %shuf = shufflevector <4 x i32> %alo, <4 x i32> %bhi, <8 x i32> + ret <8 x i32> %shuf +} + +define <8 x i32> @concat_v8i32_4567CDEF_bc(<8 x i32> %a0, <8 x i32> %a1) { +; ALL-LABEL: concat_v8i32_4567CDEF_bc: +; ALL: # BB#0: +; ALL-NEXT: vextractf128 $1, %ymm0, %xmm0 +; ALL-NEXT: vextractf128 $1, %ymm1, %xmm1 +; ALL-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0 +; ALL-NEXT: retq + %a0hi = shufflevector <8 x i32> %a0, <8 x i32> %a1, <4 x i32> + %a1hi = shufflevector <8 x i32> %a0, <8 x i32> %a1, <4 x i32> + %bc0hi = bitcast <4 x i32> %a0hi to <2 x i64> + %bc1hi = bitcast <4 x i32> %a1hi to <2 x i64> + %shuffle64 = shufflevector <2 x i64> %bc0hi, <2 x i64> %bc1hi, <4 x i32> + %shuffle32 = bitcast <4 x i64> %shuffle64 to <8 x i32> + ret <8 x i32> %shuffle32 +} -- 2.34.1