Taints the non-acquire RMW's store address with the load part
[oota-llvm.git] / test / CodeGen / NVPTX / reg-copy.ll
1 ; RUN: llc < %s -march=nvptx64 -mcpu=sm_35 | FileCheck %s
2
3 target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64"
4 target triple = "nvptx64-unknown-unknown"
5
6 define void @PR24303(float* %f) {
7 ; CHECK-LABEL: .visible .entry PR24303(
8 ; Do not use mov.f or mov.u to convert between float and int.
9 ; CHECK-NOT: mov.{{f|u}}{{32|64}} %f{{[0-9]+}}, %r{{[0-9]+}}
10 ; CHECK-NOT: mov.{{f|u}}{{32|64}} %r{{[0-9]+}}, %f{{[0-9]+}}
11 entry:
12   %arrayidx1 = getelementptr inbounds float, float* %f, i64 1
13   %0 = load float, float* %f, align 4
14   %1 = load float, float* %arrayidx1, align 4
15   %arrayidx2 = getelementptr inbounds float, float* %f, i64 2
16   %arrayidx3 = getelementptr inbounds float, float* %f, i64 3
17   %2 = load float, float* %arrayidx2, align 4
18   %3 = load float, float* %arrayidx3, align 4
19   %mul.i = fmul float %0, %2
20   %mul4.i = fmul float %1, %3
21   %mul5.i = fmul float %0, %3
22   %mul6.i = fmul float %1, %2
23   %sub.i = fsub float %mul.i, %mul4.i
24   %4 = bitcast float %sub.i to i32
25   %add.i = fadd float %mul6.i, %mul5.i
26   %5 = bitcast float %add.i to i32
27   %6 = tail call float @llvm.nvvm.fabs.f(float %sub.i) #2
28   %7 = fcmp ugt float %6, 0x7FF0000000000000
29   br i1 %7, label %land.lhs.true.i, label %_ZN12cuda_builtinmlIfEENS_7complexIT_EERKS3_S5_.exit
30
31 land.lhs.true.i:                                  ; preds = %entry
32   %8 = tail call float @llvm.nvvm.fabs.f(float %add.i) #2
33   %9 = fcmp ugt float %8, 0x7FF0000000000000
34   br i1 %9, label %if.then.i, label %_ZN12cuda_builtinmlIfEENS_7complexIT_EERKS3_S5_.exit
35
36 if.then.i:                                        ; preds = %land.lhs.true.i
37   %10 = tail call float @llvm.nvvm.fabs.f(float %0) #2
38   %11 = fcmp oeq float %10, 0x7FF0000000000000
39   %.pre.i = tail call float @llvm.nvvm.fabs.f(float %1) #2
40   %12 = fcmp oeq float %.pre.i, 0x7FF0000000000000
41   %or.cond.i = or i1 %11, %12
42   br i1 %or.cond.i, label %if.then.14.i, label %if.end.31.i
43
44 if.then.14.i:                                     ; preds = %if.then.i
45   %13 = bitcast float %0 to i32
46   %14 = and i32 %13, -2147483648
47   %15 = select i1 %11, i32 1065353216, i32 0
48   %16 = or i32 %15, %14
49   %17 = bitcast i32 %16 to float
50   %18 = bitcast float %1 to i32
51   %19 = and i32 %18, -2147483648
52   %20 = select i1 %12, i32 1065353216, i32 0
53   %21 = or i32 %20, %19
54   %22 = bitcast i32 %21 to float
55   %23 = tail call float @llvm.nvvm.fabs.f(float %2) #2
56   %24 = fcmp ugt float %23, 0x7FF0000000000000
57   br i1 %24, label %if.then.24.i, label %if.end.i
58
59 if.then.24.i:                                     ; preds = %if.then.14.i
60   %25 = bitcast float %2 to i32
61   %26 = and i32 %25, -2147483648
62   %27 = bitcast i32 %26 to float
63   br label %if.end.i
64
65 if.end.i:                                         ; preds = %if.then.24.i, %if.then.14.i
66   %__c.0.i = phi float [ %27, %if.then.24.i ], [ %2, %if.then.14.i ]
67   %28 = tail call float @llvm.nvvm.fabs.f(float %3) #2
68   %29 = fcmp ugt float %28, 0x7FF0000000000000
69   br i1 %29, label %if.then.28.i, label %if.end.31.i
70
71 if.then.28.i:                                     ; preds = %if.end.i
72   %30 = bitcast float %3 to i32
73   %31 = and i32 %30, -2147483648
74   %32 = bitcast i32 %31 to float
75   br label %if.end.31.i
76
77 if.end.31.i:                                      ; preds = %if.then.28.i, %if.end.i, %if.then.i
78   %__d.1.i = phi float [ %32, %if.then.28.i ], [ %3, %if.end.i ], [ %3, %if.then.i ]
79   %__c.1.i = phi float [ %__c.0.i, %if.then.28.i ], [ %__c.0.i, %if.end.i ], [ %2, %if.then.i ]
80   %__b.0.i = phi float [ %22, %if.then.28.i ], [ %22, %if.end.i ], [ %1, %if.then.i ]
81   %__a.0.i = phi float [ %17, %if.then.28.i ], [ %17, %if.end.i ], [ %0, %if.then.i ]
82   %__recalc.0.off0.i = phi i1 [ true, %if.then.28.i ], [ true, %if.end.i ], [ false, %if.then.i ]
83   %33 = tail call float @llvm.nvvm.fabs.f(float %__c.1.i) #2
84   %34 = fcmp oeq float %33, 0x7FF0000000000000
85   %.pre6.i = tail call float @llvm.nvvm.fabs.f(float %__d.1.i) #2
86   %35 = fcmp oeq float %.pre6.i, 0x7FF0000000000000
87   %or.cond8.i = or i1 %34, %35
88   br i1 %or.cond8.i, label %if.then.37.i, label %if.end.56.i
89
90 if.then.37.i:                                     ; preds = %if.end.31.i
91   %36 = bitcast float %__c.1.i to i32
92   %37 = and i32 %36, -2147483648
93   %38 = select i1 %34, i32 1065353216, i32 0
94   %39 = or i32 %38, %37
95   %40 = bitcast i32 %39 to float
96   %41 = bitcast float %__d.1.i to i32
97   %42 = and i32 %41, -2147483648
98   %43 = select i1 %35, i32 1065353216, i32 0
99   %44 = or i32 %43, %42
100   %45 = bitcast i32 %44 to float
101   %46 = tail call float @llvm.nvvm.fabs.f(float %__a.0.i) #2
102   %47 = fcmp ugt float %46, 0x7FF0000000000000
103   br i1 %47, label %if.then.48.i, label %if.end.50.i
104
105 if.then.48.i:                                     ; preds = %if.then.37.i
106   %48 = bitcast float %__a.0.i to i32
107   %49 = and i32 %48, -2147483648
108   %50 = bitcast i32 %49 to float
109   br label %if.end.50.i
110
111 if.end.50.i:                                      ; preds = %if.then.48.i, %if.then.37.i
112   %__a.1.i = phi float [ %50, %if.then.48.i ], [ %__a.0.i, %if.then.37.i ]
113   %51 = tail call float @llvm.nvvm.fabs.f(float %__b.0.i) #2
114   %52 = fcmp ugt float %51, 0x7FF0000000000000
115   br i1 %52, label %if.then.53.i, label %if.then.93.i
116
117 if.then.53.i:                                     ; preds = %if.end.50.i
118   %53 = bitcast float %__b.0.i to i32
119   %54 = and i32 %53, -2147483648
120   %55 = bitcast i32 %54 to float
121   br label %if.then.93.i
122
123 if.end.56.i:                                      ; preds = %if.end.31.i
124   br i1 %__recalc.0.off0.i, label %if.then.93.i, label %land.lhs.true.58.i
125
126 land.lhs.true.58.i:                               ; preds = %if.end.56.i
127   %56 = tail call float @llvm.nvvm.fabs.f(float %mul.i) #2
128   %57 = fcmp oeq float %56, 0x7FF0000000000000
129   br i1 %57, label %if.then.70.i, label %lor.lhs.false.61.i
130
131 lor.lhs.false.61.i:                               ; preds = %land.lhs.true.58.i
132   %58 = tail call float @llvm.nvvm.fabs.f(float %mul4.i) #2
133   %59 = fcmp oeq float %58, 0x7FF0000000000000
134   br i1 %59, label %if.then.70.i, label %lor.lhs.false.64.i
135
136 lor.lhs.false.64.i:                               ; preds = %lor.lhs.false.61.i
137   %60 = tail call float @llvm.nvvm.fabs.f(float %mul5.i) #2
138   %61 = fcmp oeq float %60, 0x7FF0000000000000
139   br i1 %61, label %if.then.70.i, label %lor.lhs.false.67.i
140
141 lor.lhs.false.67.i:                               ; preds = %lor.lhs.false.64.i
142   %62 = tail call float @llvm.nvvm.fabs.f(float %mul6.i) #2
143   %63 = fcmp oeq float %62, 0x7FF0000000000000
144   br i1 %63, label %if.then.70.i, label %_ZN12cuda_builtinmlIfEENS_7complexIT_EERKS3_S5_.exit
145
146 if.then.70.i:                                     ; preds = %lor.lhs.false.67.i, %lor.lhs.false.64.i, %lor.lhs.false.61.i, %land.lhs.true.58.i
147   %64 = tail call float @llvm.nvvm.fabs.f(float %__a.0.i) #2
148   %65 = fcmp ugt float %64, 0x7FF0000000000000
149   br i1 %65, label %if.then.73.i, label %if.end.75.i
150
151 if.then.73.i:                                     ; preds = %if.then.70.i
152   %66 = bitcast float %__a.0.i to i32
153   %67 = and i32 %66, -2147483648
154   %68 = bitcast i32 %67 to float
155   br label %if.end.75.i
156
157 if.end.75.i:                                      ; preds = %if.then.73.i, %if.then.70.i
158   %__a.3.i = phi float [ %68, %if.then.73.i ], [ %__a.0.i, %if.then.70.i ]
159   %69 = tail call float @llvm.nvvm.fabs.f(float %__b.0.i) #2
160   %70 = fcmp ugt float %69, 0x7FF0000000000000
161   br i1 %70, label %if.then.78.i, label %if.end.80.i
162
163 if.then.78.i:                                     ; preds = %if.end.75.i
164   %71 = bitcast float %__b.0.i to i32
165   %72 = and i32 %71, -2147483648
166   %73 = bitcast i32 %72 to float
167   br label %if.end.80.i
168
169 if.end.80.i:                                      ; preds = %if.then.78.i, %if.end.75.i
170   %__b.3.i = phi float [ %73, %if.then.78.i ], [ %__b.0.i, %if.end.75.i ]
171   %74 = fcmp ugt float %33, 0x7FF0000000000000
172   br i1 %74, label %if.then.83.i, label %if.end.85.i
173
174 if.then.83.i:                                     ; preds = %if.end.80.i
175   %75 = bitcast float %__c.1.i to i32
176   %76 = and i32 %75, -2147483648
177   %77 = bitcast i32 %76 to float
178   br label %if.end.85.i
179
180 if.end.85.i:                                      ; preds = %if.then.83.i, %if.end.80.i
181   %__c.3.i = phi float [ %77, %if.then.83.i ], [ %__c.1.i, %if.end.80.i ]
182   %78 = fcmp ugt float %.pre6.i, 0x7FF0000000000000
183   br i1 %78, label %if.then.88.i, label %if.then.93.i
184
185 if.then.88.i:                                     ; preds = %if.end.85.i
186   %79 = bitcast float %__d.1.i to i32
187   %80 = and i32 %79, -2147483648
188   %81 = bitcast i32 %80 to float
189   br label %if.then.93.i
190
191 if.then.93.i:                                     ; preds = %if.then.88.i, %if.end.85.i, %if.end.56.i, %if.then.53.i, %if.end.50.i
192   %__d.4.ph.i = phi float [ %__d.1.i, %if.end.85.i ], [ %81, %if.then.88.i ], [ %__d.1.i, %if.end.56.i ], [ %45, %if.end.50.i ], [ %45, %if.then.53.i ]
193   %__c.4.ph.i = phi float [ %__c.3.i, %if.end.85.i ], [ %__c.3.i, %if.then.88.i ], [ %__c.1.i, %if.end.56.i ], [ %40, %if.end.50.i ], [ %40, %if.then.53.i ]
194   %__b.4.ph.i = phi float [ %__b.3.i, %if.end.85.i ], [ %__b.3.i, %if.then.88.i ], [ %__b.0.i, %if.end.56.i ], [ %__b.0.i, %if.end.50.i ], [ %55, %if.then.53.i ]
195   %__a.4.ph.i = phi float [ %__a.3.i, %if.end.85.i ], [ %__a.3.i, %if.then.88.i ], [ %__a.0.i, %if.end.56.i ], [ %__a.1.i, %if.end.50.i ], [ %__a.1.i, %if.then.53.i ]
196   %mul95.i = fmul float %__c.4.ph.i, %__a.4.ph.i
197   %mul96.i = fmul float %__d.4.ph.i, %__b.4.ph.i
198   %sub97.i = fsub float %mul95.i, %mul96.i
199   %mul98.i = fmul float %sub97.i, 0x7FF0000000000000
200   %82 = bitcast float %mul98.i to i32
201   %mul100.i = fmul float %__d.4.ph.i, %__a.4.ph.i
202   %mul101.i = fmul float %__c.4.ph.i, %__b.4.ph.i
203   %add102.i = fadd float %mul101.i, %mul100.i
204   %mul103.i = fmul float %add102.i, 0x7FF0000000000000
205   %83 = bitcast float %mul103.i to i32
206   br label %_ZN12cuda_builtinmlIfEENS_7complexIT_EERKS3_S5_.exit
207
208 _ZN12cuda_builtinmlIfEENS_7complexIT_EERKS3_S5_.exit: ; preds = %if.then.93.i, %lor.lhs.false.67.i, %land.lhs.true.i, %entry
209   %84 = phi i32 [ %4, %land.lhs.true.i ], [ %4, %entry ], [ %82, %if.then.93.i ], [ %4, %lor.lhs.false.67.i ]
210   %85 = phi i32 [ %5, %land.lhs.true.i ], [ %5, %entry ], [ %83, %if.then.93.i ], [ %5, %lor.lhs.false.67.i ]
211   %arrayidx5 = getelementptr inbounds float, float* %f, i64 5
212   %86 = bitcast float* %arrayidx5 to i32*
213   store i32 %84, i32* %86, align 4
214   %arrayidx7 = getelementptr inbounds float, float* %f, i64 6
215   %87 = bitcast float* %arrayidx7 to i32*
216   store i32 %85, i32* %87, align 4
217   ret void
218 }
219
220 declare float @llvm.nvvm.fabs.f(float)
221
222 !nvvm.annotations = !{!0}
223
224 !0 = !{void (float*)* @PR24303, !"kernel", i32 1}