about summary refs log tree commit diff
path: root/tests/assembly/asm
diff options
context:
space:
mode:
authorEzra Shaw <ezrasure@outlook.com>2023-04-22 16:55:59 +1200
committerEzra Shaw <ezrasure@outlook.com>2023-04-23 19:28:50 +1200
commitd31e8a499bdab8b70295580c288e5aa8d7f080dc (patch)
tree345b3bb18895f9a5713ed284fe4a9e61f5c9f3c2 /tests/assembly/asm
parentc7815840793b980d0aae7d5a2f5d9bb1fd6c0d1e (diff)
downloadrust-d31e8a499bdab8b70295580c288e5aa8d7f080dc.tar.gz
rust-d31e8a499bdab8b70295580c288e5aa8d7f080dc.zip
allow array-style simd in inline asm
Diffstat (limited to 'tests/assembly/asm')
-rw-r--r--tests/assembly/asm/inline-asm-avx.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/assembly/asm/inline-asm-avx.rs b/tests/assembly/asm/inline-asm-avx.rs
new file mode 100644
index 00000000000..c2875f3e0a4
--- /dev/null
+++ b/tests/assembly/asm/inline-asm-avx.rs
@@ -0,0 +1,25 @@
+// assembly-output: emit-asm
+// compile-flags: --crate-type=lib
+// only-x86_64
+// ignore-sgx
+
+#![feature(portable_simd)]
+
+use std::simd::Simd;
+use std::arch::asm;
+
+#[target_feature(enable = "avx")]
+#[no_mangle]
+// CHECK-LABEL: convert:
+pub unsafe fn convert(a: *const f32) -> Simd<f32, 8> {
+    // CHECK: vbroadcastss (%{{[er][a-ds0-9][xpi0-9]?}}), {{%ymm[0-7]}}
+    let b: Simd<f32, 8>;
+    unsafe {
+        asm!(
+            "vbroadcastss {b}, [{a}]",
+            a = in(reg) a,
+            b = out(ymm_reg) b,
+        );
+    }
+    b
+}