summaryrefslogtreecommitdiff
path: root/test/CodeGen/SystemZ/tdc-03.ll
blob: 95708f1effc6bd76efe5004a252e911d49046508 (plain)
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
; Test the Test Data Class instruction logic operation conversion from
; compares.
;
; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s

declare float @llvm.fabs.f32(float)
declare double @llvm.fabs.f64(double)
declare fp128 @llvm.fabs.f128(fp128)

; Compare with 0 (unworthy)
define i32 @f1(float %x) {
; CHECK-LABEL: f1
; CHECK-NOT: tceb
; CHECK: ltebr {{%f[0-9]+}}, %f0
; CHECK-NOT: tceb
  %res = fcmp ugt float %x, 0.0
  %xres = zext i1 %res to i32
  ret i32 %xres
}

; Compare fabs with 0 (unworthy)
define i32 @f2(float %x) {
; CHECK-LABEL: f2
; CHECK-NOT: tceb
; CHECK: lpebr {{%f[0-9]+}}, %f0
; CHECK-NOT: tceb
  %y = call float @llvm.fabs.f32(float %x)
  %res = fcmp ugt float %y, 0.0
  %xres = zext i1 %res to i32
  ret i32 %xres
}

; Compare with inf (unworthy)
define i32 @f3(float %x) {
; CHECK-LABEL: f3
; CHECK-NOT: tceb
; CHECK: ceb %f0, 0(%r{{[0-9]+}})
; CHECK-NOT: tceb
  %res = fcmp ult float %x, 0x7ff0000000000000
  %xres = zext i1 %res to i32
  ret i32 %xres
}

; Compare fabs with inf
define i32 @f4(float %x) {
; CHECK-LABEL: f4
; CHECK: tceb %f0, 4047
  %y = call float @llvm.fabs.f32(float %x)
  %res = fcmp ult float %y, 0x7ff0000000000000
  %xres = zext i1 %res to i32
  ret i32 %xres
}

; Compare with minnorm (unworthy)
define i32 @f5(float %x) {
; CHECK-LABEL: f5
; CHECK-NOT: tceb
; CHECK: ceb %f0, 0(%r{{[0-9]+}})
; CHECK-NOT: tceb
  %res = fcmp ult float %x, 0x3810000000000000
  %xres = zext i1 %res to i32
  ret i32 %xres
}

; Compare fabs with minnorm
define i32 @f6(float %x) {
; CHECK-LABEL: f6
; CHECK: tceb %f0, 3279
  %y = call float @llvm.fabs.f32(float %x)
  %res = fcmp ult float %y, 0x3810000000000000
  %xres = zext i1 %res to i32
  ret i32 %xres
}

; Compare fabs with minnorm, unsupported condition
define i32 @f7(float %x) {
; CHECK-LABEL: f7
; CHECK-NOT: tceb
; CHECK: lpdfr [[REG:%f[0-9]+]], %f0
; CHECK: ceb [[REG]], 0(%r{{[0-9]+}})
; CHECK-NOT: tceb
  %y = call float @llvm.fabs.f32(float %x)
  %res = fcmp ugt float %y, 0x3810000000000000
  %xres = zext i1 %res to i32
  ret i32 %xres
}

; Compare fabs with unsupported constant
define i32 @f8(float %x) {
; CHECK-LABEL: f8
; CHECK-NOT: tceb
; CHECK: lpdfr [[REG:%f[0-9]+]], %f0
; CHECK: ceb [[REG]], 0(%r{{[0-9]+}})
; CHECK-NOT: tceb
  %y = call float @llvm.fabs.f32(float %x)
  %res = fcmp ult float %y, 0x3ff0000000000000
  %xres = zext i1 %res to i32
  ret i32 %xres
}

; Compare fabs with minnorm - double
define i32 @f9(double %x) {
; CHECK-LABEL: f9
; CHECK: tcdb %f0, 3279
  %y = call double @llvm.fabs.f64(double %x)
  %res = fcmp ult double %y, 0x0010000000000000
  %xres = zext i1 %res to i32
  ret i32 %xres
}

; Compare fabs with minnorm - long double
define i32 @f10(fp128 %x) {
; CHECK-LABEL: f10
; CHECK: tcxb %f0, 3279
  %y = call fp128 @llvm.fabs.f128(fp128 %x)
  %res = fcmp ult fp128 %y, 0xL00000000000000000001000000000000
  %xres = zext i1 %res to i32
  ret i32 %xres
}

; Compare fabs for one with inf - clang's isfinite
define i32 @f11(double %x) {
; CHECK-LABEL: f11
; CHECK: tcdb %f0, 4032
  %y = call double @llvm.fabs.f64(double %x)
  %res = fcmp one double %y, 0x7ff0000000000000
  %xres = zext i1 %res to i32
  ret i32 %xres
}

; Compare fabs for oeq with inf - clang's isinf
define i32 @f12(double %x) {
; CHECK-LABEL: f12
; CHECK: tcdb %f0, 48
  %y = call double @llvm.fabs.f64(double %x)
  %res = fcmp oeq double %y, 0x7ff0000000000000
  %xres = zext i1 %res to i32
  ret i32 %xres
}