armips icon indicating copy to clipboard operation
armips copied to clipboard

.dh, .dw, .dd and partners unaligned and undocumented?

Open clbr opened this issue 5 years ago • 4 comments

Whether the larger-than-byte data entries are aligned or not is not mentioned in the docs at all.

It appears they are unaligned. If this is intentional, can we get new default macros that are aligned? So that it's not possible to accidentally create an unaligned variable.

clbr avatar Sep 27 '20 11:09 clbr

These directives do not automatically align. They should probably emit a warning if they are used outside of the required alignment, as opcodes do.

Kingcom avatar Oct 04 '20 13:10 Kingcom

Unaligned data values may very well occur in actual MIPS programs, the architecture even has dedicated instructions for handling unaligned loads and stores (lwl, lwr, swl, swr), therefore I'm not sure a warning makes sense for the standard data directives (having a new set of aligned data directives may be a good idea however).

sp1187 avatar Oct 04 '20 13:10 sp1187

The program has to be explicitly coded to expect unaligned values, and those instructions may not exist on some implementations (e.g. rsp does not have them).

clbr avatar Oct 04 '20 15:10 clbr

I'll just add that if a warning is added for unaligned data values, it would be great to have a way to turn that on/off for when you do want to use unaligned data (which, depending on the game, can be quite often) without spamming the log with warnings.

Prof9 avatar Oct 04 '20 16:10 Prof9