@@ -0,0 +1,33 @@ |
|
|
|
1 |
+// only-x86_64 |
|
2 |
+// compile-flags: -Copt-level=3 |
|
3 |
+ |
|
4 |
+#![crate_type = "lib"] |
|
5 |
+#![feature(target_feature_11)] |
|
6 |
+ |
|
7 |
+#[cfg(target_arch = "x86_64")] |
|
8 |
+use std::arch::x86_64::*; |
|
9 |
+ |
|
10 |
+// CHECK-LABEL: @with_avx |
|
11 |
+#[no_mangle] |
|
12 |
+#[cfg(target_arch = "x86_64")] |
|
13 |
+#[target_feature(enable = "avx")] |
|
14 |
+fn with_avx(x: __m256) -> __m256 { |
|
15 |
+// CHECK: fadd |
|
16 |
+let add = { |
|
17 |
+#[inline(always)] |
|
18 |
+ |x, y |
|
19 |
+}; |
|
20 |
+add(x, x) |
|
21 |
+} |
|
22 |
+ |
|
23 |
+// CHECK-LABEL: @without_avx |
|
24 |
+#[no_mangle] |
|
25 |
+#[cfg(target_arch = "x86_64")] |
|
26 |
+unsafe fn without_avx(x: __m256) -> __m256 { |
|
27 |
+// CHECK-NOT: fadd |
|
28 |
+let add = { |
|
29 |
+#[inline(always)] |
|
30 |
+ |x, y |
|
31 |
+}; |
|
32 |
+add(x, x) |
|
33 |
+} |