llvm.org GIT mirror llvm / 6888da8
[X86] Add test case for inserting/extracting from shuffled vectors. NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369870 91177308-0d34-0410-b5e6-96231b3b80d8 Amaury Sechet 25 days ago
1 changed file(s) with 80 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
28182818 %15 = add <4 x i32> %a0, %14
28192819 ret <4 x i32> %15
28202820 }
2821
2822 define <8 x i16> @shuffle_extract_insert(<8 x i16> %a) {
2823 ; SSE2-LABEL: shuffle_extract_insert:
2824 ; SSE2: # %bb.0:
2825 ; SSE2-NEXT: pextrw $3, %xmm0, %eax
2826 ; SSE2-NEXT: pextrw $4, %xmm0, %r8d
2827 ; SSE2-NEXT: pextrw $5, %xmm0, %edx
2828 ; SSE2-NEXT: pextrw $6, %xmm0, %esi
2829 ; SSE2-NEXT: movd %xmm0, %edi
2830 ; SSE2-NEXT: pextrw $7, %xmm0, %ecx
2831 ; SSE2-NEXT: pshuflw {{.*#+}} xmm0 = xmm0[2,1,2,3,4,5,6,7]
2832 ; SSE2-NEXT: pinsrw $2, %edi, %xmm0
2833 ; SSE2-NEXT: pinsrw $3, %eax, %xmm0
2834 ; SSE2-NEXT: pinsrw $4, %esi, %xmm0
2835 ; SSE2-NEXT: pinsrw $5, %edx, %xmm0
2836 ; SSE2-NEXT: pinsrw $6, %r8d, %xmm0
2837 ; SSE2-NEXT: pinsrw $7, %ecx, %xmm0
2838 ; SSE2-NEXT: retq
2839 ;
2840 ; SSSE3-LABEL: shuffle_extract_insert:
2841 ; SSSE3: # %bb.0:
2842 ; SSSE3-NEXT: pextrw $3, %xmm0, %eax
2843 ; SSSE3-NEXT: pextrw $4, %xmm0, %r8d
2844 ; SSSE3-NEXT: pextrw $5, %xmm0, %edx
2845 ; SSSE3-NEXT: pextrw $6, %xmm0, %esi
2846 ; SSSE3-NEXT: movd %xmm0, %edi
2847 ; SSSE3-NEXT: pextrw $7, %xmm0, %ecx
2848 ; SSSE3-NEXT: pshuflw {{.*#+}} xmm0 = xmm0[2,1,2,3,4,5,6,7]
2849 ; SSSE3-NEXT: pinsrw $2, %edi, %xmm0
2850 ; SSSE3-NEXT: pinsrw $3, %eax, %xmm0
2851 ; SSSE3-NEXT: pinsrw $4, %esi, %xmm0
2852 ; SSSE3-NEXT: pinsrw $5, %edx, %xmm0
2853 ; SSSE3-NEXT: pinsrw $6, %r8d, %xmm0
2854 ; SSSE3-NEXT: pinsrw $7, %ecx, %xmm0
2855 ; SSSE3-NEXT: retq
2856 ;
2857 ; SSE41-LABEL: shuffle_extract_insert:
2858 ; SSE41: # %bb.0:
2859 ; SSE41-NEXT: pextrw $4, %xmm0, %eax
2860 ; SSE41-NEXT: pextrw $6, %xmm0, %ecx
2861 ; SSE41-NEXT: movd %xmm0, %edx
2862 ; SSE41-NEXT: pshuflw {{.*#+}} xmm1 = xmm0[2,1,2,3,4,5,6,7]
2863 ; SSE41-NEXT: pinsrw $2, %edx, %xmm1
2864 ; SSE41-NEXT: pblendw {{.*#+}} xmm1 = xmm1[0,1,2],xmm0[3],xmm1[4,5,6,7]
2865 ; SSE41-NEXT: pinsrw $4, %ecx, %xmm1
2866 ; SSE41-NEXT: pblendw {{.*#+}} xmm1 = xmm1[0,1,2,3,4],xmm0[5],xmm1[6,7]
2867 ; SSE41-NEXT: pinsrw $6, %eax, %xmm1
2868 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm1[0,1,2,3,4,5,6],xmm0[7]
2869 ; SSE41-NEXT: retq
2870 ;
2871 ; AVX-LABEL: shuffle_extract_insert:
2872 ; AVX: # %bb.0:
2873 ; AVX-NEXT: vpextrw $4, %xmm0, %eax
2874 ; AVX-NEXT: vpextrw $6, %xmm0, %ecx
2875 ; AVX-NEXT: vmovd %xmm0, %edx
2876 ; AVX-NEXT: vpshuflw {{.*#+}} xmm1 = xmm0[2,1,2,3,4,5,6,7]
2877 ; AVX-NEXT: vpinsrw $2, %edx, %xmm1, %xmm1
2878 ; AVX-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0,1,2],xmm0[3],xmm1[4,5,6,7]
2879 ; AVX-NEXT: vpinsrw $4, %ecx, %xmm1, %xmm1
2880 ; AVX-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0,1,2,3,4],xmm0[5],xmm1[6,7]
2881 ; AVX-NEXT: vpinsrw $6, %eax, %xmm1, %xmm1
2882 ; AVX-NEXT: vpblendw {{.*#+}} xmm0 = xmm1[0,1,2,3,4,5,6],xmm0[7]
2883 ; AVX-NEXT: retq
2884 %a0 = extractelement <8 x i16> %a, i32 0
2885 %a1 = extractelement <8 x i16> %a, i32 1
2886 %a3 = extractelement <8 x i16> %a, i32 3
2887 %a4 = extractelement <8 x i16> %a, i32 4
2888 %a5 = extractelement <8 x i16> %a, i32 5
2889 %a6 = extractelement <8 x i16> %a, i32 6
2890 %a7 = extractelement <8 x i16> %a, i32 7
2891 %1 = shufflevector <8 x i16> %a, <8 x i16> %a, <8 x i32>
2892 %2 = insertelement <8 x i16> %1, i16 %a1, i32 1
2893 %3 = insertelement <8 x i16> %2, i16 %a0, i32 2
2894 %4 = insertelement <8 x i16> %3, i16 %a3, i32 3
2895 %5 = insertelement <8 x i16> %4, i16 %a6, i32 4
2896 %6 = insertelement <8 x i16> %5, i16 %a5, i32 5
2897 %7 = insertelement <8 x i16> %6, i16 %a4, i32 6
2898 %8 = insertelement <8 x i16> %7, i16 %a7, i32 7
2899 ret <8 x i16> %8
2900 }