d337bb5495aff4c6d87cc3eda3d8db37b3b2d652
[oota-llvm.git] / test / CodeGen / R600 / llvm.sqrt.ll
1 ; RUN: llc < %s -march=r600 --mcpu=redwood | FileCheck %s --check-prefix=R600-CHECK
2 ; RUN: llc < %s -march=amdgcn --mcpu=SI -verify-machineinstrs| FileCheck %s --check-prefix=SI-CHECK
3 ; RUN: llc < %s -march=amdgcn --mcpu=tonga -verify-machineinstrs| FileCheck %s --check-prefix=SI-CHECK
4
5 ; R600-CHECK-LABEL: {{^}}sqrt_f32:
6 ; R600-CHECK: RECIPSQRT_CLAMPED * T{{[0-9]\.[XYZW]}}, KC0[2].Z
7 ; R600-CHECK: MUL NON-IEEE T{{[0-9]\.[XYZW]}}, KC0[2].Z, PS
8 ; SI-CHECK-LABEL: {{^}}sqrt_f32:
9 ; SI-CHECK: v_sqrt_f32_e32
10 define void @sqrt_f32(float addrspace(1)* %out, float %in) {
11 entry:
12   %0 = call float @llvm.sqrt.f32(float %in)
13   store float %0, float addrspace(1)* %out
14   ret void
15 }
16
17 ; R600-CHECK-LABEL: {{^}}sqrt_v2f32:
18 ; R600-CHECK-DAG: RECIPSQRT_CLAMPED * T{{[0-9]\.[XYZW]}}, KC0[2].W
19 ; R600-CHECK-DAG: MUL NON-IEEE T{{[0-9]\.[XYZW]}}, KC0[2].W, PS
20 ; R600-CHECK-DAG: RECIPSQRT_CLAMPED * T{{[0-9]\.[XYZW]}}, KC0[3].X
21 ; R600-CHECK-DAG: MUL NON-IEEE T{{[0-9]\.[XYZW]}}, KC0[3].X, PS
22 ; SI-CHECK-LABEL: {{^}}sqrt_v2f32:
23 ; SI-CHECK: v_sqrt_f32_e32
24 ; SI-CHECK: v_sqrt_f32_e32
25 define void @sqrt_v2f32(<2 x float> addrspace(1)* %out, <2 x float> %in) {
26 entry:
27   %0 = call <2 x float> @llvm.sqrt.v2f32(<2 x float> %in)
28   store <2 x float> %0, <2 x float> addrspace(1)* %out
29   ret void
30 }
31
32 ; R600-CHECK-LABEL: {{^}}sqrt_v4f32:
33 ; R600-CHECK-DAG: RECIPSQRT_CLAMPED * T{{[0-9]\.[XYZW]}}, KC0[3].Y
34 ; R600-CHECK-DAG: MUL NON-IEEE T{{[0-9]\.[XYZW]}}, KC0[3].Y, PS
35 ; R600-CHECK-DAG: RECIPSQRT_CLAMPED * T{{[0-9]\.[XYZW]}}, KC0[3].Z
36 ; R600-CHECK-DAG: MUL NON-IEEE T{{[0-9]\.[XYZW]}}, KC0[3].Z, PS
37 ; R600-CHECK-DAG: RECIPSQRT_CLAMPED * T{{[0-9]\.[XYZW]}}, KC0[3].W
38 ; R600-CHECK-DAG: MUL NON-IEEE T{{[0-9]\.[XYZW]}}, KC0[3].W, PS
39 ; R600-CHECK-DAG: RECIPSQRT_CLAMPED * T{{[0-9]\.[XYZW]}}, KC0[4].X
40 ; R600-CHECK-DAG: MUL NON-IEEE T{{[0-9]\.[XYZW]}}, KC0[4].X, PS
41 ; SI-CHECK-LABEL: {{^}}sqrt_v4f32:
42 ; SI-CHECK: v_sqrt_f32_e32
43 ; SI-CHECK: v_sqrt_f32_e32
44 ; SI-CHECK: v_sqrt_f32_e32
45 ; SI-CHECK: v_sqrt_f32_e32
46 define void @sqrt_v4f32(<4 x float> addrspace(1)* %out, <4 x float> %in) {
47 entry:
48   %0 = call <4 x float> @llvm.sqrt.v4f32(<4 x float> %in)
49   store <4 x float> %0, <4 x float> addrspace(1)* %out
50   ret void
51 }
52
53 declare float @llvm.sqrt.f32(float %in)
54 declare <2 x float> @llvm.sqrt.v2f32(<2 x float> %in)
55 declare <4 x float> @llvm.sqrt.v4f32(<4 x float> %in)