1
+ ; RUN: %opt < %s %loadEnzyme -enzyme -enzyme-preopt=false -mem2reg -early-cse -instsimplify -simplifycfg -S | FileCheck %s
2
+
3
+ %struct.Gradients = type { double , double }
4
+
5
+ define dso_local double @muldd (double %x , double %y ) #0 {
6
+ entry:
7
+ %mul = fmul double %x , %y
8
+ ret double %mul
9
+ }
10
+
11
+ define dso_local %struct.Gradients @dmuldd (double %x , double %y ) local_unnamed_addr #1 {
12
+ entry:
13
+ %call = call %struct.Gradients (i8* , ...) @_Z17__enzyme_autodiffPvz (i8* bitcast (double (double , double )* @muldd to i8* ), double %x , double %y )
14
+ ret %struct.Gradients %call
15
+ }
16
+
17
+ declare dso_local %struct.Gradients @_Z17__enzyme_autodiffPvz (i8* , ...) local_unnamed_addr #2
18
+
19
+ attributes #0 = { norecurse nounwind readnone "correctly-rounded-divide-sqrt-fp-math" ="false" "disable-tail-calls" ="false" "frame-pointer" ="non-leaf" "less-precise-fpmad" ="false" "min-legal-vector-width" ="0" "no-infs-fp-math" ="false" "no-jump-tables" ="false" "no-nans-fp-math" ="false" "no-signed-zeros-fp-math" ="false" "no-trapping-math" ="true" "stack-protector-buffer-size" ="8" "target-cpu" ="generic" "target-features" ="+neon" "unsafe-fp-math" ="false" "use-soft-float" ="false" }
20
+ attributes #1 = { "correctly-rounded-divide-sqrt-fp-math" ="false" "disable-tail-calls" ="false" "frame-pointer" ="non-leaf" "less-precise-fpmad" ="false" "min-legal-vector-width" ="0" "no-infs-fp-math" ="false" "no-jump-tables" ="false" "no-nans-fp-math" ="false" "no-signed-zeros-fp-math" ="false" "no-trapping-math" ="true" "stack-protector-buffer-size" ="8" "target-cpu" ="generic" "target-features" ="+neon" "unsafe-fp-math" ="false" "use-soft-float" ="false" }
21
+ attributes #2 = { "correctly-rounded-divide-sqrt-fp-math" ="false" "disable-tail-calls" ="false" "frame-pointer" ="non-leaf" "less-precise-fpmad" ="false" "no-infs-fp-math" ="false" "no-nans-fp-math" ="false" "no-signed-zeros-fp-math" ="false" "no-trapping-math" ="true" "stack-protector-buffer-size" ="8" "target-cpu" ="generic" "target-features" ="+neon" "unsafe-fp-math" ="false" "use-soft-float" ="false" }
22
+
23
+ ; CHECK: define internal {{(dso_local )?}}{ double, double } @diffemuldd(double %x, double %y, double %differeturn)
24
+ ; CHECK-NEXT: entry:
25
+ ; CHECK-NEXT: %m0diffex = fmul fast double %differeturn, %y
26
+ ; CHECK-NEXT: %m1diffey = fmul fast double %differeturn, %x
27
+ ; CHECK-NEXT: %0 = insertvalue { double, double } undef, double %m0diffex, 0
28
+ ; CHECK-NEXT: %1 = insertvalue { double, double } %0, double %m1diffey, 1
29
+ ; CHECK-NEXT: ret { double, double } %1
30
+ ; CHECK-NEXT: }
0 commit comments