[PATCH] D131384: [LoongArch] Add codegen support for not

WÁNG Xuěruì via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 8 02:03:18 PDT 2022


xen0n added inline comments.


================
Comment at: llvm/lib/Target/LoongArch/LoongArchInstrInfo.td:662
 def : PatGprImm<xor, XORI, uimm12>;
+def : Pat<(not GPR:$rj), (NOR R0, GPR:$rj)>;
+def : Pat<(not (or GPR:$rj, GPR:$rk)), (NOR  GPR:$rj, GPR:$rk)>;
----------------
This is the same codegen as gcc, while I previously used `NOR rj, zero` (putting zero in rk position) in my QEMU TCG port.

I'm not sure which form is better or more consistent, because apparently they behave the same but usually we put zero in rk position (like with `move` i.e. `move rd, rj == or rd, rj, zero`).


================
Comment at: llvm/lib/Target/LoongArch/LoongArchInstrInfo.td:663
+def : Pat<(not GPR:$rj), (NOR R0, GPR:$rj)>;
+def : Pat<(not (or GPR:$rj, GPR:$rk)), (NOR  GPR:$rj, GPR:$rk)>;
+def : Pat<(or GPR:$rj, (not GPR:$rk)), (ORN  GPR:$rj, GPR:$rk)>;
----------------
nit: single space.

same below


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131384



More information about the llvm-commits mailing list