Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -march=x86 -mattr=avx2 | FileCheck %s
      2 
      3 define <16 x i16> @test_x86_avx2_pblendw(<16 x i16> %a0, <16 x i16> %a1) {
      4   ; CHECK: vpblendw
      5   %res = call <16 x i16> @llvm.x86.avx2.pblendw(<16 x i16> %a0, <16 x i16> %a1, i32 7) ; <<16 x i16>> [#uses=1]
      6   ret <16 x i16> %res
      7 }
      8 declare <16 x i16> @llvm.x86.avx2.pblendw(<16 x i16>, <16 x i16>, i32) nounwind readnone
      9 
     10 
     11 define <4 x i32> @test_x86_avx2_pblendd_128(<4 x i32> %a0, <4 x i32> %a1) {
     12   ; CHECK: vpblendd
     13   %res = call <4 x i32> @llvm.x86.avx2.pblendd.128(<4 x i32> %a0, <4 x i32> %a1, i32 7) ; <<4 x i32>> [#uses=1]
     14   ret <4 x i32> %res
     15 }
     16 declare <4 x i32> @llvm.x86.avx2.pblendd.128(<4 x i32>, <4 x i32>, i32) nounwind readnone
     17 
     18 
     19 define <8 x i32> @test_x86_avx2_pblendd_256(<8 x i32> %a0, <8 x i32> %a1) {
     20   ; CHECK: vpblendd
     21   %res = call <8 x i32> @llvm.x86.avx2.pblendd.256(<8 x i32> %a0, <8 x i32> %a1, i32 7) ; <<8 x i32>> [#uses=1]
     22   ret <8 x i32> %res
     23 }
     24 declare <8 x i32> @llvm.x86.avx2.pblendd.256(<8 x i32>, <8 x i32>, i32) nounwind readnone
     25 
     26 
     27 define <16 x i16> @test_x86_avx2_mpsadbw(<32 x i8> %a0, <32 x i8> %a1) {
     28   ; CHECK: vmpsadbw
     29   %res = call <16 x i16> @llvm.x86.avx2.mpsadbw(<32 x i8> %a0, <32 x i8> %a1, i32 7) ; <<16 x i16>> [#uses=1]
     30   ret <16 x i16> %res
     31 }
     32 declare <16 x i16> @llvm.x86.avx2.mpsadbw(<32 x i8>, <32 x i8>, i32) nounwind readnone
     33 
     34 
     35 define <4 x i64> @test_x86_avx2_psll_dq_bs(<4 x i64> %a0) {
     36   ; CHECK: vpslldq {{.*#+}} ymm0 = zero,zero,zero,zero,zero,zero,zero,ymm0[0,1,2,3,4,5,6,7,8],zero,zero,zero,zero,zero,zero,zero,ymm0[16,17,18,19,20,21,22,23,24]
     37   %res = call <4 x i64> @llvm.x86.avx2.psll.dq.bs(<4 x i64> %a0, i32 7) ; <<4 x i64>> [#uses=1]
     38   ret <4 x i64> %res
     39 }
     40 declare <4 x i64> @llvm.x86.avx2.psll.dq.bs(<4 x i64>, i32) nounwind readnone
     41 
     42 
     43 define <4 x i64> @test_x86_avx2_psrl_dq_bs(<4 x i64> %a0) {
     44   ; CHECK: vpsrldq {{.*#+}} ymm0 = ymm0[7,8,9,10,11,12,13,14,15],zero,zero,zero,zero,zero,zero,zero,ymm0[23,24,25,26,27,28,29,30,31],zero,zero,zero,zero,zero,zero,zero
     45   %res = call <4 x i64> @llvm.x86.avx2.psrl.dq.bs(<4 x i64> %a0, i32 7) ; <<4 x i64>> [#uses=1]
     46   ret <4 x i64> %res
     47 }
     48 declare <4 x i64> @llvm.x86.avx2.psrl.dq.bs(<4 x i64>, i32) nounwind readnone
     49 
     50 
     51 define <4 x i64> @test_x86_avx2_psll_dq(<4 x i64> %a0) {
     52   ; CHECK: vpslldq {{.*#+}} ymm0 = zero,ymm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],zero,ymm0[16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]
     53   %res = call <4 x i64> @llvm.x86.avx2.psll.dq(<4 x i64> %a0, i32 8) ; <<4 x i64>> [#uses=1]
     54   ret <4 x i64> %res
     55 }
     56 declare <4 x i64> @llvm.x86.avx2.psll.dq(<4 x i64>, i32) nounwind readnone
     57 
     58 
     59 define <4 x i64> @test_x86_avx2_psrl_dq(<4 x i64> %a0) {
     60   ; CHECK: vpsrldq {{.*#+}} ymm0 = ymm0[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],zero,ymm0[17,18,19,20,21,22,23,24,25,26,27,28,29,30,31],zero
     61   %res = call <4 x i64> @llvm.x86.avx2.psrl.dq(<4 x i64> %a0, i32 8) ; <<4 x i64>> [#uses=1]
     62   ret <4 x i64> %res
     63 }
     64 declare <4 x i64> @llvm.x86.avx2.psrl.dq(<4 x i64>, i32) nounwind readnone
     65 
     66 
     67 define <2 x i64> @test_x86_avx2_vextracti128(<4 x i64> %a0) {
     68 ; CHECK-LABEL:    test_x86_avx2_vextracti128:
     69 ; CHECK:          vextracti128
     70 
     71   %res = call <2 x i64> @llvm.x86.avx2.vextracti128(<4 x i64> %a0, i8 7)
     72   ret <2 x i64> %res
     73 }
     74 declare <2 x i64> @llvm.x86.avx2.vextracti128(<4 x i64>, i8) nounwind readnone
     75 
     76 
     77 define <4 x i64> @test_x86_avx2_vinserti128(<4 x i64> %a0, <2 x i64> %a1) {
     78 ; CHECK-LABEL:    test_x86_avx2_vinserti128:
     79 ; CHECK:          vinserti128
     80 
     81   %res = call <4 x i64> @llvm.x86.avx2.vinserti128(<4 x i64> %a0, <2 x i64> %a1, i8 7)
     82   ret <4 x i64> %res
     83 }
     84 declare <4 x i64> @llvm.x86.avx2.vinserti128(<4 x i64>, <2 x i64>, i8) nounwind readnone
     85 
     86 
     87 define <4 x double> @test_x86_avx2_vbroadcast_sd_pd_256(<2 x double> %a0) {
     88   ; CHECK-LABEL: test_x86_avx2_vbroadcast_sd_pd_256:
     89   ; CHECK:       ## BB#0:
     90   ; CHECK-NEXT:    vbroadcastsd %xmm0, %ymm0
     91   ; CHECK-NEXT:    retl
     92   %res = call <4 x double> @llvm.x86.avx2.vbroadcast.sd.pd.256(<2 x double> %a0)
     93   ret <4 x double> %res
     94 }
     95 declare <4 x double> @llvm.x86.avx2.vbroadcast.sd.pd.256(<2 x double>) nounwind readonly
     96 
     97 
     98 define <4 x float> @test_x86_avx2_vbroadcast_ss_ps(<4 x float> %a0) {
     99   ; CHECK-LABEL: test_x86_avx2_vbroadcast_ss_ps:
    100   ; CHECK:       ## BB#0:
    101   ; CHECK-NEXT:    vbroadcastss %xmm0, %xmm0
    102   ; CHECK-NEXT:    retl
    103   %res = call <4 x float> @llvm.x86.avx2.vbroadcast.ss.ps(<4 x float> %a0)
    104   ret <4 x float> %res
    105 }
    106 declare <4 x float> @llvm.x86.avx2.vbroadcast.ss.ps(<4 x float>) nounwind readonly
    107 
    108 
    109 define <8 x float> @test_x86_avx2_vbroadcast_ss_ps_256(<4 x float> %a0) {
    110   ; CHECK-LABEL: test_x86_avx2_vbroadcast_ss_ps_256:
    111   ; CHECK:       ## BB#0:
    112   ; CHECK-NEXT:    vbroadcastss %xmm0, %ymm0
    113   ; CHECK-NEXT:    retl
    114   %res = call <8 x float> @llvm.x86.avx2.vbroadcast.ss.ps.256(<4 x float> %a0)
    115   ret <8 x float> %res
    116 }
    117 declare <8 x float> @llvm.x86.avx2.vbroadcast.ss.ps.256(<4 x float>) nounwind readonly
    118 
    119 
    120 define <16 x i8> @test_x86_avx2_pbroadcastb_128(<16 x i8> %a0) {
    121 ; CHECK-LABEL: test_x86_avx2_pbroadcastb_128:
    122 ; CHECK:       ## BB#0:
    123 ; CHECK-NEXT:    vpbroadcastb %xmm0, %xmm0
    124 ; CHECK-NEXT:    retl
    125   %res = call <16 x i8> @llvm.x86.avx2.pbroadcastb.128(<16 x i8> %a0)
    126   ret <16 x i8> %res
    127 }
    128 declare <16 x i8> @llvm.x86.avx2.pbroadcastb.128(<16 x i8>) nounwind readonly
    129 
    130 
    131 define <32 x i8> @test_x86_avx2_pbroadcastb_256(<16 x i8> %a0) {
    132 ; CHECK-LABEL: test_x86_avx2_pbroadcastb_256:
    133 ; CHECK:       ## BB#0:
    134 ; CHECK-NEXT:    vpbroadcastb %xmm0, %ymm0
    135 ; CHECK-NEXT:    retl
    136   %res = call <32 x i8> @llvm.x86.avx2.pbroadcastb.256(<16 x i8> %a0)
    137   ret <32 x i8> %res
    138 }
    139 declare <32 x i8> @llvm.x86.avx2.pbroadcastb.256(<16 x i8>) nounwind readonly
    140 
    141 
    142 define <8 x i16> @test_x86_avx2_pbroadcastw_128(<8 x i16> %a0) {
    143 ; CHECK-LABEL: test_x86_avx2_pbroadcastw_128:
    144 ; CHECK:       ## BB#0:
    145 ; CHECK-NEXT:    vpbroadcastw %xmm0, %xmm0
    146 ; CHECK-NEXT:    retl
    147   %res = call <8 x i16> @llvm.x86.avx2.pbroadcastw.128(<8 x i16> %a0)
    148   ret <8 x i16> %res
    149 }
    150 declare <8 x i16> @llvm.x86.avx2.pbroadcastw.128(<8 x i16>) nounwind readonly
    151 
    152 
    153 define <16 x i16> @test_x86_avx2_pbroadcastw_256(<8 x i16> %a0) {
    154 ; CHECK-LABEL: test_x86_avx2_pbroadcastw_256:
    155 ; CHECK:       ## BB#0:
    156 ; CHECK-NEXT:    vpbroadcastw %xmm0, %ymm0
    157 ; CHECK-NEXT:    retl
    158   %res = call <16 x i16> @llvm.x86.avx2.pbroadcastw.256(<8 x i16> %a0)
    159   ret <16 x i16> %res
    160 }
    161 declare <16 x i16> @llvm.x86.avx2.pbroadcastw.256(<8 x i16>) nounwind readonly
    162 
    163 
    164 define <4 x i32> @test_x86_avx2_pbroadcastd_128(<4 x i32> %a0) {
    165 ; CHECK-LABEL: test_x86_avx2_pbroadcastd_128:
    166 ; CHECK:       ## BB#0:
    167 ; CHECK-NEXT:    vbroadcastss %xmm0, %xmm0
    168 ; CHECK-NEXT:    retl
    169   %res = call <4 x i32> @llvm.x86.avx2.pbroadcastd.128(<4 x i32> %a0)
    170   ret <4 x i32> %res
    171 }
    172 declare <4 x i32> @llvm.x86.avx2.pbroadcastd.128(<4 x i32>) nounwind readonly
    173 
    174 
    175 define <8 x i32> @test_x86_avx2_pbroadcastd_256(<4 x i32> %a0) {
    176 ; CHECK-LABEL: test_x86_avx2_pbroadcastd_256:
    177 ; CHECK:       ## BB#0:
    178 ; CHECK-NEXT:    vbroadcastss %xmm0, %ymm0
    179 ; CHECK-NEXT:    retl
    180   %res = call <8 x i32> @llvm.x86.avx2.pbroadcastd.256(<4 x i32> %a0)
    181   ret <8 x i32> %res
    182 }
    183 declare <8 x i32> @llvm.x86.avx2.pbroadcastd.256(<4 x i32>) nounwind readonly
    184 
    185 
    186 define <2 x i64> @test_x86_avx2_pbroadcastq_128(<2 x i64> %a0) {
    187 ; CHECK-LABEL: test_x86_avx2_pbroadcastq_128:
    188 ; CHECK:       ## BB#0:
    189 ; CHECK-NEXT:    vpbroadcastq %xmm0, %xmm0
    190 ; CHECK-NEXT:    retl
    191   %res = call <2 x i64> @llvm.x86.avx2.pbroadcastq.128(<2 x i64> %a0)
    192   ret <2 x i64> %res
    193 }
    194 declare <2 x i64> @llvm.x86.avx2.pbroadcastq.128(<2 x i64>) nounwind readonly
    195 
    196 
    197 define <4 x i64> @test_x86_avx2_pbroadcastq_256(<2 x i64> %a0) {
    198 ; CHECK-LABEL: test_x86_avx2_pbroadcastq_256:
    199 ; CHECK:       ## BB#0:
    200 ; CHECK-NEXT:    vbroadcastsd %xmm0, %ymm0
    201 ; CHECK-NEXT:    retl
    202   %res = call <4 x i64> @llvm.x86.avx2.pbroadcastq.256(<2 x i64> %a0)
    203   ret <4 x i64> %res
    204 }
    205 declare <4 x i64> @llvm.x86.avx2.pbroadcastq.256(<2 x i64>) nounwind readonly
    206