@@ -101,6 +101,17 @@ fn f6(i: NestedInput) -> f32 {
101
101
i. x + i. y . z * i. y . z
102
102
}
103
103
104
+ // CHECK: ; abi_handling::f7
105
+ // CHECK-NEXT: ; Function Attrs: {{.*}}noinline{{.*}}
106
+ // debug-NEXT: define internal float @_ZN12abi_handling2f717h44e3cff234e3b2d5E
107
+ // debug-SAME: (ptr align 4 %x.0, ptr align 4 %x.1)
108
+ // release-NEXT: define internal fastcc noundef float @_ZN12abi_handling2f717h44e3cff234e3b2d5E
109
+ // release-SAME: (float %x.0.0.val, float %x.1.0.val)
110
+ #[ autodiff_forward( df7, Dual , Dual ) ]
111
+ fn f7 ( x : ( & f32 , & f32 ) ) -> f32 {
112
+ x. 0 * x. 1
113
+ }
114
+
104
115
// df1
105
116
// release: define internal fastcc { float, float }
106
117
// release-SAME: @fwddiffe_ZN12abi_handling2f117h536ac8081c1e4101E
@@ -117,12 +128,12 @@ fn f6(i: NestedInput) -> f32 {
117
128
// debug-NEXT: start:
118
129
// debug-NEXT: %"'ipg" = getelementptr inbounds float, ptr %"x'", i64 0
119
130
// debug-NEXT: %0 = getelementptr inbounds nuw float, ptr %x, i64 0
120
- // debug-NEXT: %"_2'ipl" = load float, ptr %"'ipg", align 4, !alias.scope !4, !noalias !7
121
- // debug-NEXT: %_2 = load float, ptr %0, align 4, !alias.scope !7, !noalias !4
131
+ // debug-NEXT: %"_2'ipl" = load float, ptr %"'ipg", align 4
132
+ // debug-NEXT: %_2 = load float, ptr %0, align 4
122
133
// debug-NEXT: %"'ipg2" = getelementptr inbounds float, ptr %"x'", i64 1
123
134
// debug-NEXT: %1 = getelementptr inbounds nuw float, ptr %x, i64 1
124
- // debug-NEXT: %"_5'ipl" = load float, ptr %"'ipg2", align 4, !alias.scope !4, !noalias !7
125
- // debug-NEXT: %_5 = load float, ptr %1, align 4, !alias.scope !7, !noalias !4
135
+ // debug-NEXT: %"_5'ipl" = load float, ptr %"'ipg2", align 4
136
+ // debug-NEXT: %_5 = load float, ptr %1, align 4
126
137
// debug-NEXT: %_0 = fadd float %_2, %_5
127
138
// debug-NEXT: %2 = fadd fast float %"_2'ipl", %"_5'ipl"
128
139
// debug-NEXT: %3 = insertvalue { float, float } undef, float %_0, 0
@@ -147,7 +158,7 @@ fn f6(i: NestedInput) -> f32 {
147
158
// debug-NEXT: %"x'de" = alloca float, align 4
148
159
// debug-NEXT: store float 0.000000e+00, ptr %"x'de", align 4
149
160
// debug-NEXT: %toreturn = alloca float, align 4
150
- // debug-NEXT: %_0 = call float %f(float %x) #12
161
+ // debug-NEXT: %_0 = call float %f(float %x)
151
162
// debug-NEXT: store float %_0, ptr %toreturn, align 4
152
163
// debug-NEXT: br label %invertstart
153
164
// debug-EMPTY:
@@ -172,10 +183,10 @@ fn f6(i: NestedInput) -> f32 {
172
183
// debug: define internal { float, float } @fwddiffe_ZN12abi_handling2f317h9cd1fc602b0815a4E
173
184
// debug-SAME: (ptr align 4 %x, ptr align 4 %"x'", ptr align 4 %y, ptr align 4 %"y'")
174
185
// debug-NEXT: start:
175
- // debug-NEXT: %"_3'ipl" = load float, ptr %"x'", align 4, !alias.scope !9, !noalias !12
176
- // debug-NEXT: %_3 = load float, ptr %x, align 4, !alias.scope !12, !noalias !9
177
- // debug-NEXT: %"_4'ipl" = load float, ptr %"y'", align 4, !alias.scope !14, !noalias !17
178
- // debug-NEXT: %_4 = load float, ptr %y, align 4, !alias.scope !17, !noalias !14
186
+ // debug-NEXT: %"_3'ipl" = load float, ptr %"x'", align 4
187
+ // debug-NEXT: %_3 = load float, ptr %x, align 4
188
+ // debug-NEXT: %"_4'ipl" = load float, ptr %"y'", align 4
189
+ // debug-NEXT: %_4 = load float, ptr %y, align 4
179
190
// debug-NEXT: %_0 = fmul float %_3, %_4
180
191
// debug-NEXT: %0 = fmul fast float %"_3'ipl", %_4
181
192
// debug-NEXT: %1 = fmul fast float %"_4'ipl", %_3
@@ -257,6 +268,28 @@ fn f6(i: NestedInput) -> f32 {
257
268
// debug-NEXT: ret { float, float } %5
258
269
// debug-NEXT: }
259
270
271
+ // df7
272
+ // release: define internal fastcc { float, float }
273
+ // release-SAME: @fwddiffe_ZN12abi_handling2f717h44e3cff234e3b2d5E
274
+ // release-SAME: (float %x.0.0.val, float %"x.0'.0.val")
275
+ // release-NEXT: start:
276
+ // release-NEXT: %0 = insertvalue { float, float } undef, float %x.0.0.val, 0
277
+ // release-NEXT: %1 = insertvalue { float, float } %0, float %"x.0'.0.val", 1
278
+ // release-NEXT: ret { float, float } %1
279
+ // release-NEXT: }
280
+
281
+ // debug: define internal { float, float }
282
+ // debug-SAME: @fwddiffe_ZN12abi_handling2f717h44e3cff234e3b2d5E
283
+ // debug-SAME: (ptr align 4 %x.0, ptr align 4 %"x.0'", ptr align 4 %x.1, ptr align 4 %"x.1'")
284
+ // debug-NEXT: start:
285
+ // debug-NEXT: %0 = call fast { float, float } @"fwddiffe_ZN49_{{.*}}"
286
+ // debug-NEXT: %1 = extractvalue { float, float } %0, 0
287
+ // debug-NEXT: %2 = extractvalue { float, float } %0, 1
288
+ // debug-NEXT: %3 = insertvalue { float, float } undef, float %1, 0
289
+ // debug-NEXT: %4 = insertvalue { float, float } %3, float %2, 1
290
+ // debug-NEXT: ret { float, float } %4
291
+ // debug-NEXT: }
292
+
260
293
fn main ( ) {
261
294
let x = std:: hint:: black_box ( 2.0 ) ;
262
295
let y = std:: hint:: black_box ( 3.0 ) ;
@@ -290,4 +323,9 @@ fn main() {
290
323
dbg ! ( f6( in_f6) ) ;
291
324
let res_f6 = df6 ( in_f6, NestedInput { x, y : Wrapper { z } } ) ;
292
325
dbg ! ( res_f6) ;
326
+
327
+ let in_f7 = ( & x, & y) ;
328
+ dbg ! ( f7( in_f7) ) ;
329
+ let res_f7 = df7 ( in_f7, ( & 1.0 , & 0.0 ) ) ;
330
+ dbg ! ( res_f7) ;
293
331
}
0 commit comments