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:
@@ -11,7 +11,6 @@ use cranelift_codegen::{
|
||||
// };
|
||||
|
||||
enum ConstImm {
|
||||
Bool(bool),
|
||||
I64(i64),
|
||||
Ieee32(f32), // Ieee32 and Ieee64 will be replaced with `Single` and `Double` from the rust_apfloat library eventually.
|
||||
Ieee64(f64),
|
||||
@@ -28,7 +27,6 @@ impl ConstImm {
|
||||
|
||||
fn evaluate_truthiness(self) -> bool {
|
||||
match self {
|
||||
Self::Bool(b) => b,
|
||||
Self::I64(imm) => imm != 0,
|
||||
_ => panic!(
|
||||
"Only a `ConstImm::Bool` and `ConstImm::I64` can be evaluated for \"truthiness\""
|
||||
@@ -93,10 +91,6 @@ fn resolve_value_to_imm(dfg: &ir::DataFlowGraph, value: ir::Value) -> Option<Con
|
||||
let ieee_f64 = f64::from_bits(imm.bits());
|
||||
Some(ConstImm::Ieee64(ieee_f64))
|
||||
}
|
||||
UnaryBool {
|
||||
opcode: Bconst,
|
||||
imm,
|
||||
} => Some(ConstImm::Bool(imm)),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
@@ -183,10 +177,6 @@ fn replace_inst(dfg: &mut ir::DataFlowGraph, inst: ir::Inst, const_imm: ConstImm
|
||||
dfg.replace(inst)
|
||||
.f64const(ir::immediates::Ieee64::with_bits(imm.to_bits()));
|
||||
}
|
||||
Bool(imm) => {
|
||||
let typevar = dfg.ctrl_typevar(inst);
|
||||
dfg.replace(inst).bconst(typevar, imm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user