[PATCH] D138177: [LoongArch] Add codegen support for atomicrmw min/max operation on LA64

WÁNG Xuěruì via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 26 07:06:06 PST 2022


xen0n added inline comments.


================
Comment at: llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp:2281-2282
+        DL.getTypeStoreSizeInBits(AI->getValOperand()->getType());
+    Value *SextShamt =
+        Builder.CreateSub(Builder.getIntN(GRLen, GRLen - ValWidth), ShiftAmt);
+    Result = Builder.CreateCall(LlwOpScwLoop,
----------------
This may have room for improvement:

Firstly, this value is statically known at compile-time, so it should probably be an immediate. I looked at the surrounding code and found out some similar expressions like this one, so you may choose to refactor later.

Secondly, we have `ext.w.b` and `ext.w.h` that is usable even in LA32 mode, so it may be very worthwhile to special-case these two sizes so that the sign extension can be done in one insn/cycle.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138177



More information about the llvm-commits mailing list