[PATCH] D144154: [X86]Use Class to refactor ArithMetic td file in X86
Wang, Xin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 15 22:27:29 PST 2023
XinWang10 added inline comments.
================
Comment at: llvm/lib/Target/X86/X86InstrArithmetic.td:741
+let Defs = [AX,DX,EFLAGS], Uses = [AX] in
+def IMUL16r : MulOpR<0xF7, MRM5r, "imul", Xi16, WriteIMul16, []>;
+// EAX,EDX = EAX*GR32
----------------
XinWang10 wrote:
> XinWang10 wrote:
> > skan wrote:
> > > XinWang10 wrote:
> > > > skan wrote:
> > > > > Could we define `MulOpR` as a multiclass and use `defm IMUL`?
> > > > I don't know if it is necessary? In my understanding, class and multiclass is designed for reuse, but if I rewrite a MulOpR as a multiclass here for IMUL, seems it has only one user here?
> > > >
> > > What's difference? You already define class `MulOpR` for MUL and IMUL, and if we change it to multiclass, couldn't we use it for MUL and IMUL as well? And the suffix "8r", "16r", "32r", "64r" can be written only once.
> > Because MUL8r and IMUL8r have different pattern.
> I get your point, will take a try.
@skan MUL can't share multiclass with IMUL, take a look at MUL8r/m and IMUL8r/m, MUL8r/m has a pattern inside without sideeffect=0, seems cannot easily make them together as ADD etc.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144154/new/
https://reviews.llvm.org/D144154
More information about the llvm-commits
mailing list