Skip to content

Commit

Permalink
Fix fortran calling conv
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses committed Sep 20, 2023
1 parent c2924c5 commit 210d033
Show file tree
Hide file tree
Showing 16 changed files with 95 additions and 82 deletions.
10 changes: 5 additions & 5 deletions enzyme/test/Enzyme/ReverseMode/blas/gemm_f.ll
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
;RUN: if [ %llvmver -lt 16 ]; then %opt < %s %loadEnzyme -enzyme -S | FileCheck %s; fi
;RUN: %opt < %s %newLoadEnzyme -passes="enzyme" -S | FileCheck %s

declare void @dgemm_64_(i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8*, i8* nocapture readonly, i8*, i8* nocapture readonly, i8* nocapture readonly, i8*, i8* nocapture readonly)
declare void @dgemm_64_(i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8*, i8* nocapture readonly, i8*, i8* nocapture readonly, i8* nocapture readonly, i8*, i8* nocapture readonly, i64, i64)

define void @f(i8* %C, i8* %A, i8* %B) {
entry:
Expand Down Expand Up @@ -33,7 +33,7 @@ entry:
store i64 8, i64* %ldb, align 16
store double 0.000000e+00, double* %beta
store i64 4, i64* %ldc, align 16
call void @dgemm_64_(i8* %transa, i8* %transb, i8* %m_p, i8* %n_p, i8* %k_p, i8* %alpha_p, i8* %A, i8* %lda_p, i8* %B, i8* %ldb_p, i8* %beta_p, i8* %C, i8* %ldc_p)
call void @dgemm_64_(i8* %transa, i8* %transb, i8* %m_p, i8* %n_p, i8* %k_p, i8* %alpha_p, i8* %A, i8* %lda_p, i8* %B, i8* %ldb_p, i8* %beta_p, i8* %C, i8* %ldc_p, i64 1, i64 1)
ret void
}

Expand Down Expand Up @@ -84,7 +84,7 @@ entry:
; CHECK-NEXT: store i64 8, i64* %ldb, align 16
; CHECK-NEXT: store double 0.000000e+00, double* %beta
; CHECK-NEXT: store i64 4, i64* %ldc, align 16
; CHECK-NEXT: call void @dgemm_64_(i8* %transa, i8* %transb, i8* %m_p, i8* %n_p, i8* %k_p, i8* %alpha_p, i8* %A, i8* %lda_p, i8* %B, i8* %ldb_p, i8* %beta_p, i8* %C, i8* %ldc_p)
; CHECK-NEXT: call void @dgemm_64_(i8* %transa, i8* %transb, i8* %m_p, i8* %n_p, i8* %k_p, i8* %alpha_p, i8* %A, i8* %lda_p, i8* %B, i8* %ldb_p, i8* %beta_p, i8* %C, i8* %ldc_p, i64 1, i64 1)
; CHECK-NEXT: br label %invertentry

; CHECK: invertentry: ; preds = %entry
Expand All @@ -110,8 +110,8 @@ entry:
; CHECK-NEXT: store i8 %[[i25]], i8* %byref.transpose.transb
; CHECK-NEXT: store i64 1, i64* %byref.int.one
; CHECK-NEXT: %intcast.int.one = bitcast i64* %byref.int.one to i8*
; CHECK-NEXT: call void @dgemm_64_(i8* %transa, i8* %byref.transpose.transb, i8* %m_p, i8* %k_p, i8* %n_p, i8* %alpha_p, i8* %"C'", i8* %ldc_p, i8* %B, i8* %ldb_p, i8* %beta_p, i8* %"A'", i8* %lda_p)
; CHECK-NEXT: call void @dgemm_64_(i8* %byref.transpose.transa, i8* %transb, i8* %k_p, i8* %n_p, i8* %m_p, i8* %alpha_p, i8* %A, i8* %lda_p, i8* %"C'", i8* %ldc_p, i8* %beta_p, i8* %"B'", i8* %ldb_p)
; CHECK-NEXT: call void @dgemm_64_(i8* %transa, i8* %byref.transpose.transb, i8* %m_p, i8* %k_p, i8* %n_p, i8* %alpha_p, i8* %"C'", i8* %ldc_p, i8* %B, i8* %ldb_p, i8* %beta_p, i8* %"A'", i8* %lda_p, i64 1, i64 1)
; CHECK-NEXT: call void @dgemm_64_(i8* %byref.transpose.transa, i8* %transb, i8* %k_p, i8* %n_p, i8* %m_p, i8* %alpha_p, i8* %A, i8* %lda_p, i8* %"C'", i8* %ldc_p, i8* %beta_p, i8* %"B'", i8* %ldb_p, i64 1, i64 1)
; CHECK-NEXT: store i8 71, i8* %byref.constant.char.G
; CHECK-NEXT: store i64 0, i64* %byref.constant.int.0
; CHECK-NEXT: %intcast.constant.int.0 = bitcast i64* %byref.constant.int.0 to i8*
Expand Down
10 changes: 5 additions & 5 deletions enzyme/test/Enzyme/ReverseMode/blas/gemm_f_c.ll
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
;RUN: if [ %llvmver -lt 16 ]; then %opt < %s %loadEnzyme -enzyme -S | FileCheck %s; fi
;RUN: %opt < %s %newLoadEnzyme -passes="enzyme" -S | FileCheck %s

declare void @dgemm_64_(i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8*, i8* nocapture readonly, i8*, i8* nocapture readonly, i8* nocapture readonly, i8*, i8* nocapture readonly)
declare void @dgemm_64_(i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8*, i8* nocapture readonly, i8*, i8* nocapture readonly, i8* nocapture readonly, i8*, i8* nocapture readonly, i64, i64)

define void @f(i8* %C, i8* %A, i8* %B) {
entry:
Expand Down Expand Up @@ -33,7 +33,7 @@ entry:
store i64 8, i64* %ldb, align 16
store double 0.000000e+00, double* %beta
store i64 4, i64* %ldc, align 16
call void @dgemm_64_(i8* %transa, i8* %transb, i8* %m_p, i8* %n_p, i8* %k_p, i8* %alpha_p, i8* %A, i8* %lda_p, i8* %B, i8* %ldb_p, i8* %beta_p, i8* %C, i8* %ldc_p)
call void @dgemm_64_(i8* %transa, i8* %transb, i8* %m_p, i8* %n_p, i8* %k_p, i8* %alpha_p, i8* %A, i8* %lda_p, i8* %B, i8* %ldb_p, i8* %beta_p, i8* %C, i8* %ldc_p, i64 1, i64 1)
%ptr = bitcast i8* %A to double*
store double 0.0000000e+00, double* %ptr, align 8
ret void
Expand Down Expand Up @@ -176,7 +176,7 @@ entry:
; CHECK-NEXT: br i1 %39, label %[[enzyme_memcpy_double_mat_64_exit21]], label %[[init_idx]]

; CHECK: [[enzyme_memcpy_double_mat_64_exit21]]: ; preds = %__enzyme_memcpy_double_mat_64.exit, %[[init_end_i18]]
; CHECK-NEXT: call void @dgemm_64_(i8* %transa, i8* %transb, i8* %m_p, i8* %n_p, i8* %k_p, i8* %alpha_p, i8* %A, i8* %lda_p, i8* %B, i8* %ldb_p, i8* %beta_p, i8* %C, i8* %ldc_p)
; CHECK-NEXT: call void @dgemm_64_(i8* %transa, i8* %transb, i8* %m_p, i8* %n_p, i8* %k_p, i8* %alpha_p, i8* %A, i8* %lda_p, i8* %B, i8* %ldb_p, i8* %beta_p, i8* %C, i8* %ldc_p, i64 1, i64 1)
; CHECK-NEXT: %"ptr'ipc" = bitcast i8* %"A'" to double*
; CHECK-NEXT: %ptr = bitcast i8* %A to double*
; CHECK-NEXT: store double 0.000000e+00, double* %ptr, align 8, !alias.scope !10, !noalias !13
Expand Down Expand Up @@ -213,13 +213,13 @@ entry:
; CHECK-DAG: %[[r19:.+]] = icmp eq i8 %loaded.trans4, 110
; CHECK-DAG: %[[r20:.+]] = or i1 %[[r19]], %[[r18]]
; CHECK-DAG: %[[r21:.+]] = select i1 %[[r20]], i8* %k_p, i8* %n_p
; CHECK-NEXT: call void @dgemm_64_(i8* %transa, i8* %byref.transpose.transb, i8* %m_p, i8* %k_p, i8* %n_p, i8* %alpha_p, i8* %"C'", i8* %ldc_p, i8* %[[i43]], i8* %[[r21]], i8* %beta_p, i8* %"A'", i8* %lda_p)
; CHECK-NEXT: call void @dgemm_64_(i8* %transa, i8* %byref.transpose.transb, i8* %m_p, i8* %k_p, i8* %n_p, i8* %alpha_p, i8* %"C'", i8* %ldc_p, i8* %[[i43]], i8* %[[r21]], i8* %beta_p, i8* %"A'", i8* %lda_p, i64 1, i64 1)
; CHECK-NEXT: %loaded.trans5 = load i8, i8* %transa
; CHECK-DAG: %[[r22:.+]] = icmp eq i8 %loaded.trans5, 78
; CHECK-DAG: %[[r23:.+]] = icmp eq i8 %loaded.trans5, 110
; CHECK-DAG: %[[r24:.+]] = or i1 %[[r23]], %[[r22]]
; CHECK-DAG: %[[r25:.+]] = select i1 %[[r24]], i8* %m_p, i8* %k_p
; CHECK-NEXT: call void @dgemm_64_(i8* %byref.transpose.transa, i8* %transb, i8* %k_p, i8* %n_p, i8* %m_p, i8* %alpha_p, i8* %[[i42]], i8* %[[r25]], i8* %"C'", i8* %ldc_p, i8* %beta_p, i8* %"B'", i8* %ldb_p)
; CHECK-NEXT: call void @dgemm_64_(i8* %byref.transpose.transa, i8* %transb, i8* %k_p, i8* %n_p, i8* %m_p, i8* %alpha_p, i8* %[[i42]], i8* %[[r25]], i8* %"C'", i8* %ldc_p, i8* %beta_p, i8* %"B'", i8* %ldb_p, i64 1, i64 1)
; CHECK-NEXT: store i8 71, i8* %byref.constant.char.G
; CHECK-NEXT: store i64 0, i64* %byref.constant.int.0
; CHECK-NEXT: %intcast.constant.int.0 = bitcast i64* %byref.constant.int.0 to i8*
Expand Down
12 changes: 6 additions & 6 deletions enzyme/test/Enzyme/ReverseMode/blas/gemm_f_c_lacpy.ll
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
;RUN: if [ %llvmver -lt 16 ]; then %opt < %s %loadEnzyme -enzyme -enzyme-lapack-copy=1 -S | FileCheck %s; fi
;RUN: %opt < %s %newLoadEnzyme -passes="enzyme" -enzyme-lapack-copy=1 -S | FileCheck %s

declare void @dgemm_64_(i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8*, i8* nocapture readonly, i8*, i8* nocapture readonly, i8* nocapture readonly, i8*, i8* nocapture readonly)
declare void @dgemm_64_(i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8*, i8* nocapture readonly, i8*, i8* nocapture readonly, i8* nocapture readonly, i8*, i8* nocapture readonly, i64, i64)

define void @f(i8* noalias %C, i8* noalias %A, i8* noalias %B, i8* noalias %alpha, i8* noalias %beta) {
entry:
Expand All @@ -27,7 +27,7 @@ entry:
store i64 4, i64* %lda, align 16
store i64 8, i64* %ldb, align 16
store i64 4, i64* %ldc, align 16
call void @dgemm_64_(i8* %transa, i8* %transb, i8* %m_p, i8* %n_p, i8* %k_p, i8* %alpha, i8* %A, i8* %lda_p, i8* %B, i8* %ldb_p, i8* %beta, i8* %C, i8* %ldc_p)
call void @dgemm_64_(i8* %transa, i8* %transb, i8* %m_p, i8* %n_p, i8* %k_p, i8* %alpha, i8* %A, i8* %lda_p, i8* %B, i8* %ldb_p, i8* %beta, i8* %C, i8* %ldc_p, i64 1, i64 1)
%ptr = bitcast i8* %A to double*
store double 0.0000000e+00, double* %ptr, align 8
ret void
Expand Down Expand Up @@ -117,7 +117,7 @@ entry:
; CHECK-NEXT: %malloccall6 = tail call noalias nonnull i8* @malloc(i64 %mallocsize5)
; CHECK-NEXT: %mat_AB = bitcast i8* %malloccall6 to double*
; CHECK-NEXT: %[[i21:.+]] = bitcast double* %mat_AB to i8*
; CHECK-NEXT: call void @dgemm_64_(i8* %transa, i8* %transb, i8* %m_p, i8* %n_p, i8* %k_p, i8* %alpha, i8* %A, i8* %lda_p, i8* %B, i8* %ldb_p, i8* %beta, i8* %C, i8* %ldc_p)
; CHECK-NEXT: call void @dgemm_64_(i8* %transa, i8* %transb, i8* %m_p, i8* %n_p, i8* %k_p, i8* %alpha, i8* %A, i8* %lda_p, i8* %B, i8* %ldb_p, i8* %beta, i8* %C, i8* %ldc_p, i64 1, i64 1)
; CHECK-NEXT: %"ptr'ipc" = bitcast i8* %"A'" to double*
; CHECK-NEXT: %ptr = bitcast i8* %A to double*
; CHECK-NEXT: store double 0.000000e+00, double* %ptr, align 8, !alias.scope !0, !noalias !3
Expand Down Expand Up @@ -159,7 +159,7 @@ entry:
; CHECK-NEXT: %[[i44:.+]] = select i1 %[[i43]], i8* %m_p, i8* %k_p
; CHECK-NEXT: store double 0.000000e+00, double* %byref.constant.fp.0.0
; CHECK-NEXT: %fpcast.constant.fp.0.0 = bitcast double* %byref.constant.fp.0.0 to i8*
; CHECK-NEXT: call void @dgemm_64_(i8* %transa, i8* %transb, i8* %m_p, i8* %n_p, i8* %k_p, i8* %fpcast.constant.fp.1.0, i8* %[[matA]], i8* %[[i44]], i8* %B, i8* %ldb_p, i8* %fpcast.constant.fp.0.0, i8* %[[i21]], i8* %m_p)
; CHECK-NEXT: call void @dgemm_64_(i8* %transa, i8* %transb, i8* %m_p, i8* %n_p, i8* %k_p, i8* %fpcast.constant.fp.1.0, i8* %[[matA]], i8* %[[i44]], i8* %B, i8* %ldb_p, i8* %fpcast.constant.fp.0.0, i8* %[[i21]], i8* %m_p, i64 1, i64 1)
; CHECK: %[[i45:.+]] = bitcast i64* %byref.constant.one.i to i8*
; CHECK: %[[i46:.+]] = bitcast i64* %byref.mat.size.i to i8*
; CHECK: store i64 1, i64* %byref.constant.one.i
Expand Down Expand Up @@ -207,13 +207,13 @@ entry:
; CHECK-NEXT: %[[i62:.+]] = load double, double* %[[i61]]
; CHECK-NEXT: %[[i63:.+]] = fadd fast double %[[i62]], %res.i
; CHECK-NEXT: store double %[[i63]], double* %[[i61]]
; CHECK-NEXT: call void @dgemm_64_(i8* %transa, i8* %byref.transpose.transb, i8* %m_p, i8* %k_p, i8* %n_p, i8* %alpha, i8* %"C'", i8* %ldc_p, i8* %B, i8* %ldb_p, i8* %beta, i8* %"A'", i8* %lda_p)
; CHECK-NEXT: call void @dgemm_64_(i8* %transa, i8* %byref.transpose.transb, i8* %m_p, i8* %k_p, i8* %n_p, i8* %alpha, i8* %"C'", i8* %ldc_p, i8* %B, i8* %ldb_p, i8* %beta, i8* %"A'", i8* %lda_p, i64 1, i64 1)
; CHECK-NEXT: %loaded.trans8 = load i8, i8* %transa
; CHECK-DAG: %[[i64:.+]] = icmp eq i8 %loaded.trans8, 78
; CHECK-DAG: %[[i65:.+]] = icmp eq i8 %loaded.trans8, 110
; CHECK-DAG: %[[i66:.+]] = or i1 %[[i65]], %[[i64]]
; CHECK-NEXT: %[[i67:.+]] = select i1 %[[i66]], i8* %m_p, i8* %k_p
; CHECK-NEXT: call void @dgemm_64_(i8* %byref.transpose.transa, i8* %transb, i8* %k_p, i8* %n_p, i8* %m_p, i8* %alpha, i8* %[[matA]], i8* %[[i67]], i8* %"C'", i8* %ldc_p, i8* %beta, i8* %"B'", i8* %ldb_p)
; CHECK-NEXT: call void @dgemm_64_(i8* %byref.transpose.transa, i8* %transb, i8* %k_p, i8* %n_p, i8* %m_p, i8* %alpha, i8* %[[matA]], i8* %[[i67]], i8* %"C'", i8* %ldc_p, i8* %beta, i8* %"B'", i8* %ldb_p, i64 1, i64 1)
; CHECK: %[[i68:.+]] = bitcast i64* %byref.constant.one.i15 to i8*
; CHECK: %[[i69:.+]] = bitcast i64* %byref.mat.size.i18 to i8*
; CHECK: store i64 1, i64* %byref.constant.one.i15
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
;RUN: if [ %llvmver -lt 16 ]; then %opt < %s %loadEnzyme -enzyme -enzyme-lapack-copy=1 -enzyme-runtime-activity=1 -S | FileCheck %s; fi
;RUN: %opt < %s %newLoadEnzyme -passes="enzyme" -enzyme-lapack-copy=1 -enzyme-runtime-activity=1 -S | FileCheck %s

declare void @dgemm_64_(i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8*, i8* nocapture readonly, i8*, i8* nocapture readonly, i8* nocapture readonly, i8*, i8* nocapture readonly)
declare void @dgemm_64_(i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8*, i8* nocapture readonly, i8*, i8* nocapture readonly, i8* nocapture readonly, i8*, i8* nocapture readonly, i64, i64)

define void @f(i8* noalias %C, i8* noalias %A, i8* noalias %B, i8* noalias %alpha, i8* noalias %beta) {
entry:
Expand All @@ -27,7 +27,7 @@ entry:
store i64 4, i64* %lda, align 16
store i64 8, i64* %ldb, align 16
store i64 4, i64* %ldc, align 16
call void @dgemm_64_(i8* %transa, i8* %transb, i8* %m_p, i8* %n_p, i8* %k_p, i8* %alpha, i8* %A, i8* %lda_p, i8* %B, i8* %ldb_p, i8* %beta, i8* %C, i8* %ldc_p)
call void @dgemm_64_(i8* %transa, i8* %transb, i8* %m_p, i8* %n_p, i8* %k_p, i8* %alpha, i8* %A, i8* %lda_p, i8* %B, i8* %ldb_p, i8* %beta, i8* %C, i8* %ldc_p, i64 1, i64 1)
%ptr = bitcast i8* %A to double*
store double 0.0000000e+00, double* %ptr, align 8
ret void
Expand Down Expand Up @@ -122,7 +122,7 @@ entry:
; CHECK-NEXT: %malloccall6 = tail call noalias nonnull i8* @malloc(i64 %mallocsize5)
; CHECK-NEXT: %mat_AB = bitcast i8* %malloccall6 to double*
; CHECK-NEXT: %[[i21:.+]] = bitcast double* %mat_AB to i8*
; CHECK-NEXT: call void @dgemm_64_(i8* %transa, i8* %transb, i8* %m_p, i8* %n_p, i8* %k_p, i8* %alpha, i8* %A, i8* %lda_p, i8* %B, i8* %ldb_p, i8* %beta, i8* %C, i8* %ldc_p)
; CHECK-NEXT: call void @dgemm_64_(i8* %transa, i8* %transb, i8* %m_p, i8* %n_p, i8* %k_p, i8* %alpha, i8* %A, i8* %lda_p, i8* %B, i8* %ldb_p, i8* %beta, i8* %C, i8* %ldc_p, i64 1, i64 1)
; CHECK-NEXT: %"ptr'ipc" = bitcast i8* %"A'" to double*
; CHECK-NEXT: %ptr = bitcast i8* %A to double*
; CHECK-NEXT: store double 0.000000e+00, double* %ptr, align 8, !alias.scope !0, !noalias !3
Expand Down Expand Up @@ -167,7 +167,7 @@ entry:
; CHECK-NEXT: %[[i44:.+]] = select i1 %[[i43]], i8* %m_p, i8* %k_p
; CHECK-NEXT: store double 0.000000e+00, double* %byref.constant.fp.0.0
; CHECK-NEXT: %fpcast.constant.fp.0.0 = bitcast double* %byref.constant.fp.0.0 to i8*
; CHECK-NEXT: call void @dgemm_64_(i8* %transa, i8* %transb, i8* %m_p, i8* %n_p, i8* %k_p, i8* %fpcast.constant.fp.1.0, i8* %[[matA]], i8* %[[i44]], i8* %B, i8* %ldb_p, i8* %fpcast.constant.fp.0.0, i8* %[[i21]], i8* %m_p)
; CHECK-NEXT: call void @dgemm_64_(i8* %transa, i8* %transb, i8* %m_p, i8* %n_p, i8* %k_p, i8* %fpcast.constant.fp.1.0, i8* %[[matA]], i8* %[[i44]], i8* %B, i8* %ldb_p, i8* %fpcast.constant.fp.0.0, i8* %[[i21]], i8* %m_p, i64 1, i64 1)
; CHECK: %[[i45:.+]] = bitcast i64* %byref.constant.one.i to i8*
; CHECK: %[[i46:.+]] = bitcast i64* %byref.mat.size.i to i8*
; CHECK: store i64 1, i64* %byref.constant.one.i
Expand Down Expand Up @@ -221,7 +221,7 @@ entry:
; CHECK-NEXT: br i1 %rt.inactive.A, label %invertentry.A.done, label %invertentry.A.active

; CHECK: invertentry.A.active: ; preds = %invertentry.alpha.done
; CHECK-NEXT: call void @dgemm_64_(i8* %transa, i8* %byref.transpose.transb, i8* %m_p, i8* %k_p, i8* %n_p, i8* %alpha, i8* %"C'", i8* %ldc_p, i8* %B, i8* %ldb_p, i8* %beta, i8* %"A'", i8* %lda_p)
; CHECK-NEXT: call void @dgemm_64_(i8* %transa, i8* %byref.transpose.transb, i8* %m_p, i8* %k_p, i8* %n_p, i8* %alpha, i8* %"C'", i8* %ldc_p, i8* %B, i8* %ldb_p, i8* %beta, i8* %"A'", i8* %lda_p, i64 1, i64 1)
; CHECK-NEXT: br label %invertentry.A.done

; CHECK: invertentry.A.done: ; preds = %invertentry.A.active, %invertentry.alpha.done
Expand All @@ -233,7 +233,7 @@ entry:
; CHECK-DAG: %[[i65:.+]] = icmp eq i8 %loaded.trans8, 110
; CHECK-DAG: %[[i66:.+]] = or i1 %[[i65]], %[[i64]]
; CHECK-NEXT: %[[i67:.+]] = select i1 %[[i66]], i8* %m_p, i8* %k_p
; CHECK-NEXT: call void @dgemm_64_(i8* %byref.transpose.transa, i8* %transb, i8* %k_p, i8* %n_p, i8* %m_p, i8* %alpha, i8* %[[matA]], i8* %[[i67]], i8* %"C'", i8* %ldc_p, i8* %beta, i8* %"B'", i8* %ldb_p)
; CHECK-NEXT: call void @dgemm_64_(i8* %byref.transpose.transa, i8* %transb, i8* %k_p, i8* %n_p, i8* %m_p, i8* %alpha, i8* %[[matA]], i8* %[[i67]], i8* %"C'", i8* %ldc_p, i8* %beta, i8* %"B'", i8* %ldb_p, i64 1, i64 1)
; CHECK-NEXT: br label %invertentry.B.done

; CHECK: invertentry.B.done: ; preds = %invertentry.B.active, %invertentry.A.done
Expand Down
8 changes: 4 additions & 4 deletions enzyme/test/Enzyme/ReverseMode/blas/gemm_f_c_loop.ll
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
;RUN: if [ %llvmver -lt 16 ]; then %opt < %s %loadEnzyme -enzyme -S | FileCheck %s; fi
;RUN: %opt < %s %newLoadEnzyme -passes="enzyme" -S | FileCheck %s

declare void @dgemm_64_(i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8*, i8* nocapture readonly, i8*, i8* nocapture readonly, i8* nocapture readonly, i8*, i8* nocapture readonly)
declare void @dgemm_64_(i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8* nocapture readonly, i8*, i8* nocapture readonly, i8*, i8* nocapture readonly, i8* nocapture readonly, i8*, i8* nocapture readonly, i64, i64)

declare i8* @AData(i64)
declare i8* @Aldap(i64)
Expand Down Expand Up @@ -43,7 +43,7 @@ loop:
store i64 4, i64* %ldc, align 16
%A = call i8* @AData(i64 %i) "enzyme_inactive"
%lda_p = call i8* @Aldap(i64 %i) "enzyme_inactive"
call void @dgemm_64_(i8* %transa, i8* %transb, i8* %m_p, i8* %n_p, i8* %k_p, i8* %alpha_p, i8* %A, i8* %lda_p, i8* %B, i8* %ldb_p, i8* %beta_p, i8* %C, i8* %ldc_p)
call void @dgemm_64_(i8* %transa, i8* %transb, i8* %m_p, i8* %n_p, i8* %k_p, i8* %alpha_p, i8* %A, i8* %lda_p, i8* %B, i8* %ldb_p, i8* %beta_p, i8* %C, i8* %ldc_p, i64 1, i64 1)
call void @free(i8* %m_p)
%cmp = icmp eq i64 %inc, 10
br i1 %cmp, label %exit, label %loop
Expand Down Expand Up @@ -187,7 +187,7 @@ entry:
; CHECK-NEXT: br i1 %23, label %__enzyme_memcpy_double_mat_64.exit, label %init.idx.i

; CHECK: __enzyme_memcpy_double_mat_64.exit: ; preds = %loop, %init.end.i
; CHECK-NEXT: call void @dgemm_64_(i8* %transa, i8* %transb, i8* %m_p, i8* %n_p, i8* %k_p, i8* %alpha_p, i8* %A, i8* %lda_p, i8* %B, i8* %ldb_p, i8* %beta_p, i8* %C, i8* %ldc_p)
; CHECK-NEXT: call void @dgemm_64_(i8* %transa, i8* %transb, i8* %m_p, i8* %n_p, i8* %k_p, i8* %alpha_p, i8* %A, i8* %lda_p, i8* %B, i8* %ldb_p, i8* %beta_p, i8* %C, i8* %ldc_p, i64 1, i64 1)
; CHECK-NEXT: call void @free(i8* %m_p)
; CHECK-NEXT: %cmp = icmp eq i64 %iv.next, 10
; CHECK-NEXT: br i1 %cmp, label %exit, label %loop
Expand Down Expand Up @@ -275,7 +275,7 @@ entry:
; CHECK-DAG: %[[r19:.+]] = icmp eq i8 %loaded.trans30, 110
; CHECK-DAG: %[[r20:.+]] = or i1 %[[r19]], %[[r18]]
; CHECK-DAG: %[[r21:.+]] = select i1 %[[r20]], i8* %[[i46]], i8* %cast.k
; CHECK-NEXT: call void @dgemm_64_(i8* %byref.transpose.transa, i8* %byref.transb, i8* %cast.k, i8* %n_p_unwrap, i8* %[[i46]], i8* %cast.alpha, i8* %[[i44]], i8* %[[r21]], i8* %"C'", i8* %cast.ldc, i8* %cast.beta, i8* %"B'", i8* %cast.ldb)
; CHECK-NEXT: call void @dgemm_64_(i8* %byref.transpose.transa, i8* %byref.transb, i8* %cast.k, i8* %n_p_unwrap, i8* %[[i46]], i8* %cast.alpha, i8* %[[i44]], i8* %[[r21]], i8* %"C'", i8* %cast.ldc, i8* %cast.beta, i8* %"B'", i8* %cast.ldb, i64 1, i64 1)
; CHECK-NEXT: store i8 71, i8* %byref.constant.char.G
; CHECK-NEXT: store i64 0, i64* %byref.constant.int.0
; CHECK-NEXT: %intcast.constant.int.0 = bitcast i64* %byref.constant.int.0 to i8*
Expand Down
Loading

0 comments on commit 210d033

Please sign in to comment.