]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/simd-intrinsic-float-pow.rs
Enable emission of alignment attrs for pointer params
[rust.git] / src / test / codegen / simd-intrinsic-float-pow.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.
4 //
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.
10
11 // ignore-emscripten
12
13 // compile-flags: -C no-prepopulate-passes
14
15 #![crate_type = "lib"]
16
17 #![feature(repr_simd, platform_intrinsics)]
18 #![allow(non_camel_case_types)]
19
20 #[repr(simd)]
21 #[derive(Copy, Clone, PartialEq, Debug)]
22 pub struct f32x2(pub f32, pub f32);
23
24 #[repr(simd)]
25 #[derive(Copy, Clone, PartialEq, Debug)]
26 pub struct f32x4(pub f32, pub f32, pub f32, pub f32);
27
28 #[repr(simd)]
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);
32
33 #[repr(simd)]
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);
39
40 extern "platform-intrinsic" {
41     fn simd_fpow<T>(x: T, b: T) -> T;
42 }
43
44 // CHECK-LABEL: @fpow_32x2
45 #[no_mangle]
46 pub unsafe fn fpow_32x2(a: f32x2, b: f32x2) -> f32x2 {
47     // CHECK: call fast <2 x float> @llvm.pow.v2f32
48     simd_fpow(a, b)
49 }
50
51 // CHECK-LABEL: @fpow_32x4
52 #[no_mangle]
53 pub unsafe fn fpow_32x4(a: f32x4, b: f32x4) -> f32x4 {
54     // CHECK: call fast <4 x float> @llvm.pow.v4f32
55     simd_fpow(a, b)
56 }
57
58 // CHECK-LABEL: @fpow_32x8
59 #[no_mangle]
60 pub unsafe fn fpow_32x8(a: f32x8, b: f32x8) -> f32x8 {
61     // CHECK: call fast <8 x float> @llvm.pow.v8f32
62     simd_fpow(a, b)
63 }
64
65 // CHECK-LABEL: @fpow_32x16
66 #[no_mangle]
67 pub unsafe fn fpow_32x16(a: f32x16, b: f32x16) -> f32x16 {
68     // CHECK: call fast <16 x float> @llvm.pow.v16f32
69     simd_fpow(a, b)
70 }
71
72 #[repr(simd)]
73 #[derive(Copy, Clone, PartialEq, Debug)]
74 pub struct f64x2(pub f64, pub f64);
75
76 #[repr(simd)]
77 #[derive(Copy, Clone, PartialEq, Debug)]
78 pub struct f64x4(pub f64, pub f64, pub f64, pub f64);
79
80 #[repr(simd)]
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);
84
85 // CHECK-LABEL: @fpow_64x4
86 #[no_mangle]
87 pub unsafe fn fpow_64x4(a: f64x4, b: f64x4) -> f64x4 {
88     // CHECK: call fast <4 x double> @llvm.pow.v4f64
89     simd_fpow(a, b)
90 }
91
92 // CHECK-LABEL: @fpow_64x2
93 #[no_mangle]
94 pub unsafe fn fpow_64x2(a: f64x2, b: f64x2) -> f64x2 {
95     // CHECK: call fast <2 x double> @llvm.pow.v2f64
96     simd_fpow(a, b)
97 }
98
99 // CHECK-LABEL: @fpow_64x8
100 #[no_mangle]
101 pub unsafe fn fpow_64x8(a: f64x8, b: f64x8) -> f64x8 {
102     // CHECK: call fast <8 x double> @llvm.pow.v8f64
103     simd_fpow(a, b)
104 }