File: change-no-infs.ll

package info (click to toggle)
llvm-toolchain-16 1%3A16.0.6-15~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,634,792 kB
  • sloc: cpp: 6,179,261; ansic: 1,216,205; asm: 741,319; python: 196,614; objc: 75,325; f90: 49,640; lisp: 32,396; pascal: 12,286; sh: 9,394; perl: 7,442; ml: 5,494; awk: 3,523; makefile: 2,723; javascript: 1,206; xml: 886; fortran: 581; cs: 573
file content (67 lines) | stat: -rw-r--r-- 2,045 bytes parent folder | download | duplicates (28)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
; Check that we can enable/disable NoInfsFPMath and NoNaNsInFPMath via function
; attributes.  An attribute on one function should not magically apply to the
; next one.

; RUN: llc < %s -mtriple=powerpc64-unknown-unknown -mcpu=pwr7 -mattr=-vsx \
; RUN:   | FileCheck %s --check-prefix=CHECK --check-prefix=SAFE

; RUN: llc < %s -mtriple=powerpc64-unknown-unknown -mcpu=pwr7 -mattr=-vsx \
; RUN:   -enable-no-infs-fp-math -enable-no-nans-fp-math \
; RUN:   | FileCheck %s --check-prefix=CHECK --check-prefix=UNSAFE

; The fcmp+select in these functions should be converted to a fsel instruction
; when both NoInfsFPMath and NoNaNsInFPMath are enabled.

; CHECK-LABEL: default0:
define double @default0(double %a, double %y, double %z) {
entry:
; SAFE-NOT:  fsel
; UNSAFE:    fsel
  %cmp = fcmp ult double %a, 0.000000e+00
  %z.y = select i1 %cmp, double %z, double %y
  ret double %z.y
}

; CHECK-LABEL: unsafe_math_off:
define double @unsafe_math_off(double %a, double %y, double %z) #0 #2 {
entry:
; SAFE-NOT:   fsel
; UNSAFE-NOT: fsel
  %cmp = fcmp ult double %a, 0.000000e+00
  %z.y = select i1 %cmp, double %z, double %y
  ret double %z.y
}

; CHECK-LABEL: default1:
define double @default1(double %a, double %y, double %z) {
; SAFE-NOT:  fsel
; UNSAFE:    fsel
  %cmp = fcmp ult double %a, 0.000000e+00
  %z.y = select i1 %cmp, double %z, double %y
  ret double %z.y
}

; CHECK-LABEL: unsafe_math_on:
define double @unsafe_math_on(double %a, double %y, double %z) #1 #3 {
entry:
; SAFE-NOT:   fsel
; UNSAFE-NOT: fsel
  %cmp = fcmp ult double %a, 0.000000e+00
  %z.y = select i1 %cmp, double %z, double %y
  ret double %z.y
}

; CHECK-LABEL: default2:
define double @default2(double %a, double %y, double %z) {
; SAFE-NOT:  fsel
; UNSAFE:    fsel
  %cmp = fcmp ult double %a, 0.000000e+00
  %z.y = select i1 %cmp, double %z, double %y
  ret double %z.y
}

attributes #0 = { "no-infs-fp-math"="false" }
attributes #1 = { "no-nans-fp-math"="false" }

attributes #2 = { "no-infs-fp-math"="false" }
attributes #3 = { "no-infs-fp-math"="true" }