FuelLabs / fuel-specs

📝 Specifications for the Fuel protocol and the FuelVM, a blazingly fast blockchain VM.
https://fuellabs.github.io/fuel-specs/master
Apache License 2.0
1.78k stars 711 forks source link

Load and Store opcodes for small values > u8 and < u64 #510

Open Voxelot opened 1 year ago

Voxelot commented 1 year ago

Related to https://github.com/FuelLabs/sway/pull/4929

In order to more efficiently represent small types like arrays of u16 or u32 without being padded to u64, it would be helpful (although not absolutely required) for the compiler to have opcodes similar to LB & SB for u16 and u32. Without these, the compiler will have to generate suboptimal bytecode using chains of LB and and SB which only move one byte at a time between registers, use extra scratch space to bitmask the high bits, etc.

mohamedalaa696 commented 1 year ago

J