[PATCH] D136310: [SPIR-V] Add atomic_flag builtin implementation
Ilia Diachkov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 15 12:29:00 PST 2022
iliya-diyachkov added inline comments.
================
Comment at: llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp:438-440
+ unsigned Semantics =
+ getSPIRVMemSemantics(Order) |
+ getMemSemanticsForStorageClass(GR->getPointerStorageClass(PtrRegister));
----------------
mpaszkowski wrote:
> arsenm wrote:
> > Why is this something that would be materialized in a register instead of an immediate argument?
> This is the way it is done by the Khronos LLVM SPIR-V Translator and we want the SPIR-V backend to be compatible.
>
> Translator:
>
> ```
> 4 Constant 2 14 42
> ...
> 7 AtomicUMin 2 30 4 12 13 14
> ```
>
> Backend:
>
> ```
> %10 = OpConstant %4 42
> ...
> %30 = OpAtomicUMin %4 %18 %12 %13 %10
> ```
@arsenm, according to the SPIRV specification (see [[ https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#OpAtomicUMin | the link ]]), the last operand of OpAtomicUMin instruction should be a register (<id> in the specification notation), not an immediate.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136310/new/
https://reviews.llvm.org/D136310
More information about the llvm-commits
mailing list