1;RUN: llc < %s -march=r600 -mcpu=redwood
2
3define void @main(<4 x float> inreg %reg0, <4 x float> inreg %reg1) #0 {
4main_body:
5  %0 = extractelement <4 x float> %reg1, i32 0
6  %1 = extractelement <4 x float> %reg1, i32 1
7  %2 = extractelement <4 x float> %reg1, i32 2
8  %3 = extractelement <4 x float> %reg1, i32 3
9  %4 = bitcast float %0 to i32
10  %5 = icmp eq i32 %4, 0
11  %6 = sext i1 %5 to i32
12  %7 = bitcast i32 %6 to float
13  %8 = bitcast float %7 to i32
14  %9 = icmp ne i32 %8, 0
15  %. = select i1 %9, float 0x36A0000000000000, float %0
16  br label %LOOP
17
18LOOP:                                             ; preds = %LOOP47, %main_body
19  %temp12.0 = phi float [ 0x36A0000000000000, %main_body ], [ %temp12.1, %LOOP47 ]
20  %temp8.0 = phi float [ 0.000000e+00, %main_body ], [ %38, %LOOP47 ]
21  %temp4.1 = phi float [ %., %main_body ], [ %52, %LOOP47 ]
22  %10 = bitcast float %temp4.1 to i32
23  %11 = icmp eq i32 %10, 1
24  %12 = sext i1 %11 to i32
25  %13 = bitcast i32 %12 to float
26  %14 = bitcast float %13 to i32
27  %15 = icmp ne i32 %14, 0
28  br i1 %15, label %IF41, label %ENDIF40
29
30IF41:                                             ; preds = %LOOP
31  %16 = insertelement <4 x float> undef, float %0, i32 0
32  %17 = insertelement <4 x float> %16, float %temp8.0, i32 1
33  %18 = insertelement <4 x float> %17, float %temp12.0, i32 2
34  %19 = insertelement <4 x float> %18, float 0.000000e+00, i32 3
35  call void @llvm.R600.store.stream.output(<4 x float> %19, i32 0, i32 0, i32 1)
36  %20 = insertelement <4 x float> undef, float %0, i32 0
37  %21 = insertelement <4 x float> %20, float %temp8.0, i32 1
38  %22 = insertelement <4 x float> %21, float %temp12.0, i32 2
39  %23 = insertelement <4 x float> %22, float 0.000000e+00, i32 3
40  call void @llvm.R600.store.stream.output(<4 x float> %23, i32 0, i32 0, i32 2)
41  %24 = insertelement <4 x float> undef, float %0, i32 0
42  %25 = insertelement <4 x float> %24, float %temp8.0, i32 1
43  %26 = insertelement <4 x float> %25, float %temp12.0, i32 2
44  %27 = insertelement <4 x float> %26, float 0.000000e+00, i32 3
45  call void @llvm.R600.store.stream.output(<4 x float> %27, i32 0, i32 0, i32 4)
46  %28 = insertelement <4 x float> undef, float 0.000000e+00, i32 0
47  %29 = insertelement <4 x float> %28, float 0.000000e+00, i32 1
48  %30 = insertelement <4 x float> %29, float 0.000000e+00, i32 2
49  %31 = insertelement <4 x float> %30, float 0.000000e+00, i32 3
50  call void @llvm.R600.store.swizzle(<4 x float> %31, i32 60, i32 1)
51  %32 = insertelement <4 x float> undef, float %0, i32 0
52  %33 = insertelement <4 x float> %32, float %temp8.0, i32 1
53  %34 = insertelement <4 x float> %33, float %temp12.0, i32 2
54  %35 = insertelement <4 x float> %34, float 0.000000e+00, i32 3
55  call void @llvm.R600.store.swizzle(<4 x float> %35, i32 0, i32 2)
56  ret void
57
58ENDIF40:                                          ; preds = %LOOP
59  %36 = bitcast float %temp8.0 to i32
60  %37 = add i32 %36, 1
61  %38 = bitcast i32 %37 to float
62  %39 = bitcast float %temp4.1 to i32
63  %40 = urem i32 %39, 2
64  %41 = bitcast i32 %40 to float
65  %42 = bitcast float %41 to i32
66  %43 = icmp eq i32 %42, 0
67  %44 = sext i1 %43 to i32
68  %45 = bitcast i32 %44 to float
69  %46 = bitcast float %45 to i32
70  %47 = icmp ne i32 %46, 0
71  %48 = bitcast float %temp4.1 to i32
72  br i1 %47, label %IF44, label %ELSE45
73
74IF44:                                             ; preds = %ENDIF40
75  %49 = udiv i32 %48, 2
76  br label %ENDIF43
77
78ELSE45:                                           ; preds = %ENDIF40
79  %50 = mul i32 3, %48
80  %51 = add i32 %50, 1
81  br label %ENDIF43
82
83ENDIF43:                                          ; preds = %ELSE45, %IF44
84  %.sink = phi i32 [ %49, %IF44 ], [ %51, %ELSE45 ]
85  %52 = bitcast i32 %.sink to float
86  %53 = load <4 x float> addrspace(8)* null
87  %54 = extractelement <4 x float> %53, i32 0
88  %55 = bitcast float %54 to i32
89  br label %LOOP47
90
91LOOP47:                                           ; preds = %ENDIF48, %ENDIF43
92  %temp12.1 = phi float [ %temp12.0, %ENDIF43 ], [ %67, %ENDIF48 ]
93  %temp28.0 = phi float [ 0.000000e+00, %ENDIF43 ], [ %70, %ENDIF48 ]
94  %56 = bitcast float %temp28.0 to i32
95  %57 = icmp uge i32 %56, %55
96  %58 = sext i1 %57 to i32
97  %59 = bitcast i32 %58 to float
98  %60 = bitcast float %59 to i32
99  %61 = icmp ne i32 %60, 0
100  br i1 %61, label %LOOP, label %ENDIF48
101
102ENDIF48:                                          ; preds = %LOOP47
103  %62 = bitcast float %temp12.1 to i32
104  %63 = mul i32 %62, 2
105  %64 = bitcast i32 %63 to float
106  %65 = bitcast float %64 to i32
107  %66 = urem i32 %65, 2147483647
108  %67 = bitcast i32 %66 to float
109  %68 = bitcast float %temp28.0 to i32
110  %69 = add i32 %68, 1
111  %70 = bitcast i32 %69 to float
112  br label %LOOP47
113}
114
115declare void @llvm.R600.store.stream.output(<4 x float>, i32, i32, i32)
116
117declare void @llvm.R600.store.swizzle(<4 x float>, i32, i32)
118
119attributes #0 = { "ShaderType"="1" }
120