| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py |
| ; RUN: llc < %s -mtriple=x86_64-- | FileCheck %s --check-prefixes=CHECK |
| ; RUN: llc < %s -mtriple=x86_64-- -mattr=+sbb-dep-breaking | FileCheck %s --check-prefixes=IDIOM |
| |
| %struct.y_s = type { ptr, ptr } |
| |
| define i32 @mallocbench_gs(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) nounwind { |
| ; CHECK-LABEL: mallocbench_gs: |
| ; CHECK: # %bb.0: |
| ; CHECK-NEXT: pushq %rbp |
| ; CHECK-NEXT: pushq %r15 |
| ; CHECK-NEXT: pushq %r14 |
| ; CHECK-NEXT: pushq %r12 |
| ; CHECK-NEXT: pushq %rbx |
| ; CHECK-NEXT: movl %r8d, %ebp |
| ; CHECK-NEXT: movl %ecx, %r14d |
| ; CHECK-NEXT: movl %edx, %r15d |
| ; CHECK-NEXT: movq %rsi, %rbx |
| ; CHECK-NEXT: movq %rdi, %r12 |
| ; CHECK-NEXT: movq (%rsi), %rdi |
| ; CHECK-NEXT: movq 8(%rsi), %rsi |
| ; CHECK-NEXT: movq %rbx, %rdx |
| ; CHECK-NEXT: callq foo1@PLT |
| ; CHECK-NEXT: movq 8(%rbx), %rax |
| ; CHECK-NEXT: movq (%rax), %rax |
| ; CHECK-NEXT: xorl %r10d, %r10d |
| ; CHECK-NEXT: movl %ebp, %ecx |
| ; CHECK-NEXT: negl %ecx |
| ; CHECK-NEXT: movl $0, %r11d |
| ; CHECK-NEXT: sbbq %r11, %r11 |
| ; CHECK-NEXT: orq %rax, %r11 |
| ; CHECK-NEXT: cmpl $1, %ebp |
| ; CHECK-NEXT: sbbq %r10, %r10 |
| ; CHECK-NEXT: orq %rax, %r10 |
| ; CHECK-NEXT: subq $8, %rsp |
| ; CHECK-NEXT: movq %r12, %rdi |
| ; CHECK-NEXT: movl %r15d, %esi |
| ; CHECK-NEXT: movl %r14d, %edx |
| ; CHECK-NEXT: xorl %ecx, %ecx |
| ; CHECK-NEXT: xorl %r8d, %r8d |
| ; CHECK-NEXT: xorl %r9d, %r9d |
| ; CHECK-NEXT: pushq %r10 |
| ; CHECK-NEXT: pushq %r11 |
| ; CHECK-NEXT: pushq %rbx |
| ; CHECK-NEXT: callq foo2@PLT |
| ; CHECK-NEXT: addq $32, %rsp |
| ; CHECK-NEXT: popq %rbx |
| ; CHECK-NEXT: popq %r12 |
| ; CHECK-NEXT: popq %r14 |
| ; CHECK-NEXT: popq %r15 |
| ; CHECK-NEXT: popq %rbp |
| ; CHECK-NEXT: retq |
| ; |
| ; IDIOM-LABEL: mallocbench_gs: |
| ; IDIOM: # %bb.0: |
| ; IDIOM-NEXT: pushq %rbp |
| ; IDIOM-NEXT: pushq %r15 |
| ; IDIOM-NEXT: pushq %r14 |
| ; IDIOM-NEXT: pushq %r12 |
| ; IDIOM-NEXT: pushq %rbx |
| ; IDIOM-NEXT: movl %r8d, %ebp |
| ; IDIOM-NEXT: movl %ecx, %r14d |
| ; IDIOM-NEXT: movl %edx, %r15d |
| ; IDIOM-NEXT: movq %rsi, %rbx |
| ; IDIOM-NEXT: movq %rdi, %r12 |
| ; IDIOM-NEXT: movq (%rsi), %rdi |
| ; IDIOM-NEXT: movq 8(%rsi), %rsi |
| ; IDIOM-NEXT: movq %rbx, %rdx |
| ; IDIOM-NEXT: callq foo1@PLT |
| ; IDIOM-NEXT: movq 8(%rbx), %rax |
| ; IDIOM-NEXT: movq (%rax), %rax |
| ; IDIOM-NEXT: movl %ebp, %ecx |
| ; IDIOM-NEXT: negl %ecx |
| ; IDIOM-NEXT: sbbq %r10, %r10 |
| ; IDIOM-NEXT: orq %rax, %r10 |
| ; IDIOM-NEXT: cmpl $1, %ebp |
| ; IDIOM-NEXT: sbbq %r11, %r11 |
| ; IDIOM-NEXT: orq %rax, %r11 |
| ; IDIOM-NEXT: subq $8, %rsp |
| ; IDIOM-NEXT: movq %r12, %rdi |
| ; IDIOM-NEXT: movl %r15d, %esi |
| ; IDIOM-NEXT: movl %r14d, %edx |
| ; IDIOM-NEXT: xorl %ecx, %ecx |
| ; IDIOM-NEXT: xorl %r8d, %r8d |
| ; IDIOM-NEXT: xorl %r9d, %r9d |
| ; IDIOM-NEXT: pushq %r11 |
| ; IDIOM-NEXT: pushq %r10 |
| ; IDIOM-NEXT: pushq %rbx |
| ; IDIOM-NEXT: callq foo2@PLT |
| ; IDIOM-NEXT: addq $32, %rsp |
| ; IDIOM-NEXT: popq %rbx |
| ; IDIOM-NEXT: popq %r12 |
| ; IDIOM-NEXT: popq %r14 |
| ; IDIOM-NEXT: popq %r15 |
| ; IDIOM-NEXT: popq %rbp |
| ; IDIOM-NEXT: retq |
| %6 = load ptr, ptr %1, align 8 |
| %7 = getelementptr inbounds %struct.y_s, ptr %1, i64 0, i32 1 |
| %8 = load ptr, ptr %7, align 8 |
| tail call void @foo1(ptr noundef %6, ptr noundef %8, ptr noundef %1) |
| %9 = icmp eq i32 %4, 0 |
| %10 = load ptr, ptr %7, align 8 |
| %11 = load i64, ptr %10, align 8 |
| %12 = select i1 %9, i64 %11, i64 -1 |
| %13 = select i1 %9, i64 -1, i64 %11 |
| %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) |
| ret i32 %14 |
| } |
| |
| declare void @foo1(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1 |
| 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 |