diff options
| author | bjorn3 <bjorn3@users.noreply.github.com> | 2022-01-09 17:39:00 +0100 |
|---|---|---|
| committer | bjorn3 <bjorn3@users.noreply.github.com> | 2022-01-09 17:39:00 +0100 |
| commit | 78e2d4a275caec70a0b64bdc97084bacc3610076 (patch) | |
| tree | 02e9109ca7871c22a9b070dd47196a85f44f29a6 /src | |
| parent | 8ace43e65012a5e4a3e07d399a2a5832e18cf917 (diff) | |
| download | rust-78e2d4a275caec70a0b64bdc97084bacc3610076.tar.gz rust-78e2d4a275caec70a0b64bdc97084bacc3610076.zip | |
Remove support for vector icmp for now
Real simd support will need an overhaul in the future anyway. For now it only complicates the code.
Diffstat (limited to 'src')
| -rw-r--r-- | src/intrinsics/simd.rs | 46 |
1 files changed, 15 insertions, 31 deletions
diff --git a/src/intrinsics/simd.rs b/src/intrinsics/simd.rs index 181b45a8740..443e2954e51 100644 --- a/src/intrinsics/simd.rs +++ b/src/intrinsics/simd.rs @@ -17,37 +17,21 @@ fn validate_simd_type(fx: &mut FunctionCx<'_, '_, '_>, intrinsic: Symbol, span: macro simd_cmp { ($fx:expr, $cc:ident|$cc_f:ident($x:ident, $y:ident) -> $ret:ident) => { - let vector_ty = clif_vector_type($fx.tcx, $x.layout()); - - if let Some(vector_ty) = vector_ty { - let x = $x.load_scalar($fx); - let y = $y.load_scalar($fx); - let val = if vector_ty.lane_type().is_float() { - $fx.bcx.ins().fcmp(FloatCC::$cc_f, x, y) - } else { - $fx.bcx.ins().icmp(IntCC::$cc, x, y) - }; - - // HACK This depends on the fact that icmp for vectors represents bools as 0 and !0, not 0 and 1. - let val = $fx.bcx.ins().raw_bitcast(vector_ty, val); - - $ret.write_cvalue($fx, CValue::by_val(val, $ret.layout())); - } else { - simd_pair_for_each_lane( - $fx, - $x, - $y, - $ret, - |fx, lane_layout, res_lane_layout, x_lane, y_lane| { - let res_lane = match lane_layout.ty.kind() { - ty::Uint(_) | ty::Int(_) => fx.bcx.ins().icmp(IntCC::$cc, x_lane, y_lane), - ty::Float(_) => fx.bcx.ins().fcmp(FloatCC::$cc_f, x_lane, y_lane), - _ => unreachable!("{:?}", lane_layout.ty), - }; - bool_to_zero_or_max_uint(fx, res_lane_layout, res_lane) - }, - ); - } + // FIXME use vector icmp when possible + simd_pair_for_each_lane( + $fx, + $x, + $y, + $ret, + |fx, lane_layout, res_lane_layout, x_lane, y_lane| { + let res_lane = match lane_layout.ty.kind() { + ty::Uint(_) | ty::Int(_) => fx.bcx.ins().icmp(IntCC::$cc, x_lane, y_lane), + ty::Float(_) => fx.bcx.ins().fcmp(FloatCC::$cc_f, x_lane, y_lane), + _ => unreachable!("{:?}", lane_layout.ty), + }; + bool_to_zero_or_max_uint(fx, res_lane_layout, res_lane) + }, + ); }, ($fx:expr, $cc_u:ident|$cc_s:ident|$cc_f:ident($x:ident, $y:ident) -> $ret:ident) => { // FIXME use vector icmp when possible |
