Home | History | Annotate | Download | only in AMDGPU
      1 ; RUN: opt -cost-model -analyze -mtriple=amdgcn-unknown-amdhsa -mcpu=hawaii -mattr=+half-rate-64-ops < %s | FileCheck -check-prefix=ALL -check-prefix=CIFASTF64 %s
      2 ; RUN: opt -cost-model -analyze -mtriple=amdgcn-unknown-amdhsa -mcpu=kaveri -mattr=-half-rate-64-ops < %s | FileCheck -check-prefix=ALL -check-prefix=CISLOWF64 %s
      3 ; RUN: opt -cost-model -analyze -mtriple=amdgcn-unknown-amdhsa -mcpu=tahiti -mattr=+half-rate-64-ops < %s | FileCheck -check-prefix=ALL -check-prefix=SIFASTF64 %s
      4 ; RUN: opt -cost-model -analyze -mtriple=amdgcn-unknown-amdhsa -mcpu=verde -mattr=-half-rate-64-ops < %s | FileCheck -check-prefix=ALL -check-prefix=SISLOWF64 %s
      5 
      6 ; CHECK: 'fdiv_f32'
      7 ; ALL: estimated cost of 10 for {{.*}} fdiv float
      8 define void @fdiv_f32(float addrspace(1)* %out, float addrspace(1)* %vaddr, float %b) #0 {
      9   %vec = load float, float addrspace(1)* %vaddr
     10   %add = fdiv float %vec, %b
     11   store float %add, float addrspace(1)* %out
     12   ret void
     13 }
     14 
     15 ; ALL: 'fdiv_v2f32'
     16 ; ALL: estimated cost of 20 for {{.*}} fdiv <2 x float>
     17 define void @fdiv_v2f32(<2 x float> addrspace(1)* %out, <2 x float> addrspace(1)* %vaddr, <2 x float> %b) #0 {
     18   %vec = load <2 x float>, <2 x float> addrspace(1)* %vaddr
     19   %add = fdiv <2 x float> %vec, %b
     20   store <2 x float> %add, <2 x float> addrspace(1)* %out
     21   ret void
     22 }
     23 
     24 ; ALL: 'fdiv_v3f32'
     25 ; ALL: estimated cost of 30 for {{.*}} fdiv <3 x float>
     26 define void @fdiv_v3f32(<3 x float> addrspace(1)* %out, <3 x float> addrspace(1)* %vaddr, <3 x float> %b) #0 {
     27   %vec = load <3 x float>, <3 x float> addrspace(1)* %vaddr
     28   %add = fdiv <3 x float> %vec, %b
     29   store <3 x float> %add, <3 x float> addrspace(1)* %out
     30   ret void
     31 }
     32 
     33 ; ALL: 'fdiv_f64'
     34 ; CIFASTF64: estimated cost of 29 for {{.*}} fdiv double
     35 ; CISLOWF64: estimated cost of 33 for {{.*}} fdiv double
     36 ; SIFASTF64: estimated cost of 32 for {{.*}} fdiv double
     37 ; SISLOWF64: estimated cost of 36 for {{.*}} fdiv double
     38 define void @fdiv_f64(double addrspace(1)* %out, double addrspace(1)* %vaddr, double %b) #0 {
     39   %vec = load double, double addrspace(1)* %vaddr
     40   %add = fdiv double %vec, %b
     41   store double %add, double addrspace(1)* %out
     42   ret void
     43 }
     44 
     45 ; ALL: 'fdiv_v2f64'
     46 ; CIFASTF64: estimated cost of 58 for {{.*}} fdiv <2 x double>
     47 ; CISLOWF64: estimated cost of 66 for {{.*}} fdiv <2 x double>
     48 ; SIFASTF64: estimated cost of 64 for {{.*}} fdiv <2 x double>
     49 ; SISLOWF64: estimated cost of 72 for {{.*}} fdiv <2 x double>
     50 define void @fdiv_v2f64(<2 x double> addrspace(1)* %out, <2 x double> addrspace(1)* %vaddr, <2 x double> %b) #0 {
     51   %vec = load <2 x double>, <2 x double> addrspace(1)* %vaddr
     52   %add = fdiv <2 x double> %vec, %b
     53   store <2 x double> %add, <2 x double> addrspace(1)* %out
     54   ret void
     55 }
     56 
     57 ; ALL: 'fdiv_v3f64'
     58 ; CIFASTF64: estimated cost of 87 for {{.*}} fdiv <3 x double>
     59 ; CISLOWF64: estimated cost of 99 for {{.*}} fdiv <3 x double>
     60 ; SIFASTF64: estimated cost of 96 for {{.*}} fdiv <3 x double>
     61 ; SISLOWF64: estimated cost of 108 for {{.*}} fdiv <3 x double>
     62 define void @fdiv_v3f64(<3 x double> addrspace(1)* %out, <3 x double> addrspace(1)* %vaddr, <3 x double> %b) #0 {
     63   %vec = load <3 x double>, <3 x double> addrspace(1)* %vaddr
     64   %add = fdiv <3 x double> %vec, %b
     65   store <3 x double> %add, <3 x double> addrspace(1)* %out
     66   ret void
     67 }
     68 
     69 ; ALL: 'fdiv_f16'
     70 ; ALL: estimated cost of 10 for {{.*}} fdiv half
     71 define void @fdiv_f16(half addrspace(1)* %out, half addrspace(1)* %vaddr, half %b) #0 {
     72   %vec = load half, half addrspace(1)* %vaddr
     73   %add = fdiv half %vec, %b
     74   store half %add, half addrspace(1)* %out
     75   ret void
     76 }
     77 
     78 ; ALL: 'fdiv_v2f16'
     79 ; ALL: estimated cost of 20 for {{.*}} fdiv <2 x half>
     80 define void @fdiv_v2f16(<2 x half> addrspace(1)* %out, <2 x half> addrspace(1)* %vaddr, <2 x half> %b) #0 {
     81   %vec = load <2 x half>, <2 x half> addrspace(1)* %vaddr
     82   %add = fdiv <2 x half> %vec, %b
     83   store <2 x half> %add, <2 x half> addrspace(1)* %out
     84   ret void
     85 }
     86 
     87 ; ALL: 'fdiv_v4f16'
     88 ; ALL: estimated cost of 40 for {{.*}} fdiv <4 x half>
     89 define void @fdiv_v4f16(<4 x half> addrspace(1)* %out, <4 x half> addrspace(1)* %vaddr, <4 x half> %b) #0 {
     90   %vec = load <4 x half>, <4 x half> addrspace(1)* %vaddr
     91   %add = fdiv <4 x half> %vec, %b
     92   store <4 x half> %add, <4 x half> addrspace(1)* %out
     93   ret void
     94 }
     95 
     96 attributes #0 = { nounwind }
     97