8
8
// We therefore use this test to verify some of our sret handling.
9
9
10
10
#![ feature( autodiff) ]
11
+ #![ feature( intrinsics) ]
11
12
12
13
use std:: autodiff:: autodiff_reverse;
13
14
@@ -17,26 +18,25 @@ fn primal(x: f32, y: f32) -> f64 {
17
18
( x * x * y) as f64
18
19
}
19
20
20
- // CHECK:define internal fastcc void @_ZN4sret2df17h93be4316dd8ea006E(ptr dead_on_unwind noalias nocapture noundef nonnull writable writeonly align 8 dereferenceable(16) initializes((0, 16)) %_0, float noundef %x, float noundef %y)
21
- // CHECK-NEXT:start:
22
- // CHECK-NEXT: %0 = tail call fastcc { double, float, float } @diffeprimal(float %x, float %y)
23
- // CHECK-NEXT: %.elt = extractvalue { double, float, float } %0, 0
24
- // CHECK-NEXT: store double %.elt, ptr %_0, align 8
25
- // CHECK-NEXT: %_0.repack1 = getelementptr inbounds nuw i8, ptr %_0, i64 8
26
- // CHECK-NEXT: %.elt2 = extractvalue { double, float, float } %0, 1
27
- // CHECK-NEXT: store float %.elt2, ptr %_0.repack1, align 8
28
- // CHECK-NEXT: %_0.repack3 = getelementptr inbounds nuw i8, ptr %_0, i64 12
29
- // CHECK-NEXT: %.elt4 = extractvalue { double, float, float } %0, 2
30
- // CHECK-NEXT: store float %.elt4, ptr %_0.repack3, align 4
31
- // CHECK-NEXT: ret void
32
- // CHECK-NEXT:}
21
+ // CHECK: define internal fastcc { double, float, float } @diffeprimal(float noundef %x, float noundef %y)
22
+ // CHECK-NEXT: invertstart:
23
+ // CHECK-NEXT: %_4 = fmul float %x, %x
24
+ // CHECK-NEXT: %_3 = fmul float %_4, %y
25
+ // CHECK-NEXT: %_0 = fpext float %_3 to double
26
+ // CHECK-NEXT: %0 = fadd fast float %y, %y
27
+ // CHECK-NEXT: %1 = fmul fast float %0, %x
28
+ // CHECK-NEXT: %2 = insertvalue { double, float, float } undef, double %_0, 0
29
+ // CHECK-NEXT: %3 = insertvalue { double, float, float } %2, float %1, 1
30
+ // CHECK-NEXT: %4 = insertvalue { double, float, float } %3, float %_4, 2
31
+ // CHECK-NEXT: ret { double, float, float } %4
32
+ // CHECK-NEXT: }
33
33
34
34
fn main ( ) {
35
35
let x = std:: hint:: black_box ( 3.0 ) ;
36
36
let y = std:: hint:: black_box ( 2.5 ) ;
37
37
let scalar = std:: hint:: black_box ( 1.0 ) ;
38
38
let ( r1, r2, r3) = df ( x, y, scalar) ;
39
- // 3*3*1 .5 = 22.5
39
+ // 3*3*2 .5 = 22.5
40
40
assert_eq ! ( r1, 22.5 ) ;
41
41
// 2*x*y = 2*3*2.5 = 15.0
42
42
assert_eq ! ( r2, 15.0 ) ;
0 commit comments