1
The following changes since commit 36e9aab3c569d4c9ad780473596e18479838d1aa:
1
The following changes since commit a5ba0a7e4e150d1350a041f0d0ef9ca6c8d7c307:
2
2
3
migration: Move return path cleanup to main migration thread (2023-09-27 13:58:02 -0400)
3
Merge tag 'pull-aspeed-20241211' of https://github.com/legoater/qemu into staging (2024-12-11 15:16:47 +0000)
4
4
5
are available in the Git repository at:
5
are available in the Git repository at:
6
6
7
https://github.com/quic/qemu tags/pull-hex-20231003
7
https://github.com/quic/qemu tags/pull-hex-20241212
8
8
9
for you to fetch changes up to 53cdd26f1909fc45ad50a5eaa95dcfff06130e5f:
9
for you to fetch changes up to b29b11b51f1ac1884a64c5b6bde969a46206263f:
10
10
11
target/hexagon: fix some occurrences of -Wshadow=local (2023-10-03 17:02:29 -0700)
11
target/hexagon: Make HVX vector args. restrict * (2024-12-12 21:43:57 -0600)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
Hexagon GETPC() and -Wshadow fixes
14
Remove HEX_DEBUG, EXCP/CAUSE fixes
15
15
16
----------------------------------------------------------------
16
----------------------------------------------------------------
17
Brian Cain (1):
17
Anton Johansson (2):
18
target/hexagon: fix some occurrences of -Wshadow=local
18
target/hexagon: Use argparse in all python scripts
19
target/hexagon: Make HVX vector args. restrict *
19
20
20
Matheus Tavares Bernardino (1):
21
Brian Cain (2):
21
target/hexagon: move GETPC() calls to top level helpers
22
target/hexagon: rename HEX_EXCP_*=>HEX_CAUSE_*
23
target/hexagon: add enums for event, cause
22
24
23
target/hexagon/imported/alu.idef | 6 +--
25
Taylor Simpson (1):
24
target/hexagon/macros.h | 19 +++++----
26
Hexagon (target/hexagon) Remove HEX_DEBUG/HEX_DEBUG_LOG
25
target/hexagon/mmvec/macros.h | 2 +-
27
26
target/hexagon/op_helper.c | 84 +++++++++++++++-------------------------
28
linux-user/hexagon/cpu_loop.c | 4 +-
27
target/hexagon/op_helper.h | 9 -----
29
target/hexagon/README | 9 ---
28
target/hexagon/translate.c | 10 ++---
30
target/hexagon/cpu.h | 8 +--
29
6 files changed, 50 insertions(+), 80 deletions(-)
31
target/hexagon/cpu_bits.h | 21 ++++--
32
target/hexagon/gen_analyze_funcs.py | 6 +-
33
target/hexagon/gen_decodetree.py | 19 ++++--
34
target/hexagon/gen_helper_funcs.py | 7 +-
35
target/hexagon/gen_helper_protos.py | 7 +-
36
target/hexagon/gen_idef_parser_funcs.py | 11 +++-
37
target/hexagon/gen_op_attribs.py | 11 +++-
38
target/hexagon/gen_opcodes_def.py | 11 +++-
39
target/hexagon/gen_printinsn.py | 11 +++-
40
target/hexagon/gen_tcg.h | 2 +-
41
target/hexagon/gen_tcg_func_table.py | 11 +++-
42
target/hexagon/gen_tcg_funcs.py | 9 +--
43
target/hexagon/gen_trans_funcs.py | 18 ++++-
44
target/hexagon/genptr.c | 7 --
45
target/hexagon/helper.h | 3 -
46
target/hexagon/hex_common.py | 33 +++++-----
47
target/hexagon/internal.h | 11 ----
48
target/hexagon/meson.build | 2 +-
49
target/hexagon/mmvec/macros.h | 36 +++++-----
50
target/hexagon/op_helper.c | 112 --------------------------------
51
target/hexagon/translate.c | 72 +-------------------
52
target/hexagon/translate.h | 2 -
53
25 files changed, 148 insertions(+), 295 deletions(-)
diff view generated by jsdifflib
1
Of the changes in this commit, the changes in `HELPER(commit_hvx_stores)()`
1
From: Taylor Simpson <ltaylorsimpson@gmail.com>
2
are less obvious. They are required because of some macro invocations like
3
SCATTER_OP_WRITE_TO_MEM().
4
2
5
e.g.:
3
All Hexagon debugging is now done with QEMU mechanisms
4
(e.g., -d in_asm) or with a connected debugger (lldb).
6
5
7
In file included from ../target/hexagon/op_helper.c:31:
6
Signed-off-by: Taylor Simpson <ltaylorsimpson@gmail.com>
8
../target/hexagon/mmvec/macros.h:205:18: error: declaration of ‘i’ shadows a previous local [-Werror=shadow=compatible-local]
7
Reviewed-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
9
205 | for (int i = 0; i < sizeof(MMVector); i += sizeof(TYPE)) { \
8
Reviewed-by: Brian Cain <brian.cain@oss.qualcomm.com>
10
| ^
9
Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
11
../target/hexagon/op_helper.c:157:17: note: in expansion of macro ‘SCATTER_OP_WRITE_TO_MEM’
10
---
12
157 | SCATTER_OP_WRITE_TO_MEM(uint16_t);
11
target/hexagon/README | 9 ---
13
| ^~~~~~~~~~~~~~~~~~~~~~~
12
target/hexagon/cpu.h | 6 --
14
../target/hexagon/op_helper.c:135:9: note: shadowed declaration is here
13
target/hexagon/genptr.c | 7 ---
15
135 | int i;
14
target/hexagon/helper.h | 3 -
16
| ^
15
target/hexagon/internal.h | 11 ----
17
In file included from ../target/hexagon/op_helper.c:31:
16
target/hexagon/op_helper.c | 112 -------------------------------------
18
../target/hexagon/mmvec/macros.h:204:19: error: declaration of ‘ra’ shadows a previous local [-Werror=shadow=compatible-local]
17
target/hexagon/translate.c | 66 ----------------------
19
204 | uintptr_t ra = GETPC(); \
18
target/hexagon/translate.h | 2 -
20
| ^~
19
8 files changed, 216 deletions(-)
21
../target/hexagon/op_helper.c:160:17: note: in expansion of macro ‘SCATTER_OP_WRITE_TO_MEM’
22
160 | SCATTER_OP_WRITE_TO_MEM(uint32_t);
23
| ^~~~~~~~~~~~~~~~~~~~~~~
24
../target/hexagon/op_helper.c:134:15: note: shadowed declaration is here
25
134 | uintptr_t ra = GETPC();
26
| ^~
27
20
28
Reviewed-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
21
diff --git a/target/hexagon/README b/target/hexagon/README
29
Signed-off-by: Brian Cain <bcain@quicinc.com>
22
index XXXXXXX..XXXXXXX 100644
30
---
23
--- a/target/hexagon/README
31
target/hexagon/imported/alu.idef | 6 +++---
24
+++ b/target/hexagon/README
32
target/hexagon/mmvec/macros.h | 2 +-
25
@@ -XXX,XX +XXX,XX @@ For Hexagon Vector eXtensions (HVX), the following fields are used
33
target/hexagon/op_helper.c | 9 +++------
26
34
target/hexagon/translate.c | 10 +++++-----
27
*** Debugging ***
35
4 files changed, 12 insertions(+), 15 deletions(-)
28
36
29
-You can turn on a lot of debugging by changing the HEX_DEBUG macro to 1 in
37
diff --git a/target/hexagon/imported/alu.idef b/target/hexagon/imported/alu.idef
30
-internal.h. This will stream a lot of information as it generates TCG and
38
index XXXXXXX..XXXXXXX 100644
31
-executes the code.
39
--- a/target/hexagon/imported/alu.idef
32
-
40
+++ b/target/hexagon/imported/alu.idef
33
To track down nasty issues with Hexagon->TCG generation, we compare the
41
@@ -XXX,XX +XXX,XX @@ Q6INSN(A4_cround_rr,"Rd32=cround(Rs32,Rt32)",ATTRIBS(),"Convergent Round", {RdV
34
execution results with actual hardware running on a Hexagon Linux target.
42
tmp128 = fSHIFTR128(tmp128, SHIFT);\
35
Run qemu with the "-d cpu" option. Then, we can diff the results and figure
43
DST = fCAST16S_8S(tmp128);\
36
@@ -XXX,XX +XXX,XX @@ Here are some handy places to set breakpoints
44
} else {\
37
The helper function for each instruction is named helper_<TAG>, so here's
45
- size16s_t rndbit_128 = fCAST8S_16S((1LL << (SHIFT - 1))); \
38
an example that will set a breakpoint at the start
46
- size16s_t src_128 = fCAST8S_16S(SRC); \
39
br helper_A2_add
47
- size16s_t tmp128 = fADD128(src_128, rndbit_128);\
40
- If you have the HEX_DEBUG macro set, the following will be useful
48
+ rndbit_128 = fCAST8S_16S((1LL << (SHIFT - 1))); \
41
- At the start of execution of a packet for a given PC
49
+ src_128 = fCAST8S_16S(SRC); \
42
- br helper_debug_start_packet if env->gpr[41] == 0xdeadbeef
50
+ tmp128 = fADD128(src_128, rndbit_128);\
43
- At the end of execution of a packet for a given PC
51
tmp128 = fSHIFTR128(tmp128, SHIFT);\
44
- br helper_debug_commit_end if this_PC == 0xdeadbeef
52
DST = fCAST16S_8S(tmp128);\
45
diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h
53
}
46
index XXXXXXX..XXXXXXX 100644
54
diff --git a/target/hexagon/mmvec/macros.h b/target/hexagon/mmvec/macros.h
47
--- a/target/hexagon/cpu.h
55
index XXXXXXX..XXXXXXX 100644
48
+++ b/target/hexagon/cpu.h
56
--- a/target/hexagon/mmvec/macros.h
49
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
57
+++ b/target/hexagon/mmvec/macros.h
50
uint8_t slot_cancelled;
51
target_ulong new_value_usr;
52
53
- /*
54
- * Only used when HEX_DEBUG is on, but unconditionally included
55
- * to reduce recompile time when turning HEX_DEBUG on/off.
56
- */
57
- target_ulong reg_written[TOTAL_PER_THREAD_REGS];
58
-
59
MemLog mem_log_stores[STORES_MAX];
60
61
float_status fp_status;
62
diff --git a/target/hexagon/genptr.c b/target/hexagon/genptr.c
63
index XXXXXXX..XXXXXXX 100644
64
--- a/target/hexagon/genptr.c
65
+++ b/target/hexagon/genptr.c
66
@@ -XXX,XX +XXX,XX @@ void gen_log_reg_write(DisasContext *ctx, int rnum, TCGv val)
67
68
gen_masked_reg_write(val, hex_gpr[rnum], reg_mask);
69
tcg_gen_mov_tl(get_result_gpr(ctx, rnum), val);
70
- if (HEX_DEBUG) {
71
- /* Do this so HELPER(debug_commit_end) will know */
72
- tcg_gen_movi_tl(hex_reg_written[rnum], 1);
73
- }
74
}
75
76
static void gen_log_reg_write_pair(DisasContext *ctx, int rnum, TCGv_i64 val)
77
@@ -XXX,XX +XXX,XX @@ void gen_log_pred_write(DisasContext *ctx, int pnum, TCGv val)
78
} else {
79
tcg_gen_and_tl(pred, pred, base_val);
80
}
81
- if (HEX_DEBUG) {
82
- tcg_gen_ori_tl(ctx->pred_written, ctx->pred_written, 1 << pnum);
83
- }
84
set_bit(pnum, ctx->pregs_written);
85
}
86
87
diff --git a/target/hexagon/helper.h b/target/hexagon/helper.h
88
index XXXXXXX..XXXXXXX 100644
89
--- a/target/hexagon/helper.h
90
+++ b/target/hexagon/helper.h
58
@@ -XXX,XX +XXX,XX @@
91
@@ -XXX,XX +XXX,XX @@
59
} while (0)
92
#include "helper_protos_generated.h.inc"
60
#define SCATTER_OP_WRITE_TO_MEM(TYPE) \
93
61
do { \
94
DEF_HELPER_FLAGS_2(raise_exception, TCG_CALL_NO_RETURN, noreturn, env, i32)
62
- uintptr_t ra = GETPC(); \
95
-DEF_HELPER_1(debug_start_packet, void, env)
63
+ ra = GETPC(); \
96
-DEF_HELPER_FLAGS_3(debug_check_store_width, TCG_CALL_NO_WG, void, env, int, int)
64
for (int i = 0; i < sizeof(MMVector); i += sizeof(TYPE)) { \
97
-DEF_HELPER_FLAGS_5(debug_commit_end, TCG_CALL_NO_WG, void, env, i32, int, int, int)
65
if (test_bit(i, env->vtcm_log.mask)) { \
98
DEF_HELPER_2(commit_store, void, env, int)
66
TYPE dst = 0; \
99
DEF_HELPER_3(gather_store, void, env, i32, int)
100
DEF_HELPER_1(commit_hvx_stores, void, env)
101
diff --git a/target/hexagon/internal.h b/target/hexagon/internal.h
102
index XXXXXXX..XXXXXXX 100644
103
--- a/target/hexagon/internal.h
104
+++ b/target/hexagon/internal.h
105
@@ -XXX,XX +XXX,XX @@
106
107
#include "qemu/log.h"
108
109
-/*
110
- * Change HEX_DEBUG to 1 to turn on debugging output
111
- */
112
-#define HEX_DEBUG 0
113
-#define HEX_DEBUG_LOG(...) \
114
- do { \
115
- if (HEX_DEBUG) { \
116
- qemu_log(__VA_ARGS__); \
117
- } \
118
- } while (0)
119
-
120
int hexagon_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
121
int hexagon_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
122
int hexagon_hvx_gdb_read_register(CPUState *env, GByteArray *mem_buf, int n);
67
diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c
123
diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c
68
index XXXXXXX..XXXXXXX 100644
124
index XXXXXXX..XXXXXXX 100644
69
--- a/target/hexagon/op_helper.c
125
--- a/target/hexagon/op_helper.c
70
+++ b/target/hexagon/op_helper.c
126
+++ b/target/hexagon/op_helper.c
71
@@ -XXX,XX +XXX,XX @@ void HELPER(gather_store)(CPUHexagonState *env, uint32_t addr, int slot)
127
@@ -XXX,XX +XXX,XX @@ G_NORETURN void HELPER(raise_exception)(CPUHexagonState *env, uint32_t excp)
72
void HELPER(commit_hvx_stores)(CPUHexagonState *env)
128
void log_store32(CPUHexagonState *env, target_ulong addr,
73
{
129
target_ulong val, int width, int slot)
74
uintptr_t ra = GETPC();
130
{
131
- HEX_DEBUG_LOG("log_store%d(0x" TARGET_FMT_lx
132
- ", %" PRId32 " [0x08%" PRIx32 "])\n",
133
- width, addr, val, val);
134
env->mem_log_stores[slot].va = addr;
135
env->mem_log_stores[slot].width = width;
136
env->mem_log_stores[slot].data32 = val;
137
@@ -XXX,XX +XXX,XX @@ void log_store32(CPUHexagonState *env, target_ulong addr,
138
void log_store64(CPUHexagonState *env, target_ulong addr,
139
int64_t val, int width, int slot)
140
{
141
- HEX_DEBUG_LOG("log_store%d(0x" TARGET_FMT_lx
142
- ", %" PRId64 " [0x016%" PRIx64 "])\n",
143
- width, addr, val, val);
144
env->mem_log_stores[slot].va = addr;
145
env->mem_log_stores[slot].width = width;
146
env->mem_log_stores[slot].data64 = val;
147
}
148
149
-/* Handy place to set a breakpoint */
150
-void HELPER(debug_start_packet)(CPUHexagonState *env)
151
-{
152
- HEX_DEBUG_LOG("Start packet: pc = 0x" TARGET_FMT_lx "\n",
153
- env->gpr[HEX_REG_PC]);
154
-
155
- for (int i = 0; i < TOTAL_PER_THREAD_REGS; i++) {
156
- env->reg_written[i] = 0;
157
- }
158
-}
159
-
160
-/* Checks for bookkeeping errors between disassembly context and runtime */
161
-void HELPER(debug_check_store_width)(CPUHexagonState *env, int slot, int check)
162
-{
163
- if (env->mem_log_stores[slot].width != check) {
164
- HEX_DEBUG_LOG("ERROR: %d != %d\n",
165
- env->mem_log_stores[slot].width, check);
166
- g_assert_not_reached();
167
- }
168
-}
169
-
170
static void commit_store(CPUHexagonState *env, int slot_num, uintptr_t ra)
171
{
172
uint8_t width = env->mem_log_stores[slot_num].width;
173
@@ -XXX,XX +XXX,XX @@ void HELPER(commit_hvx_stores)(CPUHexagonState *env)
174
}
175
}
176
177
-static void print_store(CPUHexagonState *env, int slot)
178
-{
179
- if (!(env->slot_cancelled & (1 << slot))) {
180
- uint8_t width = env->mem_log_stores[slot].width;
181
- if (width == 1) {
182
- uint32_t data = env->mem_log_stores[slot].data32 & 0xff;
183
- HEX_DEBUG_LOG("\tmemb[0x" TARGET_FMT_lx "] = %" PRId32
184
- " (0x%02" PRIx32 ")\n",
185
- env->mem_log_stores[slot].va, data, data);
186
- } else if (width == 2) {
187
- uint32_t data = env->mem_log_stores[slot].data32 & 0xffff;
188
- HEX_DEBUG_LOG("\tmemh[0x" TARGET_FMT_lx "] = %" PRId32
189
- " (0x%04" PRIx32 ")\n",
190
- env->mem_log_stores[slot].va, data, data);
191
- } else if (width == 4) {
192
- uint32_t data = env->mem_log_stores[slot].data32;
193
- HEX_DEBUG_LOG("\tmemw[0x" TARGET_FMT_lx "] = %" PRId32
194
- " (0x%08" PRIx32 ")\n",
195
- env->mem_log_stores[slot].va, data, data);
196
- } else if (width == 8) {
197
- HEX_DEBUG_LOG("\tmemd[0x" TARGET_FMT_lx "] = %" PRId64
198
- " (0x%016" PRIx64 ")\n",
199
- env->mem_log_stores[slot].va,
200
- env->mem_log_stores[slot].data64,
201
- env->mem_log_stores[slot].data64);
202
- } else {
203
- HEX_DEBUG_LOG("\tBad store width %d\n", width);
204
- g_assert_not_reached();
205
- }
206
- }
207
-}
208
-
209
-/* This function is a handy place to set a breakpoint */
210
-void HELPER(debug_commit_end)(CPUHexagonState *env, uint32_t this_PC,
211
- int pred_written, int has_st0, int has_st1)
212
-{
213
- bool reg_printed = false;
214
- bool pred_printed = false;
75
- int i;
215
- int i;
76
216
-
77
/* Normal (possibly masked) vector store */
217
- HEX_DEBUG_LOG("Packet committed: pc = 0x" TARGET_FMT_lx "\n", this_PC);
78
- for (i = 0; i < VSTORES_MAX; i++) {
218
- HEX_DEBUG_LOG("slot_cancelled = %d\n", env->slot_cancelled);
79
+ for (int i = 0; i < VSTORES_MAX; i++) {
219
-
80
if (env->vstore_pending[i]) {
220
- for (i = 0; i < TOTAL_PER_THREAD_REGS; i++) {
81
env->vstore_pending[i] = 0;
221
- if (env->reg_written[i]) {
82
target_ulong va = env->vstore[i].va;
222
- if (!reg_printed) {
83
@@ -XXX,XX +XXX,XX @@ void HELPER(commit_hvx_stores)(CPUHexagonState *env)
223
- HEX_DEBUG_LOG("Regs written\n");
84
g_assert_not_reached();
224
- reg_printed = true;
85
}
225
- }
86
} else {
226
- HEX_DEBUG_LOG("\tr%d = " TARGET_FMT_ld " (0x" TARGET_FMT_lx ")\n",
87
- for (i = 0; i < sizeof(MMVector); i++) {
227
- i, env->gpr[i], env->gpr[i]);
88
+ for (int i = 0; i < sizeof(MMVector); i++) {
228
- }
89
if (test_bit(i, env->vtcm_log.mask)) {
229
- }
90
cpu_stb_data_ra(env, env->vtcm_log.va[i],
230
-
91
env->vtcm_log.data.ub[i], ra);
231
- for (i = 0; i < NUM_PREGS; i++) {
92
@@ -XXX,XX +XXX,XX @@ void HELPER(probe_pkt_scalar_store_s0)(CPUHexagonState *env, int args)
232
- if (pred_written & (1 << i)) {
93
static void probe_hvx_stores(CPUHexagonState *env, int mmu_idx,
233
- if (!pred_printed) {
94
uintptr_t retaddr)
234
- HEX_DEBUG_LOG("Predicates written\n");
95
{
235
- pred_printed = true;
96
- int i;
236
- }
97
-
237
- HEX_DEBUG_LOG("\tp%d = 0x" TARGET_FMT_lx "\n",
98
/* Normal (possibly masked) vector store */
238
- i, env->pred[i]);
99
- for (i = 0; i < VSTORES_MAX; i++) {
239
- }
100
+ for (int i = 0; i < VSTORES_MAX; i++) {
240
- }
101
if (env->vstore_pending[i]) {
241
-
102
target_ulong va = env->vstore[i].va;
242
- if (has_st0 || has_st1) {
103
int size = env->vstore[i].size;
243
- HEX_DEBUG_LOG("Stores\n");
244
- if (has_st0) {
245
- print_store(env, 0);
246
- }
247
- if (has_st1) {
248
- print_store(env, 1);
249
- }
250
- }
251
-
252
- HEX_DEBUG_LOG("Next PC = " TARGET_FMT_lx "\n", env->gpr[HEX_REG_PC]);
253
- HEX_DEBUG_LOG("Exec counters: pkt = " TARGET_FMT_lx
254
- ", insn = " TARGET_FMT_lx
255
- ", hvx = " TARGET_FMT_lx "\n",
256
- env->gpr[HEX_REG_QEMU_PKT_CNT],
257
- env->gpr[HEX_REG_QEMU_INSN_CNT],
258
- env->gpr[HEX_REG_QEMU_HVX_CNT]);
259
-
260
-}
261
-
262
int32_t HELPER(fcircadd)(int32_t RxV, int32_t offset, int32_t M, int32_t CS)
263
{
264
uint32_t K_const = extract32(M, 24, 4);
104
diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c
265
diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c
105
index XXXXXXX..XXXXXXX 100644
266
index XXXXXXX..XXXXXXX 100644
106
--- a/target/hexagon/translate.c
267
--- a/target/hexagon/translate.c
107
+++ b/target/hexagon/translate.c
268
+++ b/target/hexagon/translate.c
269
@@ -XXX,XX +XXX,XX @@ TCGv hex_gpr[TOTAL_PER_THREAD_REGS];
270
TCGv hex_pred[NUM_PREGS];
271
TCGv hex_slot_cancelled;
272
TCGv hex_new_value_usr;
273
-TCGv hex_reg_written[TOTAL_PER_THREAD_REGS];
274
TCGv hex_store_addr[STORES_MAX];
275
TCGv hex_store_width[STORES_MAX];
276
TCGv hex_store_val32[STORES_MAX];
277
@@ -XXX,XX +XXX,XX @@ static void gen_exception_end_tb(DisasContext *ctx, int excp)
278
279
}
280
281
-#define PACKET_BUFFER_LEN 1028
282
-static void print_pkt(Packet *pkt)
283
-{
284
- GString *buf = g_string_sized_new(PACKET_BUFFER_LEN);
285
- snprint_a_pkt_debug(buf, pkt);
286
- HEX_DEBUG_LOG("%s", buf->str);
287
- g_string_free(buf, true);
288
-}
289
-#define HEX_DEBUG_PRINT_PKT(pkt) \
290
- do { \
291
- if (HEX_DEBUG) { \
292
- print_pkt(pkt); \
293
- } \
294
- } while (0)
295
-
296
static int read_packet_words(CPUHexagonState *env, DisasContext *ctx,
297
uint32_t words[])
298
{
299
@@ -XXX,XX +XXX,XX @@ static int read_packet_words(CPUHexagonState *env, DisasContext *ctx,
300
g_assert(ctx->base.num_insns == 1);
301
}
302
303
- HEX_DEBUG_LOG("decode_packet: pc = 0x%" VADDR_PRIx "\n",
304
- ctx->base.pc_next);
305
- HEX_DEBUG_LOG(" words = { ");
306
- for (int i = 0; i < nwords; i++) {
307
- HEX_DEBUG_LOG("0x%x, ", words[i]);
308
- }
309
- HEX_DEBUG_LOG("}\n");
310
-
311
return nwords;
312
}
313
108
@@ -XXX,XX +XXX,XX @@ static void gen_start_packet(DisasContext *ctx)
314
@@ -XXX,XX +XXX,XX @@ static void gen_start_packet(DisasContext *ctx)
315
*/
316
bitmap_zero(ctx->pregs_written, NUM_PREGS);
317
318
- if (HEX_DEBUG) {
319
- /* Handy place to set a breakpoint before the packet executes */
320
- gen_helper_debug_start_packet(tcg_env);
321
- }
322
-
323
/* Initialize the runtime state for packet semantics */
324
if (need_slot_cancelled(pkt)) {
325
tcg_gen_movi_tl(hex_slot_cancelled, 0);
326
@@ -XXX,XX +XXX,XX @@ static void gen_start_packet(DisasContext *ctx)
327
tcg_gen_movi_tl(hex_gpr[HEX_REG_PC], next_PC);
328
}
329
}
330
- if (HEX_DEBUG) {
331
- ctx->pred_written = tcg_temp_new();
332
- tcg_gen_movi_tl(ctx->pred_written, 0);
333
- }
334
109
/* Preload the predicated registers into get_result_gpr(ctx, i) */
335
/* Preload the predicated registers into get_result_gpr(ctx, i) */
110
if (ctx->need_commit &&
336
if (ctx->need_commit &&
111
!bitmap_empty(ctx->predicated_regs, TOTAL_PER_THREAD_REGS)) {
337
@@ -XXX,XX +XXX,XX @@ static void gen_pred_writes(DisasContext *ctx)
112
- int i = find_first_bit(ctx->predicated_regs, TOTAL_PER_THREAD_REGS);
338
}
113
+ i = find_first_bit(ctx->predicated_regs, TOTAL_PER_THREAD_REGS);
339
}
114
while (i < TOTAL_PER_THREAD_REGS) {
340
115
tcg_gen_mov_tl(get_result_gpr(ctx, i), hex_gpr[i]);
341
-static void gen_check_store_width(DisasContext *ctx, int slot_num)
116
i = find_next_bit(ctx->predicated_regs, TOTAL_PER_THREAD_REGS,
342
-{
117
@@ -XXX,XX +XXX,XX @@ static void gen_start_packet(DisasContext *ctx)
343
- if (HEX_DEBUG) {
118
* Only endloop instructions conditionally write to pred registers
344
- TCGv slot = tcg_constant_tl(slot_num);
119
*/
345
- TCGv check = tcg_constant_tl(ctx->store_width[slot_num]);
120
if (ctx->need_commit && pkt->pkt_has_endloop) {
346
- gen_helper_debug_check_store_width(tcg_env, slot, check);
121
- for (int i = 0; i < ctx->preg_log_idx; i++) {
347
- }
122
+ for (i = 0; i < ctx->preg_log_idx; i++) {
348
-}
123
int pred_num = ctx->preg_log[i];
349
-
124
ctx->new_pred_value[pred_num] = tcg_temp_new();
350
static bool slot_is_predicated(Packet *pkt, int slot_num)
125
tcg_gen_mov_tl(ctx->new_pred_value[pred_num], hex_pred[pred_num]);
351
{
126
@@ -XXX,XX +XXX,XX @@ static void gen_start_packet(DisasContext *ctx)
352
for (int i = 0; i < pkt->num_insns; i++) {
127
353
@@ -XXX,XX +XXX,XX @@ void process_store(DisasContext *ctx, int slot_num)
128
/* Preload the predicated HVX registers into future_VRegs and tmp_VRegs */
354
*/
129
if (!bitmap_empty(ctx->predicated_future_vregs, NUM_VREGS)) {
355
switch (ctx->store_width[slot_num]) {
130
- int i = find_first_bit(ctx->predicated_future_vregs, NUM_VREGS);
356
case 1:
131
+ i = find_first_bit(ctx->predicated_future_vregs, NUM_VREGS);
357
- gen_check_store_width(ctx, slot_num);
132
while (i < NUM_VREGS) {
358
tcg_gen_qemu_st_tl(hex_store_val32[slot_num],
133
const intptr_t VdV_off =
359
hex_store_addr[slot_num],
134
ctx_future_vreg_off(ctx, i, 1, true);
360
ctx->mem_idx, MO_UB);
135
@@ -XXX,XX +XXX,XX @@ static void gen_start_packet(DisasContext *ctx)
361
break;
136
}
362
case 2:
137
}
363
- gen_check_store_width(ctx, slot_num);
138
if (!bitmap_empty(ctx->predicated_tmp_vregs, NUM_VREGS)) {
364
tcg_gen_qemu_st_tl(hex_store_val32[slot_num],
139
- int i = find_first_bit(ctx->predicated_tmp_vregs, NUM_VREGS);
365
hex_store_addr[slot_num],
140
+ i = find_first_bit(ctx->predicated_tmp_vregs, NUM_VREGS);
366
ctx->mem_idx, MO_TEUW);
141
while (i < NUM_VREGS) {
367
break;
142
const intptr_t VdV_off =
368
case 4:
143
ctx_tmp_vreg_off(ctx, i, 1, true);
369
- gen_check_store_width(ctx, slot_num);
370
tcg_gen_qemu_st_tl(hex_store_val32[slot_num],
371
hex_store_addr[slot_num],
372
ctx->mem_idx, MO_TEUL);
373
break;
374
case 8:
375
- gen_check_store_width(ctx, slot_num);
376
tcg_gen_qemu_st_i64(hex_store_val64[slot_num],
377
hex_store_addr[slot_num],
378
ctx->mem_idx, MO_TEUQ);
379
@@ -XXX,XX +XXX,XX @@ static void gen_commit_packet(DisasContext *ctx)
380
gen_commit_hvx(ctx);
381
}
382
update_exec_counters(ctx);
383
- if (HEX_DEBUG) {
384
- TCGv has_st0 =
385
- tcg_constant_tl(pkt->pkt_has_store_s0 && !pkt->pkt_has_dczeroa);
386
- TCGv has_st1 =
387
- tcg_constant_tl(pkt->pkt_has_store_s1 && !pkt->pkt_has_dczeroa);
388
-
389
- /* Handy place to set a breakpoint at the end of execution */
390
- gen_helper_debug_commit_end(tcg_env, tcg_constant_tl(ctx->pkt->pc),
391
- ctx->pred_written, has_st0, has_st1);
392
- }
393
394
if (pkt->vhist_insn != NULL) {
395
ctx->pre_commit = false;
396
@@ -XXX,XX +XXX,XX @@ static void decode_and_translate_packet(CPUHexagonState *env, DisasContext *ctx)
397
ctx->pkt = &pkt;
398
if (decode_packet(ctx, nwords, words, &pkt, false) > 0) {
399
pkt.pc = ctx->base.pc_next;
400
- HEX_DEBUG_PRINT_PKT(&pkt);
401
gen_start_packet(ctx);
402
for (i = 0; i < pkt.num_insns; i++) {
403
ctx->insn = &pkt.insn[i];
404
@@ -XXX,XX +XXX,XX @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_insns,
405
}
406
407
#define NAME_LEN 64
408
-static char reg_written_names[TOTAL_PER_THREAD_REGS][NAME_LEN];
409
static char store_addr_names[STORES_MAX][NAME_LEN];
410
static char store_width_names[STORES_MAX][NAME_LEN];
411
static char store_val32_names[STORES_MAX][NAME_LEN];
144
@@ -XXX,XX +XXX,XX @@ void hexagon_translate_init(void)
412
@@ -XXX,XX +XXX,XX @@ void hexagon_translate_init(void)
145
offsetof(CPUHexagonState, mem_log_stores[i].data64),
413
hex_gpr[i] = tcg_global_mem_new(tcg_env,
146
store_val64_names[i]);
414
offsetof(CPUHexagonState, gpr[i]),
147
}
415
hexagon_regnames[i]);
148
- for (int i = 0; i < VSTORES_MAX; i++) {
416
-
149
+ for (i = 0; i < VSTORES_MAX; i++) {
417
- if (HEX_DEBUG) {
150
snprintf(vstore_addr_names[i], NAME_LEN, "vstore_addr_%d", i);
418
- snprintf(reg_written_names[i], NAME_LEN, "reg_written_%s",
151
hex_vstore_addr[i] = tcg_global_mem_new(cpu_env,
419
- hexagon_regnames[i]);
152
offsetof(CPUHexagonState, vstore[i].va),
420
- hex_reg_written[i] = tcg_global_mem_new(tcg_env,
421
- offsetof(CPUHexagonState, reg_written[i]),
422
- reg_written_names[i]);
423
- }
424
}
425
hex_new_value_usr = tcg_global_mem_new(tcg_env,
426
offsetof(CPUHexagonState, new_value_usr), "new_value_usr");
427
diff --git a/target/hexagon/translate.h b/target/hexagon/translate.h
428
index XXXXXXX..XXXXXXX 100644
429
--- a/target/hexagon/translate.h
430
+++ b/target/hexagon/translate.h
431
@@ -XXX,XX +XXX,XX @@ typedef struct DisasContext {
432
bool has_hvx_overlap;
433
TCGv new_value[TOTAL_PER_THREAD_REGS];
434
TCGv new_pred_value[NUM_PREGS];
435
- TCGv pred_written;
436
TCGv branch_taken;
437
TCGv dczero_addr;
438
} DisasContext;
439
@@ -XXX,XX +XXX,XX @@ extern TCGv hex_gpr[TOTAL_PER_THREAD_REGS];
440
extern TCGv hex_pred[NUM_PREGS];
441
extern TCGv hex_slot_cancelled;
442
extern TCGv hex_new_value_usr;
443
-extern TCGv hex_reg_written[TOTAL_PER_THREAD_REGS];
444
extern TCGv hex_store_addr[STORES_MAX];
445
extern TCGv hex_store_width[STORES_MAX];
446
extern TCGv hex_store_val32[STORES_MAX];
153
--
447
--
154
2.25.1
448
2.34.1
155
449
diff view generated by jsdifflib
1
From: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
1
From: Brian Cain <bcain@quicinc.com>
2
2
3
As docs/devel/loads-stores.rst states:
3
The values previously used for "HEX_EXCP_*" were the cause code
4
definitions and not the event numbers. So in this commit, we update
5
the names to reflect the cause codes. In HEX_EVENT_TRAP0's case, we add
6
a new "HEX_EVENT_*" with the correct event number.
4
7
5
``GETPC()`` should be used with great care: calling
8
Reviewed-by: Taylor Simpson <ltaylorsimpson@gmail.com>
6
it in other functions that are *not* the top level
9
Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
7
``HELPER(foo)`` will cause unexpected behavior. Instead, the
10
---
8
value of ``GETPC()`` should be read from the helper and passed
11
linux-user/hexagon/cpu_loop.c | 4 ++--
9
if needed to the functions that the helper calls.
12
target/hexagon/cpu.h | 2 +-
13
target/hexagon/cpu_bits.h | 15 ++++++++-------
14
target/hexagon/gen_tcg.h | 2 +-
15
target/hexagon/translate.c | 6 +++---
16
5 files changed, 15 insertions(+), 14 deletions(-)
10
17
11
Let's fix the GETPC() usage in Hexagon, making sure it's always called
18
diff --git a/linux-user/hexagon/cpu_loop.c b/linux-user/hexagon/cpu_loop.c
12
from top level helpers and passed down to the places where it's
13
needed. There are a few snippets where that is not currently the case:
14
15
- probe_store(), which is only called from two helpers, so it's easy to
16
move GETPC() up.
17
18
- mem_load*() functions, which are also called directly from helpers,
19
but through the MEM_LOAD*() set of macros. Note that this are only
20
used when compiling with --disable-hexagon-idef-parser.
21
22
In this case, we also take this opportunity to simplify the code,
23
unifying the mem_load*() functions.
24
25
- HELPER(probe_hvx_stores), when called from another helper, ends up
26
using its own GETPC() expansion instead of the top level caller.
27
28
Signed-off-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
29
Reviewed-by: Taylor Simpson <ltaylorsimpson@gmail.com>
30
Message-Id: <2c74c3696946edba7cc5b2942cf296a5af532052.1689070412.git.quic_mathbern@quicinc.com>-ne
31
Reviewed-by: Brian Cain <bcain@quicinc.com>
32
Signed-off-by: Brian Cain <bcain@quicinc.com>
33
---
34
target/hexagon/macros.h | 19 +++++-----
35
target/hexagon/op_helper.c | 75 +++++++++++++++-----------------------
36
target/hexagon/op_helper.h | 9 -----
37
3 files changed, 38 insertions(+), 65 deletions(-)
38
39
diff --git a/target/hexagon/macros.h b/target/hexagon/macros.h
40
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
41
--- a/target/hexagon/macros.h
20
--- a/linux-user/hexagon/cpu_loop.c
42
+++ b/target/hexagon/macros.h
21
+++ b/linux-user/hexagon/cpu_loop.c
43
@@ -XXX,XX +XXX,XX @@
22
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUHexagonState *env)
44
#define MEM_STORE8(VA, DATA, SLOT) \
23
case EXCP_INTERRUPT:
45
MEM_STORE8_FUNC(DATA)(cpu_env, VA, DATA, SLOT)
24
/* just indicate that signals should be handled asap */
46
#else
25
break;
47
-#define MEM_LOAD1s(VA) ((int8_t)mem_load1(env, pkt_has_store_s1, slot, VA))
26
- case HEX_EXCP_TRAP0:
48
-#define MEM_LOAD1u(VA) ((uint8_t)mem_load1(env, pkt_has_store_s1, slot, VA))
27
+ case HEX_EVENT_TRAP0:
49
-#define MEM_LOAD2s(VA) ((int16_t)mem_load2(env, pkt_has_store_s1, slot, VA))
28
syscallnum = env->gpr[6];
50
-#define MEM_LOAD2u(VA) ((uint16_t)mem_load2(env, pkt_has_store_s1, slot, VA))
29
env->gpr[HEX_REG_PC] += 4;
51
-#define MEM_LOAD4s(VA) ((int32_t)mem_load4(env, pkt_has_store_s1, slot, VA))
30
ret = do_syscall(env,
52
-#define MEM_LOAD4u(VA) ((uint32_t)mem_load4(env, pkt_has_store_s1, slot, VA))
31
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUHexagonState *env)
53
-#define MEM_LOAD8s(VA) ((int64_t)mem_load8(env, pkt_has_store_s1, slot, VA))
32
env->gpr[0] = ret;
54
-#define MEM_LOAD8u(VA) ((uint64_t)mem_load8(env, pkt_has_store_s1, slot, VA))
33
}
55
-
34
break;
56
#define MEM_STORE1(VA, DATA, SLOT) log_store32(env, VA, DATA, 1, SLOT)
35
- case HEX_EXCP_PC_NOT_ALIGNED:
57
#define MEM_STORE2(VA, DATA, SLOT) log_store32(env, VA, DATA, 2, SLOT)
36
+ case HEX_CAUSE_PC_NOT_ALIGNED:
58
#define MEM_STORE4(VA, DATA, SLOT) log_store32(env, VA, DATA, 4, SLOT)
37
force_sig_fault(TARGET_SIGBUS, TARGET_BUS_ADRALN,
59
@@ -XXX,XX +XXX,XX @@ static inline TCGv gen_read_ireg(TCGv result, TCGv val, int shift)
38
env->gpr[HEX_REG_R31]);
60
#ifdef QEMU_GENERATE
39
break;
61
#define fLOAD(NUM, SIZE, SIGN, EA, DST) MEM_LOAD##SIZE##SIGN(DST, EA)
40
diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h
62
#else
63
+#define MEM_LOAD1 cpu_ldub_data_ra
64
+#define MEM_LOAD2 cpu_lduw_data_ra
65
+#define MEM_LOAD4 cpu_ldl_data_ra
66
+#define MEM_LOAD8 cpu_ldq_data_ra
67
+
68
#define fLOAD(NUM, SIZE, SIGN, EA, DST) \
69
- DST = (size##SIZE##SIGN##_t)MEM_LOAD##SIZE##SIGN(EA)
70
+ do { \
71
+ check_noshuf(env, pkt_has_store_s1, slot, EA, SIZE, GETPC()); \
72
+ DST = (size##SIZE##SIGN##_t)MEM_LOAD##SIZE(env, EA, GETPC()); \
73
+ } while (0)
74
#endif
75
76
#define fMEMOP(NUM, SIZE, SIGN, EA, FNTYPE, VALUE)
77
diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c
78
index XXXXXXX..XXXXXXX 100644
41
index XXXXXXX..XXXXXXX 100644
79
--- a/target/hexagon/op_helper.c
42
--- a/target/hexagon/cpu.h
80
+++ b/target/hexagon/op_helper.c
43
+++ b/target/hexagon/cpu.h
81
@@ -XXX,XX +XXX,XX @@ void HELPER(debug_check_store_width)(CPUHexagonState *env, int slot, int check)
44
@@ -XXX,XX +XXX,XX @@ static inline void cpu_get_tb_cpu_state(CPUHexagonState *env, vaddr *pc,
45
}
46
*flags = hex_flags;
47
if (*pc & PCALIGN_MASK) {
48
- hexagon_raise_exception_err(env, HEX_EXCP_PC_NOT_ALIGNED, 0);
49
+ hexagon_raise_exception_err(env, HEX_CAUSE_PC_NOT_ALIGNED, 0);
82
}
50
}
83
}
51
}
84
52
85
-void HELPER(commit_store)(CPUHexagonState *env, int slot_num)
53
diff --git a/target/hexagon/cpu_bits.h b/target/hexagon/cpu_bits.h
86
+static void commit_store(CPUHexagonState *env, int slot_num, uintptr_t ra)
54
index XXXXXXX..XXXXXXX 100644
87
{
55
--- a/target/hexagon/cpu_bits.h
88
- uintptr_t ra = GETPC();
56
+++ b/target/hexagon/cpu_bits.h
89
uint8_t width = env->mem_log_stores[slot_num].width;
57
@@ -XXX,XX +XXX,XX @@
90
target_ulong va = env->mem_log_stores[slot_num].va;
58
#define PCALIGN 4
91
59
#define PCALIGN_MASK (PCALIGN - 1)
92
@@ -XXX,XX +XXX,XX @@ void HELPER(commit_store)(CPUHexagonState *env, int slot_num)
60
61
-#define HEX_EXCP_FETCH_NO_UPAGE 0x012
62
-#define HEX_EXCP_INVALID_PACKET 0x015
63
-#define HEX_EXCP_INVALID_OPCODE 0x015
64
-#define HEX_EXCP_PC_NOT_ALIGNED 0x01e
65
-#define HEX_EXCP_PRIV_NO_UREAD 0x024
66
-#define HEX_EXCP_PRIV_NO_UWRITE 0x025
67
+#define HEX_EVENT_TRAP0 0x008
68
69
-#define HEX_EXCP_TRAP0 0x172
70
+#define HEX_CAUSE_TRAP0 0x172
71
+#define HEX_CAUSE_FETCH_NO_UPAGE 0x012
72
+#define HEX_CAUSE_INVALID_PACKET 0x015
73
+#define HEX_CAUSE_INVALID_OPCODE 0x015
74
+#define HEX_CAUSE_PC_NOT_ALIGNED 0x01e
75
+#define HEX_CAUSE_PRIV_NO_UREAD 0x024
76
+#define HEX_CAUSE_PRIV_NO_UWRITE 0x025
77
78
#define PACKET_WORDS_MAX 4
79
80
diff --git a/target/hexagon/gen_tcg.h b/target/hexagon/gen_tcg.h
81
index XXXXXXX..XXXXXXX 100644
82
--- a/target/hexagon/gen_tcg.h
83
+++ b/target/hexagon/gen_tcg.h
84
@@ -XXX,XX +XXX,XX @@
85
do { \
86
uiV = uiV; \
87
tcg_gen_movi_tl(hex_gpr[HEX_REG_PC], ctx->pkt->pc); \
88
- TCGv excp = tcg_constant_tl(HEX_EXCP_TRAP0); \
89
+ TCGv excp = tcg_constant_tl(HEX_EVENT_TRAP0); \
90
gen_helper_raise_exception(tcg_env, excp); \
91
} while (0)
92
#endif
93
diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c
94
index XXXXXXX..XXXXXXX 100644
95
--- a/target/hexagon/translate.c
96
+++ b/target/hexagon/translate.c
97
@@ -XXX,XX +XXX,XX @@ static void gen_insn(DisasContext *ctx)
98
ctx->insn->generate(ctx);
99
mark_store_width(ctx);
100
} else {
101
- gen_exception_end_tb(ctx, HEX_EXCP_INVALID_OPCODE);
102
+ gen_exception_end_tb(ctx, HEX_CAUSE_INVALID_OPCODE);
93
}
103
}
94
}
104
}
95
105
96
+void HELPER(commit_store)(CPUHexagonState *env, int slot_num)
106
@@ -XXX,XX +XXX,XX @@ static void decode_and_translate_packet(CPUHexagonState *env, DisasContext *ctx)
97
+{
107
98
+ uintptr_t ra = GETPC();
108
nwords = read_packet_words(env, ctx, words);
99
+ commit_store(env, slot_num, ra);
109
if (!nwords) {
100
+}
110
- gen_exception_end_tb(ctx, HEX_EXCP_INVALID_PACKET);
101
+
111
+ gen_exception_end_tb(ctx, HEX_CAUSE_INVALID_PACKET);
102
void HELPER(gather_store)(CPUHexagonState *env, uint32_t addr, int slot)
112
return;
103
{
113
}
104
mem_gather_store(env, addr, slot);
114
105
@@ -XXX,XX +XXX,XX @@ int32_t HELPER(cabacdecbin_pred)(int64_t RssV, int64_t RttV)
115
@@ -XXX,XX +XXX,XX @@ static void decode_and_translate_packet(CPUHexagonState *env, DisasContext *ctx)
106
}
116
gen_commit_packet(ctx);
107
117
ctx->base.pc_next += pkt.encod_pkt_size_in_bytes;
108
static void probe_store(CPUHexagonState *env, int slot, int mmu_idx,
118
} else {
109
- bool is_predicated)
119
- gen_exception_end_tb(ctx, HEX_EXCP_INVALID_PACKET);
110
+ bool is_predicated, uintptr_t retaddr)
120
+ gen_exception_end_tb(ctx, HEX_CAUSE_INVALID_PACKET);
111
{
112
if (!is_predicated || !(env->slot_cancelled & (1 << slot))) {
113
size1u_t width = env->mem_log_stores[slot].width;
114
target_ulong va = env->mem_log_stores[slot].va;
115
- uintptr_t ra = GETPC();
116
- probe_write(env, va, width, mmu_idx, ra);
117
+ probe_write(env, va, width, mmu_idx, retaddr);
118
}
121
}
119
}
122
}
120
123
121
@@ -XXX,XX +XXX,XX @@ void HELPER(probe_pkt_scalar_store_s0)(CPUHexagonState *env, int args)
122
int mmu_idx = FIELD_EX32(args, PROBE_PKT_SCALAR_STORE_S0, MMU_IDX);
123
bool is_predicated =
124
FIELD_EX32(args, PROBE_PKT_SCALAR_STORE_S0, IS_PREDICATED);
125
- probe_store(env, 0, mmu_idx, is_predicated);
126
+ uintptr_t ra = GETPC();
127
+ probe_store(env, 0, mmu_idx, is_predicated, ra);
128
}
129
130
-void HELPER(probe_hvx_stores)(CPUHexagonState *env, int mmu_idx)
131
+static void probe_hvx_stores(CPUHexagonState *env, int mmu_idx,
132
+ uintptr_t retaddr)
133
{
134
- uintptr_t retaddr = GETPC();
135
int i;
136
137
/* Normal (possibly masked) vector store */
138
@@ -XXX,XX +XXX,XX @@ void HELPER(probe_hvx_stores)(CPUHexagonState *env, int mmu_idx)
139
}
140
}
141
142
+void HELPER(probe_hvx_stores)(CPUHexagonState *env, int mmu_idx)
143
+{
144
+ uintptr_t retaddr = GETPC();
145
+ probe_hvx_stores(env, mmu_idx, retaddr);
146
+}
147
+
148
void HELPER(probe_pkt_scalar_hvx_stores)(CPUHexagonState *env, int mask)
149
{
150
bool has_st0 = FIELD_EX32(mask, PROBE_PKT_SCALAR_HVX_STORES, HAS_ST0);
151
@@ -XXX,XX +XXX,XX @@ void HELPER(probe_pkt_scalar_hvx_stores)(CPUHexagonState *env, int mask)
152
bool s0_is_pred = FIELD_EX32(mask, PROBE_PKT_SCALAR_HVX_STORES, S0_IS_PRED);
153
bool s1_is_pred = FIELD_EX32(mask, PROBE_PKT_SCALAR_HVX_STORES, S1_IS_PRED);
154
int mmu_idx = FIELD_EX32(mask, PROBE_PKT_SCALAR_HVX_STORES, MMU_IDX);
155
+ uintptr_t ra = GETPC();
156
157
if (has_st0) {
158
- probe_store(env, 0, mmu_idx, s0_is_pred);
159
+ probe_store(env, 0, mmu_idx, s0_is_pred, ra);
160
}
161
if (has_st1) {
162
- probe_store(env, 1, mmu_idx, s1_is_pred);
163
+ probe_store(env, 1, mmu_idx, s1_is_pred, ra);
164
}
165
if (has_hvx_stores) {
166
- HELPER(probe_hvx_stores)(env, mmu_idx);
167
+ probe_hvx_stores(env, mmu_idx, ra);
168
}
169
}
170
171
+#ifndef CONFIG_HEXAGON_IDEF_PARSER
172
/*
173
* mem_noshuf
174
* Section 5.5 of the Hexagon V67 Programmer's Reference Manual
175
@@ -XXX,XX +XXX,XX @@ void HELPER(probe_pkt_scalar_hvx_stores)(CPUHexagonState *env, int mask)
176
* wasn't cancelled), we have to do the store first.
177
*/
178
static void check_noshuf(CPUHexagonState *env, bool pkt_has_store_s1,
179
- uint32_t slot, target_ulong vaddr, int size)
180
+ uint32_t slot, target_ulong vaddr, int size,
181
+ uintptr_t ra)
182
{
183
if (slot == 0 && pkt_has_store_s1 &&
184
((env->slot_cancelled & (1 << 1)) == 0)) {
185
- HELPER(probe_noshuf_load)(env, vaddr, size, MMU_USER_IDX);
186
- HELPER(commit_store)(env, 1);
187
+ probe_read(env, vaddr, size, MMU_USER_IDX, ra);
188
+ commit_store(env, 1, ra);
189
}
190
}
191
-
192
-uint8_t mem_load1(CPUHexagonState *env, bool pkt_has_store_s1,
193
- uint32_t slot, target_ulong vaddr)
194
-{
195
- uintptr_t ra = GETPC();
196
- check_noshuf(env, pkt_has_store_s1, slot, vaddr, 1);
197
- return cpu_ldub_data_ra(env, vaddr, ra);
198
-}
199
-
200
-uint16_t mem_load2(CPUHexagonState *env, bool pkt_has_store_s1,
201
- uint32_t slot, target_ulong vaddr)
202
-{
203
- uintptr_t ra = GETPC();
204
- check_noshuf(env, pkt_has_store_s1, slot, vaddr, 2);
205
- return cpu_lduw_data_ra(env, vaddr, ra);
206
-}
207
-
208
-uint32_t mem_load4(CPUHexagonState *env, bool pkt_has_store_s1,
209
- uint32_t slot, target_ulong vaddr)
210
-{
211
- uintptr_t ra = GETPC();
212
- check_noshuf(env, pkt_has_store_s1, slot, vaddr, 4);
213
- return cpu_ldl_data_ra(env, vaddr, ra);
214
-}
215
-
216
-uint64_t mem_load8(CPUHexagonState *env, bool pkt_has_store_s1,
217
- uint32_t slot, target_ulong vaddr)
218
-{
219
- uintptr_t ra = GETPC();
220
- check_noshuf(env, pkt_has_store_s1, slot, vaddr, 8);
221
- return cpu_ldq_data_ra(env, vaddr, ra);
222
-}
223
+#endif
224
225
/* Floating point */
226
float64 HELPER(conv_sf2df)(CPUHexagonState *env, float32 RsV)
227
diff --git a/target/hexagon/op_helper.h b/target/hexagon/op_helper.h
228
index XXXXXXX..XXXXXXX 100644
229
--- a/target/hexagon/op_helper.h
230
+++ b/target/hexagon/op_helper.h
231
@@ -XXX,XX +XXX,XX @@
232
#define HEXAGON_OP_HELPER_H
233
234
/* Misc functions */
235
-uint8_t mem_load1(CPUHexagonState *env, bool pkt_has_store_s1,
236
- uint32_t slot, target_ulong vaddr);
237
-uint16_t mem_load2(CPUHexagonState *env, bool pkt_has_store_s1,
238
- uint32_t slot, target_ulong vaddr);
239
-uint32_t mem_load4(CPUHexagonState *env, bool pkt_has_store_s1,
240
- uint32_t slot, target_ulong vaddr);
241
-uint64_t mem_load8(CPUHexagonState *env, bool pkt_has_store_s1,
242
- uint32_t slot, target_ulong vaddr);
243
-
244
void log_store64(CPUHexagonState *env, target_ulong addr,
245
int64_t val, int width, int slot);
246
void log_store32(CPUHexagonState *env, target_ulong addr,
247
--
124
--
248
2.25.1
125
2.34.1
249
126
diff view generated by jsdifflib
New patch
1
From: Brian Cain <bcain@quicinc.com>
1
2
3
Reviewed-by: Taylor Simpson <ltaylorsimpson@gmail.com>
4
Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
5
---
6
target/hexagon/cpu_bits.h | 22 ++++++++++++++--------
7
1 file changed, 14 insertions(+), 8 deletions(-)
8
9
diff --git a/target/hexagon/cpu_bits.h b/target/hexagon/cpu_bits.h
10
index XXXXXXX..XXXXXXX 100644
11
--- a/target/hexagon/cpu_bits.h
12
+++ b/target/hexagon/cpu_bits.h
13
@@ -XXX,XX +XXX,XX @@
14
#define PCALIGN 4
15
#define PCALIGN_MASK (PCALIGN - 1)
16
17
-#define HEX_EVENT_TRAP0 0x008
18
+enum hex_event {
19
+ HEX_EVENT_NONE = -1,
20
+ HEX_EVENT_TRAP0 = 0x008,
21
+};
22
23
-#define HEX_CAUSE_TRAP0 0x172
24
-#define HEX_CAUSE_FETCH_NO_UPAGE 0x012
25
-#define HEX_CAUSE_INVALID_PACKET 0x015
26
-#define HEX_CAUSE_INVALID_OPCODE 0x015
27
-#define HEX_CAUSE_PC_NOT_ALIGNED 0x01e
28
-#define HEX_CAUSE_PRIV_NO_UREAD 0x024
29
-#define HEX_CAUSE_PRIV_NO_UWRITE 0x025
30
+enum hex_cause {
31
+ HEX_CAUSE_NONE = -1,
32
+ HEX_CAUSE_TRAP0 = 0x172,
33
+ HEX_CAUSE_FETCH_NO_UPAGE = 0x012,
34
+ HEX_CAUSE_INVALID_PACKET = 0x015,
35
+ HEX_CAUSE_INVALID_OPCODE = 0x015,
36
+ HEX_CAUSE_PC_NOT_ALIGNED = 0x01e,
37
+ HEX_CAUSE_PRIV_NO_UREAD = 0x024,
38
+ HEX_CAUSE_PRIV_NO_UWRITE = 0x025,
39
+};
40
41
#define PACKET_WORDS_MAX 4
42
43
--
44
2.34.1
45
diff view generated by jsdifflib
New patch
1
From: Anton Johansson <anjo@rev.ng>
1
2
3
QOL commit, all the various gen_* python scripts take a large set
4
arguments where order is implicit. Using argparse we also get decent
5
error messages if a field is missing or too many are added.
6
7
Signed-off-by: Anton Johansson <anjo@rev.ng>
8
Reviewed-by: Brian Cain <brian.cain@oss.qualcomm.com>
9
Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
10
---
11
target/hexagon/gen_analyze_funcs.py | 6 +++--
12
target/hexagon/gen_decodetree.py | 19 +++++++++++---
13
target/hexagon/gen_helper_funcs.py | 7 +++---
14
target/hexagon/gen_helper_protos.py | 7 +++---
15
target/hexagon/gen_idef_parser_funcs.py | 11 +++++++--
16
target/hexagon/gen_op_attribs.py | 11 +++++++--
17
target/hexagon/gen_opcodes_def.py | 11 +++++++--
18
target/hexagon/gen_printinsn.py | 11 +++++++--
19
target/hexagon/gen_tcg_func_table.py | 11 +++++++--
20
target/hexagon/gen_tcg_funcs.py | 9 ++++---
21
target/hexagon/gen_trans_funcs.py | 18 +++++++++++---
22
target/hexagon/hex_common.py | 33 ++++++++++++-------------
23
target/hexagon/meson.build | 2 +-
24
13 files changed, 109 insertions(+), 47 deletions(-)
25
26
diff --git a/target/hexagon/gen_analyze_funcs.py b/target/hexagon/gen_analyze_funcs.py
27
index XXXXXXX..XXXXXXX 100755
28
--- a/target/hexagon/gen_analyze_funcs.py
29
+++ b/target/hexagon/gen_analyze_funcs.py
30
@@ -XXX,XX +XXX,XX @@ def gen_analyze_func(f, tag, regs, imms):
31
32
33
def main():
34
- hex_common.read_common_files()
35
+ args = hex_common.parse_common_args(
36
+ "Emit functions analyzing register accesses"
37
+ )
38
tagregs = hex_common.get_tagregs()
39
tagimms = hex_common.get_tagimms()
40
41
- with open(sys.argv[-1], "w") as f:
42
+ with open(args.out, "w") as f:
43
f.write("#ifndef HEXAGON_ANALYZE_FUNCS_C_INC\n")
44
f.write("#define HEXAGON_ANALYZE_FUNCS_C_INC\n\n")
45
46
diff --git a/target/hexagon/gen_decodetree.py b/target/hexagon/gen_decodetree.py
47
index XXXXXXX..XXXXXXX 100755
48
--- a/target/hexagon/gen_decodetree.py
49
+++ b/target/hexagon/gen_decodetree.py
50
@@ -XXX,XX +XXX,XX @@
51
import textwrap
52
import iset
53
import hex_common
54
+import argparse
55
56
encs = {
57
tag: "".join(reversed(iset.iset[tag]["enc"].replace(" ", "")))
58
@@ -XXX,XX +XXX,XX @@ def gen_decodetree_file(f, class_to_decode):
59
f.write(f"{tag}\t{enc_str} @{tag}\n")
60
61
62
+def main():
63
+ parser = argparse.ArgumentParser(
64
+ description="Emit opaque macro calls with instruction semantics"
65
+ )
66
+ parser.add_argument("semantics", help="semantics file")
67
+ parser.add_argument("class_to_decode", help="instruction class to decode")
68
+ parser.add_argument("out", help="output file")
69
+ args = parser.parse_args()
70
+
71
+ hex_common.read_semantics_file(args.semantics)
72
+ with open(args.out, "w") as f:
73
+ gen_decodetree_file(f, args.class_to_decode)
74
+
75
if __name__ == "__main__":
76
- hex_common.read_semantics_file(sys.argv[1])
77
- class_to_decode = sys.argv[2]
78
- with open(sys.argv[3], "w") as f:
79
- gen_decodetree_file(f, class_to_decode)
80
+ main()
81
diff --git a/target/hexagon/gen_helper_funcs.py b/target/hexagon/gen_helper_funcs.py
82
index XXXXXXX..XXXXXXX 100755
83
--- a/target/hexagon/gen_helper_funcs.py
84
+++ b/target/hexagon/gen_helper_funcs.py
85
@@ -XXX,XX +XXX,XX @@ def gen_helper_function(f, tag, tagregs, tagimms):
86
87
88
def main():
89
- hex_common.read_common_files()
90
+ args = hex_common.parse_common_args(
91
+ "Emit helper function definitions for each instruction"
92
+ )
93
tagregs = hex_common.get_tagregs()
94
tagimms = hex_common.get_tagimms()
95
96
- output_file = sys.argv[-1]
97
- with open(output_file, "w") as f:
98
+ with open(args.out, "w") as f:
99
for tag in hex_common.tags:
100
## Skip the priv instructions
101
if "A_PRIV" in hex_common.attribdict[tag]:
102
diff --git a/target/hexagon/gen_helper_protos.py b/target/hexagon/gen_helper_protos.py
103
index XXXXXXX..XXXXXXX 100755
104
--- a/target/hexagon/gen_helper_protos.py
105
+++ b/target/hexagon/gen_helper_protos.py
106
@@ -XXX,XX +XXX,XX @@ def gen_helper_prototype(f, tag, tagregs, tagimms):
107
108
109
def main():
110
- hex_common.read_common_files()
111
+ args = hex_common.parse_common_args(
112
+ "Emit helper function prototypes for each instruction"
113
+ )
114
tagregs = hex_common.get_tagregs()
115
tagimms = hex_common.get_tagimms()
116
117
- output_file = sys.argv[-1]
118
- with open(output_file, "w") as f:
119
+ with open(args.out, "w") as f:
120
for tag in hex_common.tags:
121
## Skip the priv instructions
122
if "A_PRIV" in hex_common.attribdict[tag]:
123
diff --git a/target/hexagon/gen_idef_parser_funcs.py b/target/hexagon/gen_idef_parser_funcs.py
124
index XXXXXXX..XXXXXXX 100644
125
--- a/target/hexagon/gen_idef_parser_funcs.py
126
+++ b/target/hexagon/gen_idef_parser_funcs.py
127
@@ -XXX,XX +XXX,XX @@
128
import sys
129
import re
130
import string
131
+import argparse
132
from io import StringIO
133
134
import hex_common
135
@@ -XXX,XX +XXX,XX @@
136
## them are inputs ("in" prefix), while some others are outputs.
137
##
138
def main():
139
- hex_common.read_semantics_file(sys.argv[1])
140
+ parser = argparse.ArgumentParser(
141
+ "Emit instruction implementations that can be fed to idef-parser"
142
+ )
143
+ parser.add_argument("semantics", help="semantics file")
144
+ parser.add_argument("out", help="output file")
145
+ args = parser.parse_args()
146
+ hex_common.read_semantics_file(args.semantics)
147
hex_common.calculate_attribs()
148
hex_common.init_registers()
149
tagregs = hex_common.get_tagregs()
150
tagimms = hex_common.get_tagimms()
151
152
- with open(sys.argv[-1], "w") as f:
153
+ with open(args.out, "w") as f:
154
f.write('#include "macros.h.inc"\n\n')
155
156
for tag in hex_common.tags:
157
diff --git a/target/hexagon/gen_op_attribs.py b/target/hexagon/gen_op_attribs.py
158
index XXXXXXX..XXXXXXX 100755
159
--- a/target/hexagon/gen_op_attribs.py
160
+++ b/target/hexagon/gen_op_attribs.py
161
@@ -XXX,XX +XXX,XX @@
162
import re
163
import string
164
import hex_common
165
+import argparse
166
167
168
def main():
169
- hex_common.read_semantics_file(sys.argv[1])
170
+ parser = argparse.ArgumentParser(
171
+ "Emit opaque macro calls containing instruction attributes"
172
+ )
173
+ parser.add_argument("semantics", help="semantics file")
174
+ parser.add_argument("out", help="output file")
175
+ args = parser.parse_args()
176
+ hex_common.read_semantics_file(args.semantics)
177
hex_common.calculate_attribs()
178
179
##
180
## Generate all the attributes associated with each instruction
181
##
182
- with open(sys.argv[-1], "w") as f:
183
+ with open(args.out, "w") as f:
184
for tag in hex_common.tags:
185
f.write(
186
f"OP_ATTRIB({tag},ATTRIBS("
187
diff --git a/target/hexagon/gen_opcodes_def.py b/target/hexagon/gen_opcodes_def.py
188
index XXXXXXX..XXXXXXX 100755
189
--- a/target/hexagon/gen_opcodes_def.py
190
+++ b/target/hexagon/gen_opcodes_def.py
191
@@ -XXX,XX +XXX,XX @@
192
import re
193
import string
194
import hex_common
195
+import argparse
196
197
198
def main():
199
- hex_common.read_semantics_file(sys.argv[1])
200
+ parser = argparse.ArgumentParser(
201
+ description="Emit opaque macro calls with instruction names"
202
+ )
203
+ parser.add_argument("semantics", help="semantics file")
204
+ parser.add_argument("out", help="output file")
205
+ args = parser.parse_args()
206
+ hex_common.read_semantics_file(args.semantics)
207
208
##
209
## Generate a list of all the opcodes
210
##
211
- with open(sys.argv[-1], "w") as f:
212
+ with open(args.out, "w") as f:
213
for tag in hex_common.tags:
214
f.write(f"OPCODE({tag}),\n")
215
216
diff --git a/target/hexagon/gen_printinsn.py b/target/hexagon/gen_printinsn.py
217
index XXXXXXX..XXXXXXX 100755
218
--- a/target/hexagon/gen_printinsn.py
219
+++ b/target/hexagon/gen_printinsn.py
220
@@ -XXX,XX +XXX,XX @@
221
import re
222
import string
223
import hex_common
224
+import argparse
225
226
227
##
228
@@ -XXX,XX +XXX,XX @@ def spacify(s):
229
230
231
def main():
232
- hex_common.read_semantics_file(sys.argv[1])
233
+ parser = argparse.ArgumentParser(
234
+ "Emit opaque macro calls with information for printing string representations of instrucions"
235
+ )
236
+ parser.add_argument("semantics", help="semantics file")
237
+ parser.add_argument("out", help="output file")
238
+ args = parser.parse_args()
239
+ hex_common.read_semantics_file(args.semantics)
240
241
immext_casere = re.compile(r"IMMEXT\(([A-Za-z])")
242
243
- with open(sys.argv[-1], "w") as f:
244
+ with open(args.out, "w") as f:
245
for tag in hex_common.tags:
246
if not hex_common.behdict[tag]:
247
continue
248
diff --git a/target/hexagon/gen_tcg_func_table.py b/target/hexagon/gen_tcg_func_table.py
249
index XXXXXXX..XXXXXXX 100755
250
--- a/target/hexagon/gen_tcg_func_table.py
251
+++ b/target/hexagon/gen_tcg_func_table.py
252
@@ -XXX,XX +XXX,XX @@
253
import re
254
import string
255
import hex_common
256
+import argparse
257
258
259
def main():
260
- hex_common.read_semantics_file(sys.argv[1])
261
+ parser = argparse.ArgumentParser(
262
+ "Emit opaque macro calls with instruction semantics"
263
+ )
264
+ parser.add_argument("semantics", help="semantics file")
265
+ parser.add_argument("out", help="output file")
266
+ args = parser.parse_args()
267
+ hex_common.read_semantics_file(args.semantics)
268
hex_common.calculate_attribs()
269
tagregs = hex_common.get_tagregs()
270
tagimms = hex_common.get_tagimms()
271
272
- with open(sys.argv[-1], "w") as f:
273
+ with open(args.out, "w") as f:
274
f.write("#ifndef HEXAGON_FUNC_TABLE_H\n")
275
f.write("#define HEXAGON_FUNC_TABLE_H\n\n")
276
277
diff --git a/target/hexagon/gen_tcg_funcs.py b/target/hexagon/gen_tcg_funcs.py
278
index XXXXXXX..XXXXXXX 100755
279
--- a/target/hexagon/gen_tcg_funcs.py
280
+++ b/target/hexagon/gen_tcg_funcs.py
281
@@ -XXX,XX +XXX,XX @@ def gen_def_tcg_func(f, tag, tagregs, tagimms):
282
283
284
def main():
285
- is_idef_parser_enabled = hex_common.read_common_files()
286
+ args = hex_common.parse_common_args(
287
+ "Emit functions calling generated code implementing instruction semantics (helpers, idef-parser)"
288
+ )
289
tagregs = hex_common.get_tagregs()
290
tagimms = hex_common.get_tagimms()
291
292
- output_file = sys.argv[-1]
293
- with open(output_file, "w") as f:
294
+ with open(args.out, "w") as f:
295
f.write("#ifndef HEXAGON_TCG_FUNCS_H\n")
296
f.write("#define HEXAGON_TCG_FUNCS_H\n\n")
297
- if is_idef_parser_enabled:
298
+ if args.idef_parser:
299
f.write('#include "idef-generated-emitter.h.inc"\n\n')
300
301
for tag in hex_common.tags:
302
diff --git a/target/hexagon/gen_trans_funcs.py b/target/hexagon/gen_trans_funcs.py
303
index XXXXXXX..XXXXXXX 100755
304
--- a/target/hexagon/gen_trans_funcs.py
305
+++ b/target/hexagon/gen_trans_funcs.py
306
@@ -XXX,XX +XXX,XX @@
307
import textwrap
308
import iset
309
import hex_common
310
+import argparse
311
312
encs = {
313
tag: "".join(reversed(iset.iset[tag]["enc"].replace(" ", "")))
314
@@ -XXX,XX +XXX,XX @@ def gen_trans_funcs(f):
315
"""))
316
317
318
-if __name__ == "__main__":
319
- hex_common.read_semantics_file(sys.argv[1])
320
+def main():
321
+ parser = argparse.ArgumentParser(
322
+ description="Emit trans_*() functions to be called by " \
323
+ "instruction decoder"
324
+ )
325
+ parser.add_argument("semantics", help="semantics file")
326
+ parser.add_argument("out", help="output file")
327
+ args = parser.parse_args()
328
+ hex_common.read_semantics_file(args.semantics)
329
hex_common.init_registers()
330
- with open(sys.argv[2], "w") as f:
331
+ with open(args.out, "w") as f:
332
gen_trans_funcs(f)
333
+
334
+
335
+if __name__ == "__main__":
336
+ main()
337
diff --git a/target/hexagon/hex_common.py b/target/hexagon/hex_common.py
338
index XXXXXXX..XXXXXXX 100755
339
--- a/target/hexagon/hex_common.py
340
+++ b/target/hexagon/hex_common.py
341
@@ -XXX,XX +XXX,XX @@
342
import re
343
import string
344
import textwrap
345
+import argparse
346
347
behdict = {} # tag ->behavior
348
semdict = {} # tag -> semantics
349
@@ -XXX,XX +XXX,XX @@ def helper_args(tag, regs, imms):
350
return args
351
352
353
-def read_common_files():
354
- read_semantics_file(sys.argv[1])
355
- read_overrides_file(sys.argv[2])
356
- read_overrides_file(sys.argv[3])
357
- ## Whether or not idef-parser is enabled is
358
- ## determined by the number of arguments to
359
- ## this script:
360
- ##
361
- ## 4 args. -> not enabled,
362
- ## 5 args. -> idef-parser enabled.
363
- ##
364
- ## The 5:th arg. then holds a list of the successfully
365
- ## parsed instructions.
366
- is_idef_parser_enabled = len(sys.argv) > 5
367
- if is_idef_parser_enabled:
368
- read_idef_parser_enabled_file(sys.argv[4])
369
+def parse_common_args(desc):
370
+ parser = argparse.ArgumentParser(desc)
371
+ parser.add_argument("semantics", help="semantics file")
372
+ parser.add_argument("overrides", help="overrides file")
373
+ parser.add_argument("overrides_vec", help="vector overrides file")
374
+ parser.add_argument("out", help="output file")
375
+ parser.add_argument("--idef-parser",
376
+ help="file of instructions translated by idef-parser")
377
+ args = parser.parse_args()
378
+ read_semantics_file(args.semantics)
379
+ read_overrides_file(args.overrides)
380
+ read_overrides_file(args.overrides_vec)
381
+ if args.idef_parser:
382
+ read_idef_parser_enabled_file(args.idef_parser)
383
calculate_attribs()
384
init_registers()
385
- return is_idef_parser_enabled
386
+ return args
387
diff --git a/target/hexagon/meson.build b/target/hexagon/meson.build
388
index XXXXXXX..XXXXXXX 100644
389
--- a/target/hexagon/meson.build
390
+++ b/target/hexagon/meson.build
391
@@ -XXX,XX +XXX,XX @@ if idef_parser_enabled and 'hexagon-linux-user' in target_dirs
392
# Setup input and dependencies for the next step, this depends on whether or
393
# not idef-parser is enabled
394
helper_dep = [semantics_generated, idef_generated_tcg_c, idef_generated_tcg]
395
- helper_in = [semantics_generated, gen_tcg_h, gen_tcg_hvx_h, idef_generated_list]
396
+ helper_in = [semantics_generated, gen_tcg_h, gen_tcg_hvx_h, '--idef-parser', idef_generated_list]
397
else
398
# Setup input and dependencies for the next step, this depends on whether or
399
# not idef-parser is enabled
400
--
401
2.34.1
402
diff view generated by jsdifflib
New patch
1
From: Anton Johansson <anjo@rev.ng>
1
2
3
Adds restrict qualifier to HVX pointer arguments. This will allow the
4
compiler to produce better optimized code, as input vectors are now
5
assumed not to alias, and no runtime aliasing checks will be required.
6
7
Signed-off-by: Anton Johansson <anjo@rev.ng>
8
Reviewed-by: Brian Cain <brian.cain@oss.qualcomm.com>
9
Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
10
---
11
target/hexagon/mmvec/macros.h | 36 +++++++++++++++++------------------
12
1 file changed, 18 insertions(+), 18 deletions(-)
13
14
diff --git a/target/hexagon/mmvec/macros.h b/target/hexagon/mmvec/macros.h
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/hexagon/mmvec/macros.h
17
+++ b/target/hexagon/mmvec/macros.h
18
@@ -XXX,XX +XXX,XX @@
19
#include "mmvec/system_ext_mmvec.h"
20
21
#ifndef QEMU_GENERATE
22
-#define VdV (*(MMVector *)(VdV_void))
23
-#define VsV (*(MMVector *)(VsV_void))
24
-#define VuV (*(MMVector *)(VuV_void))
25
-#define VvV (*(MMVector *)(VvV_void))
26
-#define VwV (*(MMVector *)(VwV_void))
27
-#define VxV (*(MMVector *)(VxV_void))
28
-#define VyV (*(MMVector *)(VyV_void))
29
+#define VdV (*(MMVector *restrict)(VdV_void))
30
+#define VsV (*(MMVector *restrict)(VsV_void))
31
+#define VuV (*(MMVector *restrict)(VuV_void))
32
+#define VvV (*(MMVector *restrict)(VvV_void))
33
+#define VwV (*(MMVector *restrict)(VwV_void))
34
+#define VxV (*(MMVector *restrict)(VxV_void))
35
+#define VyV (*(MMVector *restrict)(VyV_void))
36
37
-#define VddV (*(MMVectorPair *)(VddV_void))
38
-#define VuuV (*(MMVectorPair *)(VuuV_void))
39
-#define VvvV (*(MMVectorPair *)(VvvV_void))
40
-#define VxxV (*(MMVectorPair *)(VxxV_void))
41
+#define VddV (*(MMVectorPair *restrict)(VddV_void))
42
+#define VuuV (*(MMVectorPair *restrict)(VuuV_void))
43
+#define VvvV (*(MMVectorPair *restrict)(VvvV_void))
44
+#define VxxV (*(MMVectorPair *restrict)(VxxV_void))
45
46
-#define QeV (*(MMQReg *)(QeV_void))
47
-#define QdV (*(MMQReg *)(QdV_void))
48
-#define QsV (*(MMQReg *)(QsV_void))
49
-#define QtV (*(MMQReg *)(QtV_void))
50
-#define QuV (*(MMQReg *)(QuV_void))
51
-#define QvV (*(MMQReg *)(QvV_void))
52
-#define QxV (*(MMQReg *)(QxV_void))
53
+#define QeV (*(MMQReg *restrict)(QeV_void))
54
+#define QdV (*(MMQReg *restrict)(QdV_void))
55
+#define QsV (*(MMQReg *restrict)(QsV_void))
56
+#define QtV (*(MMQReg *restrict)(QtV_void))
57
+#define QuV (*(MMQReg *restrict)(QuV_void))
58
+#define QvV (*(MMQReg *restrict)(QvV_void))
59
+#define QxV (*(MMQReg *restrict)(QxV_void))
60
#endif
61
62
#define LOG_VTCM_BYTE(VA, MASK, VAL, IDX) \
63
--
64
2.34.1
65
diff view generated by jsdifflib