Add support for Hexagon v60 HVX intrinsics

This commit is contained in:
Michael Wu 2017-04-18 16:13:10 -04:00
parent 8d19877ece
commit cc4efd1370
4 changed files with 4288 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@ -27,6 +27,8 @@ const X86_WHITELIST: &'static [&'static str] = &["avx\0", "avx2\0", "bmi\0", "bm
"ssse3\0", "tbm\0", "lzcnt\0", "popcnt\0", "ssse3\0", "tbm\0", "lzcnt\0", "popcnt\0",
"sse4a\0", "rdrnd\0", "rdseed\0", "fma\0"]; "sse4a\0", "rdrnd\0", "rdseed\0", "fma\0"];
const HEXAGON_WHITELIST: &'static [&'static str] = &["hvx\0", "hvx-double\0"];
/// Add `target_feature = "..."` cfgs for a variety of platform /// Add `target_feature = "..."` cfgs for a variety of platform
/// specific features (SSE, NEON etc.). /// specific features (SSE, NEON etc.).
/// ///
@ -38,6 +40,7 @@ pub fn add_configuration(cfg: &mut ast::CrateConfig, sess: &Session) {
let whitelist = match &*sess.target.target.arch { let whitelist = match &*sess.target.target.arch {
"arm" => ARM_WHITELIST, "arm" => ARM_WHITELIST,
"x86" | "x86_64" => X86_WHITELIST, "x86" | "x86_64" => X86_WHITELIST,
"hexagon" => HEXAGON_WHITELIST,
_ => &[], _ => &[],
}; };

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,7 @@ pub enum Type {
Integer(/* signed */ bool, u8, /* llvm width */ u8), Integer(/* signed */ bool, u8, /* llvm width */ u8),
Float(u8), Float(u8),
Pointer(&'static Type, Option<&'static Type>, /* const */ bool), Pointer(&'static Type, Option<&'static Type>, /* const */ bool),
Vector(&'static Type, Option<&'static Type>, u8), Vector(&'static Type, Option<&'static Type>, u16),
Aggregate(bool, &'static [&'static Type]), Aggregate(bool, &'static [&'static Type]),
} }
@ -56,6 +56,12 @@ static I8x16: Type = Type::Vector(&I8, None, 16);
static U8x16: Type = Type::Vector(&U8, None, 16); static U8x16: Type = Type::Vector(&U8, None, 16);
static I8x32: Type = Type::Vector(&I8, None, 32); static I8x32: Type = Type::Vector(&I8, None, 32);
static U8x32: Type = Type::Vector(&U8, None, 32); static U8x32: Type = Type::Vector(&U8, None, 32);
static I8x64: Type = Type::Vector(&I8, None, 64);
static U8x64: Type = Type::Vector(&U8, None, 64);
static I8x128: Type = Type::Vector(&I8, None, 128);
static U8x128: Type = Type::Vector(&U8, None, 128);
static I8x256: Type = Type::Vector(&I8, None, 256);
static U8x256: Type = Type::Vector(&U8, None, 256);
static I16x4: Type = Type::Vector(&I16, None, 4); static I16x4: Type = Type::Vector(&I16, None, 4);
static U16x4: Type = Type::Vector(&U16, None, 4); static U16x4: Type = Type::Vector(&U16, None, 4);
@ -63,6 +69,12 @@ static I16x8: Type = Type::Vector(&I16, None, 8);
static U16x8: Type = Type::Vector(&U16, None, 8); static U16x8: Type = Type::Vector(&U16, None, 8);
static I16x16: Type = Type::Vector(&I16, None, 16); static I16x16: Type = Type::Vector(&I16, None, 16);
static U16x16: Type = Type::Vector(&U16, None, 16); static U16x16: Type = Type::Vector(&U16, None, 16);
static I16x32: Type = Type::Vector(&I16, None, 32);
static U16x32: Type = Type::Vector(&U16, None, 32);
static I16x64: Type = Type::Vector(&I16, None, 64);
static U16x64: Type = Type::Vector(&U16, None, 64);
static I16x128: Type = Type::Vector(&I16, None, 128);
static U16x128: Type = Type::Vector(&U16, None, 128);
static I32x2: Type = Type::Vector(&I32, None, 2); static I32x2: Type = Type::Vector(&I32, None, 2);
static U32x2: Type = Type::Vector(&U32, None, 2); static U32x2: Type = Type::Vector(&U32, None, 2);
@ -70,6 +82,12 @@ static I32x4: Type = Type::Vector(&I32, None, 4);
static U32x4: Type = Type::Vector(&U32, None, 4); static U32x4: Type = Type::Vector(&U32, None, 4);
static I32x8: Type = Type::Vector(&I32, None, 8); static I32x8: Type = Type::Vector(&I32, None, 8);
static U32x8: Type = Type::Vector(&U32, None, 8); static U32x8: Type = Type::Vector(&U32, None, 8);
static I32x16: Type = Type::Vector(&I32, None, 16);
static U32x16: Type = Type::Vector(&U32, None, 16);
static I32x32: Type = Type::Vector(&I32, None, 32);
static U32x32: Type = Type::Vector(&U32, None, 32);
static I32x64: Type = Type::Vector(&I32, None, 64);
static U32x64: Type = Type::Vector(&U32, None, 64);
static I64x1: Type = Type::Vector(&I64, None, 1); static I64x1: Type = Type::Vector(&I64, None, 1);
static U64x1: Type = Type::Vector(&U64, None, 1); static U64x1: Type = Type::Vector(&U64, None, 1);
@ -96,6 +114,7 @@ mod x86;
mod arm; mod arm;
mod aarch64; mod aarch64;
mod nvptx; mod nvptx;
mod hexagon;
impl Intrinsic { impl Intrinsic {
pub fn find(name: &str) -> Option<Intrinsic> { pub fn find(name: &str) -> Option<Intrinsic> {
@ -107,6 +126,8 @@ impl Intrinsic {
aarch64::find(name) aarch64::find(name)
} else if name.starts_with("nvptx_") { } else if name.starts_with("nvptx_") {
nvptx::find(name) nvptx::find(name)
} else if name.starts_with("Q6_") {
hexagon::find(name)
} else { } else {
None None
} }