]>
git.proxmox.com Git - rustc.git/blob - src/test/codegen/simd-intrinsic-float-exp2.rs
1 // Copyright 2016 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.
13 // compile-flags: -C no-prepopulate-passes
15 #![crate_type = "lib"]
17 #![feature(repr_simd, platform_intrinsics)]
18 #![allow(non_camel_case_types)]
21 #[derive(Copy, Clone, PartialEq, Debug)]
22 pub struct f32x2(pub f32, pub f32);
25 #[derive(Copy, Clone, PartialEq, Debug)]
26 pub struct f32x4(pub f32, pub f32, pub f32, pub f32);
29 #[derive(Copy, Clone, PartialEq, Debug)]
30 pub struct f32x8(pub f32, pub f32, pub f32, pub f32,
31 pub f32, pub f32, pub f32, pub f32);
34 #[derive(Copy, Clone, PartialEq, Debug)]
35 pub struct f32x16(pub f32, pub f32, pub f32, pub f32,
36 pub f32, pub f32, pub f32, pub f32,
37 pub f32, pub f32, pub f32, pub f32,
38 pub f32, pub f32, pub f32, pub f32);
40 extern "platform-intrinsic" {
41 fn simd_fexp2
<T
>(x
: T
) -> T
;
44 // CHECK-LABEL: @exp2_32x2
46 pub unsafe fn exp2_32x2(a
: f32x2
) -> f32x2
{
47 // CHECK: call fast <2 x float> @llvm.exp2.v2f32
51 // CHECK-LABEL: @exp2_32x4
53 pub unsafe fn exp2_32x4(a
: f32x4
) -> f32x4
{
54 // CHECK: call fast <4 x float> @llvm.exp2.v4f32
58 // CHECK-LABEL: @exp2_32x8
60 pub unsafe fn exp2_32x8(a
: f32x8
) -> f32x8
{
61 // CHECK: call fast <8 x float> @llvm.exp2.v8f32
65 // CHECK-LABEL: @exp2_32x16
67 pub unsafe fn exp2_32x16(a
: f32x16
) -> f32x16
{
68 // CHECK: call fast <16 x float> @llvm.exp2.v16f32
73 #[derive(Copy, Clone, PartialEq, Debug)]
74 pub struct f64x2(pub f64, pub f64);
77 #[derive(Copy, Clone, PartialEq, Debug)]
78 pub struct f64x4(pub f64, pub f64, pub f64, pub f64);
81 #[derive(Copy, Clone, PartialEq, Debug)]
82 pub struct f64x8(pub f64, pub f64, pub f64, pub f64,
83 pub f64, pub f64, pub f64, pub f64);
85 // CHECK-LABEL: @exp2_64x4
87 pub unsafe fn exp2_64x4(a
: f64x4
) -> f64x4
{
88 // CHECK: call fast <4 x double> @llvm.exp2.v4f64
92 // CHECK-LABEL: @exp2_64x2
94 pub unsafe fn exp2_64x2(a
: f64x2
) -> f64x2
{
95 // CHECK: call fast <2 x double> @llvm.exp2.v2f64
99 // CHECK-LABEL: @exp2_64x8
101 pub unsafe fn exp2_64x8(a
: f64x8
) -> f64x8
{
102 // CHECK: call fast <8 x double> @llvm.exp2.v8f64