AMDGPU: Add pass to detect used kernel features
[oota-llvm.git] / test / CodeGen / AMDGPU / schedule-if-2.ll
1 ;RUN: llc < %s -march=r600 -mcpu=cayman -stress-sched -verify-misched -verify-machineinstrs
2 ;REQUIRES: asserts
3
4 define void @main() {
5 main_body:
6   %0 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 2)
7   %1 = extractelement <4 x float> %0, i32 0
8   %2 = fadd float 1.000000e+03, %1
9   %3 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
10   %4 = extractelement <4 x float> %3, i32 0
11   %5 = bitcast float %4 to i32
12   %6 = icmp eq i32 %5, 0
13   %7 = sext i1 %6 to i32
14   %8 = bitcast i32 %7 to float
15   %9 = bitcast float %8 to i32
16   %10 = icmp ne i32 %9, 0
17   br i1 %10, label %IF, label %ELSE
18
19 IF:                                               ; preds = %main_body
20   %11 = call float @fabs(float %2)
21   %12 = fcmp ueq float %11, 0x7FF0000000000000
22   %13 = select i1 %12, float 1.000000e+00, float 0.000000e+00
23   %14 = fsub float -0.000000e+00, %13
24   %15 = fptosi float %14 to i32
25   %16 = bitcast i32 %15 to float
26   %17 = bitcast float %16 to i32
27   %18 = icmp ne i32 %17, 0
28   %. = select i1 %18, float 0x36A0000000000000, float 0.000000e+00
29   %19 = fcmp une float %2, %2
30   %20 = select i1 %19, float 1.000000e+00, float 0.000000e+00
31   %21 = fsub float -0.000000e+00, %20
32   %22 = fptosi float %21 to i32
33   %23 = bitcast i32 %22 to float
34   %24 = bitcast float %23 to i32
35   %25 = icmp ne i32 %24, 0
36   %temp8.0 = select i1 %25, float 0x36A0000000000000, float 0.000000e+00
37   %26 = bitcast float %. to i32
38   %27 = sitofp i32 %26 to float
39   %28 = bitcast float %temp8.0 to i32
40   %29 = sitofp i32 %28 to float
41   %30 = fcmp ugt float %2, 0.000000e+00
42   %31 = select i1 %30, float 1.000000e+00, float %2
43   %32 = fcmp uge float %31, 0.000000e+00
44   %33 = select i1 %32, float %31, float -1.000000e+00
45   %34 = fadd float %33, 1.000000e+00
46   %35 = fmul float %34, 5.000000e-01
47   br label %ENDIF
48
49 ELSE:                                             ; preds = %main_body
50   %36 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
51   %37 = extractelement <4 x float> %36, i32 0
52   %38 = bitcast float %37 to i32
53   %39 = icmp eq i32 %38, 1
54   %40 = sext i1 %39 to i32
55   %41 = bitcast i32 %40 to float
56   %42 = bitcast float %41 to i32
57   %43 = icmp ne i32 %42, 0
58   br i1 %43, label %IF23, label %ENDIF
59
60 ENDIF:                                            ; preds = %IF23, %ELSE, %IF
61   %temp4.0 = phi float [ %2, %IF ], [ %56, %IF23 ], [ 0.000000e+00, %ELSE ]
62   %temp5.0 = phi float [ %27, %IF ], [ %60, %IF23 ], [ 0.000000e+00, %ELSE ]
63   %temp6.0 = phi float [ %29, %IF ], [ 0.000000e+00, %ELSE ], [ 0.000000e+00, %IF23 ]
64   %temp7.0 = phi float [ %35, %IF ], [ 0.000000e+00, %ELSE ], [ 0.000000e+00, %IF23 ]
65   %44 = insertelement <4 x float> undef, float %temp4.0, i32 0
66   %45 = insertelement <4 x float> %44, float %temp5.0, i32 1
67   %46 = insertelement <4 x float> %45, float %temp6.0, i32 2
68   %47 = insertelement <4 x float> %46, float %temp7.0, i32 3
69   call void @llvm.R600.store.swizzle(<4 x float> %47, i32 0, i32 0)
70   ret void
71
72 IF23:                                             ; preds = %ELSE
73   %48 = fcmp ult float 0.000000e+00, %2
74   %49 = select i1 %48, float 1.000000e+00, float 0.000000e+00
75   %50 = fsub float -0.000000e+00, %49
76   %51 = fptosi float %50 to i32
77   %52 = bitcast i32 %51 to float
78   %53 = bitcast float %52 to i32
79   %54 = icmp ne i32 %53, 0
80   %.28 = select i1 %54, float 0x36A0000000000000, float 0.000000e+00
81   %55 = bitcast float %.28 to i32
82   %56 = sitofp i32 %55 to float
83   %57 = load <4 x float>, <4 x float> addrspace(8)* null
84   %58 = extractelement <4 x float> %57, i32 0
85   %59 = fsub float -0.000000e+00, %58
86   %60 = fadd float %2, %59
87   br label %ENDIF
88 }
89
90 declare float @fabs(float) #0
91
92 declare void @llvm.R600.store.swizzle(<4 x float>, i32, i32)
93
94 attributes #0 = { readonly }