File: fp-strict-cmp-05.ll

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (103 lines) | stat: -rw-r--r-- 3,746 bytes parent folder | download | duplicates (21)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
; Test that floating-point instructions that set cc are *not* used to
; eliminate *strict* compares for load complement, load negative and load
; positive
;
; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s

; Load complement (sign-bit flipped).
; Test f32
define float @f1(float %a, float %b, float %f) #0 {
; CHECK-LABEL: f1:
; CHECK: ltebr
; CHECK-NEXT: ber %r14
  %neg = fneg float %f
  %cond = call i1 @llvm.experimental.constrained.fcmp.f32(
                                               float %neg, float 0.0,
                                               metadata !"oeq",
                                               metadata !"fpexcept.strict") #0
  %res = select i1 %cond, float %a, float %b
  ret float %res
}

; Test f64
define double @f2(double %a, double %b, double %f) #0 {
; CHECK-LABEL: f2:
; CHECK: ltdbr
; CHECK-NEXT: ber %r14
  %neg = fneg double %f
  %cond = call i1 @llvm.experimental.constrained.fcmp.f64(
                                               double %neg, double 0.0,
                                               metadata !"oeq",
                                               metadata !"fpexcept.strict") #0
  %res = select i1 %cond, double %a, double %b
  ret double %res
}

; Negation of floating-point absolute.
; Test f32
declare float @llvm.fabs.f32(float %f)
define float @f3(float %a, float %b, float %f) #0 {
; CHECK-LABEL: f3:
; CHECK: ltebr
; CHECK-NEXT: ber %r14
  %abs = call float @llvm.fabs.f32(float %f) #0
  %neg = fneg float %abs
  %cond = call i1 @llvm.experimental.constrained.fcmp.f32(
                                               float %neg, float 0.0,
                                               metadata !"oeq",
                                               metadata !"fpexcept.strict") #0
  %res = select i1 %cond, float %a, float %b
  ret float %res
}

; Test f64
declare double @llvm.fabs.f64(double %f)
define double @f4(double %a, double %b, double %f) #0 {
; CHECK-LABEL: f4:
; CHECK: ltdbr
; CHECK-NEXT: ber %r14
  %abs = call double @llvm.fabs.f64(double %f) #0
  %neg = fneg double %abs
  %cond = call i1 @llvm.experimental.constrained.fcmp.f64(
                                               double %neg, double 0.0,
                                               metadata !"oeq",
                                               metadata !"fpexcept.strict") #0
  %res = select i1 %cond, double %a, double %b
  ret double %res
}

; Absolute floating-point value.
; Test f32
define float @f5(float %a, float %b, float %f) #0 {
; CHECK-LABEL: f5:
; CHECK: ltebr
; CHECK-NEXT: ber %r14
  %abs = call float @llvm.fabs.f32(float %f) #0
  %cond = call i1 @llvm.experimental.constrained.fcmp.f32(
                                               float %abs, float 0.0,
                                               metadata !"oeq",
                                               metadata !"fpexcept.strict") #0
  %res = select i1 %cond, float %a, float %b
  ret float %res
}

; Test f64
define double @f6(double %a, double %b, double %f) #0 {
; CHECK-LABEL: f6:
; CHECK: ltdbr
; CHECK-NEXT: ber %r14
  %abs = call double @llvm.fabs.f64(double %f) #0
  %cond = call i1 @llvm.experimental.constrained.fcmp.f64(
                                               double %abs, double 0.0,
                                               metadata !"oeq",
                                               metadata !"fpexcept.strict") #0
  %res = select i1 %cond, double %a, double %b
  ret double %res
}

attributes #0 = { strictfp }

declare i1 @llvm.experimental.constrained.fcmp.f32(float, float, metadata, metadata)
declare i1 @llvm.experimental.constrained.fcmp.f64(double, double, metadata, metadata)