Skip to content
Snippets Groups Projects
Commit fd07a29e authored by Kito Cheng's avatar Kito Cheng
Browse files

RISC-V: Fix __atomic_compare_exchange with 32 bit value on RV64


atomic_compare_and_swapsi will use lr.w to do obtain the original value,
which sign extends to DI.  RV64 only has DI comparisons, so we also need
to sign extend the expected value to DI as otherwise the comparison will
fail when the expected value has the 32nd bit set.

gcc/ChangeLog:

	PR target/114130
	* config/riscv/sync.md (atomic_compare_and_swap<mode>): Sign
	extend the expected value if needed.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/pr114130.c: New.

Reviewed-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
parent 5ff49272
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment