[llvm] [RISCV][GlobalISel] Legalize G_ATOMICRMW_AND/OR/XOR (PR #205540)

Kane Wang via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 24 05:58:19 PDT 2026


================
@@ -0,0 +1,210 @@
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
+# RUN: llc -mtriple=riscv32 -mattr=+a,+zabha -run-pass=instruction-select %s -o - | FileCheck %s
+
----------------
ReVe1uv wrote:

Thanks for the comment. The MIR instruction-select tests may seem redundant alongside the `.ll` tests, but they serve a specific purpose: they isolate the instruction-selection step and verify that `G_ATOMICRMW_AND/OR/XOR` are correctly matched to the expected RISC-V AMO instructions (e.g., `AMOAND_B, AMOOR_H, AMOXOR_W`).

The legalizer tests only confirm that the generic atomic operations survive legalization; the `.ll` tests cover the full pipeline end-to-end. The instruction-select MIR tests sit in between and document/protect the exact mapping from generic opcodes to target instructions. This makes regressions in the instruction selector easier to diagnose than failures in the end-to-end `.ll` tests alone.

That said, if you feel the RV32 and RV64 instruction-select tests are too similar, I’m happy to keep only the RV64 variant or fold them into the legalizer tests if the maintainers prefer.

https://github.com/llvm/llvm-project/pull/205540


More information about the llvm-commits mailing list