1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z14 | FileCheck %s
3
4define i32 @fun0(i32 %n) #0 {
5; CHECK-LABEL: fun0:
6; CHECK:       # %bb.0:
7; CHECK-NEXT:    stmg %r11, %r15, 88(%r15)
8; CHECK-NEXT:    .cfi_offset %r11, -72
9; CHECK-NEXT:    .cfi_offset %r15, -40
10; CHECK-NEXT:    aghi %r15, -160
11; CHECK-NEXT:    .cfi_def_cfa_offset 320
12; CHECK-NEXT:    lgr %r11, %r15
13; CHECK-NEXT:    .cfi_def_cfa_register %r11
14; CHECK-NEXT:    # kill: def $r2l killed $r2l def $r2d
15; CHECK-NEXT:    risbgn %r1, %r2, 30, 189, 2
16; CHECK-NEXT:    la %r0, 7(%r1)
17; CHECK-NEXT:    risbgn %r1, %r0, 29, 188, 0
18; CHECK-NEXT:    clgfi %r1, 4096
19; CHECK-NEXT:    jl .LBB0_2
20; CHECK-NEXT:  .LBB0_1: # =>This Inner Loop Header: Depth=1
21; CHECK-NEXT:    slgfi %r1, 4096
22; CHECK-NEXT:    slgfi %r15, 4096
23; CHECK-NEXT:    cg %r15, 4088(%r15)
24; CHECK-NEXT:    clgfi %r1, 4096
25; CHECK-NEXT:    jhe .LBB0_1
26; CHECK-NEXT:  .LBB0_2:
27; CHECK-NEXT:    cgije %r1, 0, .LBB0_4
28; CHECK-NEXT:  # %bb.3:
29; CHECK-NEXT:    slgr %r15, %r1
30; CHECK-NEXT:    cg %r15, -8(%r1,%r15)
31; CHECK-NEXT:  .LBB0_4:
32; CHECK-NEXT:    la %r1, 160(%r15)
33; CHECK-NEXT:    lhi %r0, 1
34; CHECK-NEXT:    sty %r0, 4792(%r1)
35; CHECK-NEXT:    l %r2, 0(%r1)
36; CHECK-NEXT:    lmg %r11, %r15, 248(%r11)
37; CHECK-NEXT:    br %r14
38
39  %a = alloca i32, i32 %n
40  %b = getelementptr inbounds i32, i32* %a, i64 1198
41  store volatile i32 1, i32* %b
42  %c = load volatile i32, i32* %a
43  ret i32 %c
44}
45
46; Probe size should be modulo stack alignment.
47define i32 @fun1(i32 %n) #0 "stack-probe-size"="1250" {
48; CHECK-LABEL: fun1:
49; CHECK:       # %bb.0:
50; CHECK-NEXT:    stmg %r11, %r15, 88(%r15)
51; CHECK-NEXT:    .cfi_offset %r11, -72
52; CHECK-NEXT:    .cfi_offset %r15, -40
53; CHECK-NEXT:    aghi %r15, -160
54; CHECK-NEXT:    .cfi_def_cfa_offset 320
55; CHECK-NEXT:    lgr %r11, %r15
56; CHECK-NEXT:    .cfi_def_cfa_register %r11
57; CHECK-NEXT:    # kill: def $r2l killed $r2l def $r2d
58; CHECK-NEXT:    risbgn %r1, %r2, 30, 189, 2
59; CHECK-NEXT:    la %r0, 7(%r1)
60; CHECK-NEXT:    risbgn %r1, %r0, 29, 188, 0
61; CHECK-NEXT:    clgfi %r1, 1248
62; CHECK-NEXT:    jl .LBB1_2
63; CHECK-NEXT:  .LBB1_1: # =>This Inner Loop Header: Depth=1
64; CHECK-NEXT:    slgfi %r1, 1248
65; CHECK-NEXT:    slgfi %r15, 1248
66; CHECK-NEXT:    cg %r15, 1240(%r15)
67; CHECK-NEXT:    clgfi %r1, 1248
68; CHECK-NEXT:    jhe .LBB1_1
69; CHECK-NEXT:  .LBB1_2:
70; CHECK-NEXT:    cgije %r1, 0, .LBB1_4
71; CHECK-NEXT:  # %bb.3:
72; CHECK-NEXT:    slgr %r15, %r1
73; CHECK-NEXT:    cg %r15, -8(%r1,%r15)
74; CHECK-NEXT:  .LBB1_4:
75; CHECK-NEXT:    la %r1, 160(%r15)
76; CHECK-NEXT:    lhi %r0, 1
77; CHECK-NEXT:    sty %r0, 4792(%r1)
78; CHECK-NEXT:    l %r2, 0(%r1)
79; CHECK-NEXT:    lmg %r11, %r15, 248(%r11)
80; CHECK-NEXT:    br %r14
81  %a = alloca i32, i32 %n
82  %b = getelementptr inbounds i32, i32* %a, i64 1198
83  store volatile i32 1, i32* %b
84  %c = load volatile i32, i32* %a
85  ret i32 %c
86}
87
88; The minimum probe size is the stack alignment.
89define i32 @fun2(i32 %n) #0 "stack-probe-size"="4" {
90; CHECK-LABEL: fun2:
91; CHECK:       # %bb.0:
92; CHECK-NEXT:    stmg %r11, %r15, 88(%r15)
93; CHECK-NEXT:    .cfi_offset %r11, -72
94; CHECK-NEXT:    .cfi_offset %r15, -40
95; CHECK-NEXT:    lgr %r1, %r15
96; CHECK-NEXT:    .cfi_def_cfa_register %r1
97; CHECK-NEXT:    aghi %r1, -160
98; CHECK-NEXT:    .cfi_def_cfa_offset 320
99; CHECK-NEXT:  .LBB2_1: # =>This Inner Loop Header: Depth=1
100; CHECK-NEXT:    aghi %r15, -8
101; CHECK-NEXT:    cg %r0, 0(%r15)
102; CHECK-NEXT:    clgrjh %r15, %r1, .LBB2_1
103; CHECK-NEXT:  # %bb.2:
104; CHECK-NEXT:    .cfi_def_cfa_register %r15
105; CHECK-NEXT:    lgr %r11, %r15
106; CHECK-NEXT:    .cfi_def_cfa_register %r11
107; CHECK-NEXT:    # kill: def $r2l killed $r2l def $r2d
108; CHECK-NEXT:    risbgn %r1, %r2, 30, 189, 2
109; CHECK-NEXT:    la %r0, 7(%r1)
110; CHECK-NEXT:    risbgn %r1, %r0, 29, 188, 0
111; CHECK-NEXT:    clgijl %r1, 8, .LBB2_4
112; CHECK-NEXT:  .LBB2_3: # =>This Inner Loop Header: Depth=1
113; CHECK-NEXT:    slgfi %r1, 8
114; CHECK-NEXT:    slgfi %r15, 8
115; CHECK-NEXT:    cg %r15, 0(%r15)
116; CHECK-NEXT:    clgijhe %r1, 8, .LBB2_3
117; CHECK-NEXT:  .LBB2_4:
118; CHECK-NEXT:    cgije %r1, 0, .LBB2_6
119; CHECK-NEXT:  # %bb.5:
120; CHECK-NEXT:    slgr %r15, %r1
121; CHECK-NEXT:    cg %r15, -8(%r1,%r15)
122; CHECK-NEXT:  .LBB2_6:
123; CHECK-NEXT:    la %r1, 160(%r15)
124; CHECK-NEXT:    lhi %r0, 1
125; CHECK-NEXT:    sty %r0, 4792(%r1)
126; CHECK-NEXT:    l %r2, 0(%r1)
127; CHECK-NEXT:    lmg %r11, %r15, 248(%r11)
128; CHECK-NEXT:    br %r14
129  %a = alloca i32, i32 %n
130  %b = getelementptr inbounds i32, i32* %a, i64 1198
131  store volatile i32 1, i32* %b
132  %c = load volatile i32, i32* %a
133  ret i32 %c
134}
135
136attributes #0 =  {"probe-stack"="inline-asm"}
137