[PATCH] D153620: [X86] Combine MUL+SRL+TRUNC to MULX for i32 on 64-bit

Phoebe Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 23 04:10:48 PDT 2023


pengfei created this revision.
pengfei added reviewers: craig.topper, probinson, RKSimon.
Herald added a subscriber: hiraditya.
Herald added a project: All.
pengfei requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

D153576 <https://reviews.llvm.org/D153576> brought `_mulx_u32` to 64-bit targets. But the lowering of it
doesn't satisfy `does not read or write arithmetic flags` described in
intrinsic guide: https://godbolt.org/z/xb1fjf1sM

This patch completes the lowering part through combining
(i32 (trunc (shr (mul (zext (i32 A)), (zext (i32 B))), 32)))
to (umul_lohi (i32 A), (i32 B))

It is also a general optimization.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D153620

Files:
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/test/CodeGen/X86/bmi2.ll
  llvm/test/CodeGen/X86/smul_fix.ll
  llvm/test/CodeGen/X86/smul_fix_sat.ll
  llvm/test/CodeGen/X86/umul_fix.ll
  llvm/test/CodeGen/X86/umul_fix_sat.ll
  llvm/test/CodeGen/X86/vector-mulfix-legalize.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153620.533919.patch
Type: text/x-patch
Size: 28348 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230623/092a79cb/attachment-0001.bin>


More information about the llvm-commits mailing list