[PATCH] D105754: [PowerPC] Fix L[D|W]ARX Implementation

Nemanja Ivanovic via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 9 19:23:34 PDT 2021


nemanjai added inline comments.


================
Comment at: llvm/include/llvm/IR/IntrinsicsPowerPC.td:1535
-  def int_ppc_ldarx : GCCBuiltin<"__builtin_ppc_ldarx">,
-                      Intrinsic<[llvm_i64_ty], [llvm_ptr_ty], [IntrNoMem]>;
 }
----------------
lkail wrote:
> Just curious, compiler optimizes the instruction out even setting `IntrArgMemOnly` and `IntrReadMem` here?
Yes. Well, those two more or less tell it to go ahead and optimize it out if there are no uses. What is more surprising is that even with `IntrHasSideEffects`. Heck, it even optimizes with all of:
```
IntrReadMem
IntrArgMemOnly
IntrHasSideEffects
Throws
IntrNoDuplicate
IntrNoMerge
```
I certainly found that surprising but I assume there is some justification as to why that is. There is some precedent for producing inline asm for builtins (see `EmitX86BitTestIntrinsic()` and similar). I don't know why that intrinsic was implemented using inline asm (commit messages don't say) but I presume it might have been for a similar reason.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105754/new/

https://reviews.llvm.org/D105754



More information about the cfe-commits mailing list