1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 use {Intrinsic, i, f, v};
12 use rustc::middle::ty;
15 ($name: expr, ($($inputs: tt),*) -> $output: tt) => {
16 plain!(concat!("llvm.aarch64.neon.", $name), ($($inputs),*) -> $output)
19 pub fn find<'tcx>(_tcx: &ty::ctxt<'tcx>, name: &str) -> Option<Intrinsic> {
21 "vmaxvq_u8" => p!("umaxv.i8.v16i8", (i8x16) -> i8),
22 "vmaxvq_u16" => p!("umaxv.i16.v8i16", (i16x8) -> i16),
23 "vmaxvq_u32" => p!("umaxv.i32.v4i32", (i32x4) -> i32),
25 "vmaxvq_s8" => p!("smaxv.i8.v16i8", (i8x16) -> i8),
26 "vmaxvq_s16" => p!("smaxv.i16.v8i16", (i16x8) -> i16),
27 "vmaxvq_s32" => p!("smaxv.i32.v4i32", (i32x4) -> i32),
29 "vminvq_u8" => p!("uminv.i8.v16i8", (i8x16) -> i8),
30 "vminvq_u16" => p!("uminv.i16.v8i16", (i16x8) -> i16),
31 "vminvq_u32" => p!("uminv.i32.v4i32", (i32x4) -> i32),
32 "vminvq_s8" => p!("sminv.i8.v16i8", (i8x16) -> i8),
33 "vminvq_s16" => p!("sminv.i16.v8i16", (i16x8) -> i16),
34 "vminvq_s32" => p!("sminv.i32.v4i32", (i32x4) -> i32),
36 "vsqrtq_f32" => plain!("llvm.sqrt.v4f32", (f32x4) -> f32x4),
37 "vsqrtq_f64" => plain!("llvm.sqrt.v2f64", (f64x2) -> f64x2),
39 "vrsqrteq_f32" => p!("vrsqrte.v4f32", (f32x4) -> f32x4),
40 "vrsqrteq_f64" => p!("vrsqrte.v2f64", (f64x2) -> f64x2),
41 "vrecpeq_f32" => p!("vrecpe.v4f32", (f32x4) -> f32x4),
42 "vrecpeq_f64" => p!("vrecpe.v2f64", (f64x2) -> f64x2),
44 "vmaxq_f32" => p!("fmax.v4f32", (f32x4, f32x4) -> f32x4),
45 "vmaxq_f64" => p!("fmax.v2f64", (f64x2, f64x2) -> f64x2),
47 "vminq_f32" => p!("fmin.v4f32", (f32x4, f32x4) -> f32x4),
48 "vminq_f64" => p!("fmin.v2f64", (f64x2, f64x2) -> f64x2),