; LLVM IR from gem5/gem5 :: ext/softfloat (extF80_eq_signaling)

; 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"

%struct.extFloat80M = type { i64, i16 }
%union.anon = type { %struct.extFloat80M }
%union.anon.0 = type { %struct.extFloat80M }

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @extF80_eq_signaling(i64 %0, i16 %1, i64 %2, i16 %3) #0 {
  %5 = alloca i1, align 1
  %6 = alloca %struct.extFloat80M, align 8
  %7 = alloca %struct.extFloat80M, align 8
  %8 = alloca %union.anon, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca %union.anon.0, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  %15 = getelementptr inbounds { i64, i16 }, ptr %6, i32 0, i32 0
  store i64 %0, ptr %15, align 8
  %16 = getelementptr inbounds { i64, i16 }, ptr %6, i32 0, i32 1
  store i16 %1, ptr %16, align 8
  %17 = getelementptr inbounds { i64, i16 }, ptr %7, i32 0, i32 0
  store i64 %2, ptr %17, align 8
  %18 = getelementptr inbounds { i64, i16 }, ptr %7, i32 0, i32 1
  store i16 %3, ptr %18, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %8, ptr align 8 %6, i64 16, i1 false), !tbaa.struct !5
  %19 = getelementptr inbounds %struct.extFloat80M, ptr %8, i32 0, i32 1
  %20 = load i16, ptr %19, align 8, !tbaa !12
  %21 = zext i16 %20 to i64
  store i64 %21, ptr %9, align 8, !tbaa !6
  %22 = getelementptr inbounds %struct.extFloat80M, ptr %8, i32 0, i32 0
  %23 = load i64, ptr %22, align 8, !tbaa !12
  store i64 %23, ptr %10, align 8, !tbaa !6
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %11, ptr align 8 %7, i64 16, i1 false), !tbaa.struct !5
  %24 = getelementptr inbounds %struct.extFloat80M, ptr %11, i32 0, i32 1
  %25 = load i16, ptr %24, align 8, !tbaa !12
  %26 = zext i16 %25 to i64
  store i64 %26, ptr %12, align 8, !tbaa !6
  %27 = getelementptr inbounds %struct.extFloat80M, ptr %11, i32 0, i32 0
  %28 = load i64, ptr %27, align 8, !tbaa !12
  store i64 %28, ptr %13, align 8, !tbaa !6
  %29 = load i64, ptr %9, align 8, !tbaa !6
  %30 = and i64 %29, 32767
  %31 = icmp eq i64 %30, 32767
  br i1 %31, label %32, label %36

32:                                               ; preds = %4
  %33 = load i64, ptr %10, align 8, !tbaa !6
  %34 = and i64 %33, 9223372036854775807
  %35 = icmp ne i64 %34, 0
  br i1 %35, label %44, label %36

36:                                               ; preds = %32, %4
  %37 = load i64, ptr %12, align 8, !tbaa !6
  %38 = and i64 %37, 32767
  %39 = icmp eq i64 %38, 32767
  br i1 %39, label %40, label %45

40:                                               ; preds = %36
  %41 = load i64, ptr %13, align 8, !tbaa !6
  %42 = and i64 %41, 9223372036854775807
  %43 = icmp ne i64 %42, 0
  br i1 %43, label %44, label %45

44:                                               ; preds = %40, %32
  call void @softfloat_raiseFlags(i8 noundef zeroext 16)
  store i1 false, ptr %5, align 1
  store i32 1, ptr %14, align 4
  br label %69

45:                                               ; preds = %40, %36
  %46 = load i64, ptr %10, align 8, !tbaa !6
  %47 = load i64, ptr %13, align 8, !tbaa !6
  %48 = icmp eq i64 %46, %47
  br i1 %48, label %49, label %67

49:                                               ; preds = %45
  %50 = load i64, ptr %9, align 8, !tbaa !6
  %51 = load i64, ptr %12, align 8, !tbaa !6
  %52 = icmp eq i64 %50, %51
  br i1 %52, label %65, label %53

53:                                               ; preds = %49
  %54 = load i64, ptr %10, align 8, !tbaa !6
  %55 = icmp ne i64 %54, 0
  br i1 %55, label %63, label %56

56:                                               ; preds = %53
  %57 = load i64, ptr %9, align 8, !tbaa !6
  %58 = load i64, ptr %12, align 8, !tbaa !6
  %59 = or i64 %57, %58
  %60 = and i64 %59, 32767
  %61 = icmp ne i64 %60, 0
  %62 = xor i1 %61, true
  br label %63

63:                                               ; preds = %56, %53
  %64 = phi i1 [ false, %53 ], [ %62, %56 ]
  br label %65

65:                                               ; preds = %63, %49
  %66 = phi i1 [ true, %49 ], [ %64, %63 ]
  br label %67

67:                                               ; preds = %65, %45
  %68 = phi i1 [ false, %45 ], [ %66, %65 ]
  store i1 %68, ptr %5, align 1
  store i32 1, ptr %14, align 4
  br label %69

69:                                               ; preds = %67, %44
  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 16, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #4
  %70 = load i1, ptr %5, align 1
  ret i1 %70
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

declare void @softfloat_raiseFlags(i8 noundef zeroext) #3

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 = !{i64 0, i64 8, !6, i64 8, i64 2, !10}
!6 = !{!7, !7, i64 0}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"short", !8, i64 0}
!12 = !{!8, !8, i64 0}


; 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"

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @extF80_eq_signaling(i64 %0, i16 %1, i64 %2, i16 %3) local_unnamed_addr #0 {
  %5 = zext i16 %1 to i64
  %6 = zext i16 %3 to i64
  %7 = and i64 %5, 32767
  %8 = icmp ne i64 %7, 32767
  %9 = and i64 %0, 9223372036854775807
  %.not = icmp eq i64 %9, 0
  %or.cond = select i1 %8, i1 true, i1 %.not
  br i1 %or.cond, label %10, label %14

10:                                               ; preds = %4
  %11 = and i64 %6, 32767
  %12 = icmp ne i64 %11, 32767
  %13 = and i64 %2, 9223372036854775807
  %.not22 = icmp eq i64 %13, 0
  %or.cond25 = select i1 %12, i1 true, i1 %.not22
  br i1 %or.cond25, label %15, label %14

14:                                               ; preds = %10, %4
  tail call void @softfloat_raiseFlags(i8 noundef zeroext 16) #2
  br label %23

15:                                               ; preds = %10
  %16 = icmp eq i64 %0, %2
  br i1 %16, label %17, label %23

17:                                               ; preds = %15
  %18 = icmp eq i16 %1, %3
  br i1 %18, label %23, label %19

19:                                               ; preds = %17
  %.not23 = icmp eq i64 %0, 0
  br i1 %.not23, label %20, label %23

20:                                               ; preds = %19
  %21 = or i64 %6, %5
  %22 = and i64 %21, 32767
  %.not24 = icmp eq i64 %22, 0
  br label %23

23:                                               ; preds = %15, %19, %20, %17, %14
  %.0 = phi i1 [ false, %14 ], [ false, %15 ], [ true, %17 ], [ false, %19 ], [ %.not24, %20 ]
  ret i1 %.0
}

declare void @softfloat_raiseFlags(i8 noundef zeroext) local_unnamed_addr #1

attributes #0 = { 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 #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 = { 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)"}


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