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