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

Gong LingQin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 8 02:33:47 PDT 2022


gonglingqin 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)>;
----------------
xen0n wrote:
> 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`).
Thank you for your reminder , I will change that.


================
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)>;
----------------
xen0n wrote:
> nit: single space.
> 
> same below
Thanks, I will fix it.


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