1 ; RUN: llc < %s -verify-machineinstrs -stackrealign -mtriple=x86_64-pc-windows-msvc19.11.0 -mattr=+avx,+cx16 | FileCheck %s
3 %struct.TestStruct = type { %union.Int128 }
4 %union.Int128 = type { i128 }
5 %struct.SomeArrays = type { %struct.SillyArray, %struct.SillyArray, %struct.SillyArray }
6 %struct.SillyArray = type { ptr, i32, i32 }
8 declare void @llvm.lifetime.start.p0(i64, ptr)
10 define void @foo(ptr %arg) align 2 personality ptr @__CxxFrameHandler3 {
11 ; Check that %rbx is being used for a frame pointer
13 ; CHECK: movq %rsp, %rbx
15 ; Check that %rbx is saved and restored around both lock cmpxchg16b.
16 ; CHECK: movq %rbx, %r9
17 ; CHECK-NEXT: movabsq $1393743441367457520, %rcx # imm = 0x135792468ABCDEF0
18 ; CHECK-NEXT: movq %rcx, %rax
19 ; CHECK-NEXT: movq %rcx, %rdx
20 ; CHECK-NEXT: movq %rcx, %rbx
21 ; CHECK-NEXT: lock cmpxchg16b (%r8)
22 ; CHECK-NEXT: movq %r9, %rbx
24 ; CHECK: movq %rbx, %r9
25 ; CHECK-NEXT: movq %rcx, %rax
26 ; CHECK-NEXT: movq %rcx, %rdx
27 ; CHECK-NEXT: movq %rcx, %rbx
28 ; CHECK-NEXT: lock cmpxchg16b (%r8)
29 ; CHECK-NEXT: movq %r9, %rbx
31 %i = alloca %struct.SomeArrays, align 8
32 %i1 = alloca %struct.SomeArrays, align 8
33 %i3 = cmpxchg ptr %arg, i128 25710028567316702934644703134494809840, i128 25710028567316702934644703134494809840 seq_cst seq_cst
34 %i4 = extractvalue { i128, i1 } %i3, 0
35 %i5 = trunc i128 %i4 to i64
36 %i6 = icmp eq i64 %i5, 0
37 br i1 %i6, label %bb9, label %bb7
40 %i8 = cmpxchg ptr %arg, i128 25710028567316702934644703134494809840, i128 25710028567316702934644703134494809840 seq_cst seq_cst
43 bb9: ; preds = %bb7, %bb
44 call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %i)
45 call void @llvm.memset.p0.i64(ptr nonnull align 8 dereferenceable(48) %i, i8 0, i64 48, i1 false)
46 call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %i1)
47 call void @llvm.memset.p0.i64(ptr nonnull align 8 dereferenceable(48) %i1, i8 0, i64 48, i1 false)
48 %i13 = invoke nonnull align 8 dereferenceable(48) ptr @"??4SomeArrays@@QEAAAEAU0@$$QEAU0@@Z"(ptr nonnull %i, ptr nonnull align 8 dereferenceable(48) %i1)
49 to label %bb14 unwind label %bb45
52 call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %i)
56 %i46 = cleanuppad within none []
57 %i47 = getelementptr inbounds %struct.SomeArrays, ptr %i1, i64 0, i32 2, i32 0
58 %i48 = load ptr, ptr %i47, align 8
59 invoke void @"?free@@YAXPEAX@Z"(ptr %i48) [ "funclet"(token %i46) ]
60 to label %bb51 unwind label %bb49
63 %i50 = cleanuppad within %i46 []
64 call void @__std_terminate() [ "funclet"(token %i50) ]
68 %i52 = getelementptr inbounds %struct.SomeArrays, ptr %i1, i64 0, i32 1, i32 0
69 %i53 = load ptr, ptr %i52, align 8
70 invoke void @"?free@@YAXPEAX@Z"(ptr %i53) [ "funclet"(token %i46) ]
71 to label %bb56 unwind label %bb54
74 %i55 = cleanuppad within %i46 []
75 call void @__std_terminate() [ "funclet"(token %i55) ]
79 call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %i)
80 cleanupret from %i46 unwind to caller
83 declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture)
85 declare void @llvm.memset.p0.i64(ptr, i8, i64, i1)
87 declare dso_local i32 @__CxxFrameHandler3(...)
89 declare nonnull align 8 dereferenceable(48) ptr @"??4SomeArrays@@QEAAAEAU0@$$QEAU0@@Z"(ptr, ptr nonnull align 8 dereferenceable(48)) align 2
91 declare void @"?free@@YAXPEAX@Z"(ptr)
93 declare void @__std_terminate()