1 ; Check that we can enable/disable NoInfsFPMath and NoNaNsInFPMath via function
2 ; attributes. An attribute on one function should not magically apply to the
5 ; RUN: llc < %s -mtriple=powerpc64-unknown-unknown -mcpu=pwr7 -mattr=-vsx \
6 ; RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=SAFE
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=UNSAFE
12 ; The fcmp+select in these functions should be converted to a fsel instruction
13 ; when both NoInfsFPMath and NoNaNsInFPMath are enabled.
15 ; CHECK-LABEL: default0:
16 define double @default0(double %a, double %y, double %z) {
20 %cmp = fcmp ult double %a, 0.000000e+00
21 %z.y = select i1 %cmp, double %z, double %y
25 ; CHECK-LABEL: unsafe_math_off:
26 define double @unsafe_math_off(double %a, double %y, double %z) #0 #2 {
30 %cmp = fcmp ult double %a, 0.000000e+00
31 %z.y = select i1 %cmp, double %z, double %y
35 ; CHECK-LABEL: default1:
36 define double @default1(double %a, double %y, double %z) {
39 %cmp = fcmp ult double %a, 0.000000e+00
40 %z.y = select i1 %cmp, double %z, double %y
44 ; CHECK-LABEL: unsafe_math_on:
45 define double @unsafe_math_on(double %a, double %y, double %z) #1 #3 {
49 %cmp = fcmp ult double %a, 0.000000e+00
50 %z.y = select i1 %cmp, double %z, double %y
54 ; CHECK-LABEL: default2:
55 define double @default2(double %a, double %y, double %z) {
58 %cmp = fcmp ult double %a, 0.000000e+00
59 %z.y = select i1 %cmp, double %z, double %y
63 attributes #0 = { "no-infs-fp-math"="false" }
64 attributes #1 = { "no-nans-fp-math"="false" }
66 attributes #2 = { "no-infs-fp-math"="false" }
67 attributes #3 = { "no-infs-fp-math"="true" }