Home | History | Annotate | Download | only in X86
      1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
      2 ; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+sse2 | FileCheck %s -check-prefixes=CHECK,SSE,SSE2
      3 ; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+sse4.2 | FileCheck %s -check-prefixes=CHECK,SSE,SSE42
      4 ; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+avx | FileCheck %s -check-prefixes=CHECK,AVX,AVX1
      5 ; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+avx2 | FileCheck %s -check-prefixes=CHECK,AVX,AVX2
      6 ; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+xop,+avx | FileCheck %s -check-prefixes=CHECK,AVX,AVX1
      7 ; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -cost-model -analyze -mattr=+xop,+avx2 | FileCheck %s -check-prefixes=CHECK,AVX,AVX2
      8 
      9 ; Verify the cost of vector bswap instructions.
     10 
     11 declare <2 x i64> @llvm.bswap.v2i64(<2 x i64>)
     12 declare <4 x i32> @llvm.bswap.v4i32(<4 x i32>)
     13 declare <8 x i16> @llvm.bswap.v8i16(<8 x i16>)
     14 
     15 declare <4 x i64> @llvm.bswap.v4i64(<4 x i64>)
     16 declare <8 x i32> @llvm.bswap.v8i32(<8 x i32>)
     17 declare <16 x i16> @llvm.bswap.v16i16(<16 x i16>)
     18 
     19 define <2 x i64> @var_bswap_v2i64(<2 x i64> %a) {
     20 ; SSE2-LABEL: 'var_bswap_v2i64'
     21 ; SSE2-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %bswap = call <2 x i64> @llvm.bswap.v2i64(<2 x i64> %a)
     22 ; SSE2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %bswap
     23 ;
     24 ; SSE42-LABEL: 'var_bswap_v2i64'
     25 ; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call <2 x i64> @llvm.bswap.v2i64(<2 x i64> %a)
     26 ; SSE42-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %bswap
     27 ;
     28 ; AVX-LABEL: 'var_bswap_v2i64'
     29 ; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call <2 x i64> @llvm.bswap.v2i64(<2 x i64> %a)
     30 ; AVX-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %bswap
     31 ;
     32   %bswap = call <2 x i64> @llvm.bswap.v2i64(<2 x i64> %a)
     33   ret <2 x i64> %bswap
     34 }
     35 
     36 define <4 x i64> @var_bswap_v4i64(<4 x i64> %a) {
     37 ; SSE2-LABEL: 'var_bswap_v4i64'
     38 ; SSE2-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %bswap = call <4 x i64> @llvm.bswap.v4i64(<4 x i64> %a)
     39 ; SSE2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %bswap
     40 ;
     41 ; SSE42-LABEL: 'var_bswap_v4i64'
     42 ; SSE42-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %bswap = call <4 x i64> @llvm.bswap.v4i64(<4 x i64> %a)
     43 ; SSE42-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %bswap
     44 ;
     45 ; AVX1-LABEL: 'var_bswap_v4i64'
     46 ; AVX1-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %bswap = call <4 x i64> @llvm.bswap.v4i64(<4 x i64> %a)
     47 ; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %bswap
     48 ;
     49 ; AVX2-LABEL: 'var_bswap_v4i64'
     50 ; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call <4 x i64> @llvm.bswap.v4i64(<4 x i64> %a)
     51 ; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %bswap
     52 ;
     53   %bswap = call <4 x i64> @llvm.bswap.v4i64(<4 x i64> %a)
     54   ret <4 x i64> %bswap
     55 }
     56 
     57 define <4 x i32> @var_bswap_v4i32(<4 x i32> %a) {
     58 ; SSE2-LABEL: 'var_bswap_v4i32'
     59 ; SSE2-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %bswap = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %a)
     60 ; SSE2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %bswap
     61 ;
     62 ; SSE42-LABEL: 'var_bswap_v4i32'
     63 ; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %a)
     64 ; SSE42-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %bswap
     65 ;
     66 ; AVX-LABEL: 'var_bswap_v4i32'
     67 ; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %a)
     68 ; AVX-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %bswap
     69 ;
     70   %bswap = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %a)
     71   ret <4 x i32> %bswap
     72 }
     73 
     74 define <8 x i32> @var_bswap_v8i32(<8 x i32> %a) {
     75 ; SSE2-LABEL: 'var_bswap_v8i32'
     76 ; SSE2-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %bswap = call <8 x i32> @llvm.bswap.v8i32(<8 x i32> %a)
     77 ; SSE2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %bswap
     78 ;
     79 ; SSE42-LABEL: 'var_bswap_v8i32'
     80 ; SSE42-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %bswap = call <8 x i32> @llvm.bswap.v8i32(<8 x i32> %a)
     81 ; SSE42-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %bswap
     82 ;
     83 ; AVX1-LABEL: 'var_bswap_v8i32'
     84 ; AVX1-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %bswap = call <8 x i32> @llvm.bswap.v8i32(<8 x i32> %a)
     85 ; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %bswap
     86 ;
     87 ; AVX2-LABEL: 'var_bswap_v8i32'
     88 ; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call <8 x i32> @llvm.bswap.v8i32(<8 x i32> %a)
     89 ; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %bswap
     90 ;
     91   %bswap = call <8 x i32> @llvm.bswap.v8i32(<8 x i32> %a)
     92   ret <8 x i32> %bswap
     93 }
     94 
     95 define <8 x i16> @var_bswap_v8i16(<8 x i16> %a) {
     96 ; SSE2-LABEL: 'var_bswap_v8i16'
     97 ; SSE2-NEXT:  Cost Model: Found an estimated cost of 7 for instruction: %bswap = call <8 x i16> @llvm.bswap.v8i16(<8 x i16> %a)
     98 ; SSE2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i16> %bswap
     99 ;
    100 ; SSE42-LABEL: 'var_bswap_v8i16'
    101 ; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call <8 x i16> @llvm.bswap.v8i16(<8 x i16> %a)
    102 ; SSE42-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i16> %bswap
    103 ;
    104 ; AVX-LABEL: 'var_bswap_v8i16'
    105 ; AVX-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call <8 x i16> @llvm.bswap.v8i16(<8 x i16> %a)
    106 ; AVX-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i16> %bswap
    107 ;
    108   %bswap = call <8 x i16> @llvm.bswap.v8i16(<8 x i16> %a)
    109   ret <8 x i16> %bswap
    110 }
    111 
    112 define <16 x i16> @var_bswap_v16i16(<16 x i16> %a) {
    113 ; SSE2-LABEL: 'var_bswap_v16i16'
    114 ; SSE2-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %bswap = call <16 x i16> @llvm.bswap.v16i16(<16 x i16> %a)
    115 ; SSE2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i16> %bswap
    116 ;
    117 ; SSE42-LABEL: 'var_bswap_v16i16'
    118 ; SSE42-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %bswap = call <16 x i16> @llvm.bswap.v16i16(<16 x i16> %a)
    119 ; SSE42-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i16> %bswap
    120 ;
    121 ; AVX1-LABEL: 'var_bswap_v16i16'
    122 ; AVX1-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %bswap = call <16 x i16> @llvm.bswap.v16i16(<16 x i16> %a)
    123 ; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i16> %bswap
    124 ;
    125 ; AVX2-LABEL: 'var_bswap_v16i16'
    126 ; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call <16 x i16> @llvm.bswap.v16i16(<16 x i16> %a)
    127 ; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i16> %bswap
    128 ;
    129   %bswap = call <16 x i16> @llvm.bswap.v16i16(<16 x i16> %a)
    130   ret <16 x i16> %bswap
    131 }
    132