1
From cb6ed0796cea25b7c9613dd559c70432db653b27 Mon Sep 17 00:00:00 2001
2
From: Peter Maydell <peter.maydell@linaro.org>
3
Date: Mon, 23 Dec 2013 23:27:30 +0000
4
Subject: [PATCH 059/158] target-arm: A64: Add decoder skeleton for FP
7
Add a top level decoder skeleton for FP instructions.
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Richard Henderson <rth@twiddle.net>
12
target-arm/translate-a64.c | 170 ++++++++++++++++++++++++++++++++++++++++++++-
13
1 file changed, 169 insertions(+), 1 deletion(-)
15
diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c
16
index 9ca6460..079c2f7 100644
17
--- a/target-arm/translate-a64.c
18
+++ b/target-arm/translate-a64.c
19
@@ -2670,10 +2670,178 @@ static void disas_data_proc_reg(DisasContext *s, uint32_t insn)
23
+/* C3.6.22 Floating point compare
24
+ * 31 30 29 28 24 23 22 21 20 16 15 14 13 10 9 5 4 0
25
+ * +---+---+---+-----------+------+---+------+-----+---------+------+-------+
26
+ * | M | 0 | S | 1 1 1 1 0 | type | 1 | Rm | op | 1 0 0 0 | Rn | op2 |
27
+ * +---+---+---+-----------+------+---+------+-----+---------+------+-------+
29
+static void disas_fp_compare(DisasContext *s, uint32_t insn)
31
+ unsupported_encoding(s, insn);
34
+/* C3.6.23 Floating point conditional compare
35
+ * 31 30 29 28 24 23 22 21 20 16 15 12 11 10 9 5 4 3 0
36
+ * +---+---+---+-----------+------+---+------+------+-----+------+----+------+
37
+ * | M | 0 | S | 1 1 1 1 0 | type | 1 | Rm | cond | 0 1 | Rn | op | nzcv |
38
+ * +---+---+---+-----------+------+---+------+------+-----+------+----+------+
40
+static void disas_fp_ccomp(DisasContext *s, uint32_t insn)
42
+ unsupported_encoding(s, insn);
45
+/* C3.6.24 Floating point conditional select
46
+ * 31 30 29 28 24 23 22 21 20 16 15 12 11 10 9 5 4 0
47
+ * +---+---+---+-----------+------+---+------+------+-----+------+------+
48
+ * | M | 0 | S | 1 1 1 1 0 | type | 1 | Rm | cond | 1 1 | Rn | Rd |
49
+ * +---+---+---+-----------+------+---+------+------+-----+------+------+
51
+static void disas_fp_csel(DisasContext *s, uint32_t insn)
53
+ unsupported_encoding(s, insn);
56
+/* C3.6.25 Floating point data-processing (1 source)
57
+ * 31 30 29 28 24 23 22 21 20 15 14 10 9 5 4 0
58
+ * +---+---+---+-----------+------+---+--------+-----------+------+------+
59
+ * | M | 0 | S | 1 1 1 1 0 | type | 1 | opcode | 1 0 0 0 0 | Rn | Rd |
60
+ * +---+---+---+-----------+------+---+--------+-----------+------+------+
62
+static void disas_fp_1src(DisasContext *s, uint32_t insn)
64
+ unsupported_encoding(s, insn);
67
+/* C3.6.26 Floating point data-processing (2 source)
68
+ * 31 30 29 28 24 23 22 21 20 16 15 12 11 10 9 5 4 0
69
+ * +---+---+---+-----------+------+---+------+--------+-----+------+------+
70
+ * | M | 0 | S | 1 1 1 1 0 | type | 1 | Rm | opcode | 1 0 | Rn | Rd |
71
+ * +---+---+---+-----------+------+---+------+--------+-----+------+------+
73
+static void disas_fp_2src(DisasContext *s, uint32_t insn)
75
+ unsupported_encoding(s, insn);
78
+/* C3.6.27 Floating point data-processing (3 source)
79
+ * 31 30 29 28 24 23 22 21 20 16 15 14 10 9 5 4 0
80
+ * +---+---+---+-----------+------+----+------+----+------+------+------+
81
+ * | M | 0 | S | 1 1 1 1 1 | type | o1 | Rm | o0 | Ra | Rn | Rd |
82
+ * +---+---+---+-----------+------+----+------+----+------+------+------+
84
+static void disas_fp_3src(DisasContext *s, uint32_t insn)
86
+ unsupported_encoding(s, insn);
89
+/* C3.6.28 Floating point immediate
90
+ * 31 30 29 28 24 23 22 21 20 13 12 10 9 5 4 0
91
+ * +---+---+---+-----------+------+---+------------+-------+------+------+
92
+ * | M | 0 | S | 1 1 1 1 0 | type | 1 | imm8 | 1 0 0 | imm5 | Rd |
93
+ * +---+---+---+-----------+------+---+------------+-------+------+------+
95
+static void disas_fp_imm(DisasContext *s, uint32_t insn)
97
+ unsupported_encoding(s, insn);
100
+/* C3.6.29 Floating point <-> fixed point conversions
101
+ * 31 30 29 28 24 23 22 21 20 19 18 16 15 10 9 5 4 0
102
+ * +----+---+---+-----------+------+---+-------+--------+-------+------+------+
103
+ * | sf | 0 | S | 1 1 1 1 0 | type | 0 | rmode | opcode | scale | Rn | Rd |
104
+ * +----+---+---+-----------+------+---+-------+--------+-------+------+------+
106
+static void disas_fp_fixed_conv(DisasContext *s, uint32_t insn)
108
+ unsupported_encoding(s, insn);
111
+/* C3.6.30 Floating point <-> integer conversions
112
+ * 31 30 29 28 24 23 22 21 20 19 18 16 15 10 9 5 4 0
113
+ * +----+---+---+-----------+------+---+-------+-----+-------------+----+----+
114
+ * | sf | 0 | S | 1 1 1 1 0 | type | 0 | rmode | opc | 0 0 0 0 0 0 | Rn | Rd |
115
+ * +----+---+---+-----------+------+---+-------+-----+-------------+----+----+
117
+static void disas_fp_int_conv(DisasContext *s, uint32_t insn)
119
+ unsupported_encoding(s, insn);
122
+/* FP-specific subcases of table C3-6 (SIMD and FP data processing)
123
+ * 31 30 29 28 25 24 0
124
+ * +---+---+---+---------+-----------------------------+
125
+ * | | 0 | | 1 1 1 1 | |
126
+ * +---+---+---+---------+-----------------------------+
128
+static void disas_data_proc_fp(DisasContext *s, uint32_t insn)
130
+ if (extract32(insn, 24, 1)) {
131
+ /* Floating point data-processing (3 source) */
132
+ disas_fp_3src(s, insn);
133
+ } else if (extract32(insn, 21, 1) == 0) {
134
+ /* Floating point to fixed point conversions */
135
+ disas_fp_fixed_conv(s, insn);
137
+ switch (extract32(insn, 10, 2)) {
139
+ /* Floating point conditional compare */
140
+ disas_fp_ccomp(s, insn);
143
+ /* Floating point data-processing (2 source) */
144
+ disas_fp_2src(s, insn);
147
+ /* Floating point conditional select */
148
+ disas_fp_csel(s, insn);
151
+ switch (ctz32(extract32(insn, 12, 4))) {
152
+ case 0: /* [15:12] == xxx1 */
153
+ /* Floating point immediate */
154
+ disas_fp_imm(s, insn);
156
+ case 1: /* [15:12] == xx10 */
157
+ /* Floating point compare */
158
+ disas_fp_compare(s, insn);
160
+ case 2: /* [15:12] == x100 */
161
+ /* Floating point data-processing (1 source) */
162
+ disas_fp_1src(s, insn);
164
+ case 3: /* [15:12] == 1000 */
165
+ unallocated_encoding(s);
167
+ default: /* [15:12] == 0000 */
168
+ /* Floating point <-> integer conversions */
169
+ disas_fp_int_conv(s, insn);
177
+static void disas_data_proc_simd(DisasContext *s, uint32_t insn)
179
+ /* Note that this is called with all non-FP cases from
180
+ * table C3-6 so it must UNDEF for entries not specifically
181
+ * allocated to instructions in that table.
183
+ unsupported_encoding(s, insn);
186
/* C3.6 Data processing - SIMD and floating point */
187
static void disas_data_proc_simd_fp(DisasContext *s, uint32_t insn)
189
- unsupported_encoding(s, insn);
190
+ if (extract32(insn, 28, 1) == 1 && extract32(insn, 30, 1) == 0) {
191
+ disas_data_proc_fp(s, insn);
193
+ /* SIMD, including crypto */
194
+ disas_data_proc_simd(s, insn);
198
/* C3.1 A64 instruction index by encoding */