source: icGREP/icgrep-devel/llvm-3.5.0.src/test/CodeGen/R600/selectcc-opt.ll @ 4574

Last change on this file since 4574 was 4574, checked in by cameron, 4 years ago

Updating to LLVM 3.6

File size: 2.1 KB
Line 
1; RUN: llc -march=amdgcn -mcpu=SI < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
2; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
3
4
5; FUNC-LABEL: {{^}}test_a:
6; EG-NOT: CND
7; EG: SET{{[NEQGTL]+}}_DX10
8
9define void @test_a(i32 addrspace(1)* %out, float %in) {
10entry:
11  %0 = fcmp olt float %in, 0.000000e+00
12  %1 = select i1 %0, float 1.000000e+00, float 0.000000e+00
13  %2 = fsub float -0.000000e+00, %1
14  %3 = fptosi float %2 to i32
15  %4 = bitcast i32 %3 to float
16  %5 = bitcast float %4 to i32
17  %6 = icmp ne i32 %5, 0
18  br i1 %6, label %IF, label %ENDIF
19
20IF:
21  %7 = getelementptr i32 addrspace(1)* %out, i32 1
22  store i32 0, i32 addrspace(1)* %7
23  br label %ENDIF
24
25ENDIF:
26  store i32 0, i32 addrspace(1)* %out
27  ret void
28}
29
30; Same as test_a, but the branch labels are swapped to produce the inverse cc
31; for the icmp instruction
32
33; EG-LABEL: {{^}}test_b:
34; EG: SET{{[GTEQN]+}}_DX10
35; EG-NEXT: PRED_
36; EG-NEXT: ALU clause starting
37define void @test_b(i32 addrspace(1)* %out, float %in) {
38entry:
39  %0 = fcmp olt float %in, 0.0
40  %1 = select i1 %0, float 1.000000e+00, float 0.000000e+00
41  %2 = fsub float -0.000000e+00, %1
42  %3 = fptosi float %2 to i32
43  %4 = bitcast i32 %3 to float
44  %5 = bitcast float %4 to i32
45  %6 = icmp ne i32 %5, 0
46  br i1 %6, label %ENDIF, label %IF
47
48IF:
49  %7 = getelementptr i32 addrspace(1)* %out, i32 1
50  store i32 0, i32 addrspace(1)* %7
51  br label %ENDIF
52
53ENDIF:
54  store i32 0, i32 addrspace(1)* %out
55  ret void
56}
57
58; Test a CND*_INT instruction with float true/false values
59; EG-LABEL: {{^}}test_c:
60; EG: CND{{[GTE]+}}_INT
61define void @test_c(float addrspace(1)* %out, i32 %in) {
62entry:
63  %0 = icmp sgt i32 %in, 0
64  %1 = select i1 %0, float 2.0, float 3.0
65  store float %1, float addrspace(1)* %out
66  ret void
67}
68
69; FUNC-LABEL: {{^}}selectcc_bool:
70; SI: v_cmp_ne_i32
71; SI-NEXT: v_cndmask_b32_e64
72; SI-NOT: cmp
73; SI-NOT: cndmask
74define void @selectcc_bool(i32 addrspace(1)* %out, i32 %a, i32 %b) nounwind {
75  %icmp0 = icmp ne i32 %a, %b
76  %ext = select i1 %icmp0, i32 -1, i32 0
77  store i32 %ext, i32 addrspace(1)* %out
78  ret void
79}
Note: See TracBrowser for help on using the repository browser.