Fix extending register after logical not in aarch64 compiler

This commit is contained in:
Nikita Lisitsa 2026-03-13 11:05:20 +03:00
parent c8cd86dd0b
commit 7f574eabbd
3 changed files with 7 additions and 2 deletions

View file

@ -182,8 +182,8 @@ int main(int argc, char ** argv)
{
// TODO: remove, testing-only code; should execute entry point instead
auto offset = pcontext.symbols.at("test");
auto fptr = (double(*)(double))(executable.data.get() + offset);
auto x = fptr(3.14159265358979323846 / 6.0);
auto fptr = (std::uint32_t(*)(std::uint32_t))(executable.data.get() + offset);
auto x = fptr(0);
std::cout << "Result: " << std::boolalpha << x << std::endl;
}
}

View file

@ -9,3 +9,6 @@ func add_or_sub(add : bool) -> (u32 -> u32):
return add1
else:
return sub1
func test(x: u32) -> u32:
return (!0us) as u32

View file

@ -404,6 +404,8 @@ namespace pslang::jit::aarch64
case ast::unary_operation_type::logical_not:
apply(*node.arg1);
builder.or_not_reg(31, 0, 0);
if (types::is_integer_type(*node.inferred_type))
extend(0, node.inferred_type);
break;
}
}