[PATCH] D141113: [X86] Improve mul x, 2^N +/- 2 pattern by making the +/- 2x compute independently to x << N

Phoebe Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 7 04:33:45 PST 2023


pengfei accepted this revision.
pengfei added a comment.

LGTM.



================
Comment at: llvm/test/CodeGen/X86/mul-constant-result.ll:166-175
+; X86-NEXT:    .cfi_def_cfa_offset 8
+; X86-NEXT:    leal (%eax,%eax), %ecx
+; X86-NEXT:    shll $5, %eax
+; X86-NEXT:  .LBB0_23:
+; X86-NEXT:    subl %ecx, %eax
+; X86-NEXT:    popl %esi
+; X86-NEXT:    .cfi_def_cfa_offset 4
----------------
goldstein.w.n wrote:
> goldstein.w.n wrote:
> > RKSimon wrote:
> > > pengfei wrote:
> > > > Regression?
> > > The increase in lines seems to be due to extra labels/cfi-directives - tbh I'd take the extra LEA if we reduce control flow instructions.
> > > The increase in lines seems to be due to extra labels/cfi-directives - tbh I'd take the extra LEA if we reduce control flow instructions.
> > 
> > 
> > Regression?
> 
> 
> I think that the tail of some cases fold when its `sub; sub` so lower LOC, more jumps.
> Issue?
Look it again, although the new code have one more BB, it has one less jmp. So the new code it better.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141113



More information about the llvm-commits mailing list