R600: Fix FROUND
[oota-llvm.git] / test / CodeGen / R600 / llvm.round.ll
1 ; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck %s --check-prefix=R600 --check-prefix=FUNC
2
3 ; FUNC-LABEL: @f32
4 ; R600: FRACT {{.*}}, [[ARG:KC[0-9]\[[0-9]+\]\.[XYZW]]]
5 ; R600-DAG: ADD  {{.*}}, -0.5
6 ; R600-DAG: CEIL {{.*}} [[ARG]]
7 ; R600-DAG: FLOOR {{.*}} [[ARG]]
8 ; R600-DAG: CNDGE
9 ; R600-DAG: CNDGT
10 ; R600: CNDGE {{[^,]+}}, [[ARG]]
11 define void @f32(float addrspace(1)* %out, float %in) {
12 entry:
13   %0 = call float @llvm.round.f32(float %in)
14   store float %0, float addrspace(1)* %out
15   ret void
16 }
17
18 ; The vector tests are really difficult to verify, since it can be hard to
19 ; predict how the scheduler will order the instructions.  We already have
20 ; a test for the scalar case, so the vector tests just check that the
21 ; compiler doesn't crash.
22
23 ; FUNC-LABEL: v2f32
24 ; R600: CF_END
25 define void @v2f32(<2 x float> addrspace(1)* %out, <2 x float> %in) {
26 entry:
27   %0 = call <2 x float> @llvm.round.v2f32(<2 x float> %in)
28   store <2 x float> %0, <2 x float> addrspace(1)* %out
29   ret void
30 }
31
32 ; FUNC-LABEL: v4f32
33 ; R600: CF_END
34 define void @v4f32(<4 x float> addrspace(1)* %out, <4 x float> %in) {
35 entry:
36   %0 = call <4 x float> @llvm.round.v4f32(<4 x float> %in)
37   store <4 x float> %0, <4 x float> addrspace(1)* %out
38   ret void
39 }
40
41 declare float @llvm.round.f32(float)
42 declare <2 x float> @llvm.round.v2f32(<2 x float>)
43 declare <4 x float> @llvm.round.v4f32(<4 x float>)