Home | History | Annotate | Download | only in X86
      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
     34 declare void @dummy_use(i32*, i32)
     35 
     36 define 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:  ja      .LBB0_2
     45 
     46 ; X32-Linux:       pushl $0
     47 ; X32-Linux-NEXT:  pushl $60
     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:  ja      .LBB0_2
     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:  ja      .LBB0_2
     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:  ja      .LBB0_2
     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: ja      LBB0_2
     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: ja      LBB0_2
     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:  ja      LBB0_2
    106 
    107 ; X32-MinGW:       pushl $0
    108 ; X32-MinGW-NEXT:  pushl $48
    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:  ja      .LBB0_2
    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:  ja      .LBB0_2
    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:  ja      .LBB0_2
    136 
    137 ; X32-DFlyBSD:       pushl $0
    138 ; X32-DFlyBSD-NEXT:  pushl $48
    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:  ja      .LBB0_2
    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 
    154 define 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:  ja      .LBB1_2
    163 
    164 ; X32-Linux:       pushl $4
    165 ; X32-Linux-NEXT:  pushl $60
    166 ; X32-Linux-NEXT:  calll __morestack
    167 ; X32-Linux-NEXT:  ret
    168 
    169 ; X64-Linux:       cmpq %fs:112, %rsp
    170 ; X64-Linux-NEXT:  ja      .LBB1_2
    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:  ja      .LBB1_2
    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: ja      LBB1_2
    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: ja      LBB1_2
    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:  ja      LBB1_2
    210 
    211 ; X32-MinGW:       pushl $4
    212 ; X32-MinGW-NEXT:  pushl $52
    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:  ja      .LBB1_2
    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:  ja      .LBB1_2
    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:  ja      .LBB1_2
    239 
    240 ; X32-DFlyBSD:       pushl $4
    241 ; X32-DFlyBSD-NEXT:  pushl $52
    242 ; X32-DFlyBSD-NEXT:  calll __morestack
    243 ; X32-DFlyBSD-NEXT:  ret
    244 
    245 ; X64-DFlyBSD:       cmpq %fs:32, %rsp
    246 ; X64-DFlyBSD-NEXT:  ja      .LBB1_2
    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 
    257 define void @test_large() #0 {
    258         %mem = alloca i32, i32 10000
    259         call void @dummy_use (i32* %mem, i32 0)
    260         ret void
    261 
    262 ; X32-Linux:       leal -40012(%esp), %ecx
    263 ; X32-Linux-NEXT:  cmpl %gs:48, %ecx
    264 ; X32-Linux-NEXT:  ja      .LBB2_2
    265 
    266 ; X32-Linux:       pushl $0
    267 ; X32-Linux-NEXT:  pushl $40012
    268 ; X32-Linux-NEXT:  calll __morestack
    269 ; X32-Linux-NEXT:  ret
    270 
    271 ; X64-Linux:       leaq -40008(%rsp), %r11
    272 ; X64-Linux-NEXT:  cmpq %fs:112, %r11
    273 ; X64-Linux-NEXT:  ja      .LBB2_2
    274 
    275 ; X64-Linux:       movabsq $40008, %r10
    276 ; X64-Linux-NEXT:  movabsq $0, %r11
    277 ; X64-Linux-NEXT:  callq __morestack
    278 ; X64-Linux-NEXT:  ret
    279 
    280 ; X32ABI:       leal -40008(%rsp), %r11d
    281 ; X32ABI-NEXT:  cmpl %fs:64, %r11d
    282 ; X32ABI-NEXT:  ja      .LBB2_2
    283 
    284 ; X32ABI:       movl $40008, %r10d
    285 ; X32ABI-NEXT:  movl $0, %r11d
    286 ; X32ABI-NEXT:  callq __morestack
    287 ; X32ABI-NEXT:  ret
    288 
    289 ; X32-Darwin:      leal -40012(%esp), %ecx
    290 ; X32-Darwin-NEXT: movl $432, %eax
    291 ; X32-Darwin-NEXT: cmpl %gs:(%eax), %ecx
    292 ; X32-Darwin-NEXT: ja      LBB2_2
    293 
    294 ; X32-Darwin:      pushl $0
    295 ; X32-Darwin-NEXT: pushl $40012
    296 ; X32-Darwin-NEXT: calll ___morestack
    297 ; X32-Darwin-NEXT: ret
    298 
    299 ; X64-Darwin:      leaq -40008(%rsp), %r11
    300 ; X64-Darwin-NEXT: cmpq %gs:816, %r11
    301 ; X64-Darwin-NEXT: ja      LBB2_2
    302 
    303 ; X64-Darwin:      movabsq $40008, %r10
    304 ; X64-Darwin-NEXT: movabsq $0, %r11
    305 ; X64-Darwin-NEXT: callq ___morestack
    306 ; X64-Darwin-NEXT: ret
    307 
    308 ; X32-MinGW:       leal -40008(%esp), %ecx
    309 ; X32-MinGW-NEXT:  cmpl %fs:20, %ecx
    310 ; X32-MinGW-NEXT:  ja      LBB2_2
    311 
    312 ; X32-MinGW:       pushl $0
    313 ; X32-MinGW-NEXT:  pushl $40008
    314 ; X32-MinGW-NEXT:  calll ___morestack
    315 ; X32-MinGW-NEXT:  ret
    316 
    317 ; X64-MinGW-LABEL: test_large:
    318 ; X64-MinGW:       leaq -40040(%rsp), %r11
    319 ; X64-MinGW-NEXT:  cmpq %gs:40, %r11
    320 ; X64-MinGW-NEXT:  ja      .LBB2_2
    321 
    322 ; X64-MinGW:       movabsq $40040, %r10
    323 ; X64-MinGW-NEXT:  movabsq $32, %r11
    324 ; X64-MinGW-NEXT:  callq __morestack
    325 ; X64-MinGW-NEXT:  retq
    326 
    327 ; X64-FreeBSD:       leaq -40008(%rsp), %r11
    328 ; X64-FreeBSD-NEXT:  cmpq %fs:24, %r11
    329 ; X64-FreeBSD-NEXT:  ja      .LBB2_2
    330 
    331 ; X64-FreeBSD:       movabsq $40008, %r10
    332 ; X64-FreeBSD-NEXT:  movabsq $0, %r11
    333 ; X64-FreeBSD-NEXT:  callq __morestack
    334 ; X64-FreeBSD-NEXT:  ret
    335 
    336 ; X32-DFlyBSD:       leal -40008(%esp), %ecx
    337 ; X32-DFlyBSD-NEXT:  cmpl %fs:16, %ecx
    338 ; X32-DFlyBSD-NEXT:  ja      .LBB2_2
    339 
    340 ; X32-DFlyBSD:       pushl $0
    341 ; X32-DFlyBSD-NEXT:  pushl $40008
    342 ; X32-DFlyBSD-NEXT:  calll __morestack
    343 ; X32-DFlyBSD-NEXT:  ret
    344 
    345 ; X64-DFlyBSD:       leaq -40008(%rsp), %r11
    346 ; X64-DFlyBSD-NEXT:  cmpq %fs:32, %r11
    347 ; X64-DFlyBSD-NEXT:  ja      .LBB2_2
    348 
    349 ; X64-DFlyBSD:       movabsq $40008, %r10
    350 ; X64-DFlyBSD-NEXT:  movabsq $0, %r11
    351 ; X64-DFlyBSD-NEXT:  callq __morestack
    352 ; X64-DFlyBSD-NEXT:  ret
    353 
    354 }
    355 
    356 define fastcc void @test_fastcc() #0 {
    357         %mem = alloca i32, i32 10
    358         call void @dummy_use (i32* %mem, i32 10)
    359         ret void
    360 
    361 ; X32-Linux-LABEL:       test_fastcc:
    362 
    363 ; X32-Linux:       cmpl %gs:48, %esp
    364 ; X32-Linux-NEXT:  ja      .LBB3_2
    365 
    366 ; X32-Linux:       pushl $0
    367 ; X32-Linux-NEXT:  pushl $60
    368 ; X32-Linux-NEXT:  calll __morestack
    369 ; X32-Linux-NEXT:  ret
    370 
    371 ; X64-Linux-LABEL:       test_fastcc:
    372 
    373 ; X64-Linux:       cmpq %fs:112, %rsp
    374 ; X64-Linux-NEXT:  ja      .LBB3_2
    375 
    376 ; X64-Linux:       movabsq $40, %r10
    377 ; X64-Linux-NEXT:  movabsq $0, %r11
    378 ; X64-Linux-NEXT:  callq __morestack
    379 ; X64-Linux-NEXT:  ret
    380 
    381 ; X32ABI-LABEL:       test_fastcc:
    382 
    383 ; X32ABI:       cmpl %fs:64, %esp
    384 ; X32ABI-NEXT:  ja      .LBB3_2
    385 
    386 ; X32ABI:       movl $40, %r10d
    387 ; X32ABI-NEXT:  movl $0, %r11d
    388 ; X32ABI-NEXT:  callq __morestack
    389 ; X32ABI-NEXT:  ret
    390 
    391 ; X32-Darwin-LABEL:      test_fastcc:
    392 
    393 ; X32-Darwin:      movl $432, %eax
    394 ; X32-Darwin-NEXT: cmpl %gs:(%eax), %esp
    395 ; X32-Darwin-NEXT: ja      LBB3_2
    396 
    397 ; X32-Darwin:      pushl $0
    398 ; X32-Darwin-NEXT: pushl $60
    399 ; X32-Darwin-NEXT: calll ___morestack
    400 ; X32-Darwin-NEXT: ret
    401 
    402 ; X64-Darwin-LABEL:      test_fastcc:
    403 
    404 ; X64-Darwin:      cmpq %gs:816, %rsp
    405 ; X64-Darwin-NEXT: ja      LBB3_2
    406 
    407 ; X64-Darwin:      movabsq $40, %r10
    408 ; X64-Darwin-NEXT: movabsq $0, %r11
    409 ; X64-Darwin-NEXT: callq ___morestack
    410 ; X64-Darwin-NEXT: ret
    411 
    412 ; X32-MinGW-LABEL:       test_fastcc:
    413 
    414 ; X32-MinGW:       cmpl %fs:20, %esp
    415 ; X32-MinGW-NEXT:  ja      LBB3_2
    416 
    417 ; X32-MinGW:       pushl $0
    418 ; X32-MinGW-NEXT:  pushl $48
    419 ; X32-MinGW-NEXT:  calll ___morestack
    420 ; X32-MinGW-NEXT:  ret
    421 
    422 ; X64-MinGW-LABEL:       test_fastcc:
    423 
    424 ; X64-MinGW:       cmpq %gs:40, %rsp
    425 ; X64-MinGW-NEXT:  ja      .LBB3_2
    426 
    427 ; X64-MinGW:       movabsq $72, %r10
    428 ; X64-MinGW-NEXT:  movabsq $32, %r11
    429 ; X64-MinGW-NEXT:  callq __morestack
    430 ; X64-MinGW-NEXT:  retq
    431 
    432 ; X64-FreeBSD-LABEL:       test_fastcc:
    433 
    434 ; X64-FreeBSD:       cmpq %fs:24, %rsp
    435 ; X64-FreeBSD-NEXT:  ja      .LBB3_2
    436 
    437 ; X64-FreeBSD:       movabsq $40, %r10
    438 ; X64-FreeBSD-NEXT:  movabsq $0, %r11
    439 ; X64-FreeBSD-NEXT:  callq __morestack
    440 ; X64-FreeBSD-NEXT:  ret
    441 
    442 ; X32-DFlyBSD-LABEL:       test_fastcc:
    443 
    444 ; X32-DFlyBSD:       cmpl %fs:16, %esp
    445 ; X32-DFlyBSD-NEXT:  ja      .LBB3_2
    446 
    447 ; X32-DFlyBSD:       pushl $0
    448 ; X32-DFlyBSD-NEXT:  pushl $48
    449 ; X32-DFlyBSD-NEXT:  calll __morestack
    450 ; X32-DFlyBSD-NEXT:  ret
    451 
    452 ; X64-DFlyBSD-LABEL:       test_fastcc:
    453 
    454 ; X64-DFlyBSD:       cmpq %fs:32, %rsp
    455 ; X64-DFlyBSD-NEXT:  ja      .LBB3_2
    456 
    457 ; X64-DFlyBSD:       movabsq $40, %r10
    458 ; X64-DFlyBSD-NEXT:  movabsq $0, %r11
    459 ; X64-DFlyBSD-NEXT:  callq __morestack
    460 ; X64-DFlyBSD-NEXT:  ret
    461 
    462 }
    463 
    464 define fastcc void @test_fastcc_large() #0 {
    465         %mem = alloca i32, i32 10000
    466         call void @dummy_use (i32* %mem, i32 0)
    467         ret void
    468 
    469 ; X32-Linux-LABEL:       test_fastcc_large:
    470 
    471 ; X32-Linux:       leal -40012(%esp), %eax
    472 ; X32-Linux-NEXT:  cmpl %gs:48, %eax
    473 ; X32-Linux-NEXT:  ja      .LBB4_2
    474 
    475 ; X32-Linux:       pushl $0
    476 ; X32-Linux-NEXT:  pushl $40012
    477 ; X32-Linux-NEXT:  calll __morestack
    478 ; X32-Linux-NEXT:  ret
    479 
    480 ; X64-Linux-LABEL:       test_fastcc_large:
    481 
    482 ; X64-Linux:       leaq -40008(%rsp), %r11
    483 ; X64-Linux-NEXT:  cmpq %fs:112, %r11
    484 ; X64-Linux-NEXT:  ja      .LBB4_2
    485 
    486 ; X64-Linux:       movabsq $40008, %r10
    487 ; X64-Linux-NEXT:  movabsq $0, %r11
    488 ; X64-Linux-NEXT:  callq __morestack
    489 ; X64-Linux-NEXT:  ret
    490 
    491 ; X32ABI-LABEL:       test_fastcc_large:
    492 
    493 ; X32ABI:       leal -40008(%rsp), %r11d
    494 ; X32ABI-NEXT:  cmpl %fs:64, %r11d
    495 ; X32ABI-NEXT:  ja      .LBB4_2
    496 
    497 ; X32ABI:       movl $40008, %r10d
    498 ; X32ABI-NEXT:  movl $0, %r11d
    499 ; X32ABI-NEXT:  callq __morestack
    500 ; X32ABI-NEXT:  ret
    501 
    502 ; X32-Darwin-LABEL:      test_fastcc_large:
    503 
    504 ; X32-Darwin:      leal -40012(%esp), %eax
    505 ; X32-Darwin-NEXT: movl $432, %ecx
    506 ; X32-Darwin-NEXT: cmpl %gs:(%ecx), %eax
    507 ; X32-Darwin-NEXT: ja      LBB4_2
    508 
    509 ; X32-Darwin:      pushl $0
    510 ; X32-Darwin-NEXT: pushl $40012
    511 ; X32-Darwin-NEXT: calll ___morestack
    512 ; X32-Darwin-NEXT: ret
    513 
    514 ; X64-Darwin-LABEL:      test_fastcc_large:
    515 
    516 ; X64-Darwin:      leaq -40008(%rsp), %r11
    517 ; X64-Darwin-NEXT: cmpq %gs:816, %r11
    518 ; X64-Darwin-NEXT: ja      LBB4_2
    519 
    520 ; X64-Darwin:      movabsq $40008, %r10
    521 ; X64-Darwin-NEXT: movabsq $0, %r11
    522 ; X64-Darwin-NEXT: callq ___morestack
    523 ; X64-Darwin-NEXT: ret
    524 
    525 ; X32-MinGW-LABEL:       test_fastcc_large:
    526 
    527 ; X32-MinGW:       leal -40008(%esp), %eax
    528 ; X32-MinGW-NEXT:  cmpl %fs:20, %eax
    529 ; X32-MinGW-NEXT:  ja      LBB4_2
    530 
    531 ; X32-MinGW:       pushl $0
    532 ; X32-MinGW-NEXT:  pushl $40008
    533 ; X32-MinGW-NEXT:  calll ___morestack
    534 ; X32-MinGW-NEXT:  ret
    535 
    536 ; X64-MinGW-LABEL:       test_fastcc_large:
    537 
    538 ; X64-MinGW:       leaq -40040(%rsp), %r11
    539 ; X64-MinGW-NEXT:  cmpq %gs:40, %r11
    540 ; X64-MinGW-NEXT:  ja      .LBB4_2
    541 
    542 ; X64-MinGW:       movabsq $40040, %r10
    543 ; X64-MinGW-NEXT:  movabsq $32, %r11
    544 ; X64-MinGW-NEXT:  callq __morestack
    545 ; X64-MinGW-NEXT:  retq
    546 
    547 ; X64-FreeBSD-LABEL:       test_fastcc_large:
    548 
    549 ; X64-FreeBSD:       leaq -40008(%rsp), %r11
    550 ; X64-FreeBSD-NEXT:  cmpq %fs:24, %r11
    551 ; X64-FreeBSD-NEXT:  ja      .LBB4_2
    552 
    553 ; X64-FreeBSD:       movabsq $40008, %r10
    554 ; X64-FreeBSD-NEXT:  movabsq $0, %r11
    555 ; X64-FreeBSD-NEXT:  callq __morestack
    556 ; X64-FreeBSD-NEXT:  ret
    557 
    558 ; X32-DFlyBSD-LABEL:       test_fastcc_large:
    559 
    560 ; X32-DFlyBSD:       leal -40008(%esp), %eax
    561 ; X32-DFlyBSD-NEXT:  cmpl %fs:16, %eax
    562 ; X32-DFlyBSD-NEXT:  ja      .LBB4_2
    563 
    564 ; X32-DFlyBSD:       pushl $0
    565 ; X32-DFlyBSD-NEXT:  pushl $40008
    566 ; X32-DFlyBSD-NEXT:  calll __morestack
    567 ; X32-DFlyBSD-NEXT:  ret
    568 
    569 ; X64-DFlyBSD-LABEL:       test_fastcc_large:
    570 
    571 ; X64-DFlyBSD:       leaq -40008(%rsp), %r11
    572 ; X64-DFlyBSD-NEXT:  cmpq %fs:32, %r11
    573 ; X64-DFlyBSD-NEXT:  ja      .LBB4_2
    574 
    575 ; X64-DFlyBSD:       movabsq $40008, %r10
    576 ; X64-DFlyBSD-NEXT:  movabsq $0, %r11
    577 ; X64-DFlyBSD-NEXT:  callq __morestack
    578 ; X64-DFlyBSD-NEXT:  ret
    579 
    580 }
    581 
    582 define fastcc void @test_fastcc_large_with_ecx_arg(i32 %a) #0 {
    583         %mem = alloca i32, i32 10000
    584         call void @dummy_use (i32* %mem, i32 %a)
    585         ret void
    586 
    587 ; This is testing that the Mac implementation preserves ecx
    588 
    589 ; X32-Darwin-LABEL:      test_fastcc_large_with_ecx_arg:
    590 
    591 ; X32-Darwin:      leal -40012(%esp), %eax
    592 ; X32-Darwin-NEXT: pushl %ecx
    593 ; X32-Darwin-NEXT: movl $432, %ecx
    594 ; X32-Darwin-NEXT: cmpl %gs:(%ecx), %eax
    595 ; X32-Darwin-NEXT: popl %ecx
    596 ; X32-Darwin-NEXT: ja      LBB5_2
    597 
    598 ; X32-Darwin:      pushl $0
    599 ; X32-Darwin-NEXT: pushl $40012
    600 ; X32-Darwin-NEXT: calll ___morestack
    601 ; X32-Darwin-NEXT: ret
    602 
    603 }
    604 
    605 define void @test_nostack() #0 {
    606 	ret void
    607 
    608 ; X32-Linux-LABEL: test_nostack:
    609 ; X32-Linux-NOT:   calll __morestack
    610 
    611 ; X64-Linux-LABEL: test_nostack:
    612 ; X32-Linux-NOT:   callq __morestack
    613 
    614 ; X32ABI-LABEL: test_nostack:
    615 ; X32ABI-NOT:   callq __morestack
    616 
    617 ; X32-Darwin-LABEL: test_nostack:
    618 ; X32-Darwin-NOT:   calll __morestack
    619 
    620 ; X64-Darwin-LABEL: test_nostack:
    621 ; X64-Darwin-NOT:   callq __morestack
    622 
    623 ; X32-MinGW-LABEL: test_nostack:
    624 ; X32-MinGW-NOT:   calll __morestack
    625 
    626 ; X64-MinGW-LABEL: test_nostack:
    627 ; X64-MinGW-NOT:   callq __morestack
    628 
    629 ; X64-FreeBSD-LABEL: test_nostack:
    630 ; X64-FreeBSD-NOT:   callq __morestack
    631 
    632 ; X32-DFlyBSD-LABEL: test_nostack:
    633 ; X32-DFlyBSD-NOT:   calll __morestack
    634 
    635 ; X64-DFlyBSD-LABEL: test_nostack:
    636 ; X64-DFlyBSD-NOT:   callq __morestack
    637 }
    638 
    639 attributes #0 = { "split-stack" }
    640 
    641 ; X64-Linux-Large: .rodata
    642 ; X64-Linux-Large-NEXT: __morestack_addr:
    643 ; X64-Linux-Large-NEXT: .quad	__morestack
    644