283 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 22; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT3 4declare float @llvm.sqrt.f32(float)5declare <2 x float> @llvm.sqrt.v2f32(<2 x float>)6declare float @llvm.experimental.constrained.sqrt.f32(float, metadata, metadata)7 8define float @ret_sqrt(float %arg0) #0 {9; CHECK-LABEL: define nofpclass(ninf nsub nnorm) float @ret_sqrt10; CHECK-SAME: (float [[ARG0:%.*]]) #[[ATTR2:[0-9]+]] {11; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10:[0-9]+]]12; CHECK-NEXT: ret float [[CALL]]13;14 %call = call float @llvm.sqrt.f32(float %arg0)15 ret float %call16}17 18define float @ret_sqrt_noinf(float nofpclass(inf) %arg0) #0 {19; CHECK-LABEL: define nofpclass(inf nsub nnorm) float @ret_sqrt_noinf20; CHECK-SAME: (float nofpclass(inf) [[ARG0:%.*]]) #[[ATTR2]] {21; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nsub nnorm) float @llvm.sqrt.f32(float nofpclass(inf) [[ARG0]]) #[[ATTR10]]22; CHECK-NEXT: ret float [[CALL]]23;24 %call = call float @llvm.sqrt.f32(float %arg0)25 ret float %call26}27 28define float @ret_sqrt_nopinf(float nofpclass(pinf) %arg0) #0 {29; CHECK-LABEL: define nofpclass(inf nsub nnorm) float @ret_sqrt_nopinf30; CHECK-SAME: (float nofpclass(pinf) [[ARG0:%.*]]) #[[ATTR2]] {31; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nsub nnorm) float @llvm.sqrt.f32(float nofpclass(pinf) [[ARG0]]) #[[ATTR10]]32; CHECK-NEXT: ret float [[CALL]]33;34 %call = call float @llvm.sqrt.f32(float %arg0)35 ret float %call36}37 38define float @ret_sqrt_noninf(float nofpclass(ninf) %arg0) #0 {39; CHECK-LABEL: define nofpclass(ninf nsub nnorm) float @ret_sqrt_noninf40; CHECK-SAME: (float nofpclass(ninf) [[ARG0:%.*]]) #[[ATTR2]] {41; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nsub nnorm) float @llvm.sqrt.f32(float nofpclass(ninf) [[ARG0]]) #[[ATTR10]]42; CHECK-NEXT: ret float [[CALL]]43;44 %call = call float @llvm.sqrt.f32(float %arg0)45 ret float %call46}47 48define float @ret_sqrt_nonan(float nofpclass(nan) %arg0) #0 {49; CHECK-LABEL: define nofpclass(snan ninf nsub nnorm) float @ret_sqrt_nonan50; CHECK-SAME: (float nofpclass(nan) [[ARG0:%.*]]) #[[ATTR2]] {51; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(snan ninf nsub nnorm) float @llvm.sqrt.f32(float nofpclass(nan) [[ARG0]]) #[[ATTR10]]52; CHECK-NEXT: ret float [[CALL]]53;54 %call = call float @llvm.sqrt.f32(float %arg0)55 ret float %call56}57 58define float @ret_sqrt_nonan_noinf(float nofpclass(nan inf) %arg0) #0 {59; CHECK-LABEL: define nofpclass(snan inf nsub nnorm) float @ret_sqrt_nonan_noinf60; CHECK-SAME: (float nofpclass(nan inf) [[ARG0:%.*]]) #[[ATTR2]] {61; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(snan inf nsub nnorm) float @llvm.sqrt.f32(float nofpclass(nan inf) [[ARG0]]) #[[ATTR10]]62; CHECK-NEXT: ret float [[CALL]]63;64 %call = call float @llvm.sqrt.f32(float %arg0)65 ret float %call66}67 68define float @ret_sqrt_nonan_noinf_nozero(float nofpclass(nan inf zero) %arg0) #0 {69; CHECK-LABEL: define nofpclass(snan inf nzero nsub nnorm) float @ret_sqrt_nonan_noinf_nozero70; CHECK-SAME: (float nofpclass(nan inf zero) [[ARG0:%.*]]) #[[ATTR2]] {71; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(snan inf nzero nsub nnorm) float @llvm.sqrt.f32(float nofpclass(nan inf zero) [[ARG0]]) #[[ATTR10]]72; CHECK-NEXT: ret float [[CALL]]73;74 %call = call float @llvm.sqrt.f32(float %arg0)75 ret float %call76}77 78define float @ret_sqrt_noinf_nozero(float nofpclass(inf zero) %arg0) #0 {79; CHECK-LABEL: define nofpclass(inf nzero nsub nnorm) float @ret_sqrt_noinf_nozero80; CHECK-SAME: (float nofpclass(inf zero) [[ARG0:%.*]]) #[[ATTR2]] {81; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nzero nsub nnorm) float @llvm.sqrt.f32(float nofpclass(inf zero) [[ARG0]]) #[[ATTR10]]82; CHECK-NEXT: ret float [[CALL]]83;84 %call = call float @llvm.sqrt.f32(float %arg0)85 ret float %call86}87 88define float @ret_sqrt_noinf_nonegzero(float nofpclass(inf nzero) %arg0) #0 {89; CHECK-LABEL: define nofpclass(inf nzero nsub nnorm) float @ret_sqrt_noinf_nonegzero90; CHECK-SAME: (float nofpclass(inf nzero) [[ARG0:%.*]]) #[[ATTR2]] {91; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nzero nsub nnorm) float @llvm.sqrt.f32(float nofpclass(inf nzero) [[ARG0]]) #[[ATTR10]]92; CHECK-NEXT: ret float [[CALL]]93;94 %call = call float @llvm.sqrt.f32(float %arg0)95 ret float %call96}97 98define float @ret_sqrt_positive_source(i32 %arg) #0 {99; CHECK-LABEL: define nofpclass(nan inf nzero nsub nnorm) float @ret_sqrt_positive_source100; CHECK-SAME: (i32 [[ARG:%.*]]) #[[ATTR2]] {101; CHECK-NEXT: [[UITOFP:%.*]] = uitofp i32 [[ARG]] to float102; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(nan inf nzero nsub nnorm) float @llvm.sqrt.f32(float [[UITOFP]]) #[[ATTR10]]103; CHECK-NEXT: ret float [[CALL]]104;105 %uitofp = uitofp i32 %arg to float106 %call = call float @llvm.sqrt.f32(float %uitofp)107 ret float %call108}109 110; Could produce a nan because we don't know if the multiply is negative.111define float @ret_sqrt_unknown_sign(float nofpclass(nan) %arg0, float nofpclass(nan) %arg1) #0 {112; CHECK-LABEL: define nofpclass(snan ninf nsub nnorm) float @ret_sqrt_unknown_sign113; CHECK-SAME: (float nofpclass(nan) [[ARG0:%.*]], float nofpclass(nan) [[ARG1:%.*]]) #[[ATTR2]] {114; CHECK-NEXT: [[UNKNOWN_SIGN_NOT_NAN:%.*]] = fmul nnan float [[ARG0]], [[ARG1]]115; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(snan ninf nsub nnorm) float @llvm.sqrt.f32(float [[UNKNOWN_SIGN_NOT_NAN]]) #[[ATTR10]]116; CHECK-NEXT: ret float [[CALL]]117;118 %unknown.sign.not.nan = fmul nnan float %arg0, %arg1119 %call = call float @llvm.sqrt.f32(float %unknown.sign.not.nan)120 ret float %call121}122 123define float @ret_sqrt_daz_noinf_nozero(float nofpclass(inf zero) %arg0) #1 {124; CHECK-LABEL: define nofpclass(inf nsub nnorm) float @ret_sqrt_daz_noinf_nozero125; CHECK-SAME: (float nofpclass(inf zero) [[ARG0:%.*]]) #[[ATTR3:[0-9]+]] {126; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nsub nnorm) float @llvm.sqrt.f32(float nofpclass(inf zero) [[ARG0]]) #[[ATTR10]]127; CHECK-NEXT: ret float [[CALL]]128;129 %call = call float @llvm.sqrt.f32(float %arg0)130 ret float %call131}132 133define <2 x float> @ret_sqrt_daz_noinf_nozero_v2f32(<2 x float> nofpclass(inf zero) %arg0) #1 {134; CHECK-LABEL: define nofpclass(inf nsub nnorm) <2 x float> @ret_sqrt_daz_noinf_nozero_v2f32135; CHECK-SAME: (<2 x float> nofpclass(inf zero) [[ARG0:%.*]]) #[[ATTR3]] {136; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nsub nnorm) <2 x float> @llvm.sqrt.v2f32(<2 x float> nofpclass(inf zero) [[ARG0]]) #[[ATTR10]]137; CHECK-NEXT: ret <2 x float> [[CALL]]138;139 %call = call <2 x float> @llvm.sqrt.v2f32(<2 x float> %arg0)140 ret <2 x float> %call141}142 143define float @ret_sqrt_daz_noinf_nonegzero(float nofpclass(inf nzero) %arg0) #1 {144; CHECK-LABEL: define nofpclass(inf nsub nnorm) float @ret_sqrt_daz_noinf_nonegzero145; CHECK-SAME: (float nofpclass(inf nzero) [[ARG0:%.*]]) #[[ATTR3]] {146; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nsub nnorm) float @llvm.sqrt.f32(float nofpclass(inf nzero) [[ARG0]]) #[[ATTR10]]147; CHECK-NEXT: ret float [[CALL]]148;149 %call = call float @llvm.sqrt.f32(float %arg0)150 ret float %call151}152 153define float @ret_sqrt_dapz_noinf_nozero(float nofpclass(inf zero) %arg0) #2 {154; CHECK-LABEL: define nofpclass(inf nzero nsub nnorm) float @ret_sqrt_dapz_noinf_nozero155; CHECK-SAME: (float nofpclass(inf zero) [[ARG0:%.*]]) #[[ATTR4:[0-9]+]] {156; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nzero nsub nnorm) float @llvm.sqrt.f32(float nofpclass(inf zero) [[ARG0]]) #[[ATTR10]]157; CHECK-NEXT: ret float [[CALL]]158;159 %call = call float @llvm.sqrt.f32(float %arg0)160 ret float %call161}162 163define float @ret_sqrt_dapz_noinf_nonegzero(float nofpclass(inf nzero) %arg0) #2 {164; CHECK-LABEL: define nofpclass(inf nzero nsub nnorm) float @ret_sqrt_dapz_noinf_nonegzero165; CHECK-SAME: (float nofpclass(inf nzero) [[ARG0:%.*]]) #[[ATTR4]] {166; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nzero nsub nnorm) float @llvm.sqrt.f32(float nofpclass(inf nzero) [[ARG0]]) #[[ATTR10]]167; CHECK-NEXT: ret float [[CALL]]168;169 %call = call float @llvm.sqrt.f32(float %arg0)170 ret float %call171}172 173define float @ret_sqrt_dynamic_noinf_nozero(float nofpclass(inf zero) %arg0) #3 {174; CHECK-LABEL: define nofpclass(inf nsub nnorm) float @ret_sqrt_dynamic_noinf_nozero175; CHECK-SAME: (float nofpclass(inf zero) [[ARG0:%.*]]) #[[ATTR5:[0-9]+]] {176; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nsub nnorm) float @llvm.sqrt.f32(float nofpclass(inf zero) [[ARG0]]) #[[ATTR10]]177; CHECK-NEXT: ret float [[CALL]]178;179 %call = call float @llvm.sqrt.f32(float %arg0)180 ret float %call181}182 183define float @ret_sqrt_dynamic_noinf_nonegzero(float nofpclass(inf nzero) %arg0) #3 {184; CHECK-LABEL: define nofpclass(inf nsub nnorm) float @ret_sqrt_dynamic_noinf_nonegzero185; CHECK-SAME: (float nofpclass(inf nzero) [[ARG0:%.*]]) #[[ATTR5]] {186; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nsub nnorm) float @llvm.sqrt.f32(float nofpclass(inf nzero) [[ARG0]]) #[[ATTR10]]187; CHECK-NEXT: ret float [[CALL]]188;189 %call = call float @llvm.sqrt.f32(float %arg0)190 ret float %call191}192 193define float @ret_sqrt_ftz_noinf_nonegzero(float nofpclass(inf nzero) %arg0) #4 {194; CHECK-LABEL: define nofpclass(inf nzero nsub nnorm) float @ret_sqrt_ftz_noinf_nonegzero195; CHECK-SAME: (float nofpclass(inf nzero) [[ARG0:%.*]]) #[[ATTR6:[0-9]+]] {196; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nzero nsub nnorm) float @llvm.sqrt.f32(float nofpclass(inf nzero) [[ARG0]]) #[[ATTR10]]197; CHECK-NEXT: ret float [[CALL]]198;199 %call = call float @llvm.sqrt.f32(float %arg0)200 ret float %call201}202 203define float @ret_sqrt_ftpz_noinf_nonegzero(float nofpclass(inf nzero) %arg0) #5 {204; CHECK-LABEL: define nofpclass(inf nzero nsub nnorm) float @ret_sqrt_ftpz_noinf_nonegzero205; CHECK-SAME: (float nofpclass(inf nzero) [[ARG0:%.*]]) #[[ATTR7:[0-9]+]] {206; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nzero nsub nnorm) float @llvm.sqrt.f32(float nofpclass(inf nzero) [[ARG0]]) #[[ATTR10]]207; CHECK-NEXT: ret float [[CALL]]208;209 %call = call float @llvm.sqrt.f32(float %arg0)210 ret float %call211}212 213define float @ret_sqrt_ftz_dynamic_noinf_nonegzero(float nofpclass(inf nzero) %arg0) #6 {214; CHECK-LABEL: define nofpclass(inf nzero nsub nnorm) float @ret_sqrt_ftz_dynamic_noinf_nonegzero215; CHECK-SAME: (float nofpclass(inf nzero) [[ARG0:%.*]]) #[[ATTR8:[0-9]+]] {216; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nzero nsub nnorm) float @llvm.sqrt.f32(float nofpclass(inf nzero) [[ARG0]]) #[[ATTR10]]217; CHECK-NEXT: ret float [[CALL]]218;219 %call = call float @llvm.sqrt.f32(float %arg0)220 ret float %call221}222 223define float @constrained_sqrt(float %arg) strictfp {224; CHECK-LABEL: define nofpclass(ninf nsub nnorm) float @constrained_sqrt225; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR9:[0-9]+]] {226; CHECK-NEXT: [[VAL:%.*]] = call nofpclass(ninf nsub nnorm) float @llvm.experimental.constrained.sqrt.f32(float [[ARG]], metadata !"round.dynamic", metadata !"fpexcept.strict") #[[ATTR11:[0-9]+]]227; CHECK-NEXT: ret float [[VAL]]228;229 %val = call float @llvm.experimental.constrained.sqrt.f32(float %arg, metadata !"round.dynamic", metadata !"fpexcept.strict")230 ret float %val231}232 233define float @constrained_sqrt_nonan(float nofpclass(nan) %arg) strictfp {234; CHECK-LABEL: define nofpclass(snan ninf nsub nnorm) float @constrained_sqrt_nonan235; CHECK-SAME: (float nofpclass(nan) [[ARG:%.*]]) #[[ATTR9]] {236; CHECK-NEXT: [[VAL:%.*]] = call nofpclass(snan ninf nsub nnorm) float @llvm.experimental.constrained.sqrt.f32(float nofpclass(nan) [[ARG]], metadata !"round.dynamic", metadata !"fpexcept.strict") #[[ATTR11]]237; CHECK-NEXT: ret float [[VAL]]238;239 %val = call float @llvm.experimental.constrained.sqrt.f32(float %arg, metadata !"round.dynamic", metadata !"fpexcept.strict")240 ret float %val241}242 243define float @constrained_sqrt_nopinf(float nofpclass(pinf) %arg) strictfp {244; CHECK-LABEL: define nofpclass(inf nsub nnorm) float @constrained_sqrt_nopinf245; CHECK-SAME: (float nofpclass(pinf) [[ARG:%.*]]) #[[ATTR9]] {246; CHECK-NEXT: [[VAL:%.*]] = call nofpclass(inf nsub nnorm) float @llvm.experimental.constrained.sqrt.f32(float nofpclass(pinf) [[ARG]], metadata !"round.dynamic", metadata !"fpexcept.strict") #[[ATTR11]]247; CHECK-NEXT: ret float [[VAL]]248;249 %val = call float @llvm.experimental.constrained.sqrt.f32(float %arg, metadata !"round.dynamic", metadata !"fpexcept.strict")250 ret float %val251}252 253define float @constrained_sqrt_nonegzero(float nofpclass(nzero) %arg) strictfp {254; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @constrained_sqrt_nonegzero255; CHECK-SAME: (float nofpclass(nzero) [[ARG:%.*]]) #[[ATTR9]] {256; CHECK-NEXT: [[VAL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.experimental.constrained.sqrt.f32(float nofpclass(nzero) [[ARG]], metadata !"round.dynamic", metadata !"fpexcept.strict") #[[ATTR11]]257; CHECK-NEXT: ret float [[VAL]]258;259 %val = call float @llvm.experimental.constrained.sqrt.f32(float %arg, metadata !"round.dynamic", metadata !"fpexcept.strict")260 ret float %val261}262 263define float @constrained_sqrt_nozero(float nofpclass(zero) %arg) strictfp {264; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @constrained_sqrt_nozero265; CHECK-SAME: (float nofpclass(zero) [[ARG:%.*]]) #[[ATTR9]] {266; CHECK-NEXT: [[VAL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.experimental.constrained.sqrt.f32(float nofpclass(zero) [[ARG]], metadata !"round.dynamic", metadata !"fpexcept.strict") #[[ATTR11]]267; CHECK-NEXT: ret float [[VAL]]268;269 %val = call float @llvm.experimental.constrained.sqrt.f32(float %arg, metadata !"round.dynamic", metadata !"fpexcept.strict")270 ret float %val271}272 273attributes #0 = { "denormal-fp-math"="ieee,ieee" }274attributes #1 = { "denormal-fp-math"="ieee,preserve-sign" }275attributes #2 = { "denormal-fp-math"="ieee,positive-zero" }276attributes #3 = { "denormal-fp-math"="ieee,dynamic" }277attributes #4 = { "denormal-fp-math"="preserve-sign,ieee" }278attributes #5 = { "denormal-fp-math"="positive-zero,ieee" }279attributes #6 = { "denormal-fp-math"="dynamic,ieee" }280 281;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:282; TUNIT: {{.*}}283