2010-05-28 03:08:32 +02:00
|
|
|
//===- NeonEmitter.h - Generate arm_neon.h for use with clang ---*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This tablegen backend is responsible for emitting arm_neon.h, which includes
|
2010-12-04 05:40:15 +01:00
|
|
|
// a declaration and definition of each function specified by the ARM NEON
|
2010-05-28 03:08:32 +02:00
|
|
|
// compiler interface. See ARM document DUI0348B.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef NEON_EMITTER_H
|
|
|
|
#define NEON_EMITTER_H
|
|
|
|
|
2010-06-04 03:26:15 +02:00
|
|
|
#include "Record.h"
|
2010-05-28 03:08:32 +02:00
|
|
|
#include "TableGenBackend.h"
|
2010-06-04 03:26:15 +02:00
|
|
|
#include "llvm/ADT/DenseMap.h"
|
|
|
|
#include "llvm/ADT/StringMap.h"
|
|
|
|
|
|
|
|
enum OpKind {
|
|
|
|
OpNone,
|
|
|
|
OpAdd,
|
2010-12-08 01:14:04 +01:00
|
|
|
OpAddl,
|
|
|
|
OpAddw,
|
2010-06-04 03:26:15 +02:00
|
|
|
OpSub,
|
2010-12-08 01:14:04 +01:00
|
|
|
OpSubl,
|
|
|
|
OpSubw,
|
2010-06-04 03:26:15 +02:00
|
|
|
OpMul,
|
2010-12-07 21:02:45 +01:00
|
|
|
OpMull,
|
2010-06-04 03:26:15 +02:00
|
|
|
OpMla,
|
2010-12-08 00:53:37 +01:00
|
|
|
OpMlal,
|
2010-06-04 03:26:15 +02:00
|
|
|
OpMls,
|
2010-12-08 00:53:37 +01:00
|
|
|
OpMlsl,
|
2010-06-10 02:16:56 +02:00
|
|
|
OpMulN,
|
2010-12-07 21:02:45 +01:00
|
|
|
OpMullN,
|
2010-06-10 02:16:56 +02:00
|
|
|
OpMlaN,
|
|
|
|
OpMlsN,
|
2010-12-08 00:53:37 +01:00
|
|
|
OpMlalN,
|
|
|
|
OpMlslN,
|
2010-12-03 01:34:12 +01:00
|
|
|
OpMulLane,
|
2010-12-07 23:02:48 +01:00
|
|
|
OpMullLane,
|
2010-12-03 01:34:12 +01:00
|
|
|
OpMlaLane,
|
|
|
|
OpMlsLane,
|
2010-12-08 00:53:37 +01:00
|
|
|
OpMlalLane,
|
|
|
|
OpMlslLane,
|
2010-12-08 23:36:08 +01:00
|
|
|
OpQDMullLane,
|
|
|
|
OpQDMlalLane,
|
|
|
|
OpQDMlslLane,
|
|
|
|
OpQDMulhLane,
|
|
|
|
OpQRDMulhLane,
|
2010-06-04 03:26:15 +02:00
|
|
|
OpEq,
|
|
|
|
OpGe,
|
|
|
|
OpLe,
|
|
|
|
OpGt,
|
|
|
|
OpLt,
|
|
|
|
OpNeg,
|
|
|
|
OpNot,
|
|
|
|
OpAnd,
|
|
|
|
OpOr,
|
|
|
|
OpXor,
|
|
|
|
OpAndNot,
|
|
|
|
OpOrNot,
|
2010-06-08 02:14:42 +02:00
|
|
|
OpCast,
|
|
|
|
OpConcat,
|
2010-06-09 03:09:00 +02:00
|
|
|
OpDup,
|
2010-12-07 23:39:24 +01:00
|
|
|
OpDupLane,
|
2010-06-09 03:09:00 +02:00
|
|
|
OpHi,
|
2010-06-12 05:09:49 +02:00
|
|
|
OpLo,
|
|
|
|
OpSelect,
|
|
|
|
OpRev16,
|
|
|
|
OpRev32,
|
2010-12-07 02:12:23 +01:00
|
|
|
OpRev64,
|
2010-12-08 21:09:10 +01:00
|
|
|
OpReinterpret,
|
2010-12-08 22:39:04 +01:00
|
|
|
OpAbdl,
|
|
|
|
OpAba,
|
|
|
|
OpAbal
|
2010-06-04 03:26:15 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
enum ClassKind {
|
|
|
|
ClassNone,
|
2010-12-01 20:49:56 +01:00
|
|
|
ClassI, // generic integer instruction, e.g., "i8" suffix
|
|
|
|
ClassS, // signed/unsigned/poly, e.g., "s8", "u8" or "p8" suffix
|
|
|
|
ClassW, // width-specific instruction, e.g., "8" suffix
|
|
|
|
ClassB // bitcast arguments with enum argument to specify type
|
2010-06-04 03:26:15 +02:00
|
|
|
};
|
2010-05-28 03:08:32 +02:00
|
|
|
|
|
|
|
namespace llvm {
|
2010-12-04 05:40:15 +01:00
|
|
|
|
2010-05-28 03:08:32 +02:00
|
|
|
class NeonEmitter : public TableGenBackend {
|
|
|
|
RecordKeeper &Records;
|
2010-06-04 03:26:15 +02:00
|
|
|
StringMap<OpKind> OpMap;
|
|
|
|
DenseMap<Record*, ClassKind> ClassMap;
|
2010-12-04 05:40:15 +01:00
|
|
|
|
2010-05-28 03:08:32 +02:00
|
|
|
public:
|
2010-06-04 03:26:15 +02:00
|
|
|
NeonEmitter(RecordKeeper &R) : Records(R) {
|
2010-06-10 02:16:56 +02:00
|
|
|
OpMap["OP_NONE"] = OpNone;
|
|
|
|
OpMap["OP_ADD"] = OpAdd;
|
2010-12-08 01:14:04 +01:00
|
|
|
OpMap["OP_ADDL"] = OpAddl;
|
|
|
|
OpMap["OP_ADDW"] = OpAddw;
|
2010-06-10 02:16:56 +02:00
|
|
|
OpMap["OP_SUB"] = OpSub;
|
2010-12-08 01:14:04 +01:00
|
|
|
OpMap["OP_SUBL"] = OpSubl;
|
|
|
|
OpMap["OP_SUBW"] = OpSubw;
|
2010-06-10 02:16:56 +02:00
|
|
|
OpMap["OP_MUL"] = OpMul;
|
2010-12-07 21:02:45 +01:00
|
|
|
OpMap["OP_MULL"] = OpMull;
|
2010-06-10 02:16:56 +02:00
|
|
|
OpMap["OP_MLA"] = OpMla;
|
2010-12-08 00:53:37 +01:00
|
|
|
OpMap["OP_MLAL"] = OpMlal;
|
2010-06-10 02:16:56 +02:00
|
|
|
OpMap["OP_MLS"] = OpMls;
|
2010-12-08 00:53:37 +01:00
|
|
|
OpMap["OP_MLSL"] = OpMlsl;
|
2010-06-10 02:16:56 +02:00
|
|
|
OpMap["OP_MUL_N"] = OpMulN;
|
2010-12-07 21:02:45 +01:00
|
|
|
OpMap["OP_MULL_N"]= OpMullN;
|
2010-06-10 02:16:56 +02:00
|
|
|
OpMap["OP_MLA_N"] = OpMlaN;
|
|
|
|
OpMap["OP_MLS_N"] = OpMlsN;
|
2010-12-08 00:53:37 +01:00
|
|
|
OpMap["OP_MLAL_N"] = OpMlalN;
|
|
|
|
OpMap["OP_MLSL_N"] = OpMlslN;
|
2010-12-03 01:34:12 +01:00
|
|
|
OpMap["OP_MUL_LN"]= OpMulLane;
|
2010-12-07 23:02:48 +01:00
|
|
|
OpMap["OP_MULL_LN"] = OpMullLane;
|
2010-12-03 01:34:12 +01:00
|
|
|
OpMap["OP_MLA_LN"]= OpMlaLane;
|
|
|
|
OpMap["OP_MLS_LN"]= OpMlsLane;
|
2010-12-08 00:53:37 +01:00
|
|
|
OpMap["OP_MLAL_LN"] = OpMlalLane;
|
|
|
|
OpMap["OP_MLSL_LN"] = OpMlslLane;
|
2010-12-08 23:36:08 +01:00
|
|
|
OpMap["OP_QDMULL_LN"] = OpQDMullLane;
|
|
|
|
OpMap["OP_QDMLAL_LN"] = OpQDMlalLane;
|
|
|
|
OpMap["OP_QDMLSL_LN"] = OpQDMlslLane;
|
|
|
|
OpMap["OP_QDMULH_LN"] = OpQDMulhLane;
|
|
|
|
OpMap["OP_QRDMULH_LN"] = OpQRDMulhLane;
|
2010-06-10 02:16:56 +02:00
|
|
|
OpMap["OP_EQ"] = OpEq;
|
|
|
|
OpMap["OP_GE"] = OpGe;
|
|
|
|
OpMap["OP_LE"] = OpLe;
|
|
|
|
OpMap["OP_GT"] = OpGt;
|
|
|
|
OpMap["OP_LT"] = OpLt;
|
|
|
|
OpMap["OP_NEG"] = OpNeg;
|
|
|
|
OpMap["OP_NOT"] = OpNot;
|
|
|
|
OpMap["OP_AND"] = OpAnd;
|
|
|
|
OpMap["OP_OR"] = OpOr;
|
|
|
|
OpMap["OP_XOR"] = OpXor;
|
|
|
|
OpMap["OP_ANDN"] = OpAndNot;
|
|
|
|
OpMap["OP_ORN"] = OpOrNot;
|
|
|
|
OpMap["OP_CAST"] = OpCast;
|
|
|
|
OpMap["OP_CONC"] = OpConcat;
|
|
|
|
OpMap["OP_HI"] = OpHi;
|
|
|
|
OpMap["OP_LO"] = OpLo;
|
|
|
|
OpMap["OP_DUP"] = OpDup;
|
2010-12-07 23:39:24 +01:00
|
|
|
OpMap["OP_DUP_LN"] = OpDupLane;
|
2010-06-12 05:09:49 +02:00
|
|
|
OpMap["OP_SEL"] = OpSelect;
|
|
|
|
OpMap["OP_REV16"] = OpRev16;
|
|
|
|
OpMap["OP_REV32"] = OpRev32;
|
|
|
|
OpMap["OP_REV64"] = OpRev64;
|
2010-12-07 02:12:23 +01:00
|
|
|
OpMap["OP_REINT"] = OpReinterpret;
|
2010-12-08 22:39:04 +01:00
|
|
|
OpMap["OP_ABDL"] = OpAbdl;
|
2010-12-08 21:09:10 +01:00
|
|
|
OpMap["OP_ABA"] = OpAba;
|
2010-12-08 22:39:04 +01:00
|
|
|
OpMap["OP_ABAL"] = OpAbal;
|
2010-06-04 03:26:15 +02:00
|
|
|
|
|
|
|
Record *SI = R.getClass("SInst");
|
|
|
|
Record *II = R.getClass("IInst");
|
|
|
|
Record *WI = R.getClass("WInst");
|
|
|
|
ClassMap[SI] = ClassS;
|
|
|
|
ClassMap[II] = ClassI;
|
|
|
|
ClassMap[WI] = ClassW;
|
|
|
|
}
|
2010-12-04 05:40:15 +01:00
|
|
|
|
2010-06-04 02:21:41 +02:00
|
|
|
// run - Emit arm_neon.h.inc
|
2010-05-28 03:08:32 +02:00
|
|
|
void run(raw_ostream &o);
|
2010-06-04 02:21:41 +02:00
|
|
|
|
|
|
|
// runHeader - Emit all the __builtin prototypes used in arm_neon.h
|
|
|
|
void runHeader(raw_ostream &o);
|
2010-12-08 00:53:32 +01:00
|
|
|
|
2010-12-15 17:58:45 +01:00
|
|
|
// runTests - Emit tests for all the Neon intrinsics.
|
|
|
|
void runTests(raw_ostream &o);
|
|
|
|
|
2010-12-08 00:53:32 +01:00
|
|
|
private:
|
|
|
|
void emitIntrinsic(raw_ostream &OS, Record *R);
|
2010-05-28 03:08:32 +02:00
|
|
|
};
|
2010-12-04 05:40:15 +01:00
|
|
|
|
2010-05-28 03:08:32 +02:00
|
|
|
} // End llvm namespace
|
|
|
|
|
|
|
|
#endif
|