[PATCH] D135933: [X86] Add CMPCCXADD instructions.

Freddy, Ye via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 24 04:21:59 PDT 2022


FreddyYe added inline comments.


================
Comment at: llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp:1453-1455
+    emitMemModRMByte(MI, CurOp + 1, getX86RegNum(MI.getOperand(0)), TSFlags,
+                     HasREX, StartByte, OS, Fixups, STI, false);
+    CurOp = SrcRegNum + 3; // skip VEX_V4 and CC
----------------
skan wrote:
> Minor suggestion
> 
> ```
>     emitMemModRMByte(MI, ++CurOp, getX86RegNum(MI.getOperand(0)), TSFlags,
>                      HasREX, StartByte, OS, Fixups, STI, false);
>     CurOp = SrcRegNum + 2; // skip VEX_V4 and CC
> ```
> would be more clear b/c you use "skip VEX_V4 and CC" in the comments.
We cannot do `++` before emitMemModRMByte, so there is a implicit +1 for that, like other cases.


================
Comment at: llvm/lib/Target/X86/X86InstrInfo.td:3027
+def CMPCCXADDmr32 : I<0xe0, MRMDestMem4VOp3CC, (outs GR32:$dst),
+          (ins GR32:$dstsrc2, i32mem:$dstsrc1, GR32:$src3, ccode:$cond),
+          "cmp${cond}xadd\t{$src3, $dst, $dstsrc1|$dstsrc1, $dst, $src3}",
----------------
skan wrote:
> Could you use "GR32:$dstsrc1, i32mem:$dstsrc2" instead?
OK, I'm ok to either. Then line below should do an reversion.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135933



More information about the llvm-commits mailing list