On 11/19/26 2:05 AM, Jin Ma wrote:
Loading a full word and discarding its trailing bytes still reads
past a partial tail.  Split the tail into naturally sized loads
before comparing it.

Assisted-by: qwenwork

gcc/ChangeLog:

        * config/riscv/riscv-string.cc
        (emit_memcmp_scalar_load_and_compare): Load only the remaining bytes.

gcc/testsuite/ChangeLog:

        * gcc.target/riscv/cmpmemsi-tail-safe.c: New test.
THanks.  I've pushed this to the trunk.

jeff

Reply via email to