]> granicus.if.org Git - llvm/commit
[ConstantFolding] Add constant folding for smul.fix and smul.fix.sat
authorBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Wed, 19 Jun 2019 14:28:03 +0000 (14:28 +0000)
committerBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Wed, 19 Jun 2019 14:28:03 +0000 (14:28 +0000)
commitf99e13e425de288ff5fe82851c8648e9b5fd01e6
treee8ca23c96f49f42f0c6257dd25871e890e1e2cca
parent3ad4fa3edbd9af6aefd1f1ae0a4a6d6412a7d2af
[ConstantFolding] Add constant folding for smul.fix and smul.fix.sat

Summary:
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).

Reviewers: nikic, leonardchan, RKSimon

Reviewed By: leonardchan

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D63385

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363811 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ConstantFolding.cpp
test/Analysis/ConstantFolding/smul-fix-sat.ll [new file with mode: 0644]
test/Analysis/ConstantFolding/smul-fix.ll [new file with mode: 0644]