R600/SI: Add patterns for 64-bit shift operations
[oota-llvm.git] / test / CodeGen / R600 / selectcc-opt.ll
1 ; RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck %s
2
3 ; CHECK: @test_a
4 ; CHECK-NOT: CND
5 ; CHECK: SET{{[NEQGTL]+}}_DX10
6
7 define void @test_a(i32 addrspace(1)* %out, float %in) {
8 entry:
9   %0 = fcmp ult float %in, 0.000000e+00
10   %1 = select i1 %0, float 1.000000e+00, float 0.000000e+00
11   %2 = fsub float -0.000000e+00, %1
12   %3 = fptosi float %2 to i32
13   %4 = bitcast i32 %3 to float
14   %5 = bitcast float %4 to i32
15   %6 = icmp ne i32 %5, 0
16   br i1 %6, label %IF, label %ENDIF
17
18 IF:
19   %7 = getelementptr i32 addrspace(1)* %out, i32 1
20   store i32 0, i32 addrspace(1)* %7
21   br label %ENDIF
22
23 ENDIF:
24   store i32 0, i32 addrspace(1)* %out
25   ret void
26 }
27
28 ; Same as test_a, but the branch labels are swapped to produce the inverse cc
29 ; for the icmp instruction
30
31 ; CHECK: @test_b
32 ; CHECK: VTX_READ
33 ; CHECK: SET{{[GTEQN]+}}_DX10
34 ; CHECK-NEXT: PRED_
35 ; CHECK-NEXT: ALU clause starting
36 define void @test_b(i32 addrspace(1)* %out, float %in) {
37 entry:
38   %0 = fcmp ult float %in, 0.0
39   %1 = select i1 %0, float 1.000000e+00, float 0.000000e+00
40   %2 = fsub float -0.000000e+00, %1
41   %3 = fptosi float %2 to i32
42   %4 = bitcast i32 %3 to float
43   %5 = bitcast float %4 to i32
44   %6 = icmp ne i32 %5, 0
45   br i1 %6, label %ENDIF, label %IF
46
47 IF:
48   %7 = getelementptr i32 addrspace(1)* %out, i32 1
49   store i32 0, i32 addrspace(1)* %7
50   br label %ENDIF
51
52 ENDIF:
53   store i32 0, i32 addrspace(1)* %out
54   ret void
55 }
56
57 ; Test a CND*_INT instruction with float true/false values
58 ; CHECK: @test_c
59 ; CHECK: CND{{[GTE]+}}_INT
60 define void @test_c(float addrspace(1)* %out, i32 %in) {
61 entry:
62   %0 = icmp sgt i32 %in, 0
63   %1 = select i1 %0, float 2.0, float 3.0
64   store float %1, float addrspace(1)* %out
65   ret void
66 }