Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.reverse / insn-reverse-aarch64.c
1 /* This testcase is part of GDB, the GNU debugger.
2
3 Copyright 2015-2022 Free Software Foundation, Inc.
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 /* Initialize arch-specific bits. */
90
91 static void initialize (void)
92 {
93 /* AArch64 doesn't currently use this function. */
94 }
95
96 /* Functions testing instruction decodings. GDB will test all of these. */
97 static testcase_ftype testcases[] =
98 {
99 load,
100 move,
101 adv_simd_mod_imm,
102 adv_simd_scalar_index,
103 adv_simd_smlal,
104 adv_simd_vect_shift,
105 };
This page took 0.032539 seconds and 4 git commands to generate.