[PATCH] D130874: [AArch64] Fold Mul(And(Srl(X, 15), 0x10001), 0xffff) to CMLTz

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 1 01:02:47 PDT 2022


dmgreen created this revision.
dmgreen added reviewers: SjoerdMeijer, samtebbs, bipmis, fhahn.
Herald added subscribers: hiraditya, kristof.beyls.
Herald added a project: All.
dmgreen requested review of this revision.
Herald added a project: LLVM.

This folds a v4i32 Mul(And(Srl(X, 15), 0x10001), 0xffff) into a v8i16 CMLTz instruction. The Srl and And extract the top bit (whether the input is negative) and the Mul sets all values in the i16 half to all 1/0 depending on if that top bit was set. This is equivalent to a v8i16 CMLTz instruction. The same applies to other sizes with equivalent constants.


https://reviews.llvm.org/D130874

Files:
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/test/CodeGen/AArch64/insert-extend.ll
  llvm/test/CodeGen/AArch64/mulcmle.ll
  llvm/test/CodeGen/AArch64/reduce-shuffle.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130874.448934.patch
Type: text/x-patch
Size: 18042 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220801/0950a75c/attachment-0001.bin>


More information about the llvm-commits mailing list