[all-commits] [llvm/llvm-project] bb6551: [RISCV][GlobalISel] Legalize G_ATOMICRMW_AND/OR/XO...

Kane Wang via All-commits all-commits at lists.llvm.org
Mon Jun 29 03:25:46 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bb6551e28107616882fcf8dd57bd657727abe890
      https://github.com/llvm/llvm-project/commit/bb6551e28107616882fcf8dd57bd657727abe890
  Author: Kane Wang <wangqiang1 at kylinos.cn>
  Date:   2026-06-29 (Mon, 29 Jun 2026)

  Changed paths:
    M llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
    A llvm/test/CodeGen/RISCV/GlobalISel/atomicrmw-and-or-xor.ll
    M llvm/test/CodeGen/RISCV/GlobalISel/legalizer-info-validation.mir
    A llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-atomicrmw-and-or-xor-rv32.mir
    A llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-atomicrmw-and-or-xor-rv64.mir

  Log Message:
  -----------
  [RISCV][GlobalISel] Legalize G_ATOMICRMW_AND/OR/XOR (#205540)

Add legalization support for G_ATOMICRMW_AND, G_ATOMICRMW_OR, and
G_ATOMICRMW_XOR in the RISC-V GlobalISel legalizer. These operations are
grouped with G_ATOMIC_CMPXCHG and G_ATOMICRMW_ADD since they share the
same type signature and legalization behavior:

- With the A extension, the operations are legal at XLEN width.
- Without the A extension, they are lowered to the appropriate
__atomic_fetch_{and,or,xor}_N libcalls.
- Sub-XLEN operations are clamped to XLEN before instruction selection;
the actual memory access size is preserved in the MMO so that
Zabha-enabled targets can select byte/halfword AMO instructions (e.g.
amoand.b, amoor.h).

Tests are added for the legalizer, instruction selection, and end-to-end
assembly output for both RV32 and RV64.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list