cast-unsigned-icmp-eqcmp-0.ll
6.83 KB
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -instcombine -S | FileCheck %s
; This is related to https://bugs.llvm.org/show_bug.cgi?id=36682
; In *all* of these, uitofp and bitcast should be instcombine'd out.
define i1 @i32_cast_cmp_eq_int_0_uitofp_float(i32 %i) {
; CHECK-LABEL: @i32_cast_cmp_eq_int_0_uitofp_float(
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[I:%.*]], 0
; CHECK-NEXT: ret i1 [[CMP]]
;
%f = uitofp i32 %i to float
%b = bitcast float %f to i32
%cmp = icmp eq i32 %b, 0
ret i1 %cmp
}
define <2 x i1> @i32_cast_cmp_eq_int_0_uitofp_float_vec(<2 x i32> %i) {
; CHECK-LABEL: @i32_cast_cmp_eq_int_0_uitofp_float_vec(
; CHECK-NEXT: [[CMP:%.*]] = icmp eq <2 x i32> [[I:%.*]], zeroinitializer
; CHECK-NEXT: ret <2 x i1> [[CMP]]
;
%f = uitofp <2 x i32> %i to <2 x float>
%b = bitcast <2 x float> %f to <2 x i32>
%cmp = icmp eq <2 x i32> %b, <i32 0, i32 0>
ret <2 x i1> %cmp
}
define <3 x i1> @i32_cast_cmp_eq_int_0_uitofp_float_vec_undef(<3 x i32> %i) {
; CHECK-LABEL: @i32_cast_cmp_eq_int_0_uitofp_float_vec_undef(
; CHECK-NEXT: [[CMP:%.*]] = icmp eq <3 x i32> [[I:%.*]], zeroinitializer
; CHECK-NEXT: ret <3 x i1> [[CMP]]
;
%f = uitofp <3 x i32> %i to <3 x float>
%b = bitcast <3 x float> %f to <3 x i32>
%cmp = icmp eq <3 x i32> %b, <i32 0, i32 undef, i32 0>
ret <3 x i1> %cmp
}
define i1 @i32_cast_cmp_ne_int_0_uitofp_float(i32 %i) {
; CHECK-LABEL: @i32_cast_cmp_ne_int_0_uitofp_float(
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[I:%.*]], 0
; CHECK-NEXT: ret i1 [[CMP]]
;
%f = uitofp i32 %i to float
%b = bitcast float %f to i32
%cmp = icmp ne i32 %b, 0
ret i1 %cmp
}
define <2 x i1> @i32_cast_cmp_ne_int_0_uitofp_float_vec(<2 x i32> %i) {
; CHECK-LABEL: @i32_cast_cmp_ne_int_0_uitofp_float_vec(
; CHECK-NEXT: [[CMP:%.*]] = icmp ne <2 x i32> [[I:%.*]], zeroinitializer
; CHECK-NEXT: ret <2 x i1> [[CMP]]
;
%f = uitofp <2 x i32> %i to <2 x float>
%b = bitcast <2 x float> %f to <2 x i32>
%cmp = icmp ne <2 x i32> %b, <i32 0, i32 0>
ret <2 x i1> %cmp
}
define <3 x i1> @i32_cast_cmp_ne_int_0_uitofp_float_vec_undef(<3 x i32> %i) {
; CHECK-LABEL: @i32_cast_cmp_ne_int_0_uitofp_float_vec_undef(
; CHECK-NEXT: [[CMP:%.*]] = icmp ne <3 x i32> [[I:%.*]], zeroinitializer
; CHECK-NEXT: ret <3 x i1> [[CMP]]
;
%f = uitofp <3 x i32> %i to <3 x float>
%b = bitcast <3 x float> %f to <3 x i32>
%cmp = icmp ne <3 x i32> %b, <i32 0, i32 undef, i32 0>
ret <3 x i1> %cmp
}
define i1 @i32_cast_cmp_eq_int_0_uitofp_double(i32 %i) {
; CHECK-LABEL: @i32_cast_cmp_eq_int_0_uitofp_double(
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[I:%.*]], 0
; CHECK-NEXT: ret i1 [[CMP]]
;
%f = uitofp i32 %i to double
%b = bitcast double %f to i64
%cmp = icmp eq i64 %b, 0
ret i1 %cmp
}
define <2 x i1> @i32_cast_cmp_eq_int_0_uitofp_double_vec(<2 x i32> %i) {
; CHECK-LABEL: @i32_cast_cmp_eq_int_0_uitofp_double_vec(
; CHECK-NEXT: [[CMP:%.*]] = icmp eq <2 x i32> [[I:%.*]], zeroinitializer
; CHECK-NEXT: ret <2 x i1> [[CMP]]
;
%f = uitofp <2 x i32> %i to <2 x double>
%b = bitcast <2 x double> %f to <2 x i64>
%cmp = icmp eq <2 x i64> %b, <i64 0, i64 0>
ret <2 x i1> %cmp
}
define <3 x i1> @i32_cast_cmp_eq_int_0_uitofp_double_vec_undef(<3 x i32> %i) {
; CHECK-LABEL: @i32_cast_cmp_eq_int_0_uitofp_double_vec_undef(
; CHECK-NEXT: [[CMP:%.*]] = icmp eq <3 x i32> [[I:%.*]], zeroinitializer
; CHECK-NEXT: ret <3 x i1> [[CMP]]
;
%f = uitofp <3 x i32> %i to <3 x double>
%b = bitcast <3 x double> %f to <3 x i64>
%cmp = icmp eq <3 x i64> %b, <i64 0, i64 undef, i64 0>
ret <3 x i1> %cmp
}
define i1 @i32_cast_cmp_ne_int_0_uitofp_double(i32 %i) {
; CHECK-LABEL: @i32_cast_cmp_ne_int_0_uitofp_double(
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[I:%.*]], 0
; CHECK-NEXT: ret i1 [[CMP]]
;
%f = uitofp i32 %i to double
%b = bitcast double %f to i64
%cmp = icmp ne i64 %b, 0
ret i1 %cmp
}
define <2 x i1> @i32_cast_cmp_ne_int_0_uitofp_double_vec(<2 x i32> %i) {
; CHECK-LABEL: @i32_cast_cmp_ne_int_0_uitofp_double_vec(
; CHECK-NEXT: [[CMP:%.*]] = icmp ne <2 x i32> [[I:%.*]], zeroinitializer
; CHECK-NEXT: ret <2 x i1> [[CMP]]
;
%f = uitofp <2 x i32> %i to <2 x double>
%b = bitcast <2 x double> %f to <2 x i64>
%cmp = icmp ne <2 x i64> %b, <i64 0, i64 0>
ret <2 x i1> %cmp
}
define <3 x i1> @i32_cast_cmp_ne_int_0_uitofp_double_vec_undef(<3 x i32> %i) {
; CHECK-LABEL: @i32_cast_cmp_ne_int_0_uitofp_double_vec_undef(
; CHECK-NEXT: [[CMP:%.*]] = icmp ne <3 x i32> [[I:%.*]], zeroinitializer
; CHECK-NEXT: ret <3 x i1> [[CMP]]
;
%f = uitofp <3 x i32> %i to <3 x double>
%b = bitcast <3 x double> %f to <3 x i64>
%cmp = icmp ne <3 x i64> %b, <i64 0, i64 undef, i64 0>
ret <3 x i1> %cmp
}
define i1 @i32_cast_cmp_eq_int_0_uitofp_half(i32 %i) {
; CHECK-LABEL: @i32_cast_cmp_eq_int_0_uitofp_half(
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[I:%.*]], 0
; CHECK-NEXT: ret i1 [[CMP]]
;
%f = uitofp i32 %i to half
%b = bitcast half %f to i16
%cmp = icmp eq i16 %b, 0
ret i1 %cmp
}
define <2 x i1> @i32_cast_cmp_eq_int_0_uitofp_half_vec(<2 x i32> %i) {
; CHECK-LABEL: @i32_cast_cmp_eq_int_0_uitofp_half_vec(
; CHECK-NEXT: [[CMP:%.*]] = icmp eq <2 x i32> [[I:%.*]], zeroinitializer
; CHECK-NEXT: ret <2 x i1> [[CMP]]
;
%f = uitofp <2 x i32> %i to <2 x half>
%b = bitcast <2 x half> %f to <2 x i16>
%cmp = icmp eq <2 x i16> %b, <i16 0, i16 0>
ret <2 x i1> %cmp
}
define <3 x i1> @i32_cast_cmp_eq_int_0_uitofp_half_vec_undef(<3 x i32> %i) {
; CHECK-LABEL: @i32_cast_cmp_eq_int_0_uitofp_half_vec_undef(
; CHECK-NEXT: [[CMP:%.*]] = icmp eq <3 x i32> [[I:%.*]], zeroinitializer
; CHECK-NEXT: ret <3 x i1> [[CMP]]
;
%f = uitofp <3 x i32> %i to <3 x half>
%b = bitcast <3 x half> %f to <3 x i16>
%cmp = icmp eq <3 x i16> %b, <i16 0, i16 undef, i16 0>
ret <3 x i1> %cmp
}
define i1 @i32_cast_cmp_ne_int_0_uitofp_half(i32 %i) {
; CHECK-LABEL: @i32_cast_cmp_ne_int_0_uitofp_half(
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[I:%.*]], 0
; CHECK-NEXT: ret i1 [[CMP]]
;
%f = uitofp i32 %i to half
%b = bitcast half %f to i16
%cmp = icmp ne i16 %b, 0
ret i1 %cmp
}
define <2 x i1> @i32_cast_cmp_ne_int_0_uitofp_half_vec(<2 x i32> %i) {
; CHECK-LABEL: @i32_cast_cmp_ne_int_0_uitofp_half_vec(
; CHECK-NEXT: [[CMP:%.*]] = icmp ne <2 x i32> [[I:%.*]], zeroinitializer
; CHECK-NEXT: ret <2 x i1> [[CMP]]
;
%f = uitofp <2 x i32> %i to <2 x half>
%b = bitcast <2 x half> %f to <2 x i16>
%cmp = icmp ne <2 x i16> %b, <i16 0, i16 0>
ret <2 x i1> %cmp
}
define <3 x i1> @i32_cast_cmp_ne_int_0_uitofp_half_vec_undef(<3 x i32> %i) {
; CHECK-LABEL: @i32_cast_cmp_ne_int_0_uitofp_half_vec_undef(
; CHECK-NEXT: [[CMP:%.*]] = icmp ne <3 x i32> [[I:%.*]], zeroinitializer
; CHECK-NEXT: ret <3 x i1> [[CMP]]
;
%f = uitofp <3 x i32> %i to <3 x half>
%b = bitcast <3 x half> %f to <3 x i16>
%cmp = icmp ne <3 x i16> %b, <i16 0, i16 undef, i16 0>
ret <3 x i1> %cmp
}