cranelift: Remove booleans (#5031)

Remove the boolean types from cranelift, and the associated instructions breduce, bextend, bconst, and bint. Standardize on using 1/0 for the return value from instructions that produce scalar boolean results, and -1/0 for boolean vector elements.

Fixes #3205

Co-authored-by: Afonso Bordado <afonso360@users.noreply.github.com>
Co-authored-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Co-authored-by: Chris Fallin <chris@cfallin.org>
This commit is contained in:
Trevor Elliott
2022-10-17 16:00:27 -07:00
committed by GitHub
parent 766ecb561e
commit 32a7593c94
242 changed files with 7695 additions and 10010 deletions

View File

@@ -142,8 +142,6 @@ enum Call {
fn emit_zero(ty: Type, mut cur: FuncCursor) -> Value {
if ty.is_int() {
cur.ins().iconst(ty, 0)
} else if ty.is_bool() {
cur.ins().bconst(ty, false)
} else if ty == F32 {
cur.ins().f32const(Ieee32::with_bits(0))
} else if ty == F64 {
@@ -152,7 +150,7 @@ fn emit_zero(ty: Type, mut cur: FuncCursor) -> Value {
cur.ins().null(ty)
} else if ty.is_vector() {
let scalar_ty = ty.lane_type();
if scalar_ty.is_int() || scalar_ty.is_bool() {
if scalar_ty.is_int() {
let zero = cur.func.dfg.constants.insert(
core::iter::repeat(0)
.take(ty.bytes().try_into().unwrap())
@@ -1167,12 +1165,12 @@ mod tests {
let i32_var = Variable::new(0);
let f32_var = Variable::new(1);
let f64_var = Variable::new(2);
let b1_var = Variable::new(3);
let i8_var = Variable::new(3);
let f32x4_var = Variable::new(4);
ssa.use_var(&mut func, i32_var, I32, block0);
ssa.use_var(&mut func, f32_var, F32, block0);
ssa.use_var(&mut func, f64_var, F64, block0);
ssa.use_var(&mut func, b1_var, B1, block0);
ssa.use_var(&mut func, i8_var, I8, block0);
ssa.use_var(&mut func, f32x4_var, F32X4, block0);
assert_eq!(func.dfg.num_block_params(block0), 0);
}