Home | History | Annotate | Download | only in X86
      1 ; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=corei7 -mattr=+sse2,-sse4.1 -cost-model -analyze | FileCheck %s -check-prefix=CHECK -check-prefix=SSE2
      2 ; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=core-avx2 -cost-model -analyze | FileCheck %s -check-prefix=CHECK -check-prefix=AVX2
      3 
      4 define <4 x i32> @test1(<4 x i32> %a) {
      5   %div = udiv <4 x i32> %a, <i32 7, i32 7, i32 7, i32 7>
      6   ret <4 x i32> %div
      7 
      8 ; CHECK: 'Cost Model Analysis' for function 'test1':
      9 ; SSE2: Found an estimated cost of 15 for instruction:   %div
     10 ; AVX2: Found an estimated cost of 15 for instruction:   %div
     11 }
     12 
     13 define <8 x i32> @test2(<8 x i32> %a) {
     14   %div = udiv <8 x i32> %a, <i32 7, i32 7, i32 7, i32 7,i32 7, i32 7, i32 7, i32 7>
     15   ret <8 x i32> %div
     16 
     17 ; CHECK: 'Cost Model Analysis' for function 'test2':
     18 ; SSE2: Found an estimated cost of 30 for instruction:   %div
     19 ; AVX2: Found an estimated cost of 15 for instruction:   %div
     20 }
     21 
     22 define <8 x i16> @test3(<8 x i16> %a) {
     23   %div = udiv <8 x i16> %a, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
     24   ret <8 x i16> %div
     25 
     26 ; CHECK: 'Cost Model Analysis' for function 'test3':
     27 ; SSE2: Found an estimated cost of 6 for instruction:   %div
     28 ; AVX2: Found an estimated cost of 6 for instruction:   %div
     29 }
     30 
     31 define <16 x i16> @test4(<16 x i16> %a) {
     32   %div = udiv <16 x i16> %a, <i16 7, i16 7, i16 7, i16 7,i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7,i16 7, i16 7, i16 7, i16 7>
     33   ret <16 x i16> %div
     34 
     35 ; CHECK: 'Cost Model Analysis' for function 'test4':
     36 ; SSE2: Found an estimated cost of 12 for instruction:   %div
     37 ; AVX2: Found an estimated cost of 6 for instruction:   %div
     38 }
     39 
     40 define <8 x i16> @test5(<8 x i16> %a) {
     41   %div = sdiv <8 x i16> %a, <i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7>
     42   ret <8 x i16> %div
     43 
     44 ; CHECK: 'Cost Model Analysis' for function 'test5':
     45 ; SSE2: Found an estimated cost of 6 for instruction:   %div
     46 ; AVX2: Found an estimated cost of 6 for instruction:   %div
     47 }
     48 
     49 define <16 x i16> @test6(<16 x i16> %a) {
     50   %div = sdiv <16 x i16> %a, <i16 7, i16 7, i16 7, i16 7,i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7, i16 7,i16 7, i16 7, i16 7, i16 7>
     51   ret <16 x i16> %div
     52 
     53 ; CHECK: 'Cost Model Analysis' for function 'test6':
     54 ; SSE2: Found an estimated cost of 12 for instruction:   %div
     55 ; AVX2: Found an estimated cost of 6 for instruction:   %div
     56 }
     57 
     58 define <16 x i8> @test7(<16 x i8> %a) {
     59   %div = sdiv <16 x i8> %a, <i8 7, i8 7, i8 7, i8 7,i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7,i8 7, i8 7, i8 7, i8 7>
     60   ret <16 x i8> %div
     61 
     62 ; CHECK: 'Cost Model Analysis' for function 'test7':
     63 ; SSE2: Found an estimated cost of 320 for instruction:   %div
     64 ; AVX2: Found an estimated cost of 320 for instruction:   %div
     65 }
     66 
     67 define <4 x i32> @test8(<4 x i32> %a) {
     68   %div = sdiv <4 x i32> %a, <i32 7, i32 7, i32 7, i32 7>
     69   ret <4 x i32> %div
     70 
     71 ; CHECK: 'Cost Model Analysis' for function 'test8':
     72 ; SSE2: Found an estimated cost of 19 for instruction:   %div
     73 ; AVX2: Found an estimated cost of 15 for instruction:   %div
     74 }
     75 
     76 define <8 x i32> @test9(<8 x i32> %a) {
     77   %div = sdiv <8 x i32> %a, <i32 7, i32 7, i32 7, i32 7,i32 7, i32 7, i32 7, i32 7>
     78   ret <8 x i32> %div
     79 
     80 ; CHECK: 'Cost Model Analysis' for function 'test9':
     81 ; SSE2: Found an estimated cost of 38 for instruction:   %div
     82 ; AVX2: Found an estimated cost of 15 for instruction:   %div
     83 }
     84 
     85 define <8 x i32> @test10(<8 x i32> %a) {
     86   %div = sdiv <8 x i32> %a, <i32 8, i32 7, i32 7, i32 7,i32 7, i32 7, i32 7, i32 7>
     87   ret <8 x i32> %div
     88 
     89 ; CHECK: 'Cost Model Analysis' for function 'test10':
     90 ; SSE2: Found an estimated cost of 160 for instruction:   %div
     91 ; AVX2: Found an estimated cost of 160 for instruction:   %div
     92 }
     93