68 lines · plain
1; Check that we can enable/disable NoInfsFPMath and NoNaNsInFPMath via function2; attributes. An attribute on one function should not magically apply to the3; next one.4 5; RUN: llc < %s -mtriple=powerpc64-unknown-unknown -mcpu=pwr7 -mattr=-vsx \6; RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=SAFE7 8; RUN: llc < %s -mtriple=powerpc64-unknown-unknown -mcpu=pwr7 -mattr=-vsx \9; RUN: -enable-no-infs-fp-math -enable-no-nans-fp-math \10; RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=UNSAFE11 12; The fcmp+select in these functions should be converted to a fsel instruction13; when both NoInfsFPMath and NoNaNsInFPMath are enabled.14 15; CHECK-LABEL: default0:16define double @default0(double %a, double %y, double %z) {17entry:18; SAFE-NOT: fsel19; UNSAFE: fsel20 %cmp = fcmp ult double %a, 0.000000e+0021 %z.y = select i1 %cmp, double %z, double %y22 ret double %z.y23}24 25; CHECK-LABEL: unsafe_math_off:26define double @unsafe_math_off(double %a, double %y, double %z) #0 #2 {27entry:28; SAFE-NOT: fsel29; UNSAFE-NOT: fsel30 %cmp = fcmp ult double %a, 0.000000e+0031 %z.y = select i1 %cmp, double %z, double %y32 ret double %z.y33}34 35; CHECK-LABEL: default1:36define double @default1(double %a, double %y, double %z) {37; SAFE-NOT: fsel38; UNSAFE: fsel39 %cmp = fcmp ult double %a, 0.000000e+0040 %z.y = select i1 %cmp, double %z, double %y41 ret double %z.y42}43 44; CHECK-LABEL: unsafe_math_on:45define double @unsafe_math_on(double %a, double %y, double %z) #1 #3 {46entry:47; SAFE-NOT: fsel48; UNSAFE-NOT: fsel49 %cmp = fcmp ult double %a, 0.000000e+0050 %z.y = select i1 %cmp, double %z, double %y51 ret double %z.y52}53 54; CHECK-LABEL: default2:55define double @default2(double %a, double %y, double %z) {56; SAFE-NOT: fsel57; UNSAFE: fsel58 %cmp = fcmp ult double %a, 0.000000e+0059 %z.y = select i1 %cmp, double %z, double %y60 ret double %z.y61}62 63attributes #0 = { "no-infs-fp-math"="false" }64attributes #1 = { "no-nans-fp-math"="false" }65 66attributes #2 = { "no-infs-fp-math"="false" }67attributes #3 = { "no-infs-fp-math"="true" }68