1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2 2; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -passes=amdgpu-simplifylib %s | FileCheck %s 3 4target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9" 5 6declare float @_Z4exp2f(float) 7declare <2 x float> @_Z4exp2Dv2_f(<2 x float>) 8declare <3 x float> @_Z4exp2Dv3_f(<3 x float>) 9declare <4 x float> @_Z4exp2Dv4_f(<4 x float>) 10declare <8 x float> @_Z4exp2Dv8_f(<8 x float>) 11declare <16 x float> @_Z4exp2Dv16_f(<16 x float>) 12 13declare double @_Z4exp2d(double) 14declare <2 x double> @_Z4exp2Dv2_d(<2 x double>) 15declare <3 x double> @_Z4exp2Dv3_d(<3 x double>) 16declare <4 x double> @_Z4exp2Dv4_d(<4 x double>) 17declare <8 x double> @_Z4exp2Dv8_d(<8 x double>) 18declare <16 x double> @_Z4exp2Dv16_d(<16 x double>) 19 20declare half @_Z4exp2Dh(half) 21declare <2 x half> @_Z4exp2Dv2_Dh(<2 x half>) 22declare <3 x half> @_Z4exp2Dv3_Dh(<3 x half>) 23declare <4 x half> @_Z4exp2Dv4_Dh(<4 x half>) 24declare <8 x half> @_Z4exp2Dv8_Dh(<8 x half>) 25declare <16 x half> @_Z4exp2Dv16_Dh(<16 x half>) 26 27define float @test_exp2_f32(float %arg) { 28; CHECK-LABEL: define float @test_exp2_f32 29; CHECK-SAME: (float [[ARG:%.*]]) { 30; CHECK-NEXT: [[EXP2:%.*]] = tail call float @_Z4exp2f(float [[ARG]]), !fpmath !0 31; CHECK-NEXT: ret float [[EXP2]] 32; 33 %exp2 = tail call float @_Z4exp2f(float %arg), !fpmath !0 34 ret float %exp2 35} 36 37define <2 x float> @test_exp2_v2f32(<2 x float> %arg) { 38; CHECK-LABEL: define <2 x float> @test_exp2_v2f32 39; CHECK-SAME: (<2 x float> [[ARG:%.*]]) { 40; CHECK-NEXT: [[EXP2:%.*]] = tail call <2 x float> @_Z4exp2Dv2_f(<2 x float> [[ARG]]), !fpmath !0 41; CHECK-NEXT: ret <2 x float> [[EXP2]] 42; 43 %exp2 = tail call <2 x float> @_Z4exp2Dv2_f(<2 x float> %arg), !fpmath !0 44 ret <2 x float> %exp2 45} 46 47define <3 x float> @test_exp2_v3f32(<3 x float> %arg) { 48; CHECK-LABEL: define <3 x float> @test_exp2_v3f32 49; CHECK-SAME: (<3 x float> [[ARG:%.*]]) { 50; CHECK-NEXT: [[EXP2:%.*]] = tail call <3 x float> @_Z4exp2Dv3_f(<3 x float> [[ARG]]), !fpmath !0 51; CHECK-NEXT: ret <3 x float> [[EXP2]] 52; 53 %exp2 = tail call <3 x float> @_Z4exp2Dv3_f(<3 x float> %arg), !fpmath !0 54 ret <3 x float> %exp2 55} 56 57define <4 x float> @test_exp2_v4f32(<4 x float> %arg) { 58; CHECK-LABEL: define <4 x float> @test_exp2_v4f32 59; CHECK-SAME: (<4 x float> [[ARG:%.*]]) { 60; CHECK-NEXT: [[EXP2:%.*]] = tail call <4 x float> @_Z4exp2Dv4_f(<4 x float> [[ARG]]), !fpmath !0 61; CHECK-NEXT: ret <4 x float> [[EXP2]] 62; 63 %exp2 = tail call <4 x float> @_Z4exp2Dv4_f(<4 x float> %arg), !fpmath !0 64 ret <4 x float> %exp2 65} 66 67define <8 x float> @test_exp2_v8f32(<8 x float> %arg) { 68; CHECK-LABEL: define <8 x float> @test_exp2_v8f32 69; CHECK-SAME: (<8 x float> [[ARG:%.*]]) { 70; CHECK-NEXT: [[EXP2:%.*]] = tail call <8 x float> @_Z4exp2Dv8_f(<8 x float> [[ARG]]), !fpmath !0 71; CHECK-NEXT: ret <8 x float> [[EXP2]] 72; 73 %exp2 = tail call <8 x float> @_Z4exp2Dv8_f(<8 x float> %arg), !fpmath !0 74 ret <8 x float> %exp2 75} 76 77define <16 x float> @test_exp2_v16f32(<16 x float> %arg) { 78; CHECK-LABEL: define <16 x float> @test_exp2_v16f32 79; CHECK-SAME: (<16 x float> [[ARG:%.*]]) { 80; CHECK-NEXT: [[EXP2:%.*]] = tail call <16 x float> @_Z4exp2Dv16_f(<16 x float> [[ARG]]), !fpmath !0 81; CHECK-NEXT: ret <16 x float> [[EXP2]] 82; 83 %exp2 = tail call <16 x float> @_Z4exp2Dv16_f(<16 x float> %arg), !fpmath !0 84 ret <16 x float> %exp2 85} 86 87define float @test_exp2_cr_f32(float %arg) { 88; CHECK-LABEL: define float @test_exp2_cr_f32 89; CHECK-SAME: (float [[ARG:%.*]]) { 90; CHECK-NEXT: [[EXP2:%.*]] = tail call float @_Z4exp2f(float [[ARG]]) 91; CHECK-NEXT: ret float [[EXP2]] 92; 93 %exp2 = tail call float @_Z4exp2f(float %arg) 94 ret float %exp2 95} 96 97define <2 x float> @test_exp2_cr_v2f32(<2 x float> %arg) { 98; CHECK-LABEL: define <2 x float> @test_exp2_cr_v2f32 99; CHECK-SAME: (<2 x float> [[ARG:%.*]]) { 100; CHECK-NEXT: [[EXP2:%.*]] = tail call <2 x float> @_Z4exp2Dv2_f(<2 x float> [[ARG]]) 101; CHECK-NEXT: ret <2 x float> [[EXP2]] 102; 103 %exp2 = tail call <2 x float> @_Z4exp2Dv2_f(<2 x float> %arg) 104 ret <2 x float> %exp2 105} 106 107define <3 x float> @test_exp2_cr_v3f32(<3 x float> %arg) { 108; CHECK-LABEL: define <3 x float> @test_exp2_cr_v3f32 109; CHECK-SAME: (<3 x float> [[ARG:%.*]]) { 110; CHECK-NEXT: [[EXP2:%.*]] = tail call <3 x float> @_Z4exp2Dv3_f(<3 x float> [[ARG]]) 111; CHECK-NEXT: ret <3 x float> [[EXP2]] 112; 113 %exp2 = tail call <3 x float> @_Z4exp2Dv3_f(<3 x float> %arg) 114 ret <3 x float> %exp2 115} 116 117define <4 x float> @test_exp2_cr_v4f32(<4 x float> %arg) { 118; CHECK-LABEL: define <4 x float> @test_exp2_cr_v4f32 119; CHECK-SAME: (<4 x float> [[ARG:%.*]]) { 120; CHECK-NEXT: [[EXP2:%.*]] = tail call <4 x float> @_Z4exp2Dv4_f(<4 x float> [[ARG]]) 121; CHECK-NEXT: ret <4 x float> [[EXP2]] 122; 123 %exp2 = tail call <4 x float> @_Z4exp2Dv4_f(<4 x float> %arg) 124 ret <4 x float> %exp2 125} 126 127define <8 x float> @test_exp2_cr_v8f32(<8 x float> %arg) { 128; CHECK-LABEL: define <8 x float> @test_exp2_cr_v8f32 129; CHECK-SAME: (<8 x float> [[ARG:%.*]]) { 130; CHECK-NEXT: [[EXP2:%.*]] = tail call <8 x float> @_Z4exp2Dv8_f(<8 x float> [[ARG]]) 131; CHECK-NEXT: ret <8 x float> [[EXP2]] 132; 133 %exp2 = tail call <8 x float> @_Z4exp2Dv8_f(<8 x float> %arg) 134 ret <8 x float> %exp2 135} 136 137define <16 x float> @test_exp2_cr_v16f32(<16 x float> %arg) { 138; CHECK-LABEL: define <16 x float> @test_exp2_cr_v16f32 139; CHECK-SAME: (<16 x float> [[ARG:%.*]]) { 140; CHECK-NEXT: [[EXP2:%.*]] = tail call <16 x float> @_Z4exp2Dv16_f(<16 x float> [[ARG]]) 141; CHECK-NEXT: ret <16 x float> [[EXP2]] 142; 143 %exp2 = tail call <16 x float> @_Z4exp2Dv16_f(<16 x float> %arg) 144 ret <16 x float> %exp2 145} 146 147define double @test_exp2_f64(double %arg) { 148; CHECK-LABEL: define double @test_exp2_f64 149; CHECK-SAME: (double [[ARG:%.*]]) { 150; CHECK-NEXT: [[EXP2:%.*]] = tail call double @_Z4exp2d(double [[ARG]]) 151; CHECK-NEXT: ret double [[EXP2]] 152; 153 %exp2 = tail call double @_Z4exp2d(double %arg) 154 ret double %exp2 155} 156 157define <2 x double> @test_exp2_v2f64(<2 x double> %arg) { 158; CHECK-LABEL: define <2 x double> @test_exp2_v2f64 159; CHECK-SAME: (<2 x double> [[ARG:%.*]]) { 160; CHECK-NEXT: [[EXP2:%.*]] = tail call <2 x double> @_Z4exp2Dv2_d(<2 x double> [[ARG]]) 161; CHECK-NEXT: ret <2 x double> [[EXP2]] 162; 163 %exp2 = tail call <2 x double> @_Z4exp2Dv2_d(<2 x double> %arg) 164 ret <2 x double> %exp2 165} 166 167define <3 x double> @test_exp2_v3f64(<3 x double> %arg) { 168; CHECK-LABEL: define <3 x double> @test_exp2_v3f64 169; CHECK-SAME: (<3 x double> [[ARG:%.*]]) { 170; CHECK-NEXT: [[EXP2:%.*]] = tail call <3 x double> @_Z4exp2Dv3_d(<3 x double> [[ARG]]) 171; CHECK-NEXT: ret <3 x double> [[EXP2]] 172; 173 %exp2 = tail call <3 x double> @_Z4exp2Dv3_d(<3 x double> %arg) 174 ret <3 x double> %exp2 175} 176 177define <4 x double> @test_exp2_v4f64(<4 x double> %arg) { 178; CHECK-LABEL: define <4 x double> @test_exp2_v4f64 179; CHECK-SAME: (<4 x double> [[ARG:%.*]]) { 180; CHECK-NEXT: [[EXP2:%.*]] = tail call <4 x double> @_Z4exp2Dv4_d(<4 x double> [[ARG]]) 181; CHECK-NEXT: ret <4 x double> [[EXP2]] 182; 183 %exp2 = tail call <4 x double> @_Z4exp2Dv4_d(<4 x double> %arg) 184 ret <4 x double> %exp2 185} 186 187define <8 x double> @test_exp2_v8f64(<8 x double> %arg) { 188; CHECK-LABEL: define <8 x double> @test_exp2_v8f64 189; CHECK-SAME: (<8 x double> [[ARG:%.*]]) { 190; CHECK-NEXT: [[EXP2:%.*]] = tail call <8 x double> @_Z4exp2Dv8_d(<8 x double> [[ARG]]) 191; CHECK-NEXT: ret <8 x double> [[EXP2]] 192; 193 %exp2 = tail call <8 x double> @_Z4exp2Dv8_d(<8 x double> %arg) 194 ret <8 x double> %exp2 195} 196 197define <16 x double> @test_exp2_v16f64(<16 x double> %arg) { 198; CHECK-LABEL: define <16 x double> @test_exp2_v16f64 199; CHECK-SAME: (<16 x double> [[ARG:%.*]]) { 200; CHECK-NEXT: [[EXP2:%.*]] = tail call <16 x double> @_Z4exp2Dv16_d(<16 x double> [[ARG]]) 201; CHECK-NEXT: ret <16 x double> [[EXP2]] 202; 203 %exp2 = tail call <16 x double> @_Z4exp2Dv16_d(<16 x double> %arg) 204 ret <16 x double> %exp2 205} 206 207define half @test_exp2_f16(half %arg) { 208; CHECK-LABEL: define half @test_exp2_f16 209; CHECK-SAME: (half [[ARG:%.*]]) { 210; CHECK-NEXT: [[EXP2:%.*]] = tail call half @_Z4exp2Dh(half [[ARG]]) 211; CHECK-NEXT: ret half [[EXP2]] 212; 213 %exp2 = tail call half @_Z4exp2Dh(half %arg) 214 ret half %exp2 215} 216 217define half @test_exp2_f16_fast(half %arg) { 218; CHECK-LABEL: define half @test_exp2_f16_fast 219; CHECK-SAME: (half [[ARG:%.*]]) { 220; CHECK-NEXT: [[EXP2:%.*]] = tail call fast half @llvm.exp2.f16(half [[ARG]]) 221; CHECK-NEXT: ret half [[EXP2]] 222; 223 %exp2 = tail call fast half @_Z4exp2Dh(half %arg) 224 ret half %exp2 225} 226 227define <2 x half> @test_exp2_v2f16(<2 x half> %arg) { 228; CHECK-LABEL: define <2 x half> @test_exp2_v2f16 229; CHECK-SAME: (<2 x half> [[ARG:%.*]]) { 230; CHECK-NEXT: [[EXP2:%.*]] = tail call <2 x half> @_Z4exp2Dv2_Dh(<2 x half> [[ARG]]) 231; CHECK-NEXT: ret <2 x half> [[EXP2]] 232; 233 %exp2 = tail call <2 x half> @_Z4exp2Dv2_Dh(<2 x half> %arg) 234 ret <2 x half> %exp2 235} 236 237define <3 x half> @test_exp2_v3f16(<3 x half> %arg) { 238; CHECK-LABEL: define <3 x half> @test_exp2_v3f16 239; CHECK-SAME: (<3 x half> [[ARG:%.*]]) { 240; CHECK-NEXT: [[EXP2:%.*]] = tail call <3 x half> @_Z4exp2Dv3_Dh(<3 x half> [[ARG]]) 241; CHECK-NEXT: ret <3 x half> [[EXP2]] 242; 243 %exp2 = tail call <3 x half> @_Z4exp2Dv3_Dh(<3 x half> %arg) 244 ret <3 x half> %exp2 245} 246 247define <4 x half> @test_exp2_v4f16(<4 x half> %arg) { 248; CHECK-LABEL: define <4 x half> @test_exp2_v4f16 249; CHECK-SAME: (<4 x half> [[ARG:%.*]]) { 250; CHECK-NEXT: [[EXP2:%.*]] = tail call <4 x half> @_Z4exp2Dv4_Dh(<4 x half> [[ARG]]) 251; CHECK-NEXT: ret <4 x half> [[EXP2]] 252; 253 %exp2 = tail call <4 x half> @_Z4exp2Dv4_Dh(<4 x half> %arg) 254 ret <4 x half> %exp2 255} 256 257define <8 x half> @test_exp2_v8f16(<8 x half> %arg) { 258; CHECK-LABEL: define <8 x half> @test_exp2_v8f16 259; CHECK-SAME: (<8 x half> [[ARG:%.*]]) { 260; CHECK-NEXT: [[EXP2:%.*]] = tail call <8 x half> @_Z4exp2Dv8_Dh(<8 x half> [[ARG]]) 261; CHECK-NEXT: ret <8 x half> [[EXP2]] 262; 263 %exp2 = tail call <8 x half> @_Z4exp2Dv8_Dh(<8 x half> %arg) 264 ret <8 x half> %exp2 265} 266 267define <16 x half> @test_exp2_v16f16(<16 x half> %arg) { 268; CHECK-LABEL: define <16 x half> @test_exp2_v16f16 269; CHECK-SAME: (<16 x half> [[ARG:%.*]]) { 270; CHECK-NEXT: [[EXP2:%.*]] = tail call <16 x half> @_Z4exp2Dv16_Dh(<16 x half> [[ARG]]) 271; CHECK-NEXT: ret <16 x half> [[EXP2]] 272; 273 %exp2 = tail call <16 x half> @_Z4exp2Dv16_Dh(<16 x half> %arg) 274 ret <16 x half> %exp2 275} 276 277define float @test_exp2_f32_nobuiltin_callsite(float %arg) { 278; CHECK-LABEL: define float @test_exp2_f32_nobuiltin_callsite 279; CHECK-SAME: (float [[ARG:%.*]]) { 280; CHECK-NEXT: [[EXP2:%.*]] = tail call float @_Z4exp2f(float [[ARG]]) #[[ATTR6:[0-9]+]], !fpmath !0 281; CHECK-NEXT: ret float [[EXP2]] 282; 283 %exp2 = tail call float @_Z4exp2f(float %arg) #0, !fpmath !0 284 ret float %exp2 285} 286 287define <2 x float> @test_exp2_v2f32_nobuiltin_callsite(<2 x float> %arg) { 288; CHECK-LABEL: define <2 x float> @test_exp2_v2f32_nobuiltin_callsite 289; CHECK-SAME: (<2 x float> [[ARG:%.*]]) { 290; CHECK-NEXT: [[EXP2:%.*]] = tail call <2 x float> @_Z4exp2Dv2_f(<2 x float> [[ARG]]) #[[ATTR6]], !fpmath !0 291; CHECK-NEXT: ret <2 x float> [[EXP2]] 292; 293 %exp2 = tail call <2 x float> @_Z4exp2Dv2_f(<2 x float> %arg) #0, !fpmath !0 294 ret <2 x float> %exp2 295} 296 297define float @test_exp2_cr_f32_nobuiltin_callsite(float %arg) { 298; CHECK-LABEL: define float @test_exp2_cr_f32_nobuiltin_callsite 299; CHECK-SAME: (float [[ARG:%.*]]) { 300; CHECK-NEXT: [[EXP2:%.*]] = tail call float @_Z4exp2f(float [[ARG]]) #[[ATTR6]] 301; CHECK-NEXT: ret float [[EXP2]] 302; 303 %exp2 = tail call float @_Z4exp2f(float %arg) #0 304 ret float %exp2 305} 306 307define <2 x float> @test_exp2_cr_v2f32_nobuiltin_callsite(<2 x float> %arg) { 308; CHECK-LABEL: define <2 x float> @test_exp2_cr_v2f32_nobuiltin_callsite 309; CHECK-SAME: (<2 x float> [[ARG:%.*]]) { 310; CHECK-NEXT: [[EXP2:%.*]] = tail call <2 x float> @_Z4exp2Dv2_f(<2 x float> [[ARG]]) #[[ATTR6]] 311; CHECK-NEXT: ret <2 x float> [[EXP2]] 312; 313 %exp2 = tail call <2 x float> @_Z4exp2Dv2_f(<2 x float> %arg) #0 314 ret <2 x float> %exp2 315} 316 317; "no-builtins" should be ignored 318define float @test_exp2_f32_nobuiltins(float %arg) #1 { 319; CHECK-LABEL: define float @test_exp2_f32_nobuiltins 320; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR0:[0-9]+]] { 321; CHECK-NEXT: [[EXP2:%.*]] = tail call float @_Z4exp2f(float [[ARG]]) #[[ATTR6]], !fpmath !0 322; CHECK-NEXT: ret float [[EXP2]] 323; 324 %exp2 = tail call float @_Z4exp2f(float %arg) #0, !fpmath !0 325 ret float %exp2 326} 327 328define <2 x float> @test_exp2_v2f32_nobuiltins(<2 x float> %arg) #1 { 329; CHECK-LABEL: define <2 x float> @test_exp2_v2f32_nobuiltins 330; CHECK-SAME: (<2 x float> [[ARG:%.*]]) #[[ATTR0]] { 331; CHECK-NEXT: [[EXP2:%.*]] = tail call <2 x float> @_Z4exp2Dv2_f(<2 x float> [[ARG]]) #[[ATTR6]], !fpmath !0 332; CHECK-NEXT: ret <2 x float> [[EXP2]] 333; 334 %exp2 = tail call <2 x float> @_Z4exp2Dv2_f(<2 x float> %arg) #0, !fpmath !0 335 ret <2 x float> %exp2 336} 337 338define float @test_exp2_cr_f32_nobuiltins(float %arg) #1 { 339; CHECK-LABEL: define float @test_exp2_cr_f32_nobuiltins 340; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR0]] { 341; CHECK-NEXT: [[EXP2:%.*]] = tail call float @_Z4exp2f(float [[ARG]]) #[[ATTR6]] 342; CHECK-NEXT: ret float [[EXP2]] 343; 344 %exp2 = tail call float @_Z4exp2f(float %arg) #0 345 ret float %exp2 346} 347 348define <2 x float> @test_exp2_cr_v2f32_nobuiltins(<2 x float> %arg) #1 { 349; CHECK-LABEL: define <2 x float> @test_exp2_cr_v2f32_nobuiltins 350; CHECK-SAME: (<2 x float> [[ARG:%.*]]) #[[ATTR0]] { 351; CHECK-NEXT: [[EXP2:%.*]] = tail call <2 x float> @_Z4exp2Dv2_f(<2 x float> [[ARG]]) #[[ATTR6]] 352; CHECK-NEXT: ret <2 x float> [[EXP2]] 353; 354 %exp2 = tail call <2 x float> @_Z4exp2Dv2_f(<2 x float> %arg) #0 355 ret <2 x float> %exp2 356} 357 358define float @test_exp2_f32_preserve_flags(float %arg) { 359; CHECK-LABEL: define float @test_exp2_f32_preserve_flags 360; CHECK-SAME: (float [[ARG:%.*]]) { 361; CHECK-NEXT: [[EXP2:%.*]] = tail call nnan ninf float @llvm.exp2.f32(float [[ARG]]), !fpmath !0 362; CHECK-NEXT: ret float [[EXP2]] 363; 364 %exp2 = tail call nnan ninf float @_Z4exp2f(float %arg), !fpmath !0 365 ret float %exp2 366} 367 368define <2 x float> @test_exp2_v2f32_preserve_flags(<2 x float> %arg) { 369; CHECK-LABEL: define <2 x float> @test_exp2_v2f32_preserve_flags 370; CHECK-SAME: (<2 x float> [[ARG:%.*]]) { 371; CHECK-NEXT: [[EXP2:%.*]] = tail call nnan nsz contract <2 x float> @llvm.exp2.v2f32(<2 x float> [[ARG]]), !fpmath !0 372; CHECK-NEXT: ret <2 x float> [[EXP2]] 373; 374 %exp2 = tail call contract nsz nnan <2 x float> @_Z4exp2Dv2_f(<2 x float> %arg), !fpmath !0 375 ret <2 x float> %exp2 376} 377 378define float @test_exp2_f32_preserve_flags_md(float %arg) { 379; CHECK-LABEL: define float @test_exp2_f32_preserve_flags_md 380; CHECK-SAME: (float [[ARG:%.*]]) { 381; CHECK-NEXT: [[EXP2:%.*]] = tail call nnan ninf float @llvm.exp2.f32(float [[ARG]]), !fpmath !0, !foo !1 382; CHECK-NEXT: ret float [[EXP2]] 383; 384 %exp2 = tail call nnan ninf float @_Z4exp2f(float %arg), !fpmath !0, !foo !1 385 ret float %exp2 386} 387 388define <2 x float> @test_exp2_v2f32_preserve_flags_md(<2 x float> %arg) { 389; CHECK-LABEL: define <2 x float> @test_exp2_v2f32_preserve_flags_md 390; CHECK-SAME: (<2 x float> [[ARG:%.*]]) { 391; CHECK-NEXT: [[EXP2:%.*]] = tail call nnan nsz contract <2 x float> @llvm.exp2.v2f32(<2 x float> [[ARG]]), !fpmath !0, !foo !1 392; CHECK-NEXT: ret <2 x float> [[EXP2]] 393; 394 %exp2 = tail call contract nsz nnan <2 x float> @_Z4exp2Dv2_f(<2 x float> %arg), !fpmath !0, !foo !1 395 ret <2 x float> %exp2 396} 397 398define float @test_exp2_cr_f32_preserve_flags(float %arg) { 399; CHECK-LABEL: define float @test_exp2_cr_f32_preserve_flags 400; CHECK-SAME: (float [[ARG:%.*]]) { 401; CHECK-NEXT: [[EXP2:%.*]] = tail call ninf contract float @llvm.exp2.f32(float [[ARG]]) 402; CHECK-NEXT: ret float [[EXP2]] 403; 404 %exp2 = tail call ninf contract float @_Z4exp2f(float %arg) 405 ret float %exp2 406} 407 408define <2 x float> @test_exp2_cr_v2f32_preserve_flags(<2 x float> %arg) { 409; CHECK-LABEL: define <2 x float> @test_exp2_cr_v2f32_preserve_flags 410; CHECK-SAME: (<2 x float> [[ARG:%.*]]) { 411; CHECK-NEXT: [[EXP2:%.*]] = tail call nnan nsz <2 x float> @llvm.exp2.v2f32(<2 x float> [[ARG]]) 412; CHECK-NEXT: ret <2 x float> [[EXP2]] 413; 414 %exp2 = tail call nnan nsz <2 x float> @_Z4exp2Dv2_f(<2 x float> %arg) 415 ret <2 x float> %exp2 416} 417 418; Test the libm name, not a recognized opencl builtin. 419declare float @exp2f(float) #2 420declare double @exp2(double) #2 421 422define float @test_libm_exp2_f32(float %arg) { 423; CHECK-LABEL: define float @test_libm_exp2_f32 424; CHECK-SAME: (float [[ARG:%.*]]) { 425; CHECK-NEXT: [[EXP2:%.*]] = tail call float @exp2f(float [[ARG]]) 426; CHECK-NEXT: ret float [[EXP2]] 427; 428 %exp2 = tail call float @exp2f(float %arg) 429 ret float %exp2 430} 431 432define float @test_libm_exp2_f32_fast(float %arg) { 433; CHECK-LABEL: define float @test_libm_exp2_f32_fast 434; CHECK-SAME: (float [[ARG:%.*]]) { 435; CHECK-NEXT: [[EXP2:%.*]] = tail call fast float @exp2f(float [[ARG]]) 436; CHECK-NEXT: ret float [[EXP2]] 437; 438 %exp2 = tail call fast float @exp2f(float %arg) 439 ret float %exp2 440} 441 442define float @test_libm_exp2_f32_fpmath(float %arg) { 443; CHECK-LABEL: define float @test_libm_exp2_f32_fpmath 444; CHECK-SAME: (float [[ARG:%.*]]) { 445; CHECK-NEXT: [[EXP2:%.*]] = tail call float @exp2f(float [[ARG]]), !fpmath !0 446; CHECK-NEXT: ret float [[EXP2]] 447; 448 %exp2 = tail call float @exp2f(float %arg), !fpmath !0 449 ret float %exp2 450} 451 452define double @test_libm_exp2_f64(double %arg) { 453; CHECK-LABEL: define double @test_libm_exp2_f64 454; CHECK-SAME: (double [[ARG:%.*]]) { 455; CHECK-NEXT: [[EXP2:%.*]] = tail call double @exp2(double [[ARG]]) 456; CHECK-NEXT: ret double [[EXP2]] 457; 458 %exp2 = tail call double @exp2(double %arg) 459 ret double %exp2 460} 461 462define double @test_libm_exp2_f64_fast(double %arg) { 463; CHECK-LABEL: define double @test_libm_exp2_f64_fast 464; CHECK-SAME: (double [[ARG:%.*]]) { 465; CHECK-NEXT: [[EXP2:%.*]] = tail call fast double @exp2(double [[ARG]]) 466; CHECK-NEXT: ret double [[EXP2]] 467; 468 %exp2 = tail call fast double @exp2(double %arg) 469 ret double %exp2 470} 471 472define double @test_libm_exp2_f64_fpmath(double %arg) { 473; CHECK-LABEL: define double @test_libm_exp2_f64_fpmath 474; CHECK-SAME: (double [[ARG:%.*]]) { 475; CHECK-NEXT: [[EXP2:%.*]] = tail call double @exp2(double [[ARG]]), !fpmath !0 476; CHECK-NEXT: ret double [[EXP2]] 477; 478 %exp2 = tail call double @exp2(double %arg), !fpmath !0 479 ret double %exp2 480} 481 482define float @test_exp2_f32_fast_noinline(float %arg) { 483; CHECK-LABEL: define float @test_exp2_f32_fast_noinline 484; CHECK-SAME: (float [[ARG:%.*]]) { 485; CHECK-NEXT: [[EXP2:%.*]] = tail call fast float @_Z4exp2f(float [[ARG]]) #[[ATTR7:[0-9]+]], !fpmath !0 486; CHECK-NEXT: ret float [[EXP2]] 487; 488 %exp2 = tail call fast float @_Z4exp2f(float %arg) #3, !fpmath !0 489 ret float %exp2 490} 491 492define float @test_exp2_f32_fast_optsize(float %arg) #4 { 493; CHECK-LABEL: define float @test_exp2_f32_fast_optsize 494; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR2:[0-9]+]] { 495; CHECK-NEXT: [[EXP2:%.*]] = tail call fast float @llvm.exp2.f32(float [[ARG]]), !fpmath !0 496; CHECK-NEXT: ret float [[EXP2]] 497; 498 %exp2 = tail call fast float @_Z4exp2f(float %arg), !fpmath !0 499 ret float %exp2 500} 501 502define float @test_exp2_f32_fast_minsize(float %arg) #5 { 503; CHECK-LABEL: define float @test_exp2_f32_fast_minsize 504; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR3:[0-9]+]] { 505; CHECK-NEXT: [[EXP2:%.*]] = tail call fast float @llvm.exp2.f32(float [[ARG]]), !fpmath !0 506; CHECK-NEXT: ret float [[EXP2]] 507; 508 %exp2 = tail call fast float @_Z4exp2f(float %arg), !fpmath !0 509 ret float %exp2 510} 511 512define float @test_exp2_f32_nsz_contract_optsize(float %arg) #4 { 513; CHECK-LABEL: define float @test_exp2_f32_nsz_contract_optsize 514; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR2]] { 515; CHECK-NEXT: [[EXP2:%.*]] = tail call nsz contract float @llvm.exp2.f32(float [[ARG]]), !fpmath !0 516; CHECK-NEXT: ret float [[EXP2]] 517; 518 %exp2 = tail call nsz contract float @_Z4exp2f(float %arg), !fpmath !0 519 ret float %exp2 520} 521 522define float @test_exp2_f32_nsz_contract_minsize(float %arg) #5 { 523; CHECK-LABEL: define float @test_exp2_f32_nsz_contract_minsize 524; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR3]] { 525; CHECK-NEXT: [[EXP2:%.*]] = tail call nsz contract float @_Z4exp2f(float [[ARG]]), !fpmath !0 526; CHECK-NEXT: ret float [[EXP2]] 527; 528 %exp2 = tail call nsz contract float @_Z4exp2f(float %arg), !fpmath !0 529 ret float %exp2 530} 531 532define half @test_exp2_f16_fast_minsize(half %arg) #5 { 533; CHECK-LABEL: define half @test_exp2_f16_fast_minsize 534; CHECK-SAME: (half [[ARG:%.*]]) #[[ATTR3]] { 535; CHECK-NEXT: [[EXP2:%.*]] = tail call fast half @llvm.exp2.f16(half [[ARG]]) 536; CHECK-NEXT: ret half [[EXP2]] 537; 538 %exp2 = tail call fast half @_Z4exp2Dh(half %arg) 539 ret half %exp2 540} 541 542define float @test_exp2_f32_strictfp(float %arg) #6 { 543; CHECK-LABEL: define float @test_exp2_f32_strictfp 544; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR4:[0-9]+]] { 545; CHECK-NEXT: [[EXP:%.*]] = tail call nsz float @_Z4exp2f(float [[ARG]]) #[[ATTR4]] 546; CHECK-NEXT: ret float [[EXP]] 547; 548 %exp = tail call nsz float @_Z4exp2f(float %arg) #6 549 ret float %exp 550} 551 552attributes #0 = { nobuiltin } 553attributes #1 = { "no-builtins" } 554attributes #2 = { nounwind memory(none) } 555attributes #3 = { noinline } 556attributes #4 = { optsize } 557attributes #5 = { minsize } 558attributes #6 = { strictfp } 559 560!0 = !{float 3.000000e+00} 561!1 = !{i32 1234} 562