1; RUN: llc < %s -mcpu=generic -mtriple=i686-linux -verify-machineinstrs | FileCheck %s -check-prefix=X32-Linux 2; RUN: llc < %s -mcpu=generic -mtriple=x86_64-linux -verify-machineinstrs | FileCheck %s -check-prefix=X64-Linux 3; RUN: llc < %s -mcpu=generic -mtriple=x86_64-linux -code-model=large -verify-machineinstrs | FileCheck %s -check-prefix=X64-Linux-Large 4; RUN: llc < %s -mcpu=generic -mtriple=x86_64-linux-gnux32 -verify-machineinstrs | FileCheck %s -check-prefix=X32ABI 5; RUN: llc < %s -mcpu=generic -mtriple=i686-darwin -verify-machineinstrs | FileCheck %s -check-prefix=X32-Darwin 6; RUN: llc < %s -mcpu=generic -mtriple=x86_64-darwin -verify-machineinstrs | FileCheck %s -check-prefix=X64-Darwin 7; RUN: llc < %s -mcpu=generic -mtriple=i686-mingw32 -verify-machineinstrs | FileCheck %s -check-prefix=X32-MinGW 8; RUN: llc < %s -mcpu=generic -mtriple=x86_64-freebsd -verify-machineinstrs | FileCheck %s -check-prefix=X64-FreeBSD 9; RUN: llc < %s -mcpu=generic -mtriple=i686-dragonfly -verify-machineinstrs | FileCheck %s -check-prefix=X32-DFlyBSD 10; RUN: llc < %s -mcpu=generic -mtriple=x86_64-dragonfly -verify-machineinstrs | FileCheck %s -check-prefix=X64-DFlyBSD 11; RUN: llc < %s -mcpu=generic -mtriple=x86_64-mingw32 -verify-machineinstrs | FileCheck %s -check-prefix=X64-MinGW 12 13; We used to crash with filetype=obj 14; RUN: llc < %s -mcpu=generic -mtriple=i686-linux -filetype=obj -o /dev/null 15; RUN: llc < %s -mcpu=generic -mtriple=x86_64-linux -filetype=obj -o /dev/null 16; RUN: llc < %s -mcpu=generic -mtriple=x86_64-linux-gnux32 -filetype=obj -o /dev/null 17; RUN: llc < %s -mcpu=generic -mtriple=i686-darwin -filetype=obj -o /dev/null 18; RUN: llc < %s -mcpu=generic -mtriple=x86_64-darwin -filetype=obj -o /dev/null 19; RUN: llc < %s -mcpu=generic -mtriple=i686-mingw32 -filetype=obj -o /dev/null 20; RUN: llc < %s -mcpu=generic -mtriple=x86_64-freebsd -filetype=obj -o /dev/null 21; RUN: llc < %s -mcpu=generic -mtriple=i686-dragonfly -filetype=obj -o /dev/null 22; RUN: llc < %s -mcpu=generic -mtriple=x86_64-dragonfly -filetype=obj -o /dev/null 23; RUN: llc < %s -mcpu=generic -mtriple=x86_64-mingw32 -filetype=obj -o /dev/null 24 25; RUN: not llc < %s -mcpu=generic -mtriple=x86_64-solaris 2> %t.log 26; RUN: FileCheck %s -input-file=%t.log -check-prefix=X64-Solaris 27; RUN: not llc < %s -mcpu=generic -mtriple=i686-freebsd 2> %t.log 28; RUN: FileCheck %s -input-file=%t.log -check-prefix=X32-FreeBSD 29 30; X64-Solaris: Segmented stacks not supported on this platform 31; X32-FreeBSD: Segmented stacks not supported on FreeBSD i386 32 33; Just to prevent the alloca from being optimized away 34declare void @dummy_use(i32*, i32) 35 36define void @test_basic() #0 { 37 %mem = alloca i32, i32 10 38 call void @dummy_use (i32* %mem, i32 10) 39 ret void 40 41; X32-Linux-LABEL: test_basic: 42 43; X32-Linux: cmpl %gs:48, %esp 44; X32-Linux-NEXT: jbe .LBB0_1 45 46; X32-Linux: pushl $0 47; X32-Linux-NEXT: pushl $44 48; X32-Linux-NEXT: calll __morestack 49; X32-Linux-NEXT: ret 50 51; X64-Linux-LABEL: test_basic: 52 53; X64-Linux: cmpq %fs:112, %rsp 54; X64-Linux-NEXT: jbe .LBB0_1 55 56; X64-Linux: movabsq $40, %r10 57; X64-Linux-NEXT: movabsq $0, %r11 58; X64-Linux-NEXT: callq __morestack 59; X64-Linux-NEXT: ret 60 61; X64-Linux-Large-LABEL: test_basic: 62 63; X64-Linux-Large: cmpq %fs:112, %rsp 64; X64-Linux-Large-NEXT: jbe .LBB0_1 65 66; X64-Linux-Large: movabsq $40, %r10 67; X64-Linux-Large-NEXT: movabsq $0, %r11 68; X64-Linux-Large-NEXT: callq *__morestack_addr(%rip) 69; X64-Linux-Large-NEXT: ret 70 71; X32ABI-LABEL: test_basic: 72 73; X32ABI: cmpl %fs:64, %esp 74; X32ABI-NEXT: jbe .LBB0_1 75 76; X32ABI: movl $40, %r10d 77; X32ABI-NEXT: movl $0, %r11d 78; X32ABI-NEXT: callq __morestack 79; X32ABI-NEXT: ret 80 81; X32-Darwin-LABEL: test_basic: 82 83; X32-Darwin: movl $432, %ecx 84; X32-Darwin-NEXT: cmpl %gs:(%ecx), %esp 85; X32-Darwin-NEXT: jbe LBB0_1 86 87; X32-Darwin: pushl $0 88; X32-Darwin-NEXT: pushl $60 89; X32-Darwin-NEXT: calll ___morestack 90; X32-Darwin-NEXT: ret 91 92; X64-Darwin-LABEL: test_basic: 93 94; X64-Darwin: cmpq %gs:816, %rsp 95; X64-Darwin-NEXT: jbe LBB0_1 96 97; X64-Darwin: movabsq $40, %r10 98; X64-Darwin-NEXT: movabsq $0, %r11 99; X64-Darwin-NEXT: callq ___morestack 100; X64-Darwin-NEXT: ret 101 102; X32-MinGW-LABEL: test_basic: 103 104; X32-MinGW: cmpl %fs:20, %esp 105; X32-MinGW-NEXT: jbe LBB0_1 106 107; X32-MinGW: pushl $0 108; X32-MinGW-NEXT: pushl $40 109; X32-MinGW-NEXT: calll ___morestack 110; X32-MinGW-NEXT: ret 111 112; X64-MinGW-LABEL: test_basic: 113 114; X64-MinGW: cmpq %gs:40, %rsp 115; X64-MinGW-NEXT: jbe .LBB0_1 116 117; X64-MinGW: movabsq $72, %r10 118; X64-MinGW-NEXT: movabsq $32, %r11 119; X64-MinGW-NEXT: callq __morestack 120; X64-MinGW-NEXT: retq 121 122; X64-FreeBSD-LABEL: test_basic: 123 124; X64-FreeBSD: cmpq %fs:24, %rsp 125; X64-FreeBSD-NEXT: jbe .LBB0_1 126 127; X64-FreeBSD: movabsq $40, %r10 128; X64-FreeBSD-NEXT: movabsq $0, %r11 129; X64-FreeBSD-NEXT: callq __morestack 130; X64-FreeBSD-NEXT: ret 131 132; X32-DFlyBSD-LABEL: test_basic: 133 134; X32-DFlyBSD: cmpl %fs:16, %esp 135; X32-DFlyBSD-NEXT: jbe .LBB0_1 136 137; X32-DFlyBSD: pushl $0 138; X32-DFlyBSD-NEXT: pushl $40 139; X32-DFlyBSD-NEXT: calll __morestack 140; X32-DFlyBSD-NEXT: ret 141 142; X64-DFlyBSD-LABEL: test_basic: 143 144; X64-DFlyBSD: cmpq %fs:32, %rsp 145; X64-DFlyBSD-NEXT: jbe .LBB0_1 146 147; X64-DFlyBSD: movabsq $40, %r10 148; X64-DFlyBSD-NEXT: movabsq $0, %r11 149; X64-DFlyBSD-NEXT: callq __morestack 150; X64-DFlyBSD-NEXT: ret 151 152} 153 154define i32 @test_nested(i32 * nest %closure, i32 %other) #0 { 155 %addend = load i32 , i32 * %closure 156 %result = add i32 %other, %addend 157 %mem = alloca i32, i32 10 158 call void @dummy_use (i32* %mem, i32 10) 159 ret i32 %result 160 161; X32-Linux: cmpl %gs:48, %esp 162; X32-Linux-NEXT: jbe .LBB1_1 163 164; X32-Linux: pushl $4 165; X32-Linux-NEXT: pushl $44 166; X32-Linux-NEXT: calll __morestack 167; X32-Linux-NEXT: ret 168 169; X64-Linux: cmpq %fs:112, %rsp 170; X64-Linux-NEXT: jbe .LBB1_1 171 172; X64-Linux: movq %r10, %rax 173; X64-Linux-NEXT: movabsq $56, %r10 174; X64-Linux-NEXT: movabsq $0, %r11 175; X64-Linux-NEXT: callq __morestack 176; X64-Linux-NEXT: ret 177; X64-Linux-NEXT: movq %rax, %r10 178 179; X32ABI: cmpl %fs:64, %esp 180; X32ABI-NEXT: jbe .LBB1_1 181 182; X32ABI: movl %r10d, %eax 183; X32ABI-NEXT: movl $56, %r10d 184; X32ABI-NEXT: movl $0, %r11d 185; X32ABI-NEXT: callq __morestack 186; X32ABI-NEXT: ret 187; X32ABI-NEXT: movq %rax, %r10 188 189; X32-Darwin: movl $432, %edx 190; X32-Darwin-NEXT: cmpl %gs:(%edx), %esp 191; X32-Darwin-NEXT: jbe LBB1_1 192 193; X32-Darwin: pushl $4 194; X32-Darwin-NEXT: pushl $60 195; X32-Darwin-NEXT: calll ___morestack 196; X32-Darwin-NEXT: ret 197 198; X64-Darwin: cmpq %gs:816, %rsp 199; X64-Darwin-NEXT: jbe LBB1_1 200 201; X64-Darwin: movq %r10, %rax 202; X64-Darwin-NEXT: movabsq $56, %r10 203; X64-Darwin-NEXT: movabsq $0, %r11 204; X64-Darwin-NEXT: callq ___morestack 205; X64-Darwin-NEXT: ret 206; X64-Darwin-NEXT: movq %rax, %r10 207 208; X32-MinGW: cmpl %fs:20, %esp 209; X32-MinGW-NEXT: jbe LBB1_1 210 211; X32-MinGW: pushl $4 212; X32-MinGW-NEXT: pushl $44 213; X32-MinGW-NEXT: calll ___morestack 214; X32-MinGW-NEXT: ret 215 216; X64-MinGW-LABEL: test_nested: 217; X64-MinGW: cmpq %gs:40, %rsp 218; X64-MinGW-NEXT: jbe .LBB1_1 219 220; X64-MinGW: movq %r10, %rax 221; X64-MinGW-NEXT: movabsq $88, %r10 222; X64-MinGW-NEXT: movabsq $32, %r11 223; X64-MinGW-NEXT: callq __morestack 224; X64-MinGW-NEXT: retq 225; X64-MinGW-NEXT: movq %rax, %r10 226 227; X64-FreeBSD: cmpq %fs:24, %rsp 228; X64-FreeBSD-NEXT: jbe .LBB1_1 229 230; X64-FreeBSD: movq %r10, %rax 231; X64-FreeBSD-NEXT: movabsq $56, %r10 232; X64-FreeBSD-NEXT: movabsq $0, %r11 233; X64-FreeBSD-NEXT: callq __morestack 234; X64-FreeBSD-NEXT: ret 235; X64-FreeBSD-NEXT: movq %rax, %r10 236 237; X32-DFlyBSD: cmpl %fs:16, %esp 238; X32-DFlyBSD-NEXT: jbe .LBB1_1 239 240; X32-DFlyBSD: pushl $4 241; X32-DFlyBSD-NEXT: pushl $44 242; X32-DFlyBSD-NEXT: calll __morestack 243; X32-DFlyBSD-NEXT: ret 244 245; X64-DFlyBSD: cmpq %fs:32, %rsp 246; X64-DFlyBSD-NEXT: jbe .LBB1_1 247 248; X64-DFlyBSD: movq %r10, %rax 249; X64-DFlyBSD-NEXT: movabsq $56, %r10 250; X64-DFlyBSD-NEXT: movabsq $0, %r11 251; X64-DFlyBSD-NEXT: callq __morestack 252; X64-DFlyBSD-NEXT: ret 253; X64-DFlyBSD-NEXT: movq %rax, %r10 254 255} 256 257define void @test_large() #0 { 258 %mem = alloca i32, i32 10000 259 call void @dummy_use (i32* %mem, i32 3) 260 ret void 261 262; X32-Linux-LABEL: test_large: 263 264; X32-Linux: leal -40012(%esp), %ecx 265; X32-Linux-NEXT: cmpl %gs:48, %ecx 266; X32-Linux-NEXT: jbe .LBB2_1 267 268; X32-Linux: pushl $0 269; X32-Linux-NEXT: pushl $40012 270; X32-Linux-NEXT: calll __morestack 271; X32-Linux-NEXT: ret 272 273; X64-Linux: leaq -40008(%rsp), %r11 274; X64-Linux-NEXT: cmpq %fs:112, %r11 275; X64-Linux-NEXT: jbe .LBB2_1 276 277; X64-Linux: movabsq $40008, %r10 278; X64-Linux-NEXT: movabsq $0, %r11 279; X64-Linux-NEXT: callq __morestack 280; X64-Linux-NEXT: ret 281 282; X32ABI: leal -40008(%rsp), %r11d 283; X32ABI-NEXT: cmpl %fs:64, %r11d 284; X32ABI-NEXT: jbe .LBB2_1 285 286; X32ABI: movl $40008, %r10d 287; X32ABI-NEXT: movl $0, %r11d 288; X32ABI-NEXT: callq __morestack 289; X32ABI-NEXT: ret 290 291; X32-Darwin: leal -40012(%esp), %ecx 292; X32-Darwin-NEXT: movl $432, %eax 293; X32-Darwin-NEXT: cmpl %gs:(%eax), %ecx 294; X32-Darwin-NEXT: jbe LBB2_1 295 296; X32-Darwin: pushl $0 297; X32-Darwin-NEXT: pushl $40012 298; X32-Darwin-NEXT: calll ___morestack 299; X32-Darwin-NEXT: ret 300 301; X64-Darwin: leaq -40008(%rsp), %r11 302; X64-Darwin-NEXT: cmpq %gs:816, %r11 303; X64-Darwin-NEXT: jbe LBB2_1 304 305; X64-Darwin: movabsq $40008, %r10 306; X64-Darwin-NEXT: movabsq $0, %r11 307; X64-Darwin-NEXT: callq ___morestack 308; X64-Darwin-NEXT: ret 309 310; X32-MinGW: leal -40000(%esp), %ecx 311; X32-MinGW-NEXT: cmpl %fs:20, %ecx 312; X32-MinGW-NEXT: jbe LBB2_1 313 314; X32-MinGW: pushl $0 315; X32-MinGW-NEXT: pushl $40000 316; X32-MinGW-NEXT: calll ___morestack 317; X32-MinGW-NEXT: ret 318 319; X64-MinGW-LABEL: test_large: 320; X64-MinGW: leaq -40040(%rsp), %r11 321; X64-MinGW-NEXT: cmpq %gs:40, %r11 322; X64-MinGW-NEXT: jbe .LBB2_1 323 324; X64-MinGW: movabsq $40040, %r10 325; X64-MinGW-NEXT: movabsq $32, %r11 326; X64-MinGW-NEXT: callq __morestack 327; X64-MinGW-NEXT: retq 328 329; X64-FreeBSD: leaq -40008(%rsp), %r11 330; X64-FreeBSD-NEXT: cmpq %fs:24, %r11 331; X64-FreeBSD-NEXT: jbe .LBB2_1 332 333; X64-FreeBSD: movabsq $40008, %r10 334; X64-FreeBSD-NEXT: movabsq $0, %r11 335; X64-FreeBSD-NEXT: callq __morestack 336; X64-FreeBSD-NEXT: ret 337 338; X32-DFlyBSD: leal -40000(%esp), %ecx 339; X32-DFlyBSD-NEXT: cmpl %fs:16, %ecx 340; X32-DFlyBSD-NEXT: jbe .LBB2_1 341 342; X32-DFlyBSD: pushl $0 343; X32-DFlyBSD-NEXT: pushl $40000 344; X32-DFlyBSD-NEXT: calll __morestack 345; X32-DFlyBSD-NEXT: ret 346 347; X64-DFlyBSD: leaq -40008(%rsp), %r11 348; X64-DFlyBSD-NEXT: cmpq %fs:32, %r11 349; X64-DFlyBSD-NEXT: jbe .LBB2_1 350 351; X64-DFlyBSD: movabsq $40008, %r10 352; X64-DFlyBSD-NEXT: movabsq $0, %r11 353; X64-DFlyBSD-NEXT: callq __morestack 354; X64-DFlyBSD-NEXT: ret 355 356} 357 358define fastcc void @test_fastcc() #0 { 359 %mem = alloca i32, i32 10 360 call void @dummy_use (i32* %mem, i32 10) 361 ret void 362 363; X32-Linux-LABEL: test_fastcc: 364 365; X32-Linux: cmpl %gs:48, %esp 366; X32-Linux-NEXT: jbe .LBB3_1 367 368; X32-Linux: pushl $0 369; X32-Linux-NEXT: pushl $44 370; X32-Linux-NEXT: calll __morestack 371; X32-Linux-NEXT: ret 372 373; X64-Linux-LABEL: test_fastcc: 374 375; X64-Linux: cmpq %fs:112, %rsp 376; X64-Linux-NEXT: jbe .LBB3_1 377 378; X64-Linux: movabsq $40, %r10 379; X64-Linux-NEXT: movabsq $0, %r11 380; X64-Linux-NEXT: callq __morestack 381; X64-Linux-NEXT: ret 382 383; X32ABI-LABEL: test_fastcc: 384 385; X32ABI: cmpl %fs:64, %esp 386; X32ABI-NEXT: jbe .LBB3_1 387 388; X32ABI: movl $40, %r10d 389; X32ABI-NEXT: movl $0, %r11d 390; X32ABI-NEXT: callq __morestack 391; X32ABI-NEXT: ret 392 393; X32-Darwin-LABEL: test_fastcc: 394 395; X32-Darwin: movl $432, %eax 396; X32-Darwin-NEXT: cmpl %gs:(%eax), %esp 397; X32-Darwin-NEXT: jbe LBB3_1 398 399; X32-Darwin: pushl $0 400; X32-Darwin-NEXT: pushl $60 401; X32-Darwin-NEXT: calll ___morestack 402; X32-Darwin-NEXT: ret 403 404; X64-Darwin-LABEL: test_fastcc: 405 406; X64-Darwin: cmpq %gs:816, %rsp 407; X64-Darwin-NEXT: jbe LBB3_1 408 409; X64-Darwin: movabsq $40, %r10 410; X64-Darwin-NEXT: movabsq $0, %r11 411; X64-Darwin-NEXT: callq ___morestack 412; X64-Darwin-NEXT: ret 413 414; X32-MinGW-LABEL: test_fastcc: 415 416; X32-MinGW: cmpl %fs:20, %esp 417; X32-MinGW-NEXT: jbe LBB3_1 418 419; X32-MinGW: pushl $0 420; X32-MinGW-NEXT: pushl $40 421; X32-MinGW-NEXT: calll ___morestack 422; X32-MinGW-NEXT: ret 423 424; X64-MinGW-LABEL: test_fastcc: 425 426; X64-MinGW: cmpq %gs:40, %rsp 427; X64-MinGW-NEXT: jbe .LBB3_1 428 429; X64-MinGW: movabsq $72, %r10 430; X64-MinGW-NEXT: movabsq $32, %r11 431; X64-MinGW-NEXT: callq __morestack 432; X64-MinGW-NEXT: retq 433 434; X64-FreeBSD-LABEL: test_fastcc: 435 436; X64-FreeBSD: cmpq %fs:24, %rsp 437; X64-FreeBSD-NEXT: jbe .LBB3_1 438 439; X64-FreeBSD: movabsq $40, %r10 440; X64-FreeBSD-NEXT: movabsq $0, %r11 441; X64-FreeBSD-NEXT: callq __morestack 442; X64-FreeBSD-NEXT: ret 443 444; X32-DFlyBSD-LABEL: test_fastcc: 445 446; X32-DFlyBSD: cmpl %fs:16, %esp 447; X32-DFlyBSD-NEXT: jbe .LBB3_1 448 449; X32-DFlyBSD: pushl $0 450; X32-DFlyBSD-NEXT: pushl $40 451; X32-DFlyBSD-NEXT: calll __morestack 452; X32-DFlyBSD-NEXT: ret 453 454; X64-DFlyBSD-LABEL: test_fastcc: 455 456; X64-DFlyBSD: cmpq %fs:32, %rsp 457; X64-DFlyBSD-NEXT: jbe .LBB3_1 458 459; X64-DFlyBSD: movabsq $40, %r10 460; X64-DFlyBSD-NEXT: movabsq $0, %r11 461; X64-DFlyBSD-NEXT: callq __morestack 462; X64-DFlyBSD-NEXT: ret 463 464} 465 466define fastcc void @test_fastcc_large() #0 { 467 %mem = alloca i32, i32 10000 468 call void @dummy_use (i32* %mem, i32 3) 469 ret void 470 471; X32-Linux-LABEL: test_fastcc_large: 472 473; X32-Linux: leal -40012(%esp), %eax 474; X32-Linux-NEXT: cmpl %gs:48, %eax 475; X32-Linux-NEXT: jbe .LBB4_1 476 477; X32-Linux: pushl $0 478; X32-Linux-NEXT: pushl $40012 479; X32-Linux-NEXT: calll __morestack 480; X32-Linux-NEXT: ret 481 482; X64-Linux-LABEL: test_fastcc_large: 483 484; X64-Linux: leaq -40008(%rsp), %r11 485; X64-Linux-NEXT: cmpq %fs:112, %r11 486; X64-Linux-NEXT: jbe .LBB4_1 487 488; X64-Linux: movabsq $40008, %r10 489; X64-Linux-NEXT: movabsq $0, %r11 490; X64-Linux-NEXT: callq __morestack 491; X64-Linux-NEXT: ret 492 493; X32ABI-LABEL: test_fastcc_large: 494 495; X32ABI: leal -40008(%rsp), %r11d 496; X32ABI-NEXT: cmpl %fs:64, %r11d 497; X32ABI-NEXT: jbe .LBB4_1 498 499; X32ABI: movl $40008, %r10d 500; X32ABI-NEXT: movl $0, %r11d 501; X32ABI-NEXT: callq __morestack 502; X32ABI-NEXT: ret 503 504; X32-Darwin-LABEL: test_fastcc_large: 505 506; X32-Darwin: leal -40012(%esp), %eax 507; X32-Darwin-NEXT: movl $432, %ecx 508; X32-Darwin-NEXT: cmpl %gs:(%ecx), %eax 509; X32-Darwin-NEXT: jbe LBB4_1 510 511; X32-Darwin: pushl $0 512; X32-Darwin-NEXT: pushl $40012 513; X32-Darwin-NEXT: calll ___morestack 514; X32-Darwin-NEXT: ret 515 516; X64-Darwin-LABEL: test_fastcc_large: 517 518; X64-Darwin: leaq -40008(%rsp), %r11 519; X64-Darwin-NEXT: cmpq %gs:816, %r11 520; X64-Darwin-NEXT: jbe LBB4_1 521 522; X64-Darwin: movabsq $40008, %r10 523; X64-Darwin-NEXT: movabsq $0, %r11 524; X64-Darwin-NEXT: callq ___morestack 525; X64-Darwin-NEXT: ret 526 527; X32-MinGW-LABEL: test_fastcc_large: 528 529; X32-MinGW: leal -40000(%esp), %eax 530; X32-MinGW-NEXT: cmpl %fs:20, %eax 531; X32-MinGW-NEXT: jbe LBB4_1 532 533; X32-MinGW: pushl $0 534; X32-MinGW-NEXT: pushl $40000 535; X32-MinGW-NEXT: calll ___morestack 536; X32-MinGW-NEXT: ret 537 538; X64-MinGW-LABEL: test_fastcc_large: 539 540; X64-MinGW: leaq -40040(%rsp), %r11 541; X64-MinGW-NEXT: cmpq %gs:40, %r11 542; X64-MinGW-NEXT: jbe .LBB4_1 543 544; X64-MinGW: movabsq $40040, %r10 545; X64-MinGW-NEXT: movabsq $32, %r11 546; X64-MinGW-NEXT: callq __morestack 547; X64-MinGW-NEXT: retq 548 549; X64-FreeBSD-LABEL: test_fastcc_large: 550 551; X64-FreeBSD: leaq -40008(%rsp), %r11 552; X64-FreeBSD-NEXT: cmpq %fs:24, %r11 553; X64-FreeBSD-NEXT: jbe .LBB4_1 554 555; X64-FreeBSD: movabsq $40008, %r10 556; X64-FreeBSD-NEXT: movabsq $0, %r11 557; X64-FreeBSD-NEXT: callq __morestack 558; X64-FreeBSD-NEXT: ret 559 560; X32-DFlyBSD-LABEL: test_fastcc_large: 561 562; X32-DFlyBSD: leal -40000(%esp), %eax 563; X32-DFlyBSD-NEXT: cmpl %fs:16, %eax 564; X32-DFlyBSD-NEXT: jbe .LBB4_1 565 566; X32-DFlyBSD: pushl $0 567; X32-DFlyBSD-NEXT: pushl $40000 568; X32-DFlyBSD-NEXT: calll __morestack 569; X32-DFlyBSD-NEXT: ret 570 571; X64-DFlyBSD-LABEL: test_fastcc_large: 572 573; X64-DFlyBSD: leaq -40008(%rsp), %r11 574; X64-DFlyBSD-NEXT: cmpq %fs:32, %r11 575; X64-DFlyBSD-NEXT: jbe .LBB4_1 576 577; X64-DFlyBSD: movabsq $40008, %r10 578; X64-DFlyBSD-NEXT: movabsq $0, %r11 579; X64-DFlyBSD-NEXT: callq __morestack 580; X64-DFlyBSD-NEXT: ret 581 582} 583 584define fastcc void @test_fastcc_large_with_ecx_arg(i32 %a) #0 { 585 %mem = alloca i32, i32 10000 586 call void @dummy_use (i32* %mem, i32 %a) 587 ret void 588 589; This is testing that the Mac implementation preserves ecx 590 591; X32-Darwin-LABEL: test_fastcc_large_with_ecx_arg: 592 593; X32-Darwin: leal -40012(%esp), %eax 594; X32-Darwin-NEXT: pushl %ecx 595; X32-Darwin-NEXT: movl $432, %ecx 596; X32-Darwin-NEXT: cmpl %gs:(%ecx), %eax 597; X32-Darwin-NEXT: popl %ecx 598; X32-Darwin-NEXT: jbe LBB5_1 599 600; X32-Darwin: pushl $0 601; X32-Darwin-NEXT: pushl $40012 602; X32-Darwin-NEXT: calll ___morestack 603; X32-Darwin-NEXT: ret 604 605} 606 607define void @test_nostack() #0 { 608 ret void 609 610; X32-Linux-LABEL: test_nostack: 611; X32-Linux-NOT: calll __morestack 612 613; X64-Linux-LABEL: test_nostack: 614; X32-Linux-NOT: callq __morestack 615 616; X32ABI-LABEL: test_nostack: 617; X32ABI-NOT: callq __morestack 618 619; X32-Darwin-LABEL: test_nostack: 620; X32-Darwin-NOT: calll __morestack 621 622; X64-Darwin-LABEL: test_nostack: 623; X64-Darwin-NOT: callq __morestack 624 625; X32-MinGW-LABEL: test_nostack: 626; X32-MinGW-NOT: calll __morestack 627 628; X64-MinGW-LABEL: test_nostack: 629; X64-MinGW-NOT: callq __morestack 630 631; X64-FreeBSD-LABEL: test_nostack: 632; X64-FreeBSD-NOT: callq __morestack 633 634; X32-DFlyBSD-LABEL: test_nostack: 635; X32-DFlyBSD-NOT: calll __morestack 636 637; X64-DFlyBSD-LABEL: test_nostack: 638; X64-DFlyBSD-NOT: callq __morestack 639} 640 641define void @test_nosplitstck() { 642 ret void 643} 644 645; Test to make sure that a morestack call is generated if there is a 646; sibling call, even if the function in question has no stack frame 647; (PR37807). 648 649declare i32 @callee(i32) 650 651define i32 @test_sibling_call_empty_frame(i32 %x) #0 { 652 %call = tail call i32 @callee(i32 %x) #0 653 ret i32 %call 654 655; X32-Linux-LABEL: test_sibling_call_empty_frame: 656; X32-Linux: calll __morestack 657 658; X64-Linux-LABEL: test_sibling_call_empty_frame: 659; X64-Linux: callq __morestack 660 661; X64-Linux-Large-LABEL: test_sibling_call_empty_frame: 662; X64-Linux-Large: callq *__morestack_addr(%rip) 663 664; X32ABI-LABEL: test_sibling_call_empty_frame: 665; X32ABI: callq __morestack 666 667; X32-Darwin-LABEL: test_sibling_call_empty_frame: 668; X32-Darwin: calll ___morestack 669 670; X64-Darwin-LABEL: test_sibling_call_empty_frame: 671; X64-Darwin: callq ___morestack 672 673; X32-MinGW-LABEL: test_sibling_call_empty_frame: 674; X32-MinGW: calll ___morestack 675 676; X64-MinGW-LABEL: test_sibling_call_empty_frame: 677; X64-MinGW: callq __morestack 678 679; X64-FreeBSD-LABEL: test_sibling_call_empty_frame: 680; X64-FreeBSD: callq __morestack 681 682; X32-DFlyBSD-LABEL: test_sibling_call_empty_frame: 683; X32-DFlyBSD: calll __morestack 684; X32-DFlyBSD-NEXT: ret 685 686; X64-DFlyBSD-LABEL: test_sibling_call_empty_frame: 687; X64-DFlyBSD: callq __morestack 688 689} 690 691attributes #0 = { "split-stack" } 692 693; X64-Linux-Large: .rodata 694; X64-Linux-Large-NEXT: __morestack_addr: 695; X64-Linux-Large-NEXT: .quad __morestack 696 697; X32-Linux: .section ".note.GNU-split-stack","",@progbits 698; X32-Linux: .section ".note.GNU-no-split-stack","",@progbits 699 700; X64-Linux: .section ".note.GNU-split-stack","",@progbits 701; X64-Linux: .section ".note.GNU-no-split-stack","",@progbits 702 703; X64-FreeBSD: .section ".note.GNU-split-stack","",@progbits 704; X64-FreeBSD: .section ".note.GNU-no-split-stack","",@progbits 705 706; X32-DFlyBSD: .section ".note.GNU-split-stack","",@progbits 707; X32-DFlyBSD: .section ".note.GNU-no-split-stack","",@progbits 708 709; X64-DFlyBSD: .section ".note.GNU-split-stack","",@progbits 710; X64-DFlyBSD: .section ".note.GNU-no-split-stack","",@progbits 711