#ifndef HALIDE_CODEGEN_ARM_H
#define HALIDE_CODEGEN_ARM_H
#include "CodeGen_Posix.h"
namespace Halide {
namespace Internal {
class CodeGen_ARM : public CodeGen_Posix {
public:
CodeGen_ARM(Target);
protected:
Expr sorted_avg(Expr a, Expr b);
using CodeGen_Posix::visit;
void visit(const Cast *);
void visit(const Add *);
void visit(const Sub *);
void visit(const Div *);
void visit(const Mod *);
void visit(const Mul *);
void visit(const Min *);
void visit(const Max *);
void visit(const Store *);
void visit(const Load *);
void visit(const Call *);
struct Pattern {
std::string intrin32;
std::string intrin64;
int intrin_lanes;
Expr pattern;
enum PatternType {Simple = 0,
LeftShift,
RightShift,
NarrowArgs
};
PatternType type;
Pattern() {}
Pattern(const std::string &i32, const std::string &i64, int l, Expr p, PatternType t = Simple) :
intrin32("llvm.arm.neon." + i32),
intrin64("llvm.aarch64.neon." + i64),
intrin_lanes(l), pattern(p), type(t) {}
};
std::vector<Pattern> casts, left_shifts, averagings, negations;
llvm::Value *call_pattern(const Pattern &p, Type t, const std::vector<Expr> &args);
llvm::Value *call_pattern(const Pattern &p, llvm::Type *t, const std::vector<llvm::Value *> &args);
std::string mcpu() const;
std::string mattrs() const;
bool use_soft_float_abi() const;
int native_vector_bits() const;
bool neon_intrinsics_disabled() {
return target.has_feature(Target::NoNEON);
}
};
}}
#endif