Kingcom / armips

An assembler for various ARM and MIPS platforms. Builds available at http://buildbot.orphis.net/armips/
MIT License
359 stars 77 forks source link

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

Open clbr opened 4 years ago

clbr commented 4 years ago

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.

Kingcom commented 4 years ago

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

sp1187 commented 4 years ago

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).

clbr commented 4 years ago

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).

Prof9 commented 4 years ago

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.