1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-- | FileCheck %s --check-prefixes=CHECK
3 ; RUN: llc < %s -mtriple=x86_64-- -mattr=+sbb-dep-breaking | FileCheck %s --check-prefixes=IDIOM
5 %struct.y_s = type { ptr, ptr }
7 define i32 @mallocbench_gs(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) nounwind {
8 ; CHECK-LABEL: mallocbench_gs:
10 ; CHECK-NEXT: pushq %rbp
11 ; CHECK-NEXT: pushq %r15
12 ; CHECK-NEXT: pushq %r14
13 ; CHECK-NEXT: pushq %r12
14 ; CHECK-NEXT: pushq %rbx
15 ; CHECK-NEXT: movl %r8d, %ebp
16 ; CHECK-NEXT: movl %ecx, %r14d
17 ; CHECK-NEXT: movl %edx, %r15d
18 ; CHECK-NEXT: movq %rsi, %rbx
19 ; CHECK-NEXT: movq %rdi, %r12
20 ; CHECK-NEXT: movq (%rsi), %rdi
21 ; CHECK-NEXT: movq 8(%rsi), %rsi
22 ; CHECK-NEXT: movq %rbx, %rdx
23 ; CHECK-NEXT: callq foo1@PLT
24 ; CHECK-NEXT: movq 8(%rbx), %rax
25 ; CHECK-NEXT: movq (%rax), %rax
26 ; CHECK-NEXT: xorl %r10d, %r10d
27 ; CHECK-NEXT: movl %ebp, %ecx
28 ; CHECK-NEXT: negl %ecx
29 ; CHECK-NEXT: movl $0, %r11d
30 ; CHECK-NEXT: sbbq %r11, %r11
31 ; CHECK-NEXT: orq %rax, %r11
32 ; CHECK-NEXT: cmpl $1, %ebp
33 ; CHECK-NEXT: sbbq %r10, %r10
34 ; CHECK-NEXT: orq %rax, %r10
35 ; CHECK-NEXT: subq $8, %rsp
36 ; CHECK-NEXT: movq %r12, %rdi
37 ; CHECK-NEXT: movl %r15d, %esi
38 ; CHECK-NEXT: movl %r14d, %edx
39 ; CHECK-NEXT: xorl %ecx, %ecx
40 ; CHECK-NEXT: xorl %r8d, %r8d
41 ; CHECK-NEXT: xorl %r9d, %r9d
42 ; CHECK-NEXT: pushq %r10
43 ; CHECK-NEXT: pushq %r11
44 ; CHECK-NEXT: pushq %rbx
45 ; CHECK-NEXT: callq foo2@PLT
46 ; CHECK-NEXT: addq $32, %rsp
47 ; CHECK-NEXT: popq %rbx
48 ; CHECK-NEXT: popq %r12
49 ; CHECK-NEXT: popq %r14
50 ; CHECK-NEXT: popq %r15
51 ; CHECK-NEXT: popq %rbp
54 ; IDIOM-LABEL: mallocbench_gs:
56 ; IDIOM-NEXT: pushq %rbp
57 ; IDIOM-NEXT: pushq %r15
58 ; IDIOM-NEXT: pushq %r14
59 ; IDIOM-NEXT: pushq %r12
60 ; IDIOM-NEXT: pushq %rbx
61 ; IDIOM-NEXT: movl %r8d, %ebp
62 ; IDIOM-NEXT: movl %ecx, %r14d
63 ; IDIOM-NEXT: movl %edx, %r15d
64 ; IDIOM-NEXT: movq %rsi, %rbx
65 ; IDIOM-NEXT: movq %rdi, %r12
66 ; IDIOM-NEXT: movq (%rsi), %rdi
67 ; IDIOM-NEXT: movq 8(%rsi), %rsi
68 ; IDIOM-NEXT: movq %rbx, %rdx
69 ; IDIOM-NEXT: callq foo1@PLT
70 ; IDIOM-NEXT: movq 8(%rbx), %rax
71 ; IDIOM-NEXT: movq (%rax), %rax
72 ; IDIOM-NEXT: movl %ebp, %ecx
73 ; IDIOM-NEXT: negl %ecx
74 ; IDIOM-NEXT: sbbq %r10, %r10
75 ; IDIOM-NEXT: orq %rax, %r10
76 ; IDIOM-NEXT: cmpl $1, %ebp
77 ; IDIOM-NEXT: sbbq %r11, %r11
78 ; IDIOM-NEXT: orq %rax, %r11
79 ; IDIOM-NEXT: subq $8, %rsp
80 ; IDIOM-NEXT: movq %r12, %rdi
81 ; IDIOM-NEXT: movl %r15d, %esi
82 ; IDIOM-NEXT: movl %r14d, %edx
83 ; IDIOM-NEXT: xorl %ecx, %ecx
84 ; IDIOM-NEXT: xorl %r8d, %r8d
85 ; IDIOM-NEXT: xorl %r9d, %r9d
86 ; IDIOM-NEXT: pushq %r11
87 ; IDIOM-NEXT: pushq %r10
88 ; IDIOM-NEXT: pushq %rbx
89 ; IDIOM-NEXT: callq foo2@PLT
90 ; IDIOM-NEXT: addq $32, %rsp
91 ; IDIOM-NEXT: popq %rbx
92 ; IDIOM-NEXT: popq %r12
93 ; IDIOM-NEXT: popq %r14
94 ; IDIOM-NEXT: popq %r15
95 ; IDIOM-NEXT: popq %rbp
97 %6 = load ptr, ptr %1, align 8
98 %7 = getelementptr inbounds %struct.y_s, ptr %1, i64 0, i32 1
99 %8 = load ptr, ptr %7, align 8
100 tail call void @foo1(ptr noundef %6, ptr noundef %8, ptr noundef %1)
101 %9 = icmp eq i32 %4, 0
102 %10 = load ptr, ptr %7, align 8
103 %11 = load i64, ptr %10, align 8
104 %12 = select i1 %9, i64 %11, i64 -1
105 %13 = select i1 %9, i64 -1, i64 %11
106 %14 = tail call noundef i32 @foo2(ptr noundef %0, i32 noundef %2, i32 noundef %3, i32 noundef 0, i32 noundef 0, i32 noundef 0, ptr noundef nonnull %1, i64 noundef %12, i64 noundef %13)
110 declare void @foo1(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1
111 declare noundef i32 @foo2(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #1