1 // assembly-output: emit-asm
3 // compile-flags: --target armv7-unknown-linux-gnueabihf
4 // compile-flags: -C target-feature=+neon
5 // needs-llvm-components: arm
7 #![feature(no_core, lang_items, rustc_attrs, repr_simd)]
8 #![crate_type = "rlib"]
10 #![allow(asm_sub_register, non_camel_case_types)]
12 #[rustc_builtin_macro]
16 #[rustc_builtin_macro]
20 #[rustc_builtin_macro]
21 macro_rules! stringify {
31 pub struct f32x4(f32, f32, f32, f32);
36 impl Copy for f32x4 {}
39 ($func:ident $modifier:literal $reg:ident $ty:ident $mov:literal) => {
40 // -O and extern "C" guarantee that the selected register is always r0/s0/d0/q0
42 pub unsafe extern "C" fn $func() -> $ty {
43 // Hack to avoid function merging
45 fn dont_merge(s: &str);
47 dont_merge(stringify!($func));
50 asm!(concat!($mov, " {0:", $modifier, "}, {0:", $modifier, "}"), out($reg) y);
60 check!(reg "" reg i32 "mov");
64 // CHECK: vmov.f32 s0, s0
66 check!(sreg "" sreg f32 "vmov.f32");
68 // CHECK-LABEL: sreg_low16:
70 // CHECK: vmov.f32 s0, s0
72 check!(sreg_low16 "" sreg_low16 f32 "vmov.f32");
76 // CHECK: vmov.f64 d0, d0
78 check!(dreg "" dreg f64 "vmov.f64");
80 // CHECK-LABEL: dreg_low16:
82 // CHECK: vmov.f64 d0, d0
84 check!(dreg_low16 "" dreg_low16 f64 "vmov.f64");
86 // CHECK-LABEL: dreg_low8:
88 // CHECK: vmov.f64 d0, d0
90 check!(dreg_low8 "" dreg_low8 f64 "vmov.f64");
94 // CHECK: vorr q0, q0, q0
96 check!(qreg "" qreg f32x4 "vmov");
98 // CHECK-LABEL: qreg_e:
100 // CHECK: vmov.f64 d0, d0
102 check!(qreg_e "e" qreg f32x4 "vmov.f64");
104 // CHECK-LABEL: qreg_f:
106 // CHECK: vmov.f64 d1, d1
108 check!(qreg_f "f" qreg f32x4 "vmov.f64");
110 // CHECK-LABEL: qreg_low8:
112 // CHECK: vorr q0, q0, q0
114 check!(qreg_low8 "" qreg_low8 f32x4 "vmov");
116 // CHECK-LABEL: qreg_low8_e:
118 // CHECK: vmov.f64 d0, d0
120 check!(qreg_low8_e "e" qreg_low8 f32x4 "vmov.f64");
122 // CHECK-LABEL: qreg_low8_f:
124 // CHECK: vmov.f64 d1, d1
126 check!(qreg_low8_f "f" qreg_low8 f32x4 "vmov.f64");
128 // CHECK-LABEL: qreg_low4:
130 // CHECK: vorr q0, q0, q0
132 check!(qreg_low4 "" qreg_low4 f32x4 "vmov");
134 // CHECK-LABEL: qreg_low4_e:
136 // CHECK: vmov.f64 d0, d0
138 check!(qreg_low4_e "e" qreg_low4 f32x4 "vmov.f64");
140 // CHECK-LABEL: qreg_low4_f:
142 // CHECK: vmov.f64 d1, d1
144 check!(qreg_low4_f "f" qreg_low4 f32x4 "vmov.f64");