From 512b1187794d33c75e4d88e8a4822aab375379c0 Mon Sep 17 00:00:00 2001 From: Bjorn Pettersson Date: Mon, 24 Jun 2019 12:07:11 +0000 Subject: [Scalarizer] Add scalarizer support for smul.fix.sat Summary: Handle smul.fix.sat in the scalarizer. This is done by adding smul.fix.sat to the set of "isTriviallyVectorizable" intrinsics. The addition of smul.fix.sat in isTriviallyVectorizable and hasVectorInstrinsicScalarOpd can also be seen as a preparation to be able to use hasVectorInstrinsicScalarOpd in ConstantFolding. Reviewers: rengolin, RKSimon, dblaikie Reviewed By: rengolin Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63704 llvm-svn: 364177 --- llvm/lib/Analysis/VectorUtils.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'llvm/lib/Analysis') diff --git a/llvm/lib/Analysis/VectorUtils.cpp b/llvm/lib/Analysis/VectorUtils.cpp index 8040af12d7c..986756eb262 100644 --- a/llvm/lib/Analysis/VectorUtils.cpp +++ b/llvm/lib/Analysis/VectorUtils.cpp @@ -37,8 +37,9 @@ static cl::opt MaxInterleaveGroupFactor( cl::init(8)); /// Return true if all of the intrinsic's arguments and return type are scalars -/// for the scalar form of the intrinsic and vectors for the vector form of the -/// intrinsic. +/// for the scalar form of the intrinsic, and vectors for the vector form of the +/// intrinsic (except operands that are marked as always being scalar by +/// hasVectorInstrinsicScalarOpd). bool llvm::isTriviallyVectorizable(Intrinsic::ID ID) { switch (ID) { case Intrinsic::bswap: // Begin integer bit-manipulation. @@ -53,6 +54,7 @@ bool llvm::isTriviallyVectorizable(Intrinsic::ID ID) { case Intrinsic::uadd_sat: case Intrinsic::usub_sat: case Intrinsic::smul_fix: + case Intrinsic::smul_fix_sat: case Intrinsic::umul_fix: case Intrinsic::sqrt: // Begin floating-point. case Intrinsic::sin: @@ -85,8 +87,7 @@ bool llvm::isTriviallyVectorizable(Intrinsic::ID ID) { } } -/// Identifies if the intrinsic has a scalar operand. It check for -/// ctlz,cttz and powi special intrinsics whose argument is scalar. +/// Identifies if the vector form of the intrinsic has a scalar operand. bool llvm::hasVectorInstrinsicScalarOpd(Intrinsic::ID ID, unsigned ScalarOpdIdx) { switch (ID) { @@ -95,6 +96,7 @@ bool llvm::hasVectorInstrinsicScalarOpd(Intrinsic::ID ID, case Intrinsic::powi: return (ScalarOpdIdx == 1); case Intrinsic::smul_fix: + case Intrinsic::smul_fix_sat: case Intrinsic::umul_fix: return (ScalarOpdIdx == 2); default: -- cgit v1.2.3