; LLVM IR from ermig1979/Simd :: src/Simd (SimdBaseSynetInnerProduct16b)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.Simd::SynetInnerProduct16b" = type { %"struct.Simd::Deletable", %"struct.Simd::InnerProductParam16b", %"struct.Simd::Array", %"struct.Simd::Array.0", %"struct.Simd::Array.1", %"class.std::__cxx11::basic_string", i64, i64, i64 }
%"struct.Simd::Deletable" = type { ptr }
%"struct.Simd::InnerProductParam16b" = type { i64, i64, i64, i32, i32, i32, i32, i32, i32 }
%"struct.Simd::Array" = type { ptr, i64 }
%"struct.Simd::Array.0" = type { ptr, i64 }
%"struct.Simd::Array.1" = type { ptr, i64 }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare void @_ZN4Simd4Base17Float32ToBFloat16EPKfmPt(ptr noundef, i64 noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Simd4Base23SynetInnerProduct16bRef7ForwardEPKhS3_PhS4_(ptr noundef nonnull align 8 dereferenceable(160) %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) unnamed_addr #2 align 2 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  %15 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %16 = getelementptr inbounds %"class.Simd::SynetInnerProduct16b", ptr %15, i32 0, i32 1
  store ptr %16, ptr %11, align 8, !tbaa !5
  %17 = load ptr, ptr %9, align 8, !tbaa !5
  %18 = call noundef ptr @_ZN4Simd20SynetInnerProduct16b6BufferEPh(ptr noundef nonnull align 8 dereferenceable(160) %15, ptr noundef %17)
  store ptr %18, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %19, ptr %12, align 8, !tbaa !5
  %20 = getelementptr inbounds %"class.Simd::SynetInnerProduct16b", ptr %15, i32 0, i32 6
  %21 = load i64, ptr %20, align 8, !tbaa !9
  %22 = icmp ne i64 %21, 0
  br i1 %22, label %23, label %31

23:                                               ; preds = %5
  %24 = getelementptr inbounds %"class.Simd::SynetInnerProduct16b", ptr %15, i32 0, i32 6
  %25 = load i64, ptr %24, align 8, !tbaa !9
  %26 = call noundef ptr @_ZN4Simd8AllocateItEEPT_RPhmm(ptr noundef nonnull align 8 dereferenceable(8) %9, i64 noundef %25, i64 noundef 8)
  store ptr %26, ptr %12, align 8, !tbaa !5
  %27 = load ptr, ptr %7, align 8, !tbaa !5
  %28 = getelementptr inbounds %"class.Simd::SynetInnerProduct16b", ptr %15, i32 0, i32 6
  %29 = load i64, ptr %28, align 8, !tbaa !9
  %30 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_ZN4Simd4Base17Float32ToBFloat16EPKfmPt(ptr noundef %27, i64 noundef %29, ptr noundef %30)
  br label %31

31:                                               ; preds = %23, %5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %32 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %32, ptr %13, align 8, !tbaa !5
  %33 = getelementptr inbounds %"class.Simd::SynetInnerProduct16b", ptr %15, i32 0, i32 7
  %34 = load i64, ptr %33, align 8, !tbaa !21
  %35 = icmp ne i64 %34, 0
  br i1 %35, label %36, label %44

36:                                               ; preds = %31
  %37 = getelementptr inbounds %"class.Simd::SynetInnerProduct16b", ptr %15, i32 0, i32 7
  %38 = load i64, ptr %37, align 8, !tbaa !21
  %39 = call noundef ptr @_ZN4Simd8AllocateItEEPT_RPhmm(ptr noundef nonnull align 8 dereferenceable(8) %9, i64 noundef %38, i64 noundef 8)
  store ptr %39, ptr %13, align 8, !tbaa !5
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = getelementptr inbounds %"class.Simd::SynetInnerProduct16b", ptr %15, i32 0, i32 7
  %42 = load i64, ptr %41, align 8, !tbaa !21
  %43 = load ptr, ptr %13, align 8, !tbaa !5
  call void @_ZN4Simd4Base17Float32ToBFloat16EPKfmPt(ptr noundef %40, i64 noundef %42, ptr noundef %43)
  br label %54

44:                                               ; preds = %31
  %45 = load ptr, ptr %11, align 8, !tbaa !5
  %46 = getelementptr inbounds %"struct.Simd::InnerProductParam16b", ptr %45, i32 0, i32 7
  %47 = load i32, ptr %46, align 8, !tbaa !22
  %48 = icmp ne i32 %47, 0
  br i1 %48, label %49, label %53

49:                                               ; preds = %44
  %50 = getelementptr inbounds %"class.Simd::SynetInnerProduct16b", ptr %15, i32 0, i32 3
  %51 = getelementptr inbounds %"struct.Simd::Array.0", ptr %50, i32 0, i32 0
  %52 = load ptr, ptr %51, align 8, !tbaa !23
  store ptr %52, ptr %13, align 8, !tbaa !5
  br label %53

53:                                               ; preds = %49, %44
  br label %54

54:                                               ; preds = %53, %36
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %55 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %55, ptr %14, align 8, !tbaa !5
  %56 = getelementptr inbounds %"class.Simd::SynetInnerProduct16b", ptr %15, i32 0, i32 8
  %57 = load i64, ptr %56, align 8, !tbaa !24
  %58 = icmp ne i64 %57, 0
  br i1 %58, label %59, label %63

59:                                               ; preds = %54
  %60 = getelementptr inbounds %"class.Simd::SynetInnerProduct16b", ptr %15, i32 0, i32 8
  %61 = load i64, ptr %60, align 8, !tbaa !24
  %62 = call noundef ptr @_ZN4Simd8AllocateIfEEPT_RPhmm(ptr noundef nonnull align 8 dereferenceable(8) %9, i64 noundef %61, i64 noundef 8)
  store ptr %62, ptr %14, align 8, !tbaa !5
  br label %63

63:                                               ; preds = %59, %54
  %64 = load ptr, ptr %12, align 8, !tbaa !5
  %65 = load ptr, ptr %13, align 8, !tbaa !5
  %66 = load ptr, ptr %14, align 8, !tbaa !5
  call void @_ZN4Simd4Base23SynetInnerProduct16bRef11GemmAndBiasEPKtS3_Pf(ptr noundef nonnull align 8 dereferenceable(160) %15, ptr noundef %64, ptr noundef %65, ptr noundef %66)
  %67 = getelementptr inbounds %"class.Simd::SynetInnerProduct16b", ptr %15, i32 0, i32 8
  %68 = load i64, ptr %67, align 8, !tbaa !24
  %69 = icmp ne i64 %68, 0
  br i1 %69, label %70, label %75

70:                                               ; preds = %63
  %71 = load ptr, ptr %14, align 8, !tbaa !5
  %72 = getelementptr inbounds %"class.Simd::SynetInnerProduct16b", ptr %15, i32 0, i32 8
  %73 = load i64, ptr %72, align 8, !tbaa !24
  %74 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN4Simd4Base17Float32ToBFloat16EPKfmPt(ptr noundef %71, i64 noundef %73, ptr noundef %74)
  br label %75

75:                                               ; preds = %70, %63
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN4Simd20SynetInnerProduct16b6BufferEPh(ptr noundef nonnull align 8 dereferenceable(160), ptr noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN4Simd8AllocateItEEPT_RPhmm(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef, i64 noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN4Simd8AllocateIfEEPT_RPhmm(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef, i64 noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4Simd4Base23SynetInnerProduct16bRef11GemmAndBiasEPKtS3_Pf(ptr noundef nonnull align 8 dereferenceable(160), ptr noundef, ptr noundef, ptr noundef) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !13, i64 136}
!10 = !{!"_ZTSN4Simd20SynetInnerProduct16bE", !11, i64 0, !12, i64 8, !16, i64 56, !17, i64 72, !18, i64 88, !19, i64 104, !13, i64 136, !13, i64 144, !13, i64 152}
!11 = !{!"_ZTSN4Simd9DeletableE"}
!12 = !{!"_ZTSN4Simd20InnerProductParam16bE", !13, i64 0, !13, i64 8, !13, i64 16, !14, i64 24, !14, i64 28, !14, i64 32, !15, i64 36, !15, i64 40, !15, i64 44}
!13 = !{!"long", !7, i64 0}
!14 = !{!"_ZTS18SimdTensorDataType", !7, i64 0}
!15 = !{!"_ZTS8SimdBool", !7, i64 0}
!16 = !{!"_ZTSN4Simd5ArrayIhEE", !6, i64 0, !13, i64 8}
!17 = !{!"_ZTSN4Simd5ArrayItEE", !6, i64 0, !13, i64 8}
!18 = !{!"_ZTSN4Simd5ArrayIfEE", !6, i64 0, !13, i64 8}
!19 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !20, i64 0, !13, i64 8, !7, i64 16}
!20 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!21 = !{!10, !13, i64 144}
!22 = !{!12, !15, i64 40}
!23 = !{!10, !6, i64 72}
!24 = !{!10, !13, i64 152}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

declare void @_ZN4Simd4Base17Float32ToBFloat16EPKfmPt(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Simd4Base23SynetInnerProduct16bRef7ForwardEPKhS3_PhS4_(ptr noundef nonnull align 8 dereferenceable(160) %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) unnamed_addr #1 align 2 {
  %6 = alloca ptr, align 8
  %7 = tail call noundef ptr @_ZN4Simd20SynetInnerProduct16b6BufferEPh(ptr noundef nonnull align 8 dereferenceable(160) %0, ptr noundef %3)
  store ptr %7, ptr %6, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 136
  %9 = load i64, ptr %8, align 8, !tbaa !9
  %.not = icmp eq i64 %9, 0
  br i1 %.not, label %13, label %10

10:                                               ; preds = %5
  %11 = call noundef ptr @_ZN4Simd8AllocateItEEPT_RPhmm(ptr noundef nonnull align 8 dereferenceable(8) %6, i64 noundef %9, i64 noundef 8)
  %12 = load i64, ptr %8, align 8, !tbaa !9
  call void @_ZN4Simd4Base17Float32ToBFloat16EPKfmPt(ptr noundef %1, i64 noundef %12, ptr noundef %11)
  br label %13

13:                                               ; preds = %10, %5
  %.015 = phi ptr [ %11, %10 ], [ %1, %5 ]
  %14 = getelementptr inbounds i8, ptr %0, i64 144
  %15 = load i64, ptr %14, align 8, !tbaa !21
  %.not20 = icmp eq i64 %15, 0
  br i1 %.not20, label %19, label %16

16:                                               ; preds = %13
  %17 = call noundef ptr @_ZN4Simd8AllocateItEEPT_RPhmm(ptr noundef nonnull align 8 dereferenceable(8) %6, i64 noundef %15, i64 noundef 8)
  %18 = load i64, ptr %14, align 8, !tbaa !21
  call void @_ZN4Simd4Base17Float32ToBFloat16EPKfmPt(ptr noundef %2, i64 noundef %18, ptr noundef %17)
  br label %25

19:                                               ; preds = %13
  %20 = getelementptr inbounds i8, ptr %0, i64 48
  %21 = load i32, ptr %20, align 8, !tbaa !22
  %.not21 = icmp eq i32 %21, 0
  br i1 %.not21, label %25, label %22

22:                                               ; preds = %19
  %23 = getelementptr inbounds i8, ptr %0, i64 72
  %24 = load ptr, ptr %23, align 8, !tbaa !23
  br label %25

25:                                               ; preds = %19, %22, %16
  %.014 = phi ptr [ %17, %16 ], [ %24, %22 ], [ %2, %19 ]
  %26 = getelementptr inbounds i8, ptr %0, i64 152
  %27 = load i64, ptr %26, align 8, !tbaa !24
  %.not22 = icmp eq i64 %27, 0
  br i1 %.not22, label %30, label %28

28:                                               ; preds = %25
  %29 = call noundef ptr @_ZN4Simd8AllocateIfEEPT_RPhmm(ptr noundef nonnull align 8 dereferenceable(8) %6, i64 noundef %27, i64 noundef 8)
  br label %30

30:                                               ; preds = %28, %25
  %.0 = phi ptr [ %29, %28 ], [ %4, %25 ]
  call void @_ZN4Simd4Base23SynetInnerProduct16bRef11GemmAndBiasEPKtS3_Pf(ptr noundef nonnull align 8 dereferenceable(160) %0, ptr noundef %.015, ptr noundef %.014, ptr noundef %.0)
  %31 = load i64, ptr %26, align 8, !tbaa !24
  %.not23 = icmp eq i64 %31, 0
  br i1 %.not23, label %33, label %32

32:                                               ; preds = %30
  call void @_ZN4Simd4Base17Float32ToBFloat16EPKfmPt(ptr noundef %.0, i64 noundef %31, ptr noundef %4)
  br label %33

33:                                               ; preds = %32, %30
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN4Simd20SynetInnerProduct16b6BufferEPh(ptr noundef nonnull align 8 dereferenceable(160), ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN4Simd8AllocateItEEPT_RPhmm(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN4Simd8AllocateIfEEPT_RPhmm(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4Simd4Base23SynetInnerProduct16bRef11GemmAndBiasEPKtS3_Pf(ptr noundef nonnull align 8 dereferenceable(160), ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1 align 2

attributes #0 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !13, i64 136}
!10 = !{!"_ZTSN4Simd20SynetInnerProduct16bE", !11, i64 0, !12, i64 8, !16, i64 56, !17, i64 72, !18, i64 88, !19, i64 104, !13, i64 136, !13, i64 144, !13, i64 152}
!11 = !{!"_ZTSN4Simd9DeletableE"}
!12 = !{!"_ZTSN4Simd20InnerProductParam16bE", !13, i64 0, !13, i64 8, !13, i64 16, !14, i64 24, !14, i64 28, !14, i64 32, !15, i64 36, !15, i64 40, !15, i64 44}
!13 = !{!"long", !7, i64 0}
!14 = !{!"_ZTS18SimdTensorDataType", !7, i64 0}
!15 = !{!"_ZTS8SimdBool", !7, i64 0}
!16 = !{!"_ZTSN4Simd5ArrayIhEE", !6, i64 0, !13, i64 8}
!17 = !{!"_ZTSN4Simd5ArrayItEE", !6, i64 0, !13, i64 8}
!18 = !{!"_ZTSN4Simd5ArrayIfEE", !6, i64 0, !13, i64 8}
!19 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !20, i64 0, !13, i64 8, !7, i64 16}
!20 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!21 = !{!10, !13, i64 144}
!22 = !{!12, !15, i64 40}
!23 = !{!10, !6, i64 72}
!24 = !{!10, !13, i64 152}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass