Return bools in GPR registers.
Boolean types are returned in %rax, so regclass_for_abi_type() should return GPR. Fixes #179.
This commit is contained in:
20
cranelift/filetests/isa/intel/abi-bool.cton
Normal file
20
cranelift/filetests/isa/intel/abi-bool.cton
Normal file
@@ -0,0 +1,20 @@
|
||||
test compile
|
||||
set is_64bit=1
|
||||
isa intel haswell
|
||||
|
||||
function %foo(i64, i64, i64, i32) -> b1 native {
|
||||
ebb3(v0: i64, v1: i64, v2: i64, v3: i32):
|
||||
v5 = icmp ne v2, v2
|
||||
v8 = iconst.i64 0
|
||||
jump ebb2(v8, v3, v5)
|
||||
|
||||
ebb2(v10: i64, v30: i32, v37: b1):
|
||||
v18 = load.i32 notrap aligned v2
|
||||
v27 = iadd.i64 v10, v10
|
||||
v31 = icmp eq v30, v30
|
||||
brz v31, ebb2(v27, v30, v37)
|
||||
jump ebb0(v37)
|
||||
|
||||
ebb0(v35: b1):
|
||||
return v35
|
||||
}
|
||||
@@ -125,7 +125,11 @@ pub fn legalize_signature(sig: &mut ir::Signature, flags: &shared_settings::Flag
|
||||
|
||||
/// Get register class for a type appearing in a legalized signature.
|
||||
pub fn regclass_for_abi_type(ty: ir::Type) -> RegClass {
|
||||
if ty.is_int() { GPR } else { FPR }
|
||||
if ty.is_int() || ty.is_bool() {
|
||||
GPR
|
||||
} else {
|
||||
FPR
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the set of allocatable registers for `func`.
|
||||
|
||||
Reference in New Issue
Block a user