@@ -101,6 +101,17 @@ fn f6(i: NestedInput) -> f32 {
101101 i. x + i. y . z * i. y . z
102102}
103103
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+
104115// df1
105116// release: define internal fastcc { float, float }
106117// release-SAME: @fwddiffe_ZN12abi_handling2f117h536ac8081c1e4101E
@@ -117,12 +128,12 @@ fn f6(i: NestedInput) -> f32 {
117128// debug-NEXT: start:
118129// debug-NEXT: %"'ipg" = getelementptr inbounds float, ptr %"x'", i64 0
119130// 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
122133// debug-NEXT: %"'ipg2" = getelementptr inbounds float, ptr %"x'", i64 1
123134// 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
126137// debug-NEXT: %_0 = fadd float %_2, %_5
127138// debug-NEXT: %2 = fadd fast float %"_2'ipl", %"_5'ipl"
128139// debug-NEXT: %3 = insertvalue { float, float } undef, float %_0, 0
@@ -147,7 +158,7 @@ fn f6(i: NestedInput) -> f32 {
147158// debug-NEXT: %"x'de" = alloca float, align 4
148159// debug-NEXT: store float 0.000000e+00, ptr %"x'de", align 4
149160// 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)
151162// debug-NEXT: store float %_0, ptr %toreturn, align 4
152163// debug-NEXT: br label %invertstart
153164// debug-EMPTY:
@@ -172,10 +183,10 @@ fn f6(i: NestedInput) -> f32 {
172183// debug: define internal { float, float } @fwddiffe_ZN12abi_handling2f317h9cd1fc602b0815a4E
173184// debug-SAME: (ptr align 4 %x, ptr align 4 %"x'", ptr align 4 %y, ptr align 4 %"y'")
174185// 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
179190// debug-NEXT: %_0 = fmul float %_3, %_4
180191// debug-NEXT: %0 = fmul fast float %"_3'ipl", %_4
181192// debug-NEXT: %1 = fmul fast float %"_4'ipl", %_3
@@ -257,6 +268,28 @@ fn f6(i: NestedInput) -> f32 {
257268// debug-NEXT: ret { float, float } %5
258269// debug-NEXT: }
259270
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+
260293fn main ( ) {
261294 let x = std:: hint:: black_box ( 2.0 ) ;
262295 let y = std:: hint:: black_box ( 3.0 ) ;
@@ -290,4 +323,9 @@ fn main() {
290323 dbg ! ( f6( in_f6) ) ;
291324 let res_f6 = df6 ( in_f6, NestedInput { x, y : Wrapper { z } } ) ;
292325 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) ;
293331}
0 commit comments