[PATCH] D120199: [X86] Use bit test instructions to optimize some logic atomic operations

LuoYuanke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 19 21:49:41 PST 2022


LuoYuanke added inline comments.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:30495
+  case AtomicRMWInst::Or:
+    SCR = 0;
+    break;
----------------
Use enum { BIT_SET, BIT_CLEAR, BIT_RESET} to replace {0, 1, 2}?


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:30504
+  }
+  Instruction *I = AI->user_back();
+  LLVMContext &Ctx = AI->getParent()->getParent()->getContext();
----------------
Add comments that there is only 1 user checked in shouldExpandLogicAtomicRMWInIR()?


================
Comment at: llvm/lib/Target/X86/X86InstrCompiler.td:848
+               [SDNPHasChain, SDNPMayStore, SDNPMemOperand]>;
+multiclass ATOMIC_LOG<Format Form, string mnemonic, dag SCR> {
+  let Defs = [EFLAGS], mayLoad = 1, mayStore = 1, isCodeGenOnly = 1,
----------------
Does LOG mean logic? Rename to ATOMIC_OP?
SCR means "set, clear reset"? Maybe add comments for it, so that it is well understood.


================
Comment at: llvm/lib/Target/X86/X86IntrinsicsInfo.h:40
   FIXUPIMM, FIXUPIMM_MASKZ, GATHER_AVX2,
-  ROUNDP, ROUNDS
+  ROUNDP, ROUNDS, LOCK_BITTEST
 };
----------------
It seems LOCK_BITTEST is not used?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120199



More information about the llvm-commits mailing list