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:
@@ -510,7 +510,7 @@ impl<'a> State<'a, DataValue> for InterpreterState<'a> {
|
||||
|
||||
// We start with a sentinel value that will fail if we try to load / add to it
|
||||
// without resolving the base GV First.
|
||||
let mut current_val = DataValue::B(false);
|
||||
let mut current_val = DataValue::I8(0);
|
||||
let mut action_stack = vec![ResolveAction::Resolve(gv)];
|
||||
|
||||
loop {
|
||||
@@ -639,7 +639,7 @@ mod tests {
|
||||
// filetest infrastructure.
|
||||
#[test]
|
||||
fn sanity() {
|
||||
let code = "function %test() -> b1 {
|
||||
let code = "function %test() -> i8 {
|
||||
block0:
|
||||
v0 = iconst.i32 1
|
||||
v1 = iadd_imm v0, 1
|
||||
@@ -657,7 +657,7 @@ mod tests {
|
||||
.unwrap()
|
||||
.unwrap_return();
|
||||
|
||||
assert_eq!(result, vec![DataValue::B(true)])
|
||||
assert_eq!(result, vec![DataValue::I8(1)])
|
||||
}
|
||||
|
||||
// We don't have a way to check for traps with the current filetest infrastructure
|
||||
@@ -750,7 +750,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn fuel() {
|
||||
let code = "function %test() -> b1 {
|
||||
let code = "function %test() -> i8 {
|
||||
block0:
|
||||
v0 = iconst.i32 1
|
||||
v1 = iadd_imm v0, 1
|
||||
@@ -1000,7 +1000,7 @@ mod tests {
|
||||
#[test]
|
||||
fn heap_sanity_test() {
|
||||
let code = "
|
||||
function %heap_load_store(i64 vmctx) -> b1 {
|
||||
function %heap_load_store(i64 vmctx) -> i8 {
|
||||
gv0 = vmctx
|
||||
gv1 = load.i64 notrap aligned gv0+0
|
||||
; gv2/3 do nothing, but makes sure we understand the iadd_imm mechanism
|
||||
@@ -1039,7 +1039,7 @@ mod tests {
|
||||
.unwrap()
|
||||
.unwrap_return();
|
||||
|
||||
assert_eq!(result, vec![DataValue::B(true)])
|
||||
assert_eq!(result, vec![DataValue::I8(1)])
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user