Commit | Line | Data |
---|---|---|
f6bb7db3 YQ |
1 | /* This testcase is part of GDB, the GNU debugger. |
2 | ||
618f726f | 3 | Copyright 2015-2016 Free Software Foundation, Inc. |
f6bb7db3 YQ |
4 | |
5 | This program is free software; you can redistribute it and/or modify | |
6 | it under the terms of the GNU General Public License as published by | |
7 | the Free Software Foundation; either version 3 of the License, or | |
8 | (at your option) any later version. | |
9 | ||
10 | This program is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | GNU General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU General Public License | |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
17 | ||
18 | #include <arm_neon.h> | |
19 | ||
20 | static void | |
21 | load (void) | |
22 | { | |
23 | int buf[8]; | |
24 | ||
25 | asm ("ld1 { v1.8b }, [%[buf]]\n" | |
26 | "ld1 { v2.8b, v3.8b }, [%[buf]]\n" | |
27 | "ld1 { v3.8b, v4.8b, v5.8b }, [%[buf]]\n" | |
28 | : | |
29 | : [buf] "r" (buf) | |
30 | : /* No clobbers */); | |
31 | } | |
32 | ||
33 | static void | |
34 | move (void) | |
35 | { | |
36 | float32x2_t b1_ = vdup_n_f32(123.0f); | |
37 | float32_t a1_ = 0; | |
38 | float64x1_t b2_ = vdup_n_f64(456.0f); | |
39 | float64_t a2_ = 0; | |
40 | ||
41 | asm ("ins %0.s[0], %w1\n" | |
42 | : "=w"(b1_) | |
43 | : "r"(a1_), "0"(b1_) | |
44 | : /* No clobbers */); | |
45 | ||
46 | asm ("ins %0.d[1], %x1\n" | |
47 | : "=w"(b2_) | |
48 | : "r"(a2_), "0"(b2_) | |
49 | : /* No clobbers */); | |
50 | } | |
51 | ||
52 | static void | |
53 | adv_simd_mod_imm (void) | |
54 | { | |
55 | float32x2_t a1 = {2.0, 4.0}; | |
56 | ||
57 | asm ("bic %0.2s, #1\n" | |
58 | "bic %0.2s, #1, lsl #8\n" | |
59 | : "=w"(a1) | |
60 | : "0"(a1) | |
61 | : /* No clobbers */); | |
62 | } | |
63 | ||
64 | static void | |
65 | adv_simd_scalar_index (void) | |
66 | { | |
67 | float64x2_t b_ = {0.0, 0.0}; | |
68 | float64_t a_ = 1.0; | |
69 | float64_t result; | |
70 | ||
71 | asm ("fmla %d0,%d1,%2.d[1]" | |
72 | : "=w"(result) | |
73 | : "w"(a_), "w"(b_) | |
74 | : /* No clobbers */); | |
75 | } | |
76 | ||
77 | static void | |
78 | adv_simd_smlal (void) | |
79 | { | |
80 | asm ("smlal v13.2d, v8.2s, v0.2s"); | |
81 | } | |
82 | ||
83 | static void | |
84 | adv_simd_vect_shift (void) | |
85 | { | |
86 | asm ("fcvtzs s0, s0, #1"); | |
87 | } | |
88 | ||
89 | int | |
90 | main () | |
91 | { | |
92 | load (); | |
93 | move (); | |
94 | adv_simd_mod_imm (); | |
95 | adv_simd_scalar_index (); | |
96 | adv_simd_smlal (); | |
97 | adv_simd_vect_shift (); | |
98 | return 0; | |
99 | } |