Skip to content

Commit 78e2d4a

Browse files
committed
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.
1 parent 8ace43e commit 78e2d4a

File tree

1 file changed

+15
-31
lines changed

1 file changed

+15
-31
lines changed

src/intrinsics/simd.rs

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,37 +17,21 @@ fn validate_simd_type(fx: &mut FunctionCx<'_, '_, '_>, intrinsic: Symbol, span:
1717

1818
macro simd_cmp {
1919
($fx:expr, $cc:ident|$cc_f:ident($x:ident, $y:ident) -> $ret:ident) => {
20-
let vector_ty = clif_vector_type($fx.tcx, $x.layout());
21-
22-
if let Some(vector_ty) = vector_ty {
23-
let x = $x.load_scalar($fx);
24-
let y = $y.load_scalar($fx);
25-
let val = if vector_ty.lane_type().is_float() {
26-
$fx.bcx.ins().fcmp(FloatCC::$cc_f, x, y)
27-
} else {
28-
$fx.bcx.ins().icmp(IntCC::$cc, x, y)
29-
};
30-
31-
// HACK This depends on the fact that icmp for vectors represents bools as 0 and !0, not 0 and 1.
32-
let val = $fx.bcx.ins().raw_bitcast(vector_ty, val);
33-
34-
$ret.write_cvalue($fx, CValue::by_val(val, $ret.layout()));
35-
} else {
36-
simd_pair_for_each_lane(
37-
$fx,
38-
$x,
39-
$y,
40-
$ret,
41-
|fx, lane_layout, res_lane_layout, x_lane, y_lane| {
42-
let res_lane = match lane_layout.ty.kind() {
43-
ty::Uint(_) | ty::Int(_) => fx.bcx.ins().icmp(IntCC::$cc, x_lane, y_lane),
44-
ty::Float(_) => fx.bcx.ins().fcmp(FloatCC::$cc_f, x_lane, y_lane),
45-
_ => unreachable!("{:?}", lane_layout.ty),
46-
};
47-
bool_to_zero_or_max_uint(fx, res_lane_layout, res_lane)
48-
},
49-
);
50-
}
20+
// FIXME use vector icmp when possible
21+
simd_pair_for_each_lane(
22+
$fx,
23+
$x,
24+
$y,
25+
$ret,
26+
|fx, lane_layout, res_lane_layout, x_lane, y_lane| {
27+
let res_lane = match lane_layout.ty.kind() {
28+
ty::Uint(_) | ty::Int(_) => fx.bcx.ins().icmp(IntCC::$cc, x_lane, y_lane),
29+
ty::Float(_) => fx.bcx.ins().fcmp(FloatCC::$cc_f, x_lane, y_lane),
30+
_ => unreachable!("{:?}", lane_layout.ty),
31+
};
32+
bool_to_zero_or_max_uint(fx, res_lane_layout, res_lane)
33+
},
34+
);
5135
},
5236
($fx:expr, $cc_u:ident|$cc_s:ident|$cc_f:ident($x:ident, $y:ident) -> $ret:ident) => {
5337
// FIXME use vector icmp when possible

0 commit comments

Comments
 (0)