1 //===- llvm/Transforms/Utils/VectorUtils.h - Vector utilities -*- C++ -*-=====//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines some vectorizer utilities.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_TRANSFORMS_UTILS_VECTORUTILS_H
15 #define LLVM_TRANSFORMS_UTILS_VECTORUTILS_H
17 #include "llvm/Analysis/TargetLibraryInfo.h"
18 #include "llvm/IR/IntrinsicInst.h"
19 #include "llvm/IR/Intrinsics.h"
23 /// \brief Identify if the intrinsic is trivially vectorizable.
24 /// This method returns true if the intrinsic's argument types are all
25 /// scalars for the scalar form of the intrinsic and all vectors for
26 /// the vector form of the intrinsic.
27 bool isTriviallyVectorizable(Intrinsic::ID ID);
29 /// \brief Identifies if the intrinsic has a scalar operand. It checks for
30 /// ctlz,cttz and powi special intrinsics whose argument is scalar.
31 bool hasVectorInstrinsicScalarOpd(Intrinsic::ID ID, unsigned ScalarOpdIdx);
33 /// \brief Identify if call has a unary float signature
34 /// It returns input intrinsic ID if call has a single argument,
35 /// argument type and call instruction type should be floating
36 /// point type and call should only reads memory.
37 /// else return not_intrinsic.
38 Intrinsic::ID checkUnaryFloatSignature(const CallInst &I,
39 Intrinsic::ID ValidIntrinsicID);
41 /// \brief Identify if call has a binary float signature
42 /// It returns input intrinsic ID if call has two arguments,
43 /// arguments type and call instruction type should be floating
44 /// point type and call should only reads memory.
45 /// else return not_intrinsic.
46 Intrinsic::ID checkBinaryFloatSignature(const CallInst &I,
47 Intrinsic::ID ValidIntrinsicID);
49 /// \brief Returns intrinsic ID for call.
50 /// For the input call instruction it finds mapping intrinsic and returns
51 /// its intrinsic ID, in case it does not found it return not_intrinsic.
52 Intrinsic::ID getIntrinsicIDForCall(CallInst *CI, const TargetLibraryInfo *TLI);