R600/SI: Update concat_vectors.ll to check for scratch usage
[oota-llvm.git] / test / CodeGen / R600 / fdiv.ll
1 ; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=R600 %s
2 ; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=SI %s
3
4 ; These tests check that fdiv is expanded correctly and also test that the
5 ; scheduler is scheduling the RECIP_IEEE and MUL_IEEE instructions in separate
6 ; instruction groups.
7
8 ; FUNC-LABEL: @fdiv_f32
9 ; R600-DAG: RECIP_IEEE * T{{[0-9]+\.[XYZW]}}, KC0[3].Z
10 ; R600-DAG: RECIP_IEEE * T{{[0-9]+\.[XYZW]}}, KC0[3].Y
11 ; R600-DAG: MUL_IEEE {{\** *}}T{{[0-9]+\.[XYZW]}}, KC0[3].X, PS
12 ; R600-DAG: MUL_IEEE {{\** *}}T{{[0-9]+\.[XYZW]}}, KC0[2].W, PS
13
14 ; SI-DAG: V_RCP_F32
15 ; SI-DAG: V_MUL_F32
16 define void @fdiv_f32(float addrspace(1)* %out, float %a, float %b) {
17 entry:
18   %0 = fdiv float %a, %b
19   store float %0, float addrspace(1)* %out
20   ret void
21 }
22
23
24
25 ; FUNC-LABEL: @fdiv_v2f32
26 ; R600-DAG: RECIP_IEEE * T{{[0-9]+\.[XYZW]}}, KC0[3].Z
27 ; R600-DAG: RECIP_IEEE * T{{[0-9]+\.[XYZW]}}, KC0[3].Y
28 ; R600-DAG: MUL_IEEE {{\** *}}T{{[0-9]+\.[XYZW]}}, KC0[3].X, PS
29 ; R600-DAG: MUL_IEEE {{\** *}}T{{[0-9]+\.[XYZW]}}, KC0[2].W, PS
30
31 ; SI-DAG: V_RCP_F32
32 ; SI-DAG: V_MUL_F32
33 ; SI-DAG: V_RCP_F32
34 ; SI-DAG: V_MUL_F32
35 define void @fdiv_v2f32(<2 x float> addrspace(1)* %out, <2 x float> %a, <2 x float> %b) {
36 entry:
37   %0 = fdiv <2 x float> %a, %b
38   store <2 x float> %0, <2 x float> addrspace(1)* %out
39   ret void
40 }
41
42 ; FUNC-LABEL: @fdiv_v4f32
43 ; R600-DAG: RECIP_IEEE * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
44 ; R600-DAG: RECIP_IEEE * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
45 ; R600-DAG: RECIP_IEEE * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
46 ; R600-DAG: RECIP_IEEE * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
47 ; R600-DAG: MUL_IEEE {{\** *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}, PS
48 ; R600-DAG: MUL_IEEE {{\** *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}, PS
49 ; R600-DAG: MUL_IEEE {{\** *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}, PS
50 ; R600-DAG: MUL_IEEE {{\** *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}, PS
51
52 ; SI-DAG: V_RCP_F32
53 ; SI-DAG: V_MUL_F32
54 ; SI-DAG: V_RCP_F32
55 ; SI-DAG: V_MUL_F32
56 ; SI-DAG: V_RCP_F32
57 ; SI-DAG: V_MUL_F32
58 ; SI-DAG: V_RCP_F32
59 ; SI-DAG: V_MUL_F32
60 define void @fdiv_v4f32(<4 x float> addrspace(1)* %out, <4 x float> addrspace(1)* %in) {
61   %b_ptr = getelementptr <4 x float> addrspace(1)* %in, i32 1
62   %a = load <4 x float> addrspace(1) * %in
63   %b = load <4 x float> addrspace(1) * %b_ptr
64   %result = fdiv <4 x float> %a, %b
65   store <4 x float> %result, <4 x float> addrspace(1)* %out
66   ret void
67 }