Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Optimize unaligned reading #42
Unaligned reading is performed using a pair of LWL and LWR, usually they are not contiguous if the compiler tries to use other registers to improve speed.
The way you read an unaligned word is like this:
lwl RT, offset(RS)
Currently the implementation of LWL and LWR is slow, so it would be great if we try to find both instructions and convert it in a single unaligned read word.
In order to be able to perform this optimization safely we have to see that we don't have any jump label between those instructions, and there is no access to RS or RT registers in the instructions between.
Then we replace the LWL with the load, and tell the compiler to ignore the LWR instruction.