diff options
author | Xi Ruoyao <xry111@xry111.site> | 2025-08-18 17:18:32 +0800 |
---|---|---|
committer | Xi Ruoyao <xry111@xry111.site> | 2025-09-11 18:49:36 +0800 |
commit | 4fcb26a35785c67f35ecceb34632dbf5456d240f (patch) | |
tree | 684a4e7b3d30b8e1f22175a303b90c44b577c957 /libjava | |
parent | 13ec1769fa2404eec8c34ce8e0b87fc28ff5ac76 (diff) | |
download | gcc-4fcb26a35785c67f35ecceb34632dbf5456d240f.zip gcc-4fcb26a35785c67f35ecceb34632dbf5456d240f.tar.gz gcc-4fcb26a35785c67f35ecceb34632dbf5456d240f.tar.bz2 |
LoongArch: Fix the semantic of 16B CAS
In a CAS operation, even if expected != *memory we still need to do an
atomic load of *memory into output. But I made a mistake in the initial
implementation, causing the output to contain junk in this situation.
Like a normal atomic load, the atomic load embedded in the CAS semantic
is required to work on read-only page. Thus we cannot rely on sc.q to
ensure the atomicity of the load. Use LSX to perform the load instead,
and also use LSX to compare the 16B values to keep the ll-sc loop body
short.
gcc/ChangeLog:
* config/loongarch/sync.md (atomic_compare_and_swapti_scq):
Require LSX. Change the operands for the output, the memory,
and the expected value to LSX vector modes. Add a FCCmode
output to indicate if CAS has written the desired value into
memory. Use LSX to atomically load both words of the 16B value
in memory.
(atomic_compare_and_swapti): Pun the modes to satisify
the new atomic_compare_and_swapti_scq implementation. Read the
bool return value from the FCC instead of performing a
comparision.
Diffstat (limited to 'libjava')
0 files changed, 0 insertions, 0 deletions