@@ -234,121 +234,6 @@ fn bool_to_zero_or_max_uint<'tcx>(
234
234
CValue :: by_val( res, layout)
235
235
}
236
236
237
- macro simd_cmp {
238
- ( $fx: expr, $cc: ident|$cc_f: ident( $x: ident, $y: ident) -> $ret: ident) => {
239
- let vector_ty = clif_vector_type( $fx. tcx, $x. layout( ) ) ;
240
-
241
- if let Some ( vector_ty) = vector_ty {
242
- let x = $x. load_scalar( $fx) ;
243
- let y = $y. load_scalar( $fx) ;
244
- let val = if vector_ty. lane_type( ) . is_float( ) {
245
- $fx. bcx. ins( ) . fcmp( FloatCC :: $cc_f, x, y)
246
- } else {
247
- $fx. bcx. ins( ) . icmp( IntCC :: $cc, x, y)
248
- } ;
249
-
250
- // HACK This depends on the fact that icmp for vectors represents bools as 0 and !0, not 0 and 1.
251
- let val = $fx. bcx. ins( ) . raw_bitcast( vector_ty, val) ;
252
-
253
- $ret. write_cvalue( $fx, CValue :: by_val( val, $ret. layout( ) ) ) ;
254
- } else {
255
- simd_pair_for_each_lane(
256
- $fx,
257
- $x,
258
- $y,
259
- $ret,
260
- |fx, lane_layout, res_lane_layout, x_lane, y_lane| {
261
- let res_lane = match lane_layout. ty. kind( ) {
262
- ty: : Uint ( _) | ty:: Int ( _) => fx. bcx. ins( ) . icmp( IntCC :: $cc, x_lane, y_lane) ,
263
- ty:: Float ( _) => fx. bcx. ins( ) . fcmp( FloatCC :: $cc_f, x_lane, y_lane) ,
264
- _ => unreachable ! ( "{:?}" , lane_layout. ty) ,
265
- } ;
266
- bool_to_zero_or_max_uint( fx, res_lane_layout, res_lane)
267
- } ,
268
- ) ;
269
- }
270
- } ,
271
- ( $fx: expr, $cc_u: ident|$cc_s: ident |$cc_f: ident( $x: ident, $y: ident) -> $ret: ident) => {
272
- // FIXME use vector icmp when possible
273
- simd_pair_for_each_lane(
274
- $fx,
275
- $x,
276
- $y,
277
- $ret,
278
- |fx, lane_layout, res_lane_layout, x_lane, y_lane| {
279
- let res_lane = match lane_layout. ty. kind( ) {
280
- ty: : Uint ( _) => fx. bcx. ins( ) . icmp( IntCC :: $cc_u, x_lane, y_lane) ,
281
- ty:: Int ( _) => fx. bcx. ins( ) . icmp( IntCC :: $cc_s, x_lane, y_lane) ,
282
- ty:: Float ( _) => fx. bcx. ins( ) . fcmp( FloatCC :: $cc_f, x_lane, y_lane) ,
283
- _ => unreachable ! ( "{:?}" , lane_layout. ty) ,
284
- } ;
285
- bool_to_zero_or_max_uint( fx, res_lane_layout, res_lane)
286
- } ,
287
- ) ;
288
- } ,
289
- }
290
-
291
- macro simd_int_binop {
292
- ( $fx: expr, $op: ident( $x: ident, $y: ident) -> $ret: ident) => {
293
- simd_int_binop ! ( $fx, $op|$op( $x, $y) -> $ret) ;
294
- } ,
295
- ( $fx: expr, $op_u: ident|$op_s: ident ( $x: ident , $y: ident ) -> $ret: ident) => {
296
- simd_pair_for_each_lane(
297
- $fx,
298
- $x,
299
- $y,
300
- $ret,
301
- |fx, lane_layout , ret_lane_layout , x_lane , y_lane| {
302
- let res_lane = match lane_layout. ty. kind( ) {
303
- ty: : Uint ( _) => fx. bcx. ins( ) . $op_u( x_lane, y_lane) ,
304
- ty:: Int ( _) => fx. bcx. ins( ) . $op_s( x_lane, y_lane) ,
305
- _ => unreachable ! ( "{:?}" , lane_layout. ty) ,
306
- } ;
307
- CValue :: by_val( res_lane, ret_lane_layout)
308
- } ,
309
- ) ;
310
- } ,
311
- }
312
-
313
- macro simd_int_flt_binop {
314
- ( $fx: expr, $op: ident|$op_f: ident( $x: ident, $y: ident) -> $ret: ident) => {
315
- simd_int_flt_binop ! ( $fx, $op|$op|$op_f( $x, $y) -> $ret) ;
316
- } ,
317
- ( $fx: expr, $op_u: ident|$op_s: ident |$op_f: ident( $x: ident, $y: ident) -> $ret: ident) => {
318
- simd_pair_for_each_lane(
319
- $fx,
320
- $x,
321
- $y,
322
- $ret,
323
- |fx, lane_layout, ret_lane_layout, x_lane, y_lane| {
324
- let res_lane = match lane_layout. ty. kind( ) {
325
- ty: : Uint ( _) => fx. bcx. ins( ) . $op_u( x_lane, y_lane) ,
326
- ty:: Int ( _) => fx. bcx. ins( ) . $op_s( x_lane, y_lane) ,
327
- ty:: Float ( _) => fx. bcx. ins( ) . $op_f( x_lane, y_lane) ,
328
- _ => unreachable ! ( "{:?}" , lane_layout. ty) ,
329
- } ;
330
- CValue :: by_val( res_lane, ret_lane_layout)
331
- } ,
332
- ) ;
333
- } ,
334
- }
335
-
336
- macro simd_flt_binop( $fx: expr, $op: ident( $x: ident, $y: ident) -> $ret: ident) {
337
- simd_pair_for_each_lane(
338
- $fx,
339
- $x,
340
- $y,
341
- $ret,
342
- |fx, lane_layout, ret_lane_layout, x_lane, y_lane| {
343
- let res_lane = match lane_layout. ty. kind ( ) {
344
- ty : : Float ( _) => fx. bcx. ins( ) . $op( x_lane, y_lane) ,
345
- _ => unreachable ! ( "{:?}" , lane_layout. ty) ,
346
- } ;
347
- CValue :: by_val( res_lane, ret_lane_layout)
348
- } ,
349
- ) ;
350
- }
351
-
352
237
pub ( crate ) fn codegen_intrinsic_call < ' tcx > (
353
238
fx: & mut FunctionCx < ' _ , ' _ , ' tcx > ,
354
239
instance: Instance < ' tcx > ,
0 commit comments