]> git.ipfire.org Git - thirdparty/gcc.git/commit
MIPS: Use unaligned access to expand block_move on r6
authorYunQiang Su <yunqiang.su@cipunited.com>
Wed, 31 May 2023 09:55:50 +0000 (17:55 +0800)
committerYunQiang Su <yunqiang.su@cipunited.com>
Wed, 5 Jul 2023 09:26:02 +0000 (17:26 +0800)
commit5f5e37dcbc19cbbaec58789fc532cb9940413258
tree49a8ebc71361f0cce79e88ad5cb1f13af7b0bb90
parenta9c6db31cbe9bedd2dde1c50a7007a67750a0f50
MIPS: Use unaligned access to expand block_move on r6

MIPSr6 support unaligned memory access with normal lh/sh/lw/sw/ld/sd
instructions, and thus lwl/lwr/ldl/ldr and swl/swr/sdl/sdr is removed.

For microarchitecture, these memory access instructions issue 2
operation if the address is not aligned, which is like what lwl family
do.

For some situation (such as accessing boundary of pages) on some
microarchitectures, the unaligned access may not be good enough,
then the kernel should trap&emu it: the kernel may need
-mno-unalgined-access option.

gcc/
* config/mips/mips.cc (mips_expand_block_move): don't expand for
r6 with -mno-unaligned-access option if one or both of src and
dest are unaligned. restruct: return directly if length is not const.
(mips_block_move_straight): emit_move if ISA_HAS_UNALIGNED_ACCESS.

gcc/testsuite/
* gcc.target/mips/expand-block-move-r6-no-unaligned.c: new test.
* gcc.target/mips/expand-block-move-r6.c: new test.
gcc/config/mips/mips.cc
gcc/testsuite/gcc.target/mips/expand-block-move-r6-no-unaligned.c [new file with mode: 0644]
gcc/testsuite/gcc.target/mips/expand-block-move-r6.c [new file with mode: 0644]