Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx  | FileCheck %s --check-prefix=ALL --check-prefix=AVX
      2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefix=ALL --check-prefix=AVX2
      3 
      4 define <8 x float> @insert_f32(<8 x float> %y, float %f, <8 x float> %x) {
      5 ; ALL-LABEL: insert_f32:
      6 ; ALL:         vblendps {{.*#+}} ymm0 = ymm1[0],ymm0[1,2,3,4,5,6,7]
      7 ; ALL-NEXT:    retq
      8   %i0 = insertelement <8 x float> %y, float %f, i32 0
      9   ret <8 x float> %i0
     10 }
     11 
     12 define <4 x double> @insert_f64(<4 x double> %y, double %f, <4 x double> %x) {
     13 ; ALL-LABEL: insert_f64:
     14 ; ALL:         vblendpd {{.*#+}} ymm0 = ymm1[0],ymm0[1,2,3]
     15 ; ALL-NEXT:    retq
     16   %i0 = insertelement <4 x double> %y, double %f, i32 0
     17   ret <4 x double> %i0
     18 }
     19 
     20 define <32 x i8> @insert_i8(<32 x i8> %y, i8 %f, <32 x i8> %x) {
     21 ; AVX-LABEL: insert_i8:
     22 ; AVX:       # BB#0:
     23 ; AVX-NEXT:    vpinsrb $0, %edi, %xmm0, %xmm1
     24 ; AVX-NEXT:    vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
     25 ; AVX-NEXT:    retq
     26 ;
     27 ; AVX2-LABEL: insert_i8:
     28 ; AVX2:       # BB#0:
     29 ; AVX2-NEXT:    vpinsrb $0, %edi, %xmm0, %xmm1
     30 ; AVX2-NEXT:    vpblendd {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
     31 ; AVX2-NEXT:    retq
     32   %i0 = insertelement <32 x i8> %y, i8 %f, i32 0
     33   ret <32 x i8> %i0
     34 }
     35 
     36 define <16 x i16> @insert_i16(<16 x i16> %y, i16 %f, <16 x i16> %x) {
     37 ; AVX-LABEL: insert_i16:
     38 ; AVX:       # BB#0:
     39 ; AVX-NEXT:    vpinsrw $0, %edi, %xmm0, %xmm1
     40 ; AVX-NEXT:    vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
     41 ; AVX-NEXT:    retq
     42 ;
     43 ; AVX2-LABEL: insert_i16:
     44 ; AVX2:       # BB#0:
     45 ; AVX2-NEXT:    vpinsrw $0, %edi, %xmm0, %xmm1
     46 ; AVX2-NEXT:    vpblendd {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
     47 ; AVX2-NEXT:    retq
     48   %i0 = insertelement <16 x i16> %y, i16 %f, i32 0
     49   ret <16 x i16> %i0
     50 }
     51 
     52 define <8 x i32> @insert_i32(<8 x i32> %y, i32 %f, <8 x i32> %x) {
     53 ; AVX-LABEL: insert_i32:
     54 ; AVX:       # BB#0:
     55 ; AVX-NEXT:    vpinsrd $0, %edi, %xmm0, %xmm1
     56 ; AVX-NEXT:    vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
     57 ; AVX-NEXT:    retq
     58 ;
     59 ; AVX2-LABEL: insert_i32:
     60 ; AVX2:       # BB#0:
     61 ; AVX2-NEXT:    vmovd %edi, %xmm1
     62 ; AVX2-NEXT:    vpblendd {{.*#+}} ymm0 = ymm1[0],ymm0[1,2,3,4,5,6,7]
     63 ; AVX2-NEXT:    retq
     64   %i0 = insertelement <8 x i32> %y, i32 %f, i32 0
     65   ret <8 x i32> %i0
     66 }
     67 
     68 define <4 x i64> @insert_i64(<4 x i64> %y, i64 %f, <4 x i64> %x) {
     69 ; AVX-LABEL: insert_i64:
     70 ; AVX:       # BB#0:
     71 ; AVX-NEXT:    vpinsrq $0, %rdi, %xmm0, %xmm1
     72 ; AVX-NEXT:    vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
     73 ; AVX-NEXT:    retq
     74 ;
     75 ; AVX2-LABEL: insert_i64:
     76 ; AVX2:       # BB#0:
     77 ; AVX2-NEXT:    vpinsrq $0, %rdi, %xmm0, %xmm1
     78 ; AVX2-NEXT:    vpblendd {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
     79 ; AVX2-NEXT:    retq
     80   %i0 = insertelement <4 x i64> %y, i64 %f, i32 0
     81   ret <4 x i64> %i0
     82 }
     83 
     84