brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.3 KiB · 05d3f70 Raw
153 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 52; RUN: llc --mtriple=x86_64-- < %s | FileCheck --check-prefix=X64 %s3; RUN: llc --mtriple=i386-- < %s | FileCheck --check-prefix=X86 %s4 5; This test is to ensure rbp/rbx/ebp/esi is correctly saved/restored before clobbered when enable ipra.6 7define internal void @callee_clobber_rbp() nounwind norecurse {8; X64-LABEL: callee_clobber_rbp:9; X64:       # %bb.0:10; X64-NEXT:    pushq %rbp11; X64-NEXT:    #APP12; X64-NEXT:    xorl %ebp, %ebp13; X64-NEXT:    #NO_APP14; X64-NEXT:    popq %rbp15; X64-NEXT:    retq16;17; X86-LABEL: callee_clobber_rbp:18; X86:       # %bb.0:19; X86-NEXT:    pushl %ebp20; X86-NEXT:    #APP21; X86-NEXT:    xorl %ebp, %ebp22; X86-NEXT:    #NO_APP23; X86-NEXT:    popl %ebp24; X86-NEXT:    retl25  call void asm sideeffect "xor %ebp, %ebp", "~{ebp}"()26  ret void27}28 29define internal void @callee_clobber_rbx(ptr %addr) nounwind norecurse {30; X64-LABEL: callee_clobber_rbx:31; X64:       # %bb.0:32; X64-NEXT:    pushq %rbx33; X64-NEXT:    #APP34; X64-NEXT:    xorl %ebx, %ebx35; X64-NEXT:    #NO_APP36; X64-NEXT:    popq %rbx37; X64-NEXT:    retq38  call void asm sideeffect "xor %ebx, %ebx", "~{ebx}"()39  ret void40}41 42define internal void @callee_clobber_esi(ptr %addr) nounwind norecurse {43; X86-LABEL: callee_clobber_esi:44; X86:       # %bb.0:45; X86-NEXT:    pushl %esi46; X86-NEXT:    #APP47; X86-NEXT:    xorl %esi, %esi48; X86-NEXT:    #NO_APP49; X86-NEXT:    popl %esi50; X86-NEXT:    retl51  call void asm sideeffect "xor %esi, %esi", "~{esi}"()52  ret void53}54 55define void @caller_use_rbp() "frame-pointer"="all" nounwind {56; X64-LABEL: caller_use_rbp:57; X64:       # %bb.0:58; X64-NEXT:    pushq %rbp59; X64-NEXT:    movq %rsp, %rbp60; X64-NEXT:    subq $16, %rsp61; X64-NEXT:    callq callee_clobber_rbp62; X64-NEXT:    movl $5, -4(%rbp)63; X64-NEXT:    addq $16, %rsp64; X64-NEXT:    popq %rbp65; X64-NEXT:    retq66;67; X86-LABEL: caller_use_rbp:68; X86:       # %bb.0:69; X86-NEXT:    pushl %ebp70; X86-NEXT:    movl %esp, %ebp71; X86-NEXT:    pushl %eax72; X86-NEXT:    calll callee_clobber_rbp73; X86-NEXT:    movl $5, -4(%ebp)74; X86-NEXT:    addl $4, %esp75; X86-NEXT:    popl %ebp76; X86-NEXT:    retl77  call void @callee_clobber_rbp()78  %addr = alloca i32, align 479  store i32 5, ptr %addr, align 480  ret void81}82 83define void @caller_use_rbx(i32 %X) nounwind ssp {84; X64-LABEL: caller_use_rbx:85; X64:       # %bb.0:86; X64-NEXT:    pushq %rbp87; X64-NEXT:    movq %rsp, %rbp88; X64-NEXT:    pushq %rbx89; X64-NEXT:    andq $-32, %rsp90; X64-NEXT:    subq $64, %rsp91; X64-NEXT:    movq %rsp, %rbx92; X64-NEXT:    movq __stack_chk_guard(%rip), %rax93; X64-NEXT:    movq %rax, 32(%rbx)94; X64-NEXT:    movq %rsp, %rax95; X64-NEXT:    movl %edi, %ecx96; X64-NEXT:    leaq 15(,%rcx,4), %rcx97; X64-NEXT:    andq $-16, %rcx98; X64-NEXT:    subq %rcx, %rax99; X64-NEXT:    movq %rax, %rsp100; X64-NEXT:    movq %rbx, %rdi101; X64-NEXT:    callq callee_clobber_rbx102; X64-NEXT:    movq __stack_chk_guard(%rip), %rax103; X64-NEXT:    cmpq 32(%rbx), %rax104; X64-NEXT:    jne .LBB4_2105; X64-NEXT:  # %bb.1:106; X64-NEXT:    leaq -8(%rbp), %rsp107; X64-NEXT:    popq %rbx108; X64-NEXT:    popq %rbp109; X64-NEXT:    retq110; X64-NEXT:  .LBB4_2:111; X64-NEXT:    callq __stack_chk_fail@PLT112  %realign = alloca i32, align 32113  %addr = alloca i32, i32 %X114  call void @callee_clobber_rbx(ptr %realign)115  ret void116}117 118define void @caller_use_esi(i32 %X) nounwind ssp {119; X86-LABEL: caller_use_esi:120; X86:       # %bb.0:121; X86-NEXT:    pushl %ebp122; X86-NEXT:    movl %esp, %ebp123; X86-NEXT:    pushl %esi124; X86-NEXT:    andl $-32, %esp125; X86-NEXT:    subl $32, %esp126; X86-NEXT:    movl %esp, %esi127; X86-NEXT:    movl 8(%ebp), %eax128; X86-NEXT:    movl __stack_chk_guard, %ecx129; X86-NEXT:    movl %ecx, 16(%esi)130; X86-NEXT:    movl %esp, %ecx131; X86-NEXT:    shll $2, %eax132; X86-NEXT:    subl %eax, %ecx133; X86-NEXT:    movl %ecx, %esp134; X86-NEXT:    movl %esi, %eax135; X86-NEXT:    pushl %eax136; X86-NEXT:    calll callee_clobber_esi137; X86-NEXT:    addl $4, %esp138; X86-NEXT:    movl __stack_chk_guard, %eax139; X86-NEXT:    cmpl 16(%esi), %eax140; X86-NEXT:    jne .LBB5_2141; X86-NEXT:  # %bb.1:142; X86-NEXT:    leal -4(%ebp), %esp143; X86-NEXT:    popl %esi144; X86-NEXT:    popl %ebp145; X86-NEXT:    retl146; X86-NEXT:  .LBB5_2:147; X86-NEXT:    calll __stack_chk_fail148  %realign = alloca i32, align 32149  %addr = alloca i32, i32 %X150  call void @callee_clobber_esi(ptr %realign)151  ret void152}153