Debian Codegraph @

llvm/test/CodeGen/PowerPC/change-no-infs.ll

raw
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
3 ; next one.
4
5 ; RUN: llc < %s -mtriple=powerpc64-unknown-unknown -mcpu=pwr7 -mattr=-vsx \
6 ; RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=SAFE
7
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
11
12 ; The fcmp+select in these functions should be converted to a fsel instruction
13 ; when both NoInfsFPMath and NoNaNsInFPMath are enabled.
14
15 ; CHECK-LABEL: default0:
16 define double @default0(double %a, double %y, double %z) {
17 entry:
18 ; SAFE-NOT: fsel
19 ; UNSAFE: fsel
20 %cmp = fcmp ult double %a, 0.000000e+00
21 %z.y = select i1 %cmp, double %z, double %y
22 ret double %z.y
23 }
24
25 ; CHECK-LABEL: unsafe_math_off:
26 define double @unsafe_math_off(double %a, double %y, double %z) #0 #2 {
27 entry:
28 ; SAFE-NOT: fsel
29 ; UNSAFE-NOT: fsel
30 %cmp = fcmp ult double %a, 0.000000e+00
31 %z.y = select i1 %cmp, double %z, double %y
32 ret double %z.y
33 }
34
35 ; CHECK-LABEL: default1:
36 define double @default1(double %a, double %y, double %z) {
37 ; SAFE-NOT: fsel
38 ; UNSAFE: fsel
39 %cmp = fcmp ult double %a, 0.000000e+00
40 %z.y = select i1 %cmp, double %z, double %y
41 ret double %z.y
42 }
43
44 ; CHECK-LABEL: unsafe_math_on:
45 define double @unsafe_math_on(double %a, double %y, double %z) #1 #3 {
46 entry:
47 ; SAFE-NOT: fsel
48 ; UNSAFE-NOT: fsel
49 %cmp = fcmp ult double %a, 0.000000e+00
50 %z.y = select i1 %cmp, double %z, double %y
51 ret double %z.y
52 }
53
54 ; CHECK-LABEL: default2:
55 define double @default2(double %a, double %y, double %z) {
56 ; SAFE-NOT: fsel
57 ; UNSAFE: fsel
58 %cmp = fcmp ult double %a, 0.000000e+00
59 %z.y = select i1 %cmp, double %z, double %y
60 ret double %z.y
61 }
62
63 attributes #0 = { "no-infs-fp-math"="false" }
64 attributes #1 = { "no-nans-fp-math"="false" }
65
66 attributes #2 = { "no-infs-fp-math"="false" }
67 attributes #3 = { "no-infs-fp-math"="true" }