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