Home | History | Annotate | Download | only in R600
      1 ; RUN: llc -march=amdgcn -mcpu=hawaii -verify-machineinstrs < %s | FileCheck -check-prefix=CI -check-prefix=COMMON %s
      2 ; RUN: llc -march=amdgcn -mcpu=tahiti -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=COMMON %s
      3 ; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=CI -check-prefix=COMMON %s
      4 
      5 
      6 ; COMMON-LABEL: {{^}}fdiv_f64:
      7 ; COMMON-DAG: buffer_load_dwordx2 [[NUM:v\[[0-9]+:[0-9]+\]]], {{s\[[0-9]+:[0-9]+\]}}, 0
      8 ; COMMON-DAG: buffer_load_dwordx2 [[DEN:v\[[0-9]+:[0-9]+\]]], {{s\[[0-9]+:[0-9]+\]}}, 0 offset:8
      9 ; CI-DAG: v_div_scale_f64 [[SCALE0:v\[[0-9]+:[0-9]+\]]], {{s\[[0-9]+:[0-9]+\]}}, [[DEN]], [[DEN]], [[NUM]]
     10 ; CI-DAG: v_div_scale_f64 [[SCALE1:v\[[0-9]+:[0-9]+\]]], vcc, [[NUM]], [[DEN]], [[NUM]]
     11 
     12 ; Check for div_scale bug workaround on SI
     13 ; SI-DAG: v_div_scale_f64 [[SCALE0:v\[[0-9]+:[0-9]+\]]], {{s\[[0-9]+:[0-9]+\]}}, [[DEN]], [[DEN]], [[NUM]]
     14 ; SI-DAG: v_div_scale_f64 [[SCALE1:v\[[0-9]+:[0-9]+\]]], {{s\[[0-9]+:[0-9]+\]}}, [[NUM]], [[DEN]], [[NUM]]
     15 
     16 ; COMMON-DAG: v_rcp_f64_e32 [[RCP_SCALE0:v\[[0-9]+:[0-9]+\]]], [[SCALE0]]
     17 
     18 ; SI-DAG: v_cmp_eq_i32_e32 vcc, {{v[0-9]+}}, {{v[0-9]+}}
     19 ; SI-DAG: v_cmp_eq_i32_e64 [[CMP0:s\[[0-9]+:[0-9]+\]]], {{v[0-9]+}}, {{v[0-9]+}}
     20 ; SI-DAG: s_xor_b64 vcc, [[CMP0]], vcc
     21 
     22 ; COMMON-DAG: v_fma_f64 [[FMA0:v\[[0-9]+:[0-9]+\]]], -[[SCALE0]], [[RCP_SCALE0]], 1.0
     23 ; COMMON-DAG: v_fma_f64 [[FMA1:v\[[0-9]+:[0-9]+\]]], [[RCP_SCALE0]], [[FMA0]], [[RCP_SCALE0]]
     24 ; COMMON-DAG: v_fma_f64 [[FMA2:v\[[0-9]+:[0-9]+\]]], -[[SCALE0]], [[FMA1]], 1.0
     25 ; COMMON-DAG: v_fma_f64 [[FMA3:v\[[0-9]+:[0-9]+\]]], [[FMA1]], [[FMA2]], [[FMA1]]
     26 ; COMMON-DAG: v_mul_f64 [[MUL:v\[[0-9]+:[0-9]+\]]], [[SCALE1]], [[FMA3]]
     27 ; COMMON-DAG: v_fma_f64 [[FMA4:v\[[0-9]+:[0-9]+\]]], -[[SCALE0]], [[MUL]], [[SCALE1]]
     28 ; COMMON: v_div_fmas_f64 [[FMAS:v\[[0-9]+:[0-9]+\]]], [[FMA4]], [[FMA3]], [[MUL]]
     29 ; COMMON: v_div_fixup_f64 [[RESULT:v\[[0-9]+:[0-9]+\]]], [[FMAS]], [[DEN]], [[NUM]]
     30 ; COMMON: buffer_store_dwordx2 [[RESULT]]
     31 ; COMMON: s_endpgm
     32 define void @fdiv_f64(double addrspace(1)* %out, double addrspace(1)* %in) nounwind {
     33   %gep.1 = getelementptr double, double addrspace(1)* %in, i32 1
     34   %num = load double, double addrspace(1)* %in
     35   %den = load double, double addrspace(1)* %gep.1
     36   %result = fdiv double %num, %den
     37   store double %result, double addrspace(1)* %out
     38   ret void
     39 }
     40 
     41 ; COMMON-LABEL: {{^}}fdiv_f64_s_v:
     42 define void @fdiv_f64_s_v(double addrspace(1)* %out, double addrspace(1)* %in, double %num) nounwind {
     43   %den = load double, double addrspace(1)* %in
     44   %result = fdiv double %num, %den
     45   store double %result, double addrspace(1)* %out
     46   ret void
     47 }
     48 
     49 ; COMMON-LABEL: {{^}}fdiv_f64_v_s:
     50 define void @fdiv_f64_v_s(double addrspace(1)* %out, double addrspace(1)* %in, double %den) nounwind {
     51   %num = load double, double addrspace(1)* %in
     52   %result = fdiv double %num, %den
     53   store double %result, double addrspace(1)* %out
     54   ret void
     55 }
     56 
     57 ; COMMON-LABEL: {{^}}fdiv_f64_s_s:
     58 define void @fdiv_f64_s_s(double addrspace(1)* %out, double %num, double %den) nounwind {
     59   %result = fdiv double %num, %den
     60   store double %result, double addrspace(1)* %out
     61   ret void
     62 }
     63 
     64 ; COMMON-LABEL: {{^}}v_fdiv_v2f64:
     65 define void @v_fdiv_v2f64(<2 x double> addrspace(1)* %out, <2 x double> addrspace(1)* %in) nounwind {
     66   %gep.1 = getelementptr <2 x double>, <2 x double> addrspace(1)* %in, i32 1
     67   %num = load <2 x double>, <2 x double> addrspace(1)* %in
     68   %den = load <2 x double>, <2 x double> addrspace(1)* %gep.1
     69   %result = fdiv <2 x double> %num, %den
     70   store <2 x double> %result, <2 x double> addrspace(1)* %out
     71   ret void
     72 }
     73 
     74 ; COMMON-LABEL: {{^}}s_fdiv_v2f64:
     75 define void @s_fdiv_v2f64(<2 x double> addrspace(1)* %out, <2 x double> %num, <2 x double> %den) {
     76   %result = fdiv <2 x double> %num, %den
     77   store <2 x double> %result, <2 x double> addrspace(1)* %out
     78   ret void
     79 }
     80 
     81 ; COMMON-LABEL: {{^}}v_fdiv_v4f64:
     82 define void @v_fdiv_v4f64(<4 x double> addrspace(1)* %out, <4 x double> addrspace(1)* %in) nounwind {
     83   %gep.1 = getelementptr <4 x double>, <4 x double> addrspace(1)* %in, i32 1
     84   %num = load <4 x double>, <4 x double> addrspace(1)* %in
     85   %den = load <4 x double>, <4 x double> addrspace(1)* %gep.1
     86   %result = fdiv <4 x double> %num, %den
     87   store <4 x double> %result, <4 x double> addrspace(1)* %out
     88   ret void
     89 }
     90 
     91 ; COMMON-LABEL: {{^}}s_fdiv_v4f64:
     92 define void @s_fdiv_v4f64(<4 x double> addrspace(1)* %out, <4 x double> %num, <4 x double> %den) {
     93   %result = fdiv <4 x double> %num, %den
     94   store <4 x double> %result, <4 x double> addrspace(1)* %out
     95   ret void
     96 }
     97