1; RUN: opt -inline -mtriple=aarch64--linux-gnu -S -o - < %s -inline-threshold=0 | FileCheck %s 2 3target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" 4target triple = "aarch64--linux-gnu" 5 6declare void @pad() 7@glbl = external global i32 8 9define i32 @outer_add1(i32 %a) { 10; CHECK-LABEL: @outer_add1( 11; CHECK-NOT: call i32 @add 12 %C = call i32 @add(i32 %a, i32 0) 13 ret i32 %C 14} 15 16define i32 @outer_add2(i32 %a) { 17; CHECK-LABEL: @outer_add2( 18; CHECK-NOT: call i32 @add 19 %C = call i32 @add(i32 0, i32 %a) 20 ret i32 %C 21} 22 23define i32 @add(i32 %a, i32 %b) { 24 %add = add i32 %a, %b 25 call void @pad() 26 store i32 0, i32* @glbl 27 ret i32 %add 28} 29 30 31 32define i32 @outer_sub1(i32 %a) { 33; CHECK-LABEL: @outer_sub1( 34; CHECK-NOT: call i32 @sub1 35 %C = call i32 @sub1(i32 %a, i32 0) 36 ret i32 %C 37} 38 39define i32 @sub1(i32 %a, i32 %b) { 40 %sub = sub i32 %a, %b 41 call void @pad() 42 store i32 0, i32* @glbl 43 ret i32 %sub 44} 45 46 47define i32 @outer_sub2(i32 %a) { 48; CHECK-LABEL: @outer_sub2( 49; CHECK-NOT: call i32 @sub2 50 %C = call i32 @sub2(i32 %a) 51 ret i32 %C 52} 53 54define i32 @sub2(i32 %a) { 55 %sub = sub i32 %a, %a 56 call void @pad() 57 ret i32 %sub 58} 59 60 61 62define i32 @outer_mul1(i32 %a) { 63; CHECK-LABEL: @outer_mul1( 64; CHECK-NOT: call i32 @mul 65 %C = call i32 @mul(i32 %a, i32 0) 66 ret i32 %C 67} 68 69define i32 @outer_mul2(i32 %a) { 70; CHECK-LABEL: @outer_mul2( 71; CHECK-NOT: call i32 @mul 72 %C = call i32 @mul(i32 %a, i32 1) 73 ret i32 %C 74} 75 76define i32 @mul(i32 %a, i32 %b) { 77 %mul = mul i32 %a, %b 78 call void @pad() 79 store i32 0, i32* @glbl 80 ret i32 %mul 81} 82 83 84 85define i32 @outer_div1(i32 %a) { 86; CHECK-LABEL: @outer_div1( 87; CHECK-NOT: call i32 @div1 88 %C = call i32 @div1(i32 0, i32 %a) 89 ret i32 %C 90} 91 92define i32 @outer_div2(i32 %a) { 93; CHECK-LABEL: @outer_div2( 94; CHECK-NOT: call i32 @div1 95 %C = call i32 @div1(i32 %a, i32 1) 96 ret i32 %C 97} 98 99define i32 @div1(i32 %a, i32 %b) { 100 %div = sdiv i32 %a, %b 101 call void @pad() 102 store i32 0, i32* @glbl 103 ret i32 %div 104} 105 106 107define i32 @outer_div3(i32 %a) { 108; CHECK-LABEL: @outer_div3( 109; CHECK-NOT: call i32 @div 110 %C = call i32 @div2(i32 %a) 111 ret i32 %C 112} 113 114define i32 @div2(i32 %a) { 115 %div = sdiv i32 %a, %a 116 call void @pad() 117 ret i32 %div 118} 119 120 121 122define i32 @outer_rem1(i32 %a) { 123; CHECK-LABEL: @outer_rem1( 124; CHECK-NOT: call i32 @rem 125 %C = call i32 @rem1(i32 0, i32 %a) 126 ret i32 %C 127} 128 129define i32 @outer_rem2(i32 %a) { 130; CHECK-LABEL: @outer_rem2( 131; CHECK-NOT: call i32 @rem 132 %C = call i32 @rem1(i32 %a, i32 1) 133 ret i32 %C 134} 135 136define i32 @rem1(i32 %a, i32 %b) { 137 %rem = urem i32 %a, %b 138 call void @pad() 139 store i32 0, i32* @glbl 140 ret i32 %rem 141} 142 143 144define i32 @outer_rem3(i32 %a) { 145; CHECK-LABEL: @outer_rem3( 146; CHECK-NOT: call i32 @rem 147 %C = call i32 @rem2(i32 %a) 148 ret i32 %C 149} 150 151define i32 @rem2(i32 %a) { 152 %rem = urem i32 %a, %a 153 call void @pad() 154 ret i32 %rem 155} 156 157 158 159define i32 @outer_shl1(i32 %a) { 160; CHECK-LABEL: @outer_shl1( 161; CHECK-NOT: call i32 @shl 162 %C = call i32 @shl(i32 %a, i32 0) 163 ret i32 %C 164} 165 166define i32 @shl(i32 %a, i32 %b) { 167 %shl = shl i32 %a, %b 168 call void @pad() 169 store i32 0, i32* @glbl 170 ret i32 %shl 171} 172 173 174 175define i32 @outer_shr1(i32 %a) { 176; CHECK-LABEL: @outer_shr1( 177; CHECK-NOT: call i32 @shr 178 %C = call i32 @shr(i32 %a, i32 0) 179 ret i32 %C 180} 181 182define i32 @shr(i32 %a, i32 %b) { 183 %shr = ashr i32 %a, %b 184 call void @pad() 185 store i32 0, i32* @glbl 186 ret i32 %shr 187} 188 189 190 191define i1 @outer_and1(i1 %a) { 192; check-label: @outer_and1( 193; check-not: call i1 @and1 194 %c = call i1 @and1(i1 %a, i1 false) 195 ret i1 %c 196} 197 198define i1 @outer_and2(i1 %a) { 199; check-label: @outer_and2( 200; check-not: call i1 @and1 201 %c = call i1 @and1(i1 %a, i1 true) 202 ret i1 %c 203} 204 205define i1 @and1(i1 %a, i1 %b) { 206 %and = and i1 %a, %b 207 call void @pad() 208 store i32 0, i32* @glbl 209 ret i1 %and 210} 211 212 213define i1 @outer_and3(i1 %a) { 214; check-label: @outer_and3( 215; check-not: call i1 @and2 216 %c = call i1 @and2(i1 %a) 217 ret i1 %c 218} 219 220define i1 @and2(i1 %a) { 221 %and = and i1 %a, %a 222 call void @pad() 223 ret i1 %and 224} 225 226 227 228define i1 @outer_or1(i1 %a) { 229; check-label: @outer_or1( 230; check-not: call i1 @or1 231 %c = call i1 @or1(i1 %a, i1 false) 232 ret i1 %c 233} 234 235define i1 @outer_or2(i1 %a) { 236; check-label: @outer_or2( 237; check-not: call i1 @or1 238 %c = call i1 @or1(i1 %a, i1 true) 239 ret i1 %c 240} 241 242define i1 @or1(i1 %a, i1 %b) { 243 %or = or i1 %a, %b 244 call void @pad() 245 store i32 0, i32* @glbl 246 ret i1 %or 247} 248 249 250define i1 @outer_or3(i1 %a) { 251; check-label: @outer_or3( 252; check-not: call i1 @or2 253 %c = call i1 @or2(i1 %a) 254 ret i1 %c 255} 256 257define i1 @or2(i1 %a) { 258 %or = or i1 %a, %a 259 call void @pad() 260 ret i1 %or 261} 262 263 264 265define i1 @outer_xor1(i1 %a) { 266; check-label: @outer_xor1( 267; check-not: call i1 @xor 268 %c = call i1 @xor1(i1 %a, i1 false) 269 ret i1 %c 270} 271 272define i1 @xor1(i1 %a, i1 %b) { 273 %xor = xor i1 %a, %b 274 call void @pad() 275 store i32 0, i32* @glbl 276 ret i1 %xor 277} 278 279 280define i1 @outer_xor3(i1 %a) { 281; check-label: @outer_xor3( 282; check-not: call i1 @xor 283 %c = call i1 @xor2(i1 %a) 284 ret i1 %c 285} 286 287define i1 @xor2(i1 %a) { 288 %xor = xor i1 %a, %a 289 call void @pad() 290 ret i1 %xor 291} 292