139 lines · plain
1; RUN: llc < %s -mcpu=generic -enable-misched=false -mtriple=x86_64-mingw32 | FileCheck %s -check-prefix=M642; RUN: llc < %s -mcpu=generic -enable-misched=false -mtriple=x86_64-win32 | FileCheck %s -check-prefix=W643; RUN: llc < %s -mcpu=generic -enable-misched=false -mtriple=x86_64-win32 -code-model=large | FileCheck %s -check-prefix=L644; RUN: llc < %s -mcpu=generic -enable-misched=false -mtriple=x86_64-win32-macho | FileCheck %s -check-prefix=EFI5; PR87776; PR87787 8define i64 @unaligned(i64 %n, i64 %x) nounwind {9; M64-LABEL: unaligned:10; W64-LABEL: unaligned:11; EFI-LABEL: unaligned:12entry:13 14 %buf0 = alloca i8, i64 4096, align 115 16; ___chkstk_ms does not adjust %rsp.17; M64: $4096, %eax18; M64: callq ___chkstk_ms19; M64: subq %rax, %rsp20; M64: leaq 128(%rsp), %rbp21 22; __chkstk does not adjust %rsp.23; W64: $4096, %eax24; W64: callq __chkstk25; W64: subq %rax, %rsp26; W64: leaq 128(%rsp), %rbp27 28; Use %r11 for the large model.29; L64: $4096, %eax30; L64: movabsq $__chkstk, %r1131; L64: callq *%r1132; L64: subq %rax, %rsp33 34; Freestanding35; EFI: $[[B0OFS:4096|4104]], %rsp36; EFI-NOT: call37 38 %buf1 = alloca i8, i64 %n, align 139 40; M64: leaq 15(%{{.*}}), %rax41; M64: andq $-16, %rax42; M64: callq ___chkstk_ms43; M64: subq %rax, %rsp44; M64: movq %rsp, %rax45 46; W64: leaq 15(%{{.*}}), %rax47; W64: andq $-16, %rax48; W64: callq __chkstk49; W64: subq %rax, %rsp50; W64: movq %rsp, %rax51 52; L64: leaq 15(%{{.*}}), %rax53; L64: andq $-16, %rax54; L64: movabsq $__chkstk, %r1155; L64: callq *%r1156; L64: subq %rax, %rsp57; L64: movq %rsp, %rax58 59; EFI: leaq 15(%{{.*}}), [[R1:%r.*]]60; EFI: andq $-16, [[R1]]61; EFI: movq %rsp, [[R64:%r.*]]62; EFI: subq [[R1]], [[R64]]63; EFI: movq [[R64]], %rsp64 65 %r = call i64 @bar(i64 %n, i64 %x, i64 %n, ptr %buf0, ptr %buf1) nounwind66 67; M64: subq $48, %rsp68; M64: movq %rax, 32(%rsp)69; M64: leaq -128(%rbp), %r970; M64: callq bar71 72; W64: subq $48, %rsp73; W64: movq %rax, 32(%rsp)74; W64: leaq -128(%rbp), %r975; W64: callq bar76 77; EFI: subq $48, %rsp78; EFI: movq [[R64]], 32(%rsp)79; EFI: leaq -[[B0OFS]](%rbp), %r980; EFI: callq _bar81 82 ret i64 %r83 84; M64: leaq 3968(%rbp), %rsp85 86; W64: leaq 3968(%rbp), %rsp87 88}89 90define i64 @aligned(i64 %n, i64 %x) nounwind {91; M64-LABEL: aligned:92; W64-LABEL: aligned:93; EFI-LABEL: aligned:94entry:95 96 %buf1 = alloca i8, i64 %n, align 12897 98; M64: leaq 15(%{{.*}}), %rax99; M64: andq $-16, %rax100; M64: callq ___chkstk_ms101; M64: subq %rax, %rsp102; M64: movq %rsp, [[R2:%r.*]]103; M64: andq $-128, [[R2]]104; M64: movq [[R2]], %rsp105 106; W64: leaq 15(%{{.*}}), %rax107; W64: andq $-16, %rax108; W64: callq __chkstk109; W64: subq %rax, %rsp110; W64: movq %rsp, [[R2:%r.*]]111; W64: andq $-128, [[R2]]112; W64: movq [[R2]], %rsp113 114; EFI: leaq 15(%{{.*}}), [[R1:%r.*]]115; EFI: andq $-16, [[R1]]116; EFI: movq %rsp, [[R64:%r.*]]117; EFI: subq [[R1]], [[R64]]118; EFI: andq $-128, [[R64]]119; EFI: movq [[R64]], %rsp120 121 %r = call i64 @bar(i64 %n, i64 %x, i64 %n, ptr undef, ptr %buf1) nounwind122 123; M64: subq $48, %rsp124; M64: movq [[R2]], 32(%rsp)125; M64: callq bar126 127; W64: subq $48, %rsp128; W64: movq [[R2]], 32(%rsp)129; W64: callq bar130 131; EFI: subq $48, %rsp132; EFI: movq [[R64]], 32(%rsp)133; EFI: callq _bar134 135 ret i64 %r136}137 138declare i64 @bar(i64, i64, i64, ptr nocapture, ptr nocapture) nounwind139