1 ; RUN: llc < %s -verify-machineinstrs -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 { i8*, i32, i32 }
8 declare void @llvm.lifetime.start.p0i8(i64, i8*)
10 define void @foo(%struct.TestStruct* %arg) align 2 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
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 %i2 = getelementptr inbounds %struct.TestStruct, %struct.TestStruct* %arg, i64 0, i32 0, i32 0
34 %i3 = cmpxchg i128* %i2, i128 25710028567316702934644703134494809840, i128 25710028567316702934644703134494809840 seq_cst seq_cst
35 %i4 = extractvalue { i128, i1 } %i3, 0
36 %i5 = trunc i128 %i4 to i64
37 %i6 = icmp eq i64 %i5, 0
38 br i1 %i6, label %bb9, label %bb7
41 %i8 = cmpxchg i128* %i2, i128 25710028567316702934644703134494809840, i128 25710028567316702934644703134494809840 seq_cst seq_cst
44 bb9: ; preds = %bb7, %bb
45 %i10 = bitcast %struct.SomeArrays* %i to i8*
46 call void @llvm.lifetime.start.p0i8(i64 48, i8* nonnull %i10)
47 call void @llvm.memset.p0i8.i64(i8* nonnull align 8 dereferenceable(48) %i10, i8 0, i64 48, i1 false)
48 %i11 = bitcast %struct.SomeArrays* %i1 to i8*
49 call void @llvm.lifetime.start.p0i8(i64 48, i8* nonnull %i11)
50 %i12 = bitcast %struct.SomeArrays* %i1 to i8*
51 call void @llvm.memset.p0i8.i64(i8* nonnull align 8 dereferenceable(48) %i12, i8 0, i64 48, i1 false)
52 %i13 = invoke nonnull align 8 dereferenceable(48) %struct.SomeArrays* @"??4SomeArrays@@QEAAAEAU0@$$QEAU0@@Z"(%struct.SomeArrays* nonnull %i, %struct.SomeArrays* nonnull align 8 dereferenceable(48) %i1)
53 to label %bb14 unwind label %bb45
56 call void @llvm.lifetime.end.p0i8(i64 48, i8* nonnull %i10)
60 %i46 = cleanuppad within none []
61 %i47 = getelementptr inbounds %struct.SomeArrays, %struct.SomeArrays* %i1, i64 0, i32 2, i32 0
62 %i48 = load i8*, i8** %i47, align 8
63 invoke void @"?free@@YAXPEAX@Z"(i8* %i48) [ "funclet"(token %i46) ]
64 to label %bb51 unwind label %bb49
67 %i50 = cleanuppad within %i46 []
68 call void @__std_terminate() [ "funclet"(token %i50) ]
72 %i52 = getelementptr inbounds %struct.SomeArrays, %struct.SomeArrays* %i1, i64 0, i32 1, i32 0
73 %i53 = load i8*, i8** %i52, align 8
74 invoke void @"?free@@YAXPEAX@Z"(i8* %i53) [ "funclet"(token %i46) ]
75 to label %bb56 unwind label %bb54
78 %i55 = cleanuppad within %i46 []
79 call void @__std_terminate() [ "funclet"(token %i55) ]
83 call void @llvm.lifetime.end.p0i8(i64 48, i8* nonnull %i10)
84 cleanupret from %i46 unwind to caller
87 declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture)
89 declare void @llvm.memset.p0i8.i64(i8*, i8, i64, i1)
91 declare dso_local i32 @__CxxFrameHandler3(...)
93 declare nonnull align 8 dereferenceable(48) %struct.SomeArrays* @"??4SomeArrays@@QEAAAEAU0@$$QEAU0@@Z"(%struct.SomeArrays*, %struct.SomeArrays* nonnull align 8 dereferenceable(48)) align 2
95 declare void @"?free@@YAXPEAX@Z"(i8*)
97 declare void @__std_terminate()