Skip to content

Commit a7b06e8

Browse files
committed
Fix two type mismatch bugs
1 parent c42be79 commit a7b06e8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/intrinsics/mod.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,11 @@ fn simd_reduce_bool<'tcx>(
250250
let lane = fx.bcx.ins().band_imm(lane, 1); // mask to boolean
251251
res_val = f(fx, res_val, lane);
252252
}
253+
let res_val = if fx.bcx.func.dfg.value_type(res_val) != types::I8 {
254+
fx.bcx.ins().ireduce(types::I8, res_val)
255+
} else {
256+
res_val
257+
};
253258
let res = CValue::by_val(res_val, ret.layout());
254259
ret.write_cvalue(fx, res);
255260
}
@@ -284,7 +289,11 @@ macro simd_cmp {
284289
if let Some(vector_ty) = vector_ty {
285290
let x = $x.load_scalar($fx);
286291
let y = $y.load_scalar($fx);
287-
let val = $fx.bcx.ins().icmp(IntCC::$cc, x, y);
292+
let val = if vector_ty.lane_type().is_float() {
293+
$fx.bcx.ins().fcmp(FloatCC::$cc_f, x, y)
294+
} else {
295+
$fx.bcx.ins().icmp(IntCC::$cc, x, y)
296+
};
288297

289298
// HACK This depends on the fact that icmp for vectors represents bools as 0 and !0, not 0 and 1.
290299
let val = $fx.bcx.ins().raw_bitcast(vector_ty, val);

0 commit comments

Comments
 (0)