You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As discovered in #357, we parse u64 constants as two i32 parts on the stack, which makes translating from_u64_unchecked calls to bitcast op non-optimal. So, temporarily, in #357 I switched for felt! macro to use Felt::from_u32.
How
The easiest way is to peek into the next translated op in the frontend, and if it's a Felt::from_u64_unchecked call translate u64 constant as one u64 value on the stack. Alternative would be to allow to alter n previous translated ops, i.e. convert push.i32.i32 to push.u64.
The text was updated successfully, but these errors were encountered:
@greenhat The reason we were using u64 was so that we could support the full field element range, u32 only supports a small portion of it (maybe fine for our current use cases), but probably will need to switch back to u64.
I think with the new IR, we'd translate calls to Felt::from_u64_unchecked to the hir.constant operation, with a u64 operand, followed by a hir.cast operation to felt type - this would get constant folded to a hir.constant operation with a felt operand, and lowered to MASM as a field element literal, which I believe is what you want. The only thing we need to add is the Folder implementation for hir.cast.
What
As discovered in #357, we parse
u64
constants as twoi32
parts on the stack, which makes translatingfrom_u64_unchecked
calls tobitcast
op non-optimal. So, temporarily, in #357 I switched forfelt!
macro to useFelt::from_u32
.How
The easiest way is to
peek
into the next translated op in the frontend, and if it's aFelt::from_u64_unchecked
call translateu64
constant as oneu64
value on the stack. Alternative would be to allow to altern
previous translated ops, i.e. convertpush.i32.i32
topush.u64
.The text was updated successfully, but these errors were encountered: