[PATCH] D63385: [ConstantFolding] Add constant folding for smul.fix and smul.fix.sat

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 16 08:26:07 PDT 2019


bjope created this revision.
bjope added a reviewer: nikic.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
bjope added a parent revision: D63384: [ConstantFolding] Refactor ConstantFoldScalarCall. NFC.
bjope added a reviewer: leonardchan.

This patch teaches ConstantFolding to constant fold
both scalar and vector variants of llvm.smul.fix and
llvm.smul.fix.sat.

As described in the LangRef rounding is unspecified for
these instrinsics. If the result cannot be represented
exactly the default behavior in ConstantFolding is to
round down towards negative infinity. If a target has a
preferred rounding that is different some kind of target
hook would be needed (same strategy as used by the
SelectionDAG legalizer).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D63385

Files:
  llvm/lib/Analysis/ConstantFolding.cpp
  llvm/test/Analysis/ConstantFolding/smul-fix-sat.ll
  llvm/test/Analysis/ConstantFolding/smul-fix.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63385.204949.patch
Type: text/x-patch
Size: 12025 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190616/e6f01dff/attachment.bin>


More information about the llvm-commits mailing list