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

@@ -762,9 +762,6 @@ fn const_for_type<'f, T: InstBuilder<'f>>(mut builder: T, ty: ir::Type) -> &'sta
} else if ty == F64 {
builder.f64const(0.0);
"f64const"
} else if ty.is_bool() {
builder.bconst(ty, false);
"bconst"
} else if ty.is_ref() {
builder.null(ty);
"null"

View File

@@ -156,14 +156,14 @@ mod test {
fn nop() {
let code = String::from(
"
function %test() -> b8 {
function %test() -> i8 {
block0:
nop
v1 = bconst.b8 true
v1 = iconst.i8 -1
v2 = iconst.i8 42
return v1
}
; run: %test() == true
; run: %test() == -1
",
);
FileInterpreter::from_inline_code(code).run().unwrap()

View File

@@ -126,10 +126,10 @@ mod test {
fn nop() {
let code = String::from(
"
function %test() -> b8 {
function %test() -> i8 {
block0:
nop
v1 = bconst.b8 true
v1 = iconst.i8 -1
return v1
}
; run