Fix short-circuit || for small integer types

This commit is contained in:
Nikita Lisitsa 2026-03-12 23:13:42 +03:00
parent 13a9ba24f2
commit cb433d87bf
2 changed files with 6 additions and 4 deletions

View file

@ -1,9 +1,9 @@
func g() -> u32: func g() -> u16:
return g() return g()
func h() -> bool: func h() -> bool:
return h() return h()
func test() -> u32: func test() -> u16:
return (!1u) || g() return 65535us || g()

View file

@ -480,7 +480,9 @@ namespace pslang::jit::aarch64
break; break;
case ast::binary_operation_type::logical_or: case ast::binary_operation_type::logical_or:
{ {
builder.or_not_reg(31, 0, 1); set_m1(1);
extend(1, arg1_type);
builder.xor_reg(0, 1, 1);
std::int32_t start = pcontext.code.size(); std::int32_t start = pcontext.code.size();
builder.cbz(1, 0); builder.cbz(1, 0);
push(0); push(0);