1
The following changes since commit 05de778b5b8ab0b402996769117b88c7ea5c7c61:
1
Merge the first set of reviewed patches from my queue.
2
2
3
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging (2021-07-09 14:30:01 +0100)
3
r~
4
5
The following changes since commit 6dd06214892d71cbbdd25daed7693e58afcb1093:
6
7
Merge tag 'pull-hex-20230421' of https://github.com/quic/qemu into staging (2023-04-22 08:31:38 +0100)
4
8
5
are available in the Git repository at:
9
are available in the Git repository at:
6
10
7
https://gitlab.com/rth7680/qemu.git tags/pull-tcg-20210710
11
https://gitlab.com/rth7680/qemu.git tags/pull-tcg-20230423
8
12
9
for you to fetch changes up to ad1a706f386c2281adb0b09257d892735e405834:
13
for you to fetch changes up to 3ea9be33400f14305565a9a094cb6031c07183d5:
10
14
11
cpu: Add breakpoint tracepoints (2021-07-09 21:31:11 -0700)
15
tcg/riscv: Conditionalize tcg_out_exts_i32_i64 (2023-04-23 08:46:45 +0100)
12
16
13
----------------------------------------------------------------
17
----------------------------------------------------------------
14
Add translator_use_goto_tb.
18
tcg cleanups:
15
Cleanups in prep of breakpoint fixes.
19
- Remove tcg_abort()
16
Misc fixes.
20
- Split out extensions as known backend interfaces
21
- Put the separate extensions together as tcg_out_movext
22
- Introduce tcg_out_xchg as a backend interface
23
- Clear TCGLabelQemuLdst on allocation
24
- Avoid redundant extensions for riscv
17
25
18
----------------------------------------------------------------
26
----------------------------------------------------------------
19
Liren Wei (2):
27
Richard Henderson (15):
20
accel/tcg: Hoist tcg_tb_insert() up above tb_link_page()
28
tcg: Replace if + tcg_abort with tcg_debug_assert
21
tcg: Bake tb_destroy() into tcg_region_tree
29
tcg: Replace tcg_abort with g_assert_not_reached
30
tcg: Split out tcg_out_ext8s
31
tcg: Split out tcg_out_ext8u
32
tcg: Split out tcg_out_ext16s
33
tcg: Split out tcg_out_ext16u
34
tcg: Split out tcg_out_ext32s
35
tcg: Split out tcg_out_ext32u
36
tcg: Split out tcg_out_exts_i32_i64
37
tcg: Split out tcg_out_extu_i32_i64
38
tcg: Split out tcg_out_extrl_i64_i32
39
tcg: Introduce tcg_out_movext
40
tcg: Introduce tcg_out_xchg
41
tcg: Clear TCGLabelQemuLdst on allocation
42
tcg/riscv: Conditionalize tcg_out_exts_i32_i64
22
43
23
Philippe Mathieu-Daudé (1):
44
include/tcg/tcg.h | 6 --
24
tcg: Avoid including 'trace-tcg.h' in target translate.c
45
target/i386/tcg/translate.c | 20 +++---
25
46
target/s390x/tcg/translate.c | 4 +-
26
Richard Henderson (38):
47
tcg/optimize.c | 10 ++-
27
tcg: Add separator in INDEX_op_call dump
48
tcg/tcg.c | 135 +++++++++++++++++++++++++++++++++++----
28
tcg: Move tb_phys_invalidate_count to tb_ctx
49
tcg/aarch64/tcg-target.c.inc | 106 +++++++++++++++++++-----------
29
accel/tcg: Introduce translator_use_goto_tb
50
tcg/arm/tcg-target.c.inc | 93 +++++++++++++++++----------
30
target/alpha: Remove use_exit_tb
51
tcg/i386/tcg-target.c.inc | 129 ++++++++++++++++++-------------------
31
target/alpha: Remove in_superpage
52
tcg/loongarch64/tcg-target.c.inc | 123 +++++++++++++----------------------
32
target/alpha: Use translator_use_goto_tb
53
tcg/mips/tcg-target.c.inc | 94 +++++++++++++++++++--------
33
target/arm: Use DISAS_TOO_MANY for ISB and SB
54
tcg/ppc/tcg-target.c.inc | 119 ++++++++++++++++++----------------
34
target/arm: Use translator_use_goto_tb for aarch64
55
tcg/riscv/tcg-target.c.inc | 83 +++++++++++-------------
35
target/arm: Use translator_use_goto_tb for aarch32
56
tcg/s390x/tcg-target.c.inc | 128 +++++++++++++++++--------------------
36
target/avr: Use translator_use_goto_tb
57
tcg/sparc64/tcg-target.c.inc | 117 +++++++++++++++++++++------------
37
target/avr: Mark some helpers noreturn
58
tcg/tcg-ldst.c.inc | 1 +
38
target/cris: Use translator_use_goto_tb
59
tcg/tci/tcg-target.c.inc | 116 ++++++++++++++++++++++++++++++---
39
target/hppa: Use translator_use_goto_tb
60
16 files changed, 786 insertions(+), 498 deletions(-)
40
target/i386: Use translator_use_goto_tb
41
target/m68k: Use translator_use_goto_tb
42
target/microblaze: Use translator_use_goto_tb
43
target/mips: Use translator_use_goto_tb
44
target/mips: Fix missing else in gen_goto_tb
45
target/nios2: Use translator_use_goto_tb
46
target/openrisc: Use translator_use_goto_tb
47
target/ppc: Use translator_use_goto_tb
48
target/riscv: Use translator_use_goto_tb
49
target/rx: Use translator_use_goto_tb
50
target/s390x: Use translator_use_goto_tb
51
target/s390x: Remove use_exit_tb
52
target/sh4: Use translator_use_goto_tb
53
target/sparc: Use translator_use_goto_tb
54
target/tricore: Use translator_use_goto_tb
55
target/tricore: Use tcg_gen_lookup_and_goto_ptr
56
target/xtensa: Use translator_use_goto_tb
57
tcg: Fix prologue disassembly
58
target/i386: Use cpu_breakpoint_test in breakpoint_handler
59
accel/tcg: Move helper_lookup_tb_ptr to cpu-exec.c
60
accel/tcg: Move tb_lookup to cpu-exec.c
61
accel/tcg: Split out log_cpu_exec
62
accel/tcg: Log tb->cflags with -d exec
63
tcg: Remove TCG_TARGET_HAS_goto_ptr
64
cpu: Add breakpoint tracepoints
65
66
accel/tcg/tb-context.h | 1 +
67
accel/tcg/tb-lookup.h | 49 ----------------
68
include/exec/translator.h | 10 ++++
69
include/tcg/tcg-opc.h | 3 +-
70
include/tcg/tcg.h | 4 --
71
target/avr/helper.h | 8 +--
72
tcg/aarch64/tcg-target.h | 1 -
73
tcg/arm/tcg-target.h | 1 -
74
tcg/i386/tcg-target.h | 1 -
75
tcg/mips/tcg-target.h | 1 -
76
tcg/ppc/tcg-target.h | 1 -
77
tcg/riscv/tcg-target.h | 1 -
78
tcg/s390/tcg-target.h | 1 -
79
tcg/sparc/tcg-target.h | 1 -
80
tcg/tci/tcg-target.h | 1 -
81
accel/tcg/cpu-exec.c | 112 ++++++++++++++++++++++++++++--------
82
accel/tcg/tcg-runtime.c | 22 -------
83
accel/tcg/translate-all.c | 23 ++++----
84
accel/tcg/translator.c | 11 ++++
85
cpu.c | 13 +++--
86
target/alpha/translate.c | 47 ++-------------
87
target/arm/translate-a64.c | 26 ++-------
88
target/arm/translate-sve.c | 1 -
89
target/arm/translate.c | 17 +-----
90
target/avr/translate.c | 9 ++-
91
target/cris/translate.c | 6 +-
92
target/hppa/translate.c | 6 +-
93
target/i386/tcg/sysemu/bpt_helper.c | 12 +---
94
target/i386/tcg/translate.c | 15 +----
95
target/m68k/translate.c | 13 +----
96
target/microblaze/translate.c | 12 +---
97
target/mips/tcg/translate.c | 21 ++-----
98
target/nios2/translate.c | 15 +----
99
target/openrisc/translate.c | 16 +++---
100
target/ppc/translate.c | 11 +---
101
target/riscv/translate.c | 20 +------
102
target/rx/translate.c | 12 +---
103
target/s390x/translate.c | 19 +-----
104
target/sh4/translate.c | 12 +---
105
target/sparc/translate.c | 20 ++-----
106
target/tricore/translate.c | 20 ++-----
107
target/xtensa/translate.c | 7 +--
108
tcg/region.c | 33 +++--------
109
tcg/tcg-op.c | 2 +-
110
tcg/tcg.c | 14 ++---
111
trace-events | 5 ++
112
46 files changed, 217 insertions(+), 439 deletions(-)
113
delete mode 100644 accel/tcg/tb-lookup.h
114
diff view generated by jsdifflib
1
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3
---
3
---
4
cpu.c | 13 +++++++++----
4
tcg/tcg.c | 4 +---
5
trace-events | 5 +++++
5
tcg/i386/tcg-target.c.inc | 8 +++-----
6
2 files changed, 14 insertions(+), 4 deletions(-)
6
2 files changed, 4 insertions(+), 8 deletions(-)
7
7
8
diff --git a/cpu.c b/cpu.c
8
diff --git a/tcg/tcg.c b/tcg/tcg.c
9
index XXXXXXX..XXXXXXX 100644
9
index XXXXXXX..XXXXXXX 100644
10
--- a/cpu.c
10
--- a/tcg/tcg.c
11
+++ b/cpu.c
11
+++ b/tcg/tcg.c
12
@@ -XXX,XX +XXX,XX @@
12
@@ -XXX,XX +XXX,XX @@ static TCGTemp *tcg_global_reg_new_internal(TCGContext *s, TCGType type,
13
#include "exec/translate-all.h"
14
#include "exec/log.h"
15
#include "hw/core/accel-cpu.h"
16
+#include "trace/trace-root.h"
17
18
uintptr_t qemu_host_page_size;
19
intptr_t qemu_host_page_mask;
20
@@ -XXX,XX +XXX,XX @@ int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, int flags,
21
if (breakpoint) {
22
*breakpoint = bp;
23
}
24
+
25
+ trace_breakpoint_insert(cpu->cpu_index, pc, flags);
26
return 0;
27
}
28
29
@@ -XXX,XX +XXX,XX @@ int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, int flags)
30
}
31
32
/* Remove a specific breakpoint by reference. */
33
-void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBreakpoint *breakpoint)
34
+void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBreakpoint *bp)
35
{
13
{
36
- QTAILQ_REMOVE(&cpu->breakpoints, breakpoint, entry);
14
TCGTemp *ts;
37
+ QTAILQ_REMOVE(&cpu->breakpoints, bp, entry);
15
38
16
- if (TCG_TARGET_REG_BITS == 32 && type != TCG_TYPE_I32) {
39
- breakpoint_invalidate(cpu, breakpoint->pc);
17
- tcg_abort();
40
+ breakpoint_invalidate(cpu, bp->pc);
18
- }
41
19
+ tcg_debug_assert(TCG_TARGET_REG_BITS == 64 || type == TCG_TYPE_I32);
42
- g_free(breakpoint);
20
43
+ trace_breakpoint_remove(cpu->cpu_index, bp->pc, bp->flags);
21
ts = tcg_global_alloc(s);
44
+ g_free(bp);
22
ts->base_type = type;
45
}
23
diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc
46
24
index XXXXXXX..XXXXXXX 100644
47
/* Remove all matching breakpoints. */
25
--- a/tcg/i386/tcg-target.c.inc
48
@@ -XXX,XX +XXX,XX @@ void cpu_single_step(CPUState *cpu, int enabled)
26
+++ b/tcg/i386/tcg-target.c.inc
49
/* XXX: only flush what is necessary */
27
@@ -XXX,XX +XXX,XX @@ static void tcg_out_addi(TCGContext *s, int reg, tcg_target_long val)
50
tb_flush(cpu);
51
}
52
+ trace_breakpoint_singlestep(cpu->cpu_index, enabled);
53
}
28
}
54
}
29
}
55
30
56
diff --git a/trace-events b/trace-events
31
-/* Use SMALL != 0 to force a short forward branch. */
57
index XXXXXXX..XXXXXXX 100644
32
-static void tcg_out_jxx(TCGContext *s, int opc, TCGLabel *l, int small)
58
--- a/trace-events
33
+/* Set SMALL to force a short forward branch. */
59
+++ b/trace-events
34
+static void tcg_out_jxx(TCGContext *s, int opc, TCGLabel *l, bool small)
60
@@ -XXX,XX +XXX,XX @@
35
{
61
#
36
int32_t val, val1;
62
# The <format-string> should be a sprintf()-compatible format string.
37
63
38
@@ -XXX,XX +XXX,XX @@ static void tcg_out_jxx(TCGContext *s, int opc, TCGLabel *l, int small)
64
+# cpu.c
39
}
65
+breakpoint_insert(int cpu_index, uint64_t pc, int flags) "cpu=%d pc=0x%" PRIx64 " flags=0x%x"
40
tcg_out8(s, val1);
66
+breakpoint_remove(int cpu_index, uint64_t pc, int flags) "cpu=%d pc=0x%" PRIx64 " flags=0x%x"
41
} else {
67
+breakpoint_singlestep(int cpu_index, int enabled) "cpu=%d enable=%d"
42
- if (small) {
68
+
43
- tcg_abort();
69
# dma-helpers.c
44
- }
70
dma_blk_io(void *dbs, void *bs, int64_t offset, bool to_dev) "dbs=%p bs=%p offset=%" PRId64 " to_dev=%d"
45
+ tcg_debug_assert(!small);
71
dma_aio_cancel(void *dbs) "dbs=%p"
46
if (opc == -1) {
47
tcg_out8(s, OPC_JMP_long);
48
tcg_out32(s, val - 5);
72
--
49
--
73
2.25.1
50
2.34.1
74
51
75
52
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2
3
The root trace-events only declares a single TCG event:
4
5
$ git grep -w tcg trace-events
6
trace-events:115:# tcg/tcg-op.c
7
trace-events:137:vcpu tcg guest_mem_before(TCGv vaddr, uint16_t info) "info=%d", "vaddr=0x%016"PRIx64" info=%d"
8
9
and only a tcg/tcg-op.c uses it:
10
11
$ git grep -l trace_guest_mem_before_tcg
12
tcg/tcg-op.c
13
14
therefore it is pointless to include "trace-tcg.h" in each target
15
(because it is not used). Remove it.
16
17
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
18
Message-Id: <20210629050935.2570721-1-f4bug@amsat.org>
19
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
20
---
3
---
21
target/alpha/translate.c | 1 -
4
include/tcg/tcg.h | 6 ------
22
target/arm/translate-a64.c | 1 -
5
target/i386/tcg/translate.c | 20 ++++++++++----------
23
target/arm/translate-sve.c | 1 -
6
target/s390x/tcg/translate.c | 4 ++--
24
target/arm/translate.c | 1 -
7
tcg/optimize.c | 10 ++++------
25
target/cris/translate.c | 1 -
8
tcg/tcg.c | 8 ++++----
26
target/hppa/translate.c | 1 -
9
tcg/aarch64/tcg-target.c.inc | 4 ++--
27
target/i386/tcg/translate.c | 1 -
10
tcg/arm/tcg-target.c.inc | 2 +-
28
target/m68k/translate.c | 1 -
11
tcg/i386/tcg-target.c.inc | 14 +++++++-------
29
target/microblaze/translate.c | 1 -
12
tcg/mips/tcg-target.c.inc | 14 +++++++-------
30
target/mips/tcg/translate.c | 1 -
13
tcg/ppc/tcg-target.c.inc | 8 ++++----
31
target/openrisc/translate.c | 1 -
14
tcg/s390x/tcg-target.c.inc | 8 ++++----
32
target/ppc/translate.c | 1 -
15
tcg/sparc64/tcg-target.c.inc | 2 +-
33
target/rx/translate.c | 1 -
16
tcg/tci/tcg-target.c.inc | 2 +-
34
target/s390x/translate.c | 1 -
17
13 files changed, 47 insertions(+), 55 deletions(-)
35
target/sh4/translate.c | 1 -
36
target/sparc/translate.c | 1 -
37
target/xtensa/translate.c | 1 -
38
17 files changed, 17 deletions(-)
39
18
40
diff --git a/target/alpha/translate.c b/target/alpha/translate.c
19
diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h
41
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
42
--- a/target/alpha/translate.c
21
--- a/include/tcg/tcg.h
43
+++ b/target/alpha/translate.c
22
+++ b/include/tcg/tcg.h
44
@@ -XXX,XX +XXX,XX @@
23
@@ -XXX,XX +XXX,XX @@ typedef struct TCGTargetOpDef {
45
#include "exec/cpu_ldst.h"
24
const char *args_ct_str[TCG_MAX_OP_ARGS];
46
#include "exec/helper-proto.h"
25
} TCGTargetOpDef;
47
#include "exec/helper-gen.h"
26
48
-#include "trace-tcg.h"
27
-#define tcg_abort() \
49
#include "exec/translator.h"
28
-do {\
50
#include "exec/log.h"
29
- fprintf(stderr, "%s:%d: tcg fatal error\n", __FILE__, __LINE__);\
51
30
- abort();\
52
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
31
-} while (0)
53
index XXXXXXX..XXXXXXX 100644
32
-
54
--- a/target/arm/translate-a64.c
33
bool tcg_op_supported(TCGOpcode op);
55
+++ b/target/arm/translate-a64.c
34
56
@@ -XXX,XX +XXX,XX @@
35
void tcg_gen_callN(void *func, TCGTemp *ret, int nargs, TCGTemp **args);
57
#include "exec/helper-gen.h"
58
#include "exec/log.h"
59
60
-#include "trace-tcg.h"
61
#include "translate-a64.h"
62
#include "qemu/atomic128.h"
63
64
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
65
index XXXXXXX..XXXXXXX 100644
66
--- a/target/arm/translate-sve.c
67
+++ b/target/arm/translate-sve.c
68
@@ -XXX,XX +XXX,XX @@
69
#include "exec/helper-proto.h"
70
#include "exec/helper-gen.h"
71
#include "exec/log.h"
72
-#include "trace-tcg.h"
73
#include "translate-a64.h"
74
#include "fpu/softfloat.h"
75
76
diff --git a/target/arm/translate.c b/target/arm/translate.c
77
index XXXXXXX..XXXXXXX 100644
78
--- a/target/arm/translate.c
79
+++ b/target/arm/translate.c
80
@@ -XXX,XX +XXX,XX @@
81
#include "exec/helper-proto.h"
82
#include "exec/helper-gen.h"
83
84
-#include "trace-tcg.h"
85
#include "exec/log.h"
86
87
88
diff --git a/target/cris/translate.c b/target/cris/translate.c
89
index XXXXXXX..XXXXXXX 100644
90
--- a/target/cris/translate.c
91
+++ b/target/cris/translate.c
92
@@ -XXX,XX +XXX,XX @@
93
94
#include "exec/helper-gen.h"
95
96
-#include "trace-tcg.h"
97
#include "exec/log.h"
98
99
100
diff --git a/target/hppa/translate.c b/target/hppa/translate.c
101
index XXXXXXX..XXXXXXX 100644
102
--- a/target/hppa/translate.c
103
+++ b/target/hppa/translate.c
104
@@ -XXX,XX +XXX,XX @@
105
#include "exec/helper-proto.h"
106
#include "exec/helper-gen.h"
107
#include "exec/translator.h"
108
-#include "trace-tcg.h"
109
#include "exec/log.h"
110
111
/* Since we have a distinction between register size and address size,
112
diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
36
diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
113
index XXXXXXX..XXXXXXX 100644
37
index XXXXXXX..XXXXXXX 100644
114
--- a/target/i386/tcg/translate.c
38
--- a/target/i386/tcg/translate.c
115
+++ b/target/i386/tcg/translate.c
39
+++ b/target/i386/tcg/translate.c
116
@@ -XXX,XX +XXX,XX @@
40
@@ -XXX,XX +XXX,XX @@ static TCGv gen_op_deposit_reg_v(DisasContext *s, MemOp ot, int reg, TCGv dest,
117
#include "exec/helper-gen.h"
41
break;
118
#include "helper-tcg.h"
42
#endif
119
43
default:
120
-#include "trace-tcg.h"
44
- tcg_abort();
121
#include "exec/log.h"
45
+ g_assert_not_reached();
122
46
}
123
#define PREFIX_REPZ 0x01
47
return cpu_regs[reg];
124
diff --git a/target/m68k/translate.c b/target/m68k/translate.c
48
}
125
index XXXXXXX..XXXXXXX 100644
49
@@ -XXX,XX +XXX,XX @@ static void gen_lea_v_seg(DisasContext *s, MemOp aflag, TCGv a0,
126
--- a/target/m68k/translate.c
50
}
127
+++ b/target/m68k/translate.c
51
break;
128
@@ -XXX,XX +XXX,XX @@
52
default:
129
#include "exec/helper-proto.h"
53
- tcg_abort();
130
#include "exec/helper-gen.h"
54
+ g_assert_not_reached();
131
55
}
132
-#include "trace-tcg.h"
56
133
#include "exec/log.h"
57
if (ovr_seg >= 0) {
134
#include "fpu/softfloat.h"
58
@@ -XXX,XX +XXX,XX @@ static void gen_helper_in_func(MemOp ot, TCGv v, TCGv_i32 n)
135
59
gen_helper_inl(v, cpu_env, n);
136
diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c
60
break;
137
index XXXXXXX..XXXXXXX 100644
61
default:
138
--- a/target/microblaze/translate.c
62
- tcg_abort();
139
+++ b/target/microblaze/translate.c
63
+ g_assert_not_reached();
140
@@ -XXX,XX +XXX,XX @@
64
}
141
#include "exec/translator.h"
65
}
142
#include "qemu/qemu-print.h"
66
143
67
@@ -XXX,XX +XXX,XX @@ static void gen_helper_out_func(MemOp ot, TCGv_i32 v, TCGv_i32 n)
144
-#include "trace-tcg.h"
68
gen_helper_outl(cpu_env, v, n);
145
#include "exec/log.h"
69
break;
146
70
default:
147
#define EXTRACT_FIELD(src, start, end) \
71
- tcg_abort();
148
diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c
72
+ g_assert_not_reached();
149
index XXXXXXX..XXXXXXX 100644
73
}
150
--- a/target/mips/tcg/translate.c
74
}
151
+++ b/target/mips/tcg/translate.c
75
152
@@ -XXX,XX +XXX,XX @@
76
@@ -XXX,XX +XXX,XX @@ static void gen_rotc_rm_T1(DisasContext *s, MemOp ot, int op1,
153
#include "semihosting/semihost.h"
77
break;
154
78
#endif
155
#include "trace.h"
79
default:
156
-#include "trace-tcg.h"
80
- tcg_abort();
157
#include "exec/translator.h"
81
+ g_assert_not_reached();
158
#include "exec/log.h"
82
}
159
#include "qemu/qemu-print.h"
83
} else {
160
diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c
84
switch (ot) {
161
index XXXXXXX..XXXXXXX 100644
85
@@ -XXX,XX +XXX,XX @@ static void gen_rotc_rm_T1(DisasContext *s, MemOp ot, int op1,
162
--- a/target/openrisc/translate.c
86
break;
163
+++ b/target/openrisc/translate.c
87
#endif
164
@@ -XXX,XX +XXX,XX @@
88
default:
165
#include "exec/helper-gen.h"
89
- tcg_abort();
166
#include "exec/gen-icount.h"
90
+ g_assert_not_reached();
167
91
}
168
-#include "trace-tcg.h"
92
}
169
#include "exec/log.h"
93
/* store */
170
94
@@ -XXX,XX +XXX,XX @@ static AddressParts gen_lea_modrm_0(CPUX86State *env, DisasContext *s,
171
/* is_jmp field values */
95
break;
172
diff --git a/target/ppc/translate.c b/target/ppc/translate.c
96
173
index XXXXXXX..XXXXXXX 100644
97
default:
174
--- a/target/ppc/translate.c
98
- tcg_abort();
175
+++ b/target/ppc/translate.c
99
+ g_assert_not_reached();
176
@@ -XXX,XX +XXX,XX @@
100
}
177
#include "exec/helper-proto.h"
101
178
#include "exec/helper-gen.h"
102
done:
179
103
@@ -XXX,XX +XXX,XX @@ static inline uint32_t insn_get(CPUX86State *env, DisasContext *s, MemOp ot)
180
-#include "trace-tcg.h"
104
ret = x86_ldl_code(env, s);
181
#include "exec/translator.h"
105
break;
182
#include "exec/log.h"
106
default:
183
#include "qemu/atomic128.h"
107
- tcg_abort();
184
diff --git a/target/rx/translate.c b/target/rx/translate.c
108
+ g_assert_not_reached();
185
index XXXXXXX..XXXXXXX 100644
109
}
186
--- a/target/rx/translate.c
110
return ret;
187
+++ b/target/rx/translate.c
111
}
188
@@ -XXX,XX +XXX,XX @@
112
@@ -XXX,XX +XXX,XX @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
189
#include "exec/helper-proto.h"
113
gen_op_mov_reg_v(s, MO_16, R_EAX, s->T0);
190
#include "exec/helper-gen.h"
114
break;
191
#include "exec/translator.h"
115
default:
192
-#include "trace-tcg.h"
116
- tcg_abort();
193
#include "exec/log.h"
117
+ g_assert_not_reached();
194
118
}
195
typedef struct DisasContext {
119
break;
196
diff --git a/target/s390x/translate.c b/target/s390x/translate.c
120
case 0x99: /* CDQ/CWD */
197
index XXXXXXX..XXXXXXX 100644
121
@@ -XXX,XX +XXX,XX @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
198
--- a/target/s390x/translate.c
122
gen_op_mov_reg_v(s, MO_16, R_EDX, s->T0);
199
+++ b/target/s390x/translate.c
123
break;
200
@@ -XXX,XX +XXX,XX @@
124
default:
201
#include "exec/helper-proto.h"
125
- tcg_abort();
202
#include "exec/helper-gen.h"
126
+ g_assert_not_reached();
203
127
}
204
-#include "trace-tcg.h"
128
break;
205
#include "exec/translator.h"
129
case 0x1af: /* imul Gv, Ev */
206
#include "exec/log.h"
130
diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
207
#include "qemu/atomic128.h"
131
index XXXXXXX..XXXXXXX 100644
208
diff --git a/target/sh4/translate.c b/target/sh4/translate.c
132
--- a/target/s390x/tcg/translate.c
209
index XXXXXXX..XXXXXXX 100644
133
+++ b/target/s390x/tcg/translate.c
210
--- a/target/sh4/translate.c
134
@@ -XXX,XX +XXX,XX @@ static int get_mem_index(DisasContext *s)
211
+++ b/target/sh4/translate.c
135
case PSW_ASC_HOME >> FLAG_MASK_PSW_SHIFT:
212
@@ -XXX,XX +XXX,XX @@
136
return MMU_HOME_IDX;
213
#include "exec/helper-proto.h"
137
default:
214
#include "exec/helper-gen.h"
138
- tcg_abort();
215
#include "exec/translator.h"
139
+ g_assert_not_reached();
216
-#include "trace-tcg.h"
140
break;
217
#include "exec/log.h"
141
}
218
#include "qemu/qemu-print.h"
142
#endif
219
143
@@ -XXX,XX +XXX,XX @@ static void gen_op_calc_cc(DisasContext *s)
220
diff --git a/target/sparc/translate.c b/target/sparc/translate.c
144
gen_helper_calc_cc(cc_op, cpu_env, cc_op, cc_src, cc_dst, cc_vr);
221
index XXXXXXX..XXXXXXX 100644
145
break;
222
--- a/target/sparc/translate.c
146
default:
223
+++ b/target/sparc/translate.c
147
- tcg_abort();
224
@@ -XXX,XX +XXX,XX @@
148
+ g_assert_not_reached();
225
149
}
226
#include "exec/helper-gen.h"
150
227
151
/* We now have cc in cc_op as constant */
228
-#include "trace-tcg.h"
152
diff --git a/tcg/optimize.c b/tcg/optimize.c
229
#include "exec/translator.h"
153
index XXXXXXX..XXXXXXX 100644
230
#include "exec/log.h"
154
--- a/tcg/optimize.c
231
#include "asi.h"
155
+++ b/tcg/optimize.c
232
diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c
156
@@ -XXX,XX +XXX,XX @@ static uint64_t do_constant_folding_2(TCGOpcode op, uint64_t x, uint64_t y)
233
index XXXXXXX..XXXXXXX 100644
157
return (uint64_t)x % ((uint64_t)y ? : 1);
234
--- a/target/xtensa/translate.c
158
235
+++ b/target/xtensa/translate.c
159
default:
236
@@ -XXX,XX +XXX,XX @@
160
- fprintf(stderr,
237
#include "exec/helper-proto.h"
161
- "Unrecognized operation %d in do_constant_folding.\n", op);
238
#include "exec/helper-gen.h"
162
- tcg_abort();
239
163
+ g_assert_not_reached();
240
-#include "trace-tcg.h"
164
}
241
#include "exec/log.h"
165
}
242
166
167
@@ -XXX,XX +XXX,XX @@ static bool do_constant_folding_cond_32(uint32_t x, uint32_t y, TCGCond c)
168
case TCG_COND_GTU:
169
return x > y;
170
default:
171
- tcg_abort();
172
+ g_assert_not_reached();
173
}
174
}
175
176
@@ -XXX,XX +XXX,XX @@ static bool do_constant_folding_cond_64(uint64_t x, uint64_t y, TCGCond c)
177
case TCG_COND_GTU:
178
return x > y;
179
default:
180
- tcg_abort();
181
+ g_assert_not_reached();
182
}
183
}
184
185
@@ -XXX,XX +XXX,XX @@ static bool do_constant_folding_cond_eq(TCGCond c)
186
case TCG_COND_EQ:
187
return 1;
188
default:
189
- tcg_abort();
190
+ g_assert_not_reached();
191
}
192
}
193
194
diff --git a/tcg/tcg.c b/tcg/tcg.c
195
index XXXXXXX..XXXXXXX 100644
196
--- a/tcg/tcg.c
197
+++ b/tcg/tcg.c
198
@@ -XXX,XX +XXX,XX @@ static void temp_sync(TCGContext *s, TCGTemp *ts, TCGRegSet allocated_regs,
199
200
case TEMP_VAL_DEAD:
201
default:
202
- tcg_abort();
203
+ g_assert_not_reached();
204
}
205
ts->mem_coherent = 1;
206
}
207
@@ -XXX,XX +XXX,XX @@ static TCGReg tcg_reg_alloc(TCGContext *s, TCGRegSet required_regs,
208
}
209
}
210
211
- tcg_abort();
212
+ g_assert_not_reached();
213
}
214
215
static TCGReg tcg_reg_alloc_pair(TCGContext *s, TCGRegSet required_regs,
216
@@ -XXX,XX +XXX,XX @@ static TCGReg tcg_reg_alloc_pair(TCGContext *s, TCGRegSet required_regs,
217
}
218
}
219
}
220
- tcg_abort();
221
+ g_assert_not_reached();
222
}
223
224
/* Make sure the temporary is in a register. If needed, allocate the register
225
@@ -XXX,XX +XXX,XX @@ static void temp_load(TCGContext *s, TCGTemp *ts, TCGRegSet desired_regs,
226
break;
227
case TEMP_VAL_DEAD:
228
default:
229
- tcg_abort();
230
+ g_assert_not_reached();
231
}
232
set_temp_val_reg(s, ts, reg);
233
}
234
diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc
235
index XXXXXXX..XXXXXXX 100644
236
--- a/tcg/aarch64/tcg-target.c.inc
237
+++ b/tcg/aarch64/tcg-target.c.inc
238
@@ -XXX,XX +XXX,XX @@ static void tcg_out_qemu_ld_direct(TCGContext *s, MemOp memop, TCGType ext,
239
tcg_out_ldst_r(s, I3312_LDRX, data_r, addr_r, otype, off_r);
240
break;
241
default:
242
- tcg_abort();
243
+ g_assert_not_reached();
244
}
245
}
246
247
@@ -XXX,XX +XXX,XX @@ static void tcg_out_qemu_st_direct(TCGContext *s, MemOp memop,
248
tcg_out_ldst_r(s, I3312_STRX, data_r, addr_r, otype, off_r);
249
break;
250
default:
251
- tcg_abort();
252
+ g_assert_not_reached();
253
}
254
}
255
256
diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc
257
index XXXXXXX..XXXXXXX 100644
258
--- a/tcg/arm/tcg-target.c.inc
259
+++ b/tcg/arm/tcg-target.c.inc
260
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
261
case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */
262
case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
263
default:
264
- tcg_abort();
265
+ g_assert_not_reached();
266
}
267
}
268
269
diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc
270
index XXXXXXX..XXXXXXX 100644
271
--- a/tcg/i386/tcg-target.c.inc
272
+++ b/tcg/i386/tcg-target.c.inc
273
@@ -XXX,XX +XXX,XX @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int type,
274
tcg_patch8(code_ptr, value);
275
break;
276
default:
277
- tcg_abort();
278
+ g_assert_not_reached();
279
}
280
return true;
281
}
282
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_pushi(TCGContext *s, tcg_target_long val)
283
tcg_out_opc(s, OPC_PUSH_Iv, 0, 0, 0);
284
tcg_out32(s, val);
285
} else {
286
- tcg_abort();
287
+ g_assert_not_reached();
288
}
289
}
290
291
@@ -XXX,XX +XXX,XX @@ static void tgen_arithi(TCGContext *s, int c, int r0,
292
return;
293
}
294
295
- tcg_abort();
296
+ g_assert_not_reached();
297
}
298
299
static void tcg_out_addi(TCGContext *s, int reg, tcg_target_long val)
300
@@ -XXX,XX +XXX,XX @@ static void tcg_out_brcond2(TCGContext *s, const TCGArg *args,
301
label_this, small);
302
break;
303
default:
304
- tcg_abort();
305
+ g_assert_not_reached();
306
}
307
tcg_out_label(s, label_next);
308
}
309
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *l)
310
}
311
break;
312
default:
313
- tcg_abort();
314
+ g_assert_not_reached();
315
}
316
317
/* Jump to the code corresponding to next IR of qemu_st */
318
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
319
/* load bits 0..15 */
320
tcg_out_modrm(s, OPC_MOVL_EvGv | P_DATA16, a2, a0);
321
} else {
322
- tcg_abort();
323
+ g_assert_not_reached();
324
}
325
break;
326
327
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
328
case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */
329
case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
330
default:
331
- tcg_abort();
332
+ g_assert_not_reached();
333
}
334
335
#undef OP_32_64
336
diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc
337
index XXXXXXX..XXXXXXX 100644
338
--- a/tcg/mips/tcg-target.c.inc
339
+++ b/tcg/mips/tcg-target.c.inc
340
@@ -XXX,XX +XXX,XX @@ static void tcg_out_setcond(TCGContext *s, TCGCond cond, TCGReg ret,
341
break;
342
343
default:
344
- tcg_abort();
345
+ g_assert_not_reached();
346
break;
347
}
348
}
349
@@ -XXX,XX +XXX,XX @@ static void tcg_out_brcond(TCGContext *s, TCGCond cond, TCGReg arg1,
350
break;
351
352
default:
353
- tcg_abort();
354
+ g_assert_not_reached();
355
break;
356
}
357
358
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *l)
359
}
360
break;
361
default:
362
- tcg_abort();
363
+ g_assert_not_reached();
364
}
365
i = tcg_out_call_iarg_imm(s, i, oi);
366
367
@@ -XXX,XX +XXX,XX @@ static void tcg_out_qemu_ld_direct(TCGContext *s, TCGReg lo, TCGReg hi,
368
}
369
break;
370
default:
371
- tcg_abort();
372
+ g_assert_not_reached();
373
}
374
}
375
376
@@ -XXX,XX +XXX,XX @@ static void tcg_out_qemu_st_direct(TCGContext *s, TCGReg lo, TCGReg hi,
377
break;
378
379
default:
380
- tcg_abort();
381
+ g_assert_not_reached();
382
}
383
}
384
385
@@ -XXX,XX +XXX,XX @@ static void tcg_out_qemu_st_unalign(TCGContext *s, TCGReg lo, TCGReg hi,
386
break;
387
388
default:
389
- tcg_abort();
390
+ g_assert_not_reached();
391
}
392
}
393
static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, bool is_64)
394
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
395
case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */
396
case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
397
default:
398
- tcg_abort();
399
+ g_assert_not_reached();
400
}
401
}
402
403
diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc
404
index XXXXXXX..XXXXXXX 100644
405
--- a/tcg/ppc/tcg-target.c.inc
406
+++ b/tcg/ppc/tcg-target.c.inc
407
@@ -XXX,XX +XXX,XX @@ static void tcg_out_cmp(TCGContext *s, int cond, TCGArg arg1, TCGArg arg2,
408
break;
409
410
default:
411
- tcg_abort();
412
+ g_assert_not_reached();
413
}
414
op |= BF(cr) | ((type == TCG_TYPE_I64) << 21);
415
416
@@ -XXX,XX +XXX,XX @@ static void tcg_out_setcond(TCGContext *s, TCGType type, TCGCond cond,
417
break;
418
419
default:
420
- tcg_abort();
421
+ g_assert_not_reached();
422
}
423
}
424
425
@@ -XXX,XX +XXX,XX @@ static void tcg_out_cmp2(TCGContext *s, const TCGArg *args,
426
break;
427
428
default:
429
- tcg_abort();
430
+ g_assert_not_reached();
431
}
432
}
433
434
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
435
case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */
436
case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
437
default:
438
- tcg_abort();
439
+ g_assert_not_reached();
440
}
441
}
442
443
diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc
444
index XXXXXXX..XXXXXXX 100644
445
--- a/tcg/s390x/tcg-target.c.inc
446
+++ b/tcg/s390x/tcg-target.c.inc
447
@@ -XXX,XX +XXX,XX @@ static void tcg_out_qemu_ld_direct(TCGContext *s, MemOp opc, TCGReg data,
448
break;
449
450
default:
451
- tcg_abort();
452
+ g_assert_not_reached();
453
}
454
}
455
456
@@ -XXX,XX +XXX,XX @@ static void tcg_out_qemu_st_direct(TCGContext *s, MemOp opc, TCGReg data,
457
break;
458
459
default:
460
- tcg_abort();
461
+ g_assert_not_reached();
462
}
463
}
464
465
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *lb)
466
tcg_out_mov(s, TCG_TYPE_I64, TCG_REG_R4, data_reg);
467
break;
468
default:
469
- tcg_abort();
470
+ g_assert_not_reached();
471
}
472
tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_R5, oi);
473
tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_R6, (uintptr_t)lb->raddr);
474
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
475
case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */
476
case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
477
default:
478
- tcg_abort();
479
+ g_assert_not_reached();
480
}
481
}
482
483
diff --git a/tcg/sparc64/tcg-target.c.inc b/tcg/sparc64/tcg-target.c.inc
484
index XXXXXXX..XXXXXXX 100644
485
--- a/tcg/sparc64/tcg-target.c.inc
486
+++ b/tcg/sparc64/tcg-target.c.inc
487
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
488
case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */
489
case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
490
default:
491
- tcg_abort();
492
+ g_assert_not_reached();
493
}
494
}
495
496
diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc
497
index XXXXXXX..XXXXXXX 100644
498
--- a/tcg/tci/tcg-target.c.inc
499
+++ b/tcg/tci/tcg-target.c.inc
500
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
501
case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */
502
case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
503
default:
504
- tcg_abort();
505
+ g_assert_not_reached();
506
}
507
}
243
508
244
--
509
--
245
2.25.1
510
2.34.1
246
511
247
512
diff view generated by jsdifflib
1
The non-single-step case of gen_goto_tb may use
1
We will need a backend interface for performing 8-bit sign-extend.
2
tcg_gen_lookup_and_goto_ptr to indirectly chain.
2
Use it in tcg_reg_alloc_op in the meantime.
3
3
4
Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
4
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
6
---
7
target/tricore/translate.c | 3 ++-
7
tcg/tcg.c | 21 ++++++++++++++++-----
8
1 file changed, 2 insertions(+), 1 deletion(-)
8
tcg/aarch64/tcg-target.c.inc | 11 +++++++----
9
tcg/arm/tcg-target.c.inc | 10 ++++------
10
tcg/i386/tcg-target.c.inc | 10 +++++-----
11
tcg/loongarch64/tcg-target.c.inc | 11 ++++-------
12
tcg/mips/tcg-target.c.inc | 12 ++++++++----
13
tcg/ppc/tcg-target.c.inc | 10 ++++------
14
tcg/riscv/tcg-target.c.inc | 9 +++------
15
tcg/s390x/tcg-target.c.inc | 10 +++-------
16
tcg/sparc64/tcg-target.c.inc | 7 +++++++
17
tcg/tci/tcg-target.c.inc | 21 ++++++++++++++++++++-
18
11 files changed, 81 insertions(+), 51 deletions(-)
9
19
10
diff --git a/target/tricore/translate.c b/target/tricore/translate.c
20
diff --git a/tcg/tcg.c b/tcg/tcg.c
11
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
12
--- a/target/tricore/translate.c
22
--- a/tcg/tcg.c
13
+++ b/target/tricore/translate.c
23
+++ b/tcg/tcg.c
14
@@ -XXX,XX +XXX,XX @@ static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
24
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg1,
15
gen_save_pc(dest);
25
static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg);
16
if (ctx->base.singlestep_enabled) {
26
static void tcg_out_movi(TCGContext *s, TCGType type,
17
generate_qemu_excp(ctx, EXCP_DEBUG);
27
TCGReg ret, tcg_target_long arg);
28
+static void tcg_out_ext8s(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg);
29
static void tcg_out_addi_ptr(TCGContext *s, TCGReg, TCGReg, tcg_target_long);
30
static void tcg_out_exit_tb(TCGContext *s, uintptr_t arg);
31
static void tcg_out_goto_tb(TCGContext *s, int which);
32
@@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op)
33
}
34
35
/* emit instruction */
36
- if (def->flags & TCG_OPF_VECTOR) {
37
- tcg_out_vec_op(s, op->opc, TCGOP_VECL(op), TCGOP_VECE(op),
38
- new_args, const_args);
39
- } else {
40
- tcg_out_op(s, op->opc, new_args, const_args);
41
+ switch (op->opc) {
42
+ case INDEX_op_ext8s_i32:
43
+ tcg_out_ext8s(s, TCG_TYPE_I32, new_args[0], new_args[1]);
44
+ break;
45
+ case INDEX_op_ext8s_i64:
46
+ tcg_out_ext8s(s, TCG_TYPE_I64, new_args[0], new_args[1]);
47
+ break;
48
+ default:
49
+ if (def->flags & TCG_OPF_VECTOR) {
50
+ tcg_out_vec_op(s, op->opc, TCGOP_VECL(op), TCGOP_VECE(op),
51
+ new_args, const_args);
18
+ } else {
52
+ } else {
19
+ tcg_gen_lookup_and_goto_ptr();
53
+ tcg_out_op(s, op->opc, new_args, const_args);
54
+ }
55
+ break;
56
}
57
58
/* move the outputs in the correct register if needed */
59
diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc
60
index XXXXXXX..XXXXXXX 100644
61
--- a/tcg/aarch64/tcg-target.c.inc
62
+++ b/tcg/aarch64/tcg-target.c.inc
63
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_sxt(TCGContext *s, TCGType ext, MemOp s_bits,
64
tcg_out_sbfm(s, ext, rd, rn, 0, bits);
65
}
66
67
+static void tcg_out_ext8s(TCGContext *s, TCGType type, TCGReg rd, TCGReg rn)
68
+{
69
+ tcg_out_sxt(s, type, MO_8, rd, rn);
70
+}
71
+
72
static inline void tcg_out_uxt(TCGContext *s, MemOp s_bits,
73
TCGReg rd, TCGReg rn)
74
{
75
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
20
}
76
}
21
- tcg_gen_exit_tb(NULL, 0);
77
break;
22
}
78
23
}
79
- case INDEX_op_ext8s_i64:
24
80
- case INDEX_op_ext8s_i32:
81
- tcg_out_sxt(s, ext, MO_8, a0, a1);
82
- break;
83
case INDEX_op_ext16s_i64:
84
case INDEX_op_ext16s_i32:
85
tcg_out_sxt(s, ext, MO_16, a0, a1);
86
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
87
case INDEX_op_call: /* Always emitted via tcg_out_call. */
88
case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */
89
case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
90
+ case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */
91
+ case INDEX_op_ext8s_i64:
92
default:
93
g_assert_not_reached();
94
}
95
diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc
96
index XXXXXXX..XXXXXXX 100644
97
--- a/tcg/arm/tcg-target.c.inc
98
+++ b/tcg/arm/tcg-target.c.inc
99
@@ -XXX,XX +XXX,XX @@ static void tcg_out_udiv(TCGContext *s, ARMCond cond,
100
tcg_out32(s, 0x0730f010 | (cond << 28) | (rd << 16) | rn | (rm << 8));
101
}
102
103
-static void tcg_out_ext8s(TCGContext *s, ARMCond cond, TCGReg rd, TCGReg rn)
104
+static void tcg_out_ext8s(TCGContext *s, TCGType t, TCGReg rd, TCGReg rn)
105
{
106
/* sxtb */
107
- tcg_out32(s, 0x06af0070 | (cond << 28) | (rd << 12) | rn);
108
+ tcg_out32(s, 0x06af0070 | (COND_AL << 28) | (rd << 12) | rn);
109
}
110
111
static void __attribute__((unused))
112
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *lb)
113
datahi = lb->datahi_reg;
114
switch (opc & MO_SSIZE) {
115
case MO_SB:
116
- tcg_out_ext8s(s, COND_AL, datalo, TCG_REG_R0);
117
+ tcg_out_ext8s(s, TCG_TYPE_I32, datalo, TCG_REG_R0);
118
break;
119
case MO_SW:
120
tcg_out_ext16s(s, COND_AL, datalo, TCG_REG_R0);
121
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
122
tcg_out_bswap32(s, COND_AL, args[0], args[1]);
123
break;
124
125
- case INDEX_op_ext8s_i32:
126
- tcg_out_ext8s(s, COND_AL, args[0], args[1]);
127
- break;
128
case INDEX_op_ext16s_i32:
129
tcg_out_ext16s(s, COND_AL, args[0], args[1]);
130
break;
131
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
132
case INDEX_op_call: /* Always emitted via tcg_out_call. */
133
case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */
134
case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
135
+ case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */
136
default:
137
g_assert_not_reached();
138
}
139
diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc
140
index XXXXXXX..XXXXXXX 100644
141
--- a/tcg/i386/tcg-target.c.inc
142
+++ b/tcg/i386/tcg-target.c.inc
143
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_ext8u(TCGContext *s, int dest, int src)
144
tcg_out_modrm(s, OPC_MOVZBL + P_REXB_RM, dest, src);
145
}
146
147
-static void tcg_out_ext8s(TCGContext *s, int dest, int src, int rexw)
148
+static void tcg_out_ext8s(TCGContext *s, TCGType type, TCGReg dest, TCGReg src)
149
{
150
+ int rexw = type == TCG_TYPE_I32 ? 0 : P_REXW;
151
/* movsbl */
152
tcg_debug_assert(src < 4 || TCG_TARGET_REG_BITS == 64);
153
tcg_out_modrm(s, OPC_MOVSBL + P_REXB_RM + rexw, dest, src);
154
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *l)
155
data_reg = l->datalo_reg;
156
switch (opc & MO_SSIZE) {
157
case MO_SB:
158
- tcg_out_ext8s(s, data_reg, TCG_REG_EAX, rexw);
159
+ tcg_out_ext8s(s, l->type, data_reg, TCG_REG_EAX);
160
break;
161
case MO_SW:
162
tcg_out_ext16s(s, data_reg, TCG_REG_EAX, rexw);
163
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
164
tcg_out_modrm(s, OPC_GRP3_Ev + rexw, EXT3_NOT, a0);
165
break;
166
167
- OP_32_64(ext8s):
168
- tcg_out_ext8s(s, a0, a1, rexw);
169
- break;
170
OP_32_64(ext16s):
171
tcg_out_ext16s(s, a0, a1, rexw);
172
break;
173
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
174
case INDEX_op_call: /* Always emitted via tcg_out_call. */
175
case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */
176
case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
177
+ case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */
178
+ case INDEX_op_ext8s_i64:
179
default:
180
g_assert_not_reached();
181
}
182
diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc
183
index XXXXXXX..XXXXXXX 100644
184
--- a/tcg/loongarch64/tcg-target.c.inc
185
+++ b/tcg/loongarch64/tcg-target.c.inc
186
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext32u(TCGContext *s, TCGReg ret, TCGReg arg)
187
tcg_out_opc_bstrpick_d(s, ret, arg, 0, 31);
188
}
189
190
-static void tcg_out_ext8s(TCGContext *s, TCGReg ret, TCGReg arg)
191
+static void tcg_out_ext8s(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg)
192
{
193
tcg_out_opc_sext_b(s, ret, arg);
194
}
195
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *l)
196
197
switch (opc & MO_SSIZE) {
198
case MO_SB:
199
- tcg_out_ext8s(s, l->datalo_reg, TCG_REG_A0);
200
+ tcg_out_ext8s(s, type, l->datalo_reg, TCG_REG_A0);
201
break;
202
case MO_SW:
203
tcg_out_ext16s(s, l->datalo_reg, TCG_REG_A0);
204
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
205
tcg_out_brcond(s, a2, a0, a1, arg_label(args[3]));
206
break;
207
208
- case INDEX_op_ext8s_i32:
209
- case INDEX_op_ext8s_i64:
210
- tcg_out_ext8s(s, a0, a1);
211
- break;
212
-
213
case INDEX_op_ext8u_i32:
214
case INDEX_op_ext8u_i64:
215
tcg_out_ext8u(s, a0, a1);
216
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
217
case INDEX_op_call: /* Always emitted via tcg_out_call. */
218
case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */
219
case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
220
+ case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */
221
+ case INDEX_op_ext8s_i64:
222
default:
223
g_assert_not_reached();
224
}
225
diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc
226
index XXXXXXX..XXXXXXX 100644
227
--- a/tcg/mips/tcg-target.c.inc
228
+++ b/tcg/mips/tcg-target.c.inc
229
@@ -XXX,XX +XXX,XX @@ static void tcg_out_movi(TCGContext *s, TCGType type,
230
}
231
}
232
233
+static void tcg_out_ext8s(TCGContext *s, TCGType type, TCGReg rd, TCGReg rs)
234
+{
235
+ tcg_debug_assert(TCG_TARGET_HAS_ext8s_i32);
236
+ tcg_out_opc_reg(s, OPC_SEB, rd, TCG_REG_ZERO, rs);
237
+}
238
+
239
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
240
tcg_target_long imm)
241
{
242
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
243
case INDEX_op_not_i64:
244
i1 = OPC_NOR;
245
goto do_unary;
246
- case INDEX_op_ext8s_i32:
247
- case INDEX_op_ext8s_i64:
248
- i1 = OPC_SEB;
249
- goto do_unary;
250
case INDEX_op_ext16s_i32:
251
case INDEX_op_ext16s_i64:
252
i1 = OPC_SEH;
253
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
254
case INDEX_op_call: /* Always emitted via tcg_out_call. */
255
case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */
256
case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
257
+ case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */
258
+ case INDEX_op_ext8s_i64:
259
default:
260
g_assert_not_reached();
261
}
262
diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc
263
index XXXXXXX..XXXXXXX 100644
264
--- a/tcg/ppc/tcg-target.c.inc
265
+++ b/tcg/ppc/tcg-target.c.inc
266
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_rlw(TCGContext *s, int op, TCGReg ra, TCGReg rs,
267
tcg_out32(s, op | RA(ra) | RS(rs) | SH(sh) | MB(mb) | ME(me));
268
}
269
270
-static inline void tcg_out_ext8s(TCGContext *s, TCGReg dst, TCGReg src)
271
+static void tcg_out_ext8s(TCGContext *s, TCGType type, TCGReg dst, TCGReg src)
272
{
273
tcg_out32(s, EXTSB | RA(dst) | RS(src));
274
}
275
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
276
case INDEX_op_ld8s_i32:
277
case INDEX_op_ld8s_i64:
278
tcg_out_mem_long(s, LBZ, LBZX, args[0], args[1], args[2]);
279
- tcg_out_ext8s(s, args[0], args[0]);
280
+ tcg_out_ext8s(s, TCG_TYPE_REG, args[0], args[0]);
281
break;
282
case INDEX_op_ld16u_i32:
283
case INDEX_op_ld16u_i64:
284
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
285
tcg_out_qemu_st(s, args, true);
286
break;
287
288
- case INDEX_op_ext8s_i32:
289
- case INDEX_op_ext8s_i64:
290
- tcg_out_ext8s(s, args[0], args[1]);
291
- break;
292
case INDEX_op_ext16s_i32:
293
case INDEX_op_ext16s_i64:
294
tcg_out_ext16s(s, args[0], args[1]);
295
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
296
case INDEX_op_call: /* Always emitted via tcg_out_call. */
297
case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */
298
case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
299
+ case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */
300
+ case INDEX_op_ext8s_i64:
301
default:
302
g_assert_not_reached();
303
}
304
diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc
305
index XXXXXXX..XXXXXXX 100644
306
--- a/tcg/riscv/tcg-target.c.inc
307
+++ b/tcg/riscv/tcg-target.c.inc
308
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext32u(TCGContext *s, TCGReg ret, TCGReg arg)
309
tcg_out_opc_imm(s, OPC_SRLI, ret, ret, 32);
310
}
311
312
-static void tcg_out_ext8s(TCGContext *s, TCGReg ret, TCGReg arg)
313
+static void tcg_out_ext8s(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg)
314
{
315
tcg_out_opc_imm(s, OPC_SLLIW, ret, arg, 24);
316
tcg_out_opc_imm(s, OPC_SRAIW, ret, ret, 24);
317
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
318
tcg_out_ext32u(s, a0, a1);
319
break;
320
321
- case INDEX_op_ext8s_i32:
322
- case INDEX_op_ext8s_i64:
323
- tcg_out_ext8s(s, a0, a1);
324
- break;
325
-
326
case INDEX_op_ext16s_i32:
327
case INDEX_op_ext16s_i64:
328
tcg_out_ext16s(s, a0, a1);
329
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
330
case INDEX_op_call: /* Always emitted via tcg_out_call. */
331
case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */
332
case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
333
+ case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */
334
+ case INDEX_op_ext8s_i64:
335
default:
336
g_assert_not_reached();
337
}
338
diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc
339
index XXXXXXX..XXXXXXX 100644
340
--- a/tcg/s390x/tcg-target.c.inc
341
+++ b/tcg/s390x/tcg-target.c.inc
342
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_risbg(TCGContext *s, TCGReg dest, TCGReg src,
343
tcg_out16(s, (ofs << 8) | (RIEf_RISBG & 0xff));
344
}
345
346
-static void tgen_ext8s(TCGContext *s, TCGType type, TCGReg dest, TCGReg src)
347
+static void tcg_out_ext8s(TCGContext *s, TCGType type, TCGReg dest, TCGReg src)
348
{
349
tcg_out_insn(s, RRE, LGBR, dest, src);
350
}
351
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
352
}
353
break;
354
355
- case INDEX_op_ext8s_i32:
356
- tgen_ext8s(s, TCG_TYPE_I32, args[0], args[1]);
357
- break;
358
case INDEX_op_ext16s_i32:
359
tgen_ext16s(s, TCG_TYPE_I32, args[0], args[1]);
360
break;
361
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
362
}
363
break;
364
365
- case INDEX_op_ext8s_i64:
366
- tgen_ext8s(s, TCG_TYPE_I64, args[0], args[1]);
367
- break;
368
case INDEX_op_ext16s_i64:
369
tgen_ext16s(s, TCG_TYPE_I64, args[0], args[1]);
370
break;
371
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
372
case INDEX_op_call: /* Always emitted via tcg_out_call. */
373
case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */
374
case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
375
+ case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */
376
+ case INDEX_op_ext8s_i64:
377
default:
378
g_assert_not_reached();
379
}
380
diff --git a/tcg/sparc64/tcg-target.c.inc b/tcg/sparc64/tcg-target.c.inc
381
index XXXXXXX..XXXXXXX 100644
382
--- a/tcg/sparc64/tcg-target.c.inc
383
+++ b/tcg/sparc64/tcg-target.c.inc
384
@@ -XXX,XX +XXX,XX @@ static void tcg_out_movi(TCGContext *s, TCGType type,
385
tcg_out_movi_int(s, type, ret, arg, false, TCG_REG_T2);
386
}
387
388
+static void tcg_out_ext8s(TCGContext *s, TCGType type, TCGReg rd, TCGReg rs)
389
+{
390
+ g_assert_not_reached();
391
+}
392
+
393
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
394
tcg_target_long imm)
395
{
396
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
397
case INDEX_op_call: /* Always emitted via tcg_out_call. */
398
case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */
399
case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
400
+ case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */
401
+ case INDEX_op_ext8s_i64:
402
default:
403
g_assert_not_reached();
404
}
405
diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc
406
index XXXXXXX..XXXXXXX 100644
407
--- a/tcg/tci/tcg-target.c.inc
408
+++ b/tcg/tci/tcg-target.c.inc
409
@@ -XXX,XX +XXX,XX @@ static void tcg_out_movi(TCGContext *s, TCGType type,
410
}
411
}
412
413
+static void tcg_out_ext8s(TCGContext *s, TCGType type, TCGReg rd, TCGReg rs)
414
+{
415
+ switch (type) {
416
+ case TCG_TYPE_I32:
417
+ tcg_debug_assert(TCG_TARGET_HAS_ext8s_i32);
418
+ tcg_out_op_rr(s, INDEX_op_ext8s_i32, rd, rs);
419
+ break;
420
+#if TCG_TARGET_REG_BITS == 64
421
+ case TCG_TYPE_I64:
422
+ tcg_debug_assert(TCG_TARGET_HAS_ext8s_i64);
423
+ tcg_out_op_rr(s, INDEX_op_ext8s_i64, rd, rs);
424
+ break;
425
+#endif
426
+ default:
427
+ g_assert_not_reached();
428
+ }
429
+}
430
+
431
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
432
tcg_target_long imm)
433
{
434
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
435
436
CASE_32_64(neg) /* Optional (TCG_TARGET_HAS_neg_*). */
437
CASE_32_64(not) /* Optional (TCG_TARGET_HAS_not_*). */
438
- CASE_32_64(ext8s) /* Optional (TCG_TARGET_HAS_ext8s_*). */
439
CASE_32_64(ext8u) /* Optional (TCG_TARGET_HAS_ext8u_*). */
440
CASE_32_64(ext16s) /* Optional (TCG_TARGET_HAS_ext16s_*). */
441
CASE_32_64(ext16u) /* Optional (TCG_TARGET_HAS_ext16u_*). */
442
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
443
case INDEX_op_call: /* Always emitted via tcg_out_call. */
444
case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */
445
case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
446
+ case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */
447
+ case INDEX_op_ext8s_i64:
448
default:
449
g_assert_not_reached();
450
}
25
--
451
--
26
2.25.1
452
2.34.1
27
453
28
454
diff view generated by jsdifflib
1
Split out CPU_LOG_EXEC and CPU_LOG_TB_CPU logging from
1
We will need a backend interface for performing 8-bit zero-extend.
2
cpu_tb_exec to a new function. Perform only one pc
2
Use it in tcg_reg_alloc_op in the meantime.
3
range check after a combined mask check.
4
3
5
Use the new function in lookup_tb_ptr. This enables
4
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6
CPU_LOG_TB_CPU between indirectly chained tbs.
7
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
---
6
---
10
accel/tcg/cpu-exec.c | 61 ++++++++++++++++++++++++--------------------
7
tcg/tcg.c | 5 +++++
11
1 file changed, 34 insertions(+), 27 deletions(-)
8
tcg/aarch64/tcg-target.c.inc | 11 +++++++----
9
tcg/arm/tcg-target.c.inc | 12 +++++++++---
10
tcg/i386/tcg-target.c.inc | 7 +++----
11
tcg/loongarch64/tcg-target.c.inc | 7 ++-----
12
tcg/mips/tcg-target.c.inc | 9 ++++++++-
13
tcg/ppc/tcg-target.c.inc | 7 +++++++
14
tcg/riscv/tcg-target.c.inc | 7 ++-----
15
tcg/s390x/tcg-target.c.inc | 14 +++++---------
16
tcg/sparc64/tcg-target.c.inc | 9 ++++++++-
17
tcg/tci/tcg-target.c.inc | 14 +++++++++++++-
18
11 files changed, 69 insertions(+), 33 deletions(-)
12
19
13
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
20
diff --git a/tcg/tcg.c b/tcg/tcg.c
14
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
15
--- a/accel/tcg/cpu-exec.c
22
--- a/tcg/tcg.c
16
+++ b/accel/tcg/cpu-exec.c
23
+++ b/tcg/tcg.c
17
@@ -XXX,XX +XXX,XX @@ static inline TranslationBlock *tb_lookup(CPUState *cpu, target_ulong pc,
24
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg);
18
return tb;
25
static void tcg_out_movi(TCGContext *s, TCGType type,
19
}
26
TCGReg ret, tcg_target_long arg);
20
27
static void tcg_out_ext8s(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg);
21
+static inline void log_cpu_exec(target_ulong pc, CPUState *cpu,
28
+static void tcg_out_ext8u(TCGContext *s, TCGReg ret, TCGReg arg);
22
+ const TranslationBlock *tb)
29
static void tcg_out_addi_ptr(TCGContext *s, TCGReg, TCGReg, tcg_target_long);
23
+{
30
static void tcg_out_exit_tb(TCGContext *s, uintptr_t arg);
24
+ if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_CPU | CPU_LOG_EXEC))
31
static void tcg_out_goto_tb(TCGContext *s, int which);
25
+ && qemu_log_in_addr_range(pc)) {
32
@@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op)
26
+
33
case INDEX_op_ext8s_i64:
27
+ qemu_log_mask(CPU_LOG_EXEC,
34
tcg_out_ext8s(s, TCG_TYPE_I64, new_args[0], new_args[1]);
28
+ "Trace %d: %p [" TARGET_FMT_lx
35
break;
29
+ "/" TARGET_FMT_lx "/%#x] %s\n",
36
+ case INDEX_op_ext8u_i32:
30
+ cpu->cpu_index, tb->tc.ptr, tb->cs_base, pc, tb->flags,
37
+ case INDEX_op_ext8u_i64:
31
+ lookup_symbol(pc));
38
+ tcg_out_ext8u(s, new_args[0], new_args[1]);
32
+
39
+ break;
33
+#if defined(DEBUG_DISAS)
40
default:
34
+ if (qemu_loglevel_mask(CPU_LOG_TB_CPU)) {
41
if (def->flags & TCG_OPF_VECTOR) {
35
+ FILE *logfile = qemu_log_lock();
42
tcg_out_vec_op(s, op->opc, TCGOP_VECL(op), TCGOP_VECE(op),
36
+ int flags = 0;
43
diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc
37
+
44
index XXXXXXX..XXXXXXX 100644
38
+ if (qemu_loglevel_mask(CPU_LOG_TB_FPU)) {
45
--- a/tcg/aarch64/tcg-target.c.inc
39
+ flags |= CPU_DUMP_FPU;
46
+++ b/tcg/aarch64/tcg-target.c.inc
40
+ }
47
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_uxt(TCGContext *s, MemOp s_bits,
41
+#if defined(TARGET_I386)
48
tcg_out_ubfm(s, 0, rd, rn, 0, bits);
42
+ flags |= CPU_DUMP_CCOP;
49
}
43
+#endif
50
44
+ log_cpu_state(cpu, flags);
51
+static void tcg_out_ext8u(TCGContext *s, TCGReg rd, TCGReg rn)
45
+ qemu_log_unlock(logfile);
52
+{
46
+ }
53
+ tcg_out_uxt(s, MO_8, rd, rn);
47
+#endif /* DEBUG_DISAS */
54
+}
55
+
56
static void tcg_out_addsubi(TCGContext *s, int ext, TCGReg rd,
57
TCGReg rn, int64_t aimm)
58
{
59
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
60
case INDEX_op_ext32s_i64:
61
tcg_out_sxt(s, TCG_TYPE_I64, MO_32, a0, a1);
62
break;
63
- case INDEX_op_ext8u_i64:
64
- case INDEX_op_ext8u_i32:
65
- tcg_out_uxt(s, MO_8, a0, a1);
66
- break;
67
case INDEX_op_ext16u_i64:
68
case INDEX_op_ext16u_i32:
69
tcg_out_uxt(s, MO_16, a0, a1);
70
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
71
case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
72
case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */
73
case INDEX_op_ext8s_i64:
74
+ case INDEX_op_ext8u_i32:
75
+ case INDEX_op_ext8u_i64:
76
default:
77
g_assert_not_reached();
78
}
79
diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc
80
index XXXXXXX..XXXXXXX 100644
81
--- a/tcg/arm/tcg-target.c.inc
82
+++ b/tcg/arm/tcg-target.c.inc
83
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext8s(TCGContext *s, TCGType t, TCGReg rd, TCGReg rn)
84
tcg_out32(s, 0x06af0070 | (COND_AL << 28) | (rd << 12) | rn);
85
}
86
87
+static void tcg_out_ext8u(TCGContext *s, TCGReg rd, TCGReg rn)
88
+{
89
+ tcg_out_dat_imm(s, COND_AL, ARITH_AND, rd, rn, 0xff);
90
+}
91
+
92
static void __attribute__((unused))
93
-tcg_out_ext8u(TCGContext *s, ARMCond cond, TCGReg rd, TCGReg rn)
94
+tcg_out_ext8u_cond(TCGContext *s, ARMCond cond, TCGReg rd, TCGReg rn)
95
{
96
tcg_out_dat_imm(s, cond, ARITH_AND, rd, rn, 0xff);
97
}
98
@@ -XXX,XX +XXX,XX @@ static TCGReg NAME(TCGContext *s, TCGReg argreg, ARGTYPE arg) \
99
100
DEFINE_TCG_OUT_ARG(tcg_out_arg_imm32, uint32_t, tcg_out_movi32,
101
(tcg_out_movi32(s, COND_AL, TCG_REG_TMP, arg), arg = TCG_REG_TMP))
102
-DEFINE_TCG_OUT_ARG(tcg_out_arg_reg8, TCGReg, tcg_out_ext8u,
103
- (tcg_out_ext8u(s, COND_AL, TCG_REG_TMP, arg), arg = TCG_REG_TMP))
104
+DEFINE_TCG_OUT_ARG(tcg_out_arg_reg8, TCGReg, tcg_out_ext8u_cond,
105
+ (tcg_out_ext8u_cond(s, COND_AL, TCG_REG_TMP, arg), arg = TCG_REG_TMP))
106
DEFINE_TCG_OUT_ARG(tcg_out_arg_reg16, TCGReg, tcg_out_ext16u,
107
(tcg_out_ext16u(s, COND_AL, TCG_REG_TMP, arg), arg = TCG_REG_TMP))
108
DEFINE_TCG_OUT_ARG(tcg_out_arg_reg32, TCGReg, tcg_out_mov_reg, )
109
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
110
case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */
111
case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
112
case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */
113
+ case INDEX_op_ext8u_i32:
114
default:
115
g_assert_not_reached();
116
}
117
diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc
118
index XXXXXXX..XXXXXXX 100644
119
--- a/tcg/i386/tcg-target.c.inc
120
+++ b/tcg/i386/tcg-target.c.inc
121
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_rolw_8(TCGContext *s, int reg)
122
tcg_out_shifti(s, SHIFT_ROL + P_DATA16, reg, 8);
123
}
124
125
-static inline void tcg_out_ext8u(TCGContext *s, int dest, int src)
126
+static void tcg_out_ext8u(TCGContext *s, TCGReg dest, TCGReg src)
127
{
128
/* movzbl */
129
tcg_debug_assert(src < 4 || TCG_TARGET_REG_BITS == 64);
130
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
131
OP_32_64(ext16s):
132
tcg_out_ext16s(s, a0, a1, rexw);
133
break;
134
- OP_32_64(ext8u):
135
- tcg_out_ext8u(s, a0, a1);
136
- break;
137
OP_32_64(ext16u):
138
tcg_out_ext16u(s, a0, a1);
139
break;
140
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
141
case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
142
case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */
143
case INDEX_op_ext8s_i64:
144
+ case INDEX_op_ext8u_i32:
145
+ case INDEX_op_ext8u_i64:
146
default:
147
g_assert_not_reached();
148
}
149
diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc
150
index XXXXXXX..XXXXXXX 100644
151
--- a/tcg/loongarch64/tcg-target.c.inc
152
+++ b/tcg/loongarch64/tcg-target.c.inc
153
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
154
tcg_out_brcond(s, a2, a0, a1, arg_label(args[3]));
155
break;
156
157
- case INDEX_op_ext8u_i32:
158
- case INDEX_op_ext8u_i64:
159
- tcg_out_ext8u(s, a0, a1);
160
- break;
161
-
162
case INDEX_op_ext16s_i32:
163
case INDEX_op_ext16s_i64:
164
tcg_out_ext16s(s, a0, a1);
165
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
166
case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
167
case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */
168
case INDEX_op_ext8s_i64:
169
+ case INDEX_op_ext8u_i32:
170
+ case INDEX_op_ext8u_i64:
171
default:
172
g_assert_not_reached();
173
}
174
diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc
175
index XXXXXXX..XXXXXXX 100644
176
--- a/tcg/mips/tcg-target.c.inc
177
+++ b/tcg/mips/tcg-target.c.inc
178
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext8s(TCGContext *s, TCGType type, TCGReg rd, TCGReg rs)
179
tcg_out_opc_reg(s, OPC_SEB, rd, TCG_REG_ZERO, rs);
180
}
181
182
+static void tcg_out_ext8u(TCGContext *s, TCGReg rd, TCGReg rs)
183
+{
184
+ tcg_out_opc_imm(s, OPC_ANDI, rd, rs, 0xff);
185
+}
186
+
187
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
188
tcg_target_long imm)
189
{
190
@@ -XXX,XX +XXX,XX @@ static int tcg_out_call_iarg_reg8(TCGContext *s, int i, TCGReg arg)
191
if (i < ARRAY_SIZE(tcg_target_call_iarg_regs)) {
192
tmp = tcg_target_call_iarg_regs[i];
193
}
194
- tcg_out_opc_imm(s, OPC_ANDI, tmp, arg, 0xff);
195
+ tcg_out_ext8u(s, tmp, arg);
196
return tcg_out_call_iarg_reg(s, i, tmp);
197
}
198
199
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
200
case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
201
case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */
202
case INDEX_op_ext8s_i64:
203
+ case INDEX_op_ext8u_i32:
204
+ case INDEX_op_ext8u_i64:
205
default:
206
g_assert_not_reached();
207
}
208
diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc
209
index XXXXXXX..XXXXXXX 100644
210
--- a/tcg/ppc/tcg-target.c.inc
211
+++ b/tcg/ppc/tcg-target.c.inc
212
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext8s(TCGContext *s, TCGType type, TCGReg dst, TCGReg src)
213
tcg_out32(s, EXTSB | RA(dst) | RS(src));
214
}
215
216
+static void tcg_out_ext8u(TCGContext *s, TCGReg dst, TCGReg src)
217
+{
218
+ tcg_out32(s, ANDI | SAI(src, dst, 0xff));
219
+}
220
+
221
static inline void tcg_out_ext16s(TCGContext *s, TCGReg dst, TCGReg src)
222
{
223
tcg_out32(s, EXTSH | RA(dst) | RS(src));
224
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
225
case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
226
case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */
227
case INDEX_op_ext8s_i64:
228
+ case INDEX_op_ext8u_i32:
229
+ case INDEX_op_ext8u_i64:
230
default:
231
g_assert_not_reached();
232
}
233
diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc
234
index XXXXXXX..XXXXXXX 100644
235
--- a/tcg/riscv/tcg-target.c.inc
236
+++ b/tcg/riscv/tcg-target.c.inc
237
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
238
tcg_out_qemu_st(s, args, true);
239
break;
240
241
- case INDEX_op_ext8u_i32:
242
- case INDEX_op_ext8u_i64:
243
- tcg_out_ext8u(s, a0, a1);
244
- break;
245
-
246
case INDEX_op_ext16u_i32:
247
case INDEX_op_ext16u_i64:
248
tcg_out_ext16u(s, a0, a1);
249
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
250
case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
251
case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */
252
case INDEX_op_ext8s_i64:
253
+ case INDEX_op_ext8u_i32:
254
+ case INDEX_op_ext8u_i64:
255
default:
256
g_assert_not_reached();
257
}
258
diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc
259
index XXXXXXX..XXXXXXX 100644
260
--- a/tcg/s390x/tcg-target.c.inc
261
+++ b/tcg/s390x/tcg-target.c.inc
262
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext8s(TCGContext *s, TCGType type, TCGReg dest, TCGReg src)
263
tcg_out_insn(s, RRE, LGBR, dest, src);
264
}
265
266
-static void tgen_ext8u(TCGContext *s, TCGType type, TCGReg dest, TCGReg src)
267
+static void tcg_out_ext8u(TCGContext *s, TCGReg dest, TCGReg src)
268
{
269
tcg_out_insn(s, RRE, LLGCR, dest, src);
270
}
271
@@ -XXX,XX +XXX,XX @@ static void tgen_andi(TCGContext *s, TCGType type, TCGReg dest, uint64_t val)
272
return;
273
}
274
if ((val & valid) == 0xff) {
275
- tgen_ext8u(s, TCG_TYPE_I64, dest, dest);
276
+ tcg_out_ext8u(s, dest, dest);
277
return;
278
}
279
if ((val & valid) == 0xffff) {
280
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *lb)
281
}
282
switch (opc & MO_SIZE) {
283
case MO_UB:
284
- tgen_ext8u(s, TCG_TYPE_I64, TCG_REG_R4, data_reg);
285
+ tcg_out_ext8u(s, TCG_REG_R4, data_reg);
286
break;
287
case MO_UW:
288
tgen_ext16u(s, TCG_TYPE_I64, TCG_REG_R4, data_reg);
289
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
290
case INDEX_op_ext16s_i32:
291
tgen_ext16s(s, TCG_TYPE_I32, args[0], args[1]);
292
break;
293
- case INDEX_op_ext8u_i32:
294
- tgen_ext8u(s, TCG_TYPE_I32, args[0], args[1]);
295
- break;
296
case INDEX_op_ext16u_i32:
297
tgen_ext16u(s, TCG_TYPE_I32, args[0], args[1]);
298
break;
299
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
300
case INDEX_op_ext32s_i64:
301
tgen_ext32s(s, args[0], args[1]);
302
break;
303
- case INDEX_op_ext8u_i64:
304
- tgen_ext8u(s, TCG_TYPE_I64, args[0], args[1]);
305
- break;
306
case INDEX_op_ext16u_i64:
307
tgen_ext16u(s, TCG_TYPE_I64, args[0], args[1]);
308
break;
309
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
310
case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
311
case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */
312
case INDEX_op_ext8s_i64:
313
+ case INDEX_op_ext8u_i32:
314
+ case INDEX_op_ext8u_i64:
315
default:
316
g_assert_not_reached();
317
}
318
diff --git a/tcg/sparc64/tcg-target.c.inc b/tcg/sparc64/tcg-target.c.inc
319
index XXXXXXX..XXXXXXX 100644
320
--- a/tcg/sparc64/tcg-target.c.inc
321
+++ b/tcg/sparc64/tcg-target.c.inc
322
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext8s(TCGContext *s, TCGType type, TCGReg rd, TCGReg rs)
323
g_assert_not_reached();
324
}
325
326
+static void tcg_out_ext8u(TCGContext *s, TCGReg rd, TCGReg rs)
327
+{
328
+ tcg_out_arithi(s, rd, rs, 0xff, ARITH_AND);
329
+}
330
+
331
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
332
tcg_target_long imm)
333
{
334
@@ -XXX,XX +XXX,XX @@ static void emit_extend(TCGContext *s, TCGReg r, int op)
335
*/
336
switch (op & MO_SIZE) {
337
case MO_8:
338
- tcg_out_arithi(s, r, r, 0xff, ARITH_AND);
339
+ tcg_out_ext8u(s, r, r);
340
break;
341
case MO_16:
342
tcg_out_arithi(s, r, r, 16, SHIFT_SLL);
343
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
344
case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
345
case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */
346
case INDEX_op_ext8s_i64:
347
+ case INDEX_op_ext8u_i32:
348
+ case INDEX_op_ext8u_i64:
349
default:
350
g_assert_not_reached();
351
}
352
diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc
353
index XXXXXXX..XXXXXXX 100644
354
--- a/tcg/tci/tcg-target.c.inc
355
+++ b/tcg/tci/tcg-target.c.inc
356
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext8s(TCGContext *s, TCGType type, TCGReg rd, TCGReg rs)
357
}
358
}
359
360
+static void tcg_out_ext8u(TCGContext *s, TCGReg rd, TCGReg rs)
361
+{
362
+ if (TCG_TARGET_REG_BITS == 64) {
363
+ tcg_debug_assert(TCG_TARGET_HAS_ext8u_i64);
364
+ tcg_out_op_rr(s, INDEX_op_ext8u_i64, rd, rs);
365
+ } else {
366
+ tcg_debug_assert(TCG_TARGET_HAS_ext8u_i32);
367
+ tcg_out_op_rr(s, INDEX_op_ext8u_i32, rd, rs);
48
+ }
368
+ }
49
+}
369
+}
50
+
370
+
51
/**
371
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
52
* helper_lookup_tb_ptr: quick check for next tb
372
tcg_target_long imm)
53
* @env: current cpu state
373
{
54
@@ -XXX,XX +XXX,XX @@ const void *HELPER(lookup_tb_ptr)(CPUArchState *env)
374
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
55
if (tb == NULL) {
375
56
return tcg_code_gen_epilogue;
376
CASE_32_64(neg) /* Optional (TCG_TARGET_HAS_neg_*). */
57
}
377
CASE_32_64(not) /* Optional (TCG_TARGET_HAS_not_*). */
58
- qemu_log_mask_and_addr(CPU_LOG_EXEC, pc,
378
- CASE_32_64(ext8u) /* Optional (TCG_TARGET_HAS_ext8u_*). */
59
- "Chain %d: %p ["
379
CASE_32_64(ext16s) /* Optional (TCG_TARGET_HAS_ext16s_*). */
60
- TARGET_FMT_lx "/" TARGET_FMT_lx "/%#x] %s\n",
380
CASE_32_64(ext16u) /* Optional (TCG_TARGET_HAS_ext16u_*). */
61
- cpu->cpu_index, tb->tc.ptr, cs_base, pc, flags,
381
CASE_64(ext32s) /* Optional (TCG_TARGET_HAS_ext32s_i64). */
62
- lookup_symbol(pc));
382
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
63
+
383
case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
64
+ log_cpu_exec(pc, cpu, tb);
384
case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */
65
+
385
case INDEX_op_ext8s_i64:
66
return tb->tc.ptr;
386
+ case INDEX_op_ext8u_i32:
67
}
387
+ case INDEX_op_ext8u_i64:
68
388
default:
69
@@ -XXX,XX +XXX,XX @@ cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit)
389
g_assert_not_reached();
70
TranslationBlock *last_tb;
390
}
71
const void *tb_ptr = itb->tc.ptr;
72
73
- qemu_log_mask_and_addr(CPU_LOG_EXEC, itb->pc,
74
- "Trace %d: %p ["
75
- TARGET_FMT_lx "/" TARGET_FMT_lx "/%#x] %s\n",
76
- cpu->cpu_index, itb->tc.ptr,
77
- itb->cs_base, itb->pc, itb->flags,
78
- lookup_symbol(itb->pc));
79
-
80
-#if defined(DEBUG_DISAS)
81
- if (qemu_loglevel_mask(CPU_LOG_TB_CPU)
82
- && qemu_log_in_addr_range(itb->pc)) {
83
- FILE *logfile = qemu_log_lock();
84
- int flags = 0;
85
- if (qemu_loglevel_mask(CPU_LOG_TB_FPU)) {
86
- flags |= CPU_DUMP_FPU;
87
- }
88
-#if defined(TARGET_I386)
89
- flags |= CPU_DUMP_CCOP;
90
-#endif
91
- log_cpu_state(cpu, flags);
92
- qemu_log_unlock(logfile);
93
- }
94
-#endif /* DEBUG_DISAS */
95
+ log_cpu_exec(itb->pc, cpu, itb);
96
97
qemu_thread_jit_execute();
98
ret = tcg_qemu_tb_exec(env, tb_ptr);
99
--
391
--
100
2.25.1
392
2.34.1
101
393
102
394
diff view generated by jsdifflib
1
Now that we've moved helper_lookup_tb_ptr, the only user
1
We will need a backend interface for performing 16-bit sign-extend.
2
of tb-lookup.h is cpu-exec.c; merge the contents in.
2
Use it in tcg_reg_alloc_op in the meantime.
3
3
4
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
4
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
6
---
7
accel/tcg/tb-lookup.h | 49 -------------------------------------------
7
tcg/tcg.c | 7 +++++++
8
accel/tcg/cpu-exec.c | 31 ++++++++++++++++++++++++++-
8
tcg/aarch64/tcg-target.c.inc | 13 ++++++++-----
9
2 files changed, 30 insertions(+), 50 deletions(-)
9
tcg/arm/tcg-target.c.inc | 10 ++++------
10
delete mode 100644 accel/tcg/tb-lookup.h
10
tcg/i386/tcg-target.c.inc | 16 ++++++++--------
11
tcg/loongarch64/tcg-target.c.inc | 13 +++++--------
12
tcg/mips/tcg-target.c.inc | 11 ++++++++---
13
tcg/ppc/tcg-target.c.inc | 12 +++++-------
14
tcg/riscv/tcg-target.c.inc | 9 +++------
15
tcg/s390x/tcg-target.c.inc | 12 ++++--------
16
tcg/sparc64/tcg-target.c.inc | 7 +++++++
17
tcg/tci/tcg-target.c.inc | 21 ++++++++++++++++++++-
18
11 files changed, 79 insertions(+), 52 deletions(-)
11
19
12
diff --git a/accel/tcg/tb-lookup.h b/accel/tcg/tb-lookup.h
20
diff --git a/tcg/tcg.c b/tcg/tcg.c
13
deleted file mode 100644
21
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX
22
--- a/tcg/tcg.c
15
--- a/accel/tcg/tb-lookup.h
23
+++ b/tcg/tcg.c
16
+++ /dev/null
24
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg);
17
@@ -XXX,XX +XXX,XX @@
25
static void tcg_out_movi(TCGContext *s, TCGType type,
18
-/*
26
TCGReg ret, tcg_target_long arg);
19
- * Copyright (C) 2017, Emilio G. Cota <cota@braap.org>
27
static void tcg_out_ext8s(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg);
20
- *
28
+static void tcg_out_ext16s(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg);
21
- * License: GNU GPL, version 2 or later.
29
static void tcg_out_ext8u(TCGContext *s, TCGReg ret, TCGReg arg);
22
- * See the COPYING file in the top-level directory.
30
static void tcg_out_addi_ptr(TCGContext *s, TCGReg, TCGReg, tcg_target_long);
23
- */
31
static void tcg_out_exit_tb(TCGContext *s, uintptr_t arg);
24
-#ifndef EXEC_TB_LOOKUP_H
32
@@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op)
25
-#define EXEC_TB_LOOKUP_H
33
case INDEX_op_ext8u_i64:
26
-
34
tcg_out_ext8u(s, new_args[0], new_args[1]);
27
-#ifdef NEED_CPU_H
35
break;
28
-#include "cpu.h"
36
+ case INDEX_op_ext16s_i32:
29
-#else
37
+ tcg_out_ext16s(s, TCG_TYPE_I32, new_args[0], new_args[1]);
30
-#include "exec/poison.h"
38
+ break;
31
-#endif
39
+ case INDEX_op_ext16s_i64:
32
-
40
+ tcg_out_ext16s(s, TCG_TYPE_I64, new_args[0], new_args[1]);
33
-#include "exec/exec-all.h"
41
+ break;
34
-#include "tb-hash.h"
42
default:
35
-
43
if (def->flags & TCG_OPF_VECTOR) {
36
-/* Might cause an exception, so have a longjmp destination ready */
44
tcg_out_vec_op(s, op->opc, TCGOP_VECL(op), TCGOP_VECE(op),
37
-static inline TranslationBlock *tb_lookup(CPUState *cpu, target_ulong pc,
45
diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc
38
- target_ulong cs_base,
46
index XXXXXXX..XXXXXXX 100644
39
- uint32_t flags, uint32_t cflags)
47
--- a/tcg/aarch64/tcg-target.c.inc
40
-{
48
+++ b/tcg/aarch64/tcg-target.c.inc
41
- TranslationBlock *tb;
49
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext8s(TCGContext *s, TCGType type, TCGReg rd, TCGReg rn)
42
- uint32_t hash;
50
tcg_out_sxt(s, type, MO_8, rd, rn);
43
-
51
}
44
- /* we should never be trying to look up an INVALID tb */
52
45
- tcg_debug_assert(!(cflags & CF_INVALID));
53
+static void tcg_out_ext16s(TCGContext *s, TCGType type, TCGReg rd, TCGReg rn)
46
-
47
- hash = tb_jmp_cache_hash_func(pc);
48
- tb = qatomic_rcu_read(&cpu->tb_jmp_cache[hash]);
49
-
50
- if (likely(tb &&
51
- tb->pc == pc &&
52
- tb->cs_base == cs_base &&
53
- tb->flags == flags &&
54
- tb->trace_vcpu_dstate == *cpu->trace_dstate &&
55
- tb_cflags(tb) == cflags)) {
56
- return tb;
57
- }
58
- tb = tb_htable_lookup(cpu, pc, cs_base, flags, cflags);
59
- if (tb == NULL) {
60
- return NULL;
61
- }
62
- qatomic_set(&cpu->tb_jmp_cache[hash], tb);
63
- return tb;
64
-}
65
-
66
-#endif /* EXEC_TB_LOOKUP_H */
67
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
68
index XXXXXXX..XXXXXXX 100644
69
--- a/accel/tcg/cpu-exec.c
70
+++ b/accel/tcg/cpu-exec.c
71
@@ -XXX,XX +XXX,XX @@
72
#include "sysemu/replay.h"
73
#include "exec/helper-proto.h"
74
#include "tb-hash.h"
75
-#include "tb-lookup.h"
76
#include "tb-context.h"
77
#include "internal.h"
78
79
@@ -XXX,XX +XXX,XX @@ static void init_delay_params(SyncClocks *sc, const CPUState *cpu)
80
}
81
#endif /* CONFIG USER ONLY */
82
83
+/* Might cause an exception, so have a longjmp destination ready */
84
+static inline TranslationBlock *tb_lookup(CPUState *cpu, target_ulong pc,
85
+ target_ulong cs_base,
86
+ uint32_t flags, uint32_t cflags)
87
+{
54
+{
88
+ TranslationBlock *tb;
55
+ tcg_out_sxt(s, type, MO_16, rd, rn);
89
+ uint32_t hash;
90
+
91
+ /* we should never be trying to look up an INVALID tb */
92
+ tcg_debug_assert(!(cflags & CF_INVALID));
93
+
94
+ hash = tb_jmp_cache_hash_func(pc);
95
+ tb = qatomic_rcu_read(&cpu->tb_jmp_cache[hash]);
96
+
97
+ if (likely(tb &&
98
+ tb->pc == pc &&
99
+ tb->cs_base == cs_base &&
100
+ tb->flags == flags &&
101
+ tb->trace_vcpu_dstate == *cpu->trace_dstate &&
102
+ tb_cflags(tb) == cflags)) {
103
+ return tb;
104
+ }
105
+ tb = tb_htable_lookup(cpu, pc, cs_base, flags, cflags);
106
+ if (tb == NULL) {
107
+ return NULL;
108
+ }
109
+ qatomic_set(&cpu->tb_jmp_cache[hash], tb);
110
+ return tb;
111
+}
56
+}
112
+
57
+
113
/**
58
static inline void tcg_out_uxt(TCGContext *s, MemOp s_bits,
114
* helper_lookup_tb_ptr: quick check for next tb
59
TCGReg rd, TCGReg rn)
115
* @env: current cpu state
60
{
61
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
62
tcg_out_rev(s, TCG_TYPE_I32, MO_16, a0, a1);
63
if (a2 & TCG_BSWAP_OS) {
64
/* Output must be sign-extended. */
65
- tcg_out_sxt(s, ext, MO_16, a0, a0);
66
+ tcg_out_ext16s(s, ext, a0, a0);
67
} else if ((a2 & (TCG_BSWAP_IZ | TCG_BSWAP_OZ)) == TCG_BSWAP_OZ) {
68
/* Output must be zero-extended, but input isn't. */
69
tcg_out_uxt(s, MO_16, a0, a0);
70
}
71
break;
72
73
- case INDEX_op_ext16s_i64:
74
- case INDEX_op_ext16s_i32:
75
- tcg_out_sxt(s, ext, MO_16, a0, a1);
76
- break;
77
case INDEX_op_ext_i32_i64:
78
case INDEX_op_ext32s_i64:
79
tcg_out_sxt(s, TCG_TYPE_I64, MO_32, a0, a1);
80
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
81
case INDEX_op_ext8s_i64:
82
case INDEX_op_ext8u_i32:
83
case INDEX_op_ext8u_i64:
84
+ case INDEX_op_ext16s_i64:
85
+ case INDEX_op_ext16s_i32:
86
default:
87
g_assert_not_reached();
88
}
89
diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc
90
index XXXXXXX..XXXXXXX 100644
91
--- a/tcg/arm/tcg-target.c.inc
92
+++ b/tcg/arm/tcg-target.c.inc
93
@@ -XXX,XX +XXX,XX @@ tcg_out_ext8u_cond(TCGContext *s, ARMCond cond, TCGReg rd, TCGReg rn)
94
tcg_out_dat_imm(s, cond, ARITH_AND, rd, rn, 0xff);
95
}
96
97
-static void tcg_out_ext16s(TCGContext *s, ARMCond cond, TCGReg rd, TCGReg rn)
98
+static void tcg_out_ext16s(TCGContext *s, TCGType t, TCGReg rd, TCGReg rn)
99
{
100
/* sxth */
101
- tcg_out32(s, 0x06bf0070 | (cond << 28) | (rd << 12) | rn);
102
+ tcg_out32(s, 0x06bf0070 | (COND_AL << 28) | (rd << 12) | rn);
103
}
104
105
static void tcg_out_ext16u(TCGContext *s, ARMCond cond, TCGReg rd, TCGReg rn)
106
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *lb)
107
tcg_out_ext8s(s, TCG_TYPE_I32, datalo, TCG_REG_R0);
108
break;
109
case MO_SW:
110
- tcg_out_ext16s(s, COND_AL, datalo, TCG_REG_R0);
111
+ tcg_out_ext16s(s, TCG_TYPE_I32, datalo, TCG_REG_R0);
112
break;
113
default:
114
tcg_out_mov_reg(s, COND_AL, datalo, TCG_REG_R0);
115
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
116
tcg_out_bswap32(s, COND_AL, args[0], args[1]);
117
break;
118
119
- case INDEX_op_ext16s_i32:
120
- tcg_out_ext16s(s, COND_AL, args[0], args[1]);
121
- break;
122
case INDEX_op_ext16u_i32:
123
tcg_out_ext16u(s, COND_AL, args[0], args[1]);
124
break;
125
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
126
case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
127
case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */
128
case INDEX_op_ext8u_i32:
129
+ case INDEX_op_ext16s_i32:
130
default:
131
g_assert_not_reached();
132
}
133
diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc
134
index XXXXXXX..XXXXXXX 100644
135
--- a/tcg/i386/tcg-target.c.inc
136
+++ b/tcg/i386/tcg-target.c.inc
137
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_ext16u(TCGContext *s, int dest, int src)
138
tcg_out_modrm(s, OPC_MOVZWL, dest, src);
139
}
140
141
-static inline void tcg_out_ext16s(TCGContext *s, int dest, int src, int rexw)
142
+static void tcg_out_ext16s(TCGContext *s, TCGType type, TCGReg dest, TCGReg src)
143
{
144
+ int rexw = type == TCG_TYPE_I32 ? 0 : P_REXW;
145
/* movsw[lq] */
146
tcg_out_modrm(s, OPC_MOVSWL + rexw, dest, src);
147
}
148
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *l)
149
MemOp opc = get_memop(oi);
150
TCGReg data_reg;
151
tcg_insn_unit **label_ptr = &l->label_ptr[0];
152
- int rexw = (l->type == TCG_TYPE_I64 ? P_REXW : 0);
153
154
/* resolve label address */
155
tcg_patch32(label_ptr[0], s->code_ptr - label_ptr[0] - 4);
156
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *l)
157
tcg_out_ext8s(s, l->type, data_reg, TCG_REG_EAX);
158
break;
159
case MO_SW:
160
- tcg_out_ext16s(s, data_reg, TCG_REG_EAX, rexw);
161
+ tcg_out_ext16s(s, l->type, data_reg, TCG_REG_EAX);
162
break;
163
#if TCG_TARGET_REG_BITS == 64
164
case MO_SL:
165
@@ -XXX,XX +XXX,XX @@ static void tcg_out_qemu_ld_direct(TCGContext *s, TCGReg datalo, TCGReg datahi,
166
TCGReg base, int index, intptr_t ofs,
167
int seg, bool is64, MemOp memop)
168
{
169
+ TCGType type = is64 ? TCG_TYPE_I64 : TCG_TYPE_I32;
170
bool use_movbe = false;
171
int rexw = is64 * P_REXW;
172
int movop = OPC_MOVL_GvEv;
173
@@ -XXX,XX +XXX,XX @@ static void tcg_out_qemu_ld_direct(TCGContext *s, TCGReg datalo, TCGReg datahi,
174
if (use_movbe) {
175
tcg_out_modrm_sib_offset(s, OPC_MOVBE_GyMy + P_DATA16 + seg,
176
datalo, base, index, 0, ofs);
177
- tcg_out_ext16s(s, datalo, datalo, rexw);
178
+ tcg_out_ext16s(s, type, datalo, datalo);
179
} else {
180
tcg_out_modrm_sib_offset(s, OPC_MOVSWL + rexw + seg,
181
datalo, base, index, 0, ofs);
182
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
183
tcg_out_modrm(s, OPC_GRP3_Ev + rexw, EXT3_NOT, a0);
184
break;
185
186
- OP_32_64(ext16s):
187
- tcg_out_ext16s(s, a0, a1, rexw);
188
- break;
189
OP_32_64(ext16u):
190
tcg_out_ext16u(s, a0, a1);
191
break;
192
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
193
if (a1 < 4 && a0 < 8) {
194
tcg_out_modrm(s, OPC_MOVSBL, a0, a1 + 4);
195
} else {
196
- tcg_out_ext16s(s, a0, a1, 0);
197
+ tcg_out_ext16s(s, TCG_TYPE_I32, a0, a1);
198
tcg_out_shifti(s, SHIFT_SAR, a0, 8);
199
}
200
break;
201
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
202
case INDEX_op_ext8s_i64:
203
case INDEX_op_ext8u_i32:
204
case INDEX_op_ext8u_i64:
205
+ case INDEX_op_ext16s_i32:
206
+ case INDEX_op_ext16s_i64:
207
default:
208
g_assert_not_reached();
209
}
210
diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc
211
index XXXXXXX..XXXXXXX 100644
212
--- a/tcg/loongarch64/tcg-target.c.inc
213
+++ b/tcg/loongarch64/tcg-target.c.inc
214
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext8s(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg)
215
tcg_out_opc_sext_b(s, ret, arg);
216
}
217
218
-static void tcg_out_ext16s(TCGContext *s, TCGReg ret, TCGReg arg)
219
+static void tcg_out_ext16s(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg)
220
{
221
tcg_out_opc_sext_h(s, ret, arg);
222
}
223
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *l)
224
tcg_out_ext8s(s, type, l->datalo_reg, TCG_REG_A0);
225
break;
226
case MO_SW:
227
- tcg_out_ext16s(s, l->datalo_reg, TCG_REG_A0);
228
+ tcg_out_ext16s(s, type, l->datalo_reg, TCG_REG_A0);
229
break;
230
case MO_SL:
231
tcg_out_ext32s(s, l->datalo_reg, TCG_REG_A0);
232
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
233
tcg_out_brcond(s, a2, a0, a1, arg_label(args[3]));
234
break;
235
236
- case INDEX_op_ext16s_i32:
237
- case INDEX_op_ext16s_i64:
238
- tcg_out_ext16s(s, a0, a1);
239
- break;
240
-
241
case INDEX_op_ext16u_i32:
242
case INDEX_op_ext16u_i64:
243
tcg_out_ext16u(s, a0, a1);
244
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
245
case INDEX_op_bswap16_i64:
246
tcg_out_opc_revb_2h(s, a0, a1);
247
if (a2 & TCG_BSWAP_OS) {
248
- tcg_out_ext16s(s, a0, a0);
249
+ tcg_out_ext16s(s, TCG_TYPE_REG, a0, a0);
250
} else if ((a2 & (TCG_BSWAP_IZ | TCG_BSWAP_OZ)) == TCG_BSWAP_OZ) {
251
tcg_out_ext16u(s, a0, a0);
252
}
253
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
254
case INDEX_op_ext8s_i64:
255
case INDEX_op_ext8u_i32:
256
case INDEX_op_ext8u_i64:
257
+ case INDEX_op_ext16s_i32:
258
+ case INDEX_op_ext16s_i64:
259
default:
260
g_assert_not_reached();
261
}
262
diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc
263
index XXXXXXX..XXXXXXX 100644
264
--- a/tcg/mips/tcg-target.c.inc
265
+++ b/tcg/mips/tcg-target.c.inc
266
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext8u(TCGContext *s, TCGReg rd, TCGReg rs)
267
tcg_out_opc_imm(s, OPC_ANDI, rd, rs, 0xff);
268
}
269
270
+static void tcg_out_ext16s(TCGContext *s, TCGType type, TCGReg rd, TCGReg rs)
271
+{
272
+ tcg_debug_assert(TCG_TARGET_HAS_ext16s_i32);
273
+ tcg_out_opc_reg(s, OPC_SEH, rd, TCG_REG_ZERO, rs);
274
+}
275
+
276
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
277
tcg_target_long imm)
278
{
279
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
280
case INDEX_op_not_i64:
281
i1 = OPC_NOR;
282
goto do_unary;
283
- case INDEX_op_ext16s_i32:
284
- case INDEX_op_ext16s_i64:
285
- i1 = OPC_SEH;
286
do_unary:
287
tcg_out_opc_reg(s, i1, a0, TCG_REG_ZERO, a1);
288
break;
289
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
290
case INDEX_op_ext8s_i64:
291
case INDEX_op_ext8u_i32:
292
case INDEX_op_ext8u_i64:
293
+ case INDEX_op_ext16s_i32:
294
+ case INDEX_op_ext16s_i64:
295
default:
296
g_assert_not_reached();
297
}
298
diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc
299
index XXXXXXX..XXXXXXX 100644
300
--- a/tcg/ppc/tcg-target.c.inc
301
+++ b/tcg/ppc/tcg-target.c.inc
302
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext8u(TCGContext *s, TCGReg dst, TCGReg src)
303
tcg_out32(s, ANDI | SAI(src, dst, 0xff));
304
}
305
306
-static inline void tcg_out_ext16s(TCGContext *s, TCGReg dst, TCGReg src)
307
+static void tcg_out_ext16s(TCGContext *s, TCGType type, TCGReg dst, TCGReg src)
308
{
309
tcg_out32(s, EXTSH | RA(dst) | RS(src));
310
}
311
@@ -XXX,XX +XXX,XX @@ static void tcg_out_bswap16(TCGContext *s, TCGReg dst, TCGReg src, int flags)
312
if (have_isa_3_10) {
313
tcg_out32(s, BRH | RA(dst) | RS(src));
314
if (flags & TCG_BSWAP_OS) {
315
- tcg_out_ext16s(s, dst, dst);
316
+ tcg_out_ext16s(s, TCG_TYPE_REG, dst, dst);
317
} else if ((flags & (TCG_BSWAP_IZ | TCG_BSWAP_OZ)) == TCG_BSWAP_OZ) {
318
tcg_out_ext16u(s, dst, dst);
319
}
320
@@ -XXX,XX +XXX,XX @@ static void tcg_out_bswap16(TCGContext *s, TCGReg dst, TCGReg src, int flags)
321
tcg_out_rlw(s, RLWIMI, tmp, src, 8, 16, 23);
322
323
if (flags & TCG_BSWAP_OS) {
324
- tcg_out_ext16s(s, dst, tmp);
325
+ tcg_out_ext16s(s, TCG_TYPE_REG, dst, tmp);
326
} else {
327
tcg_out_mov(s, TCG_TYPE_REG, dst, tmp);
328
}
329
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
330
tcg_out_qemu_st(s, args, true);
331
break;
332
333
- case INDEX_op_ext16s_i32:
334
- case INDEX_op_ext16s_i64:
335
- tcg_out_ext16s(s, args[0], args[1]);
336
- break;
337
case INDEX_op_ext_i32_i64:
338
case INDEX_op_ext32s_i64:
339
tcg_out_ext32s(s, args[0], args[1]);
340
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
341
case INDEX_op_ext8s_i64:
342
case INDEX_op_ext8u_i32:
343
case INDEX_op_ext8u_i64:
344
+ case INDEX_op_ext16s_i32:
345
+ case INDEX_op_ext16s_i64:
346
default:
347
g_assert_not_reached();
348
}
349
diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc
350
index XXXXXXX..XXXXXXX 100644
351
--- a/tcg/riscv/tcg-target.c.inc
352
+++ b/tcg/riscv/tcg-target.c.inc
353
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext8s(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg)
354
tcg_out_opc_imm(s, OPC_SRAIW, ret, ret, 24);
355
}
356
357
-static void tcg_out_ext16s(TCGContext *s, TCGReg ret, TCGReg arg)
358
+static void tcg_out_ext16s(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg)
359
{
360
tcg_out_opc_imm(s, OPC_SLLIW, ret, arg, 16);
361
tcg_out_opc_imm(s, OPC_SRAIW, ret, ret, 16);
362
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
363
tcg_out_ext32u(s, a0, a1);
364
break;
365
366
- case INDEX_op_ext16s_i32:
367
- case INDEX_op_ext16s_i64:
368
- tcg_out_ext16s(s, a0, a1);
369
- break;
370
-
371
case INDEX_op_ext32s_i64:
372
case INDEX_op_extrl_i64_i32:
373
case INDEX_op_ext_i32_i64:
374
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
375
case INDEX_op_ext8s_i64:
376
case INDEX_op_ext8u_i32:
377
case INDEX_op_ext8u_i64:
378
+ case INDEX_op_ext16s_i32:
379
+ case INDEX_op_ext16s_i64:
380
default:
381
g_assert_not_reached();
382
}
383
diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc
384
index XXXXXXX..XXXXXXX 100644
385
--- a/tcg/s390x/tcg-target.c.inc
386
+++ b/tcg/s390x/tcg-target.c.inc
387
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext8u(TCGContext *s, TCGReg dest, TCGReg src)
388
tcg_out_insn(s, RRE, LLGCR, dest, src);
389
}
390
391
-static void tgen_ext16s(TCGContext *s, TCGType type, TCGReg dest, TCGReg src)
392
+static void tcg_out_ext16s(TCGContext *s, TCGType type, TCGReg dest, TCGReg src)
393
{
394
tcg_out_insn(s, RRE, LGHR, dest, src);
395
}
396
@@ -XXX,XX +XXX,XX @@ static void tcg_out_qemu_ld_direct(TCGContext *s, MemOp opc, TCGReg data,
397
case MO_SW | MO_BSWAP:
398
/* swapped sign-extended halfword load */
399
tcg_out_insn(s, RXY, LRVH, data, base, index, disp);
400
- tgen_ext16s(s, TCG_TYPE_I64, data, data);
401
+ tcg_out_ext16s(s, TCG_TYPE_REG, data, data);
402
break;
403
case MO_SW:
404
tcg_out_insn(s, RXY, LGH, data, base, index, disp);
405
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
406
}
407
break;
408
409
- case INDEX_op_ext16s_i32:
410
- tgen_ext16s(s, TCG_TYPE_I32, args[0], args[1]);
411
- break;
412
case INDEX_op_ext16u_i32:
413
tgen_ext16u(s, TCG_TYPE_I32, args[0], args[1]);
414
break;
415
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
416
}
417
break;
418
419
- case INDEX_op_ext16s_i64:
420
- tgen_ext16s(s, TCG_TYPE_I64, args[0], args[1]);
421
- break;
422
case INDEX_op_ext_i32_i64:
423
case INDEX_op_ext32s_i64:
424
tgen_ext32s(s, args[0], args[1]);
425
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
426
case INDEX_op_ext8s_i64:
427
case INDEX_op_ext8u_i32:
428
case INDEX_op_ext8u_i64:
429
+ case INDEX_op_ext16s_i32:
430
+ case INDEX_op_ext16s_i64:
431
default:
432
g_assert_not_reached();
433
}
434
diff --git a/tcg/sparc64/tcg-target.c.inc b/tcg/sparc64/tcg-target.c.inc
435
index XXXXXXX..XXXXXXX 100644
436
--- a/tcg/sparc64/tcg-target.c.inc
437
+++ b/tcg/sparc64/tcg-target.c.inc
438
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext8s(TCGContext *s, TCGType type, TCGReg rd, TCGReg rs)
439
g_assert_not_reached();
440
}
441
442
+static void tcg_out_ext16s(TCGContext *s, TCGType type, TCGReg rd, TCGReg rs)
443
+{
444
+ g_assert_not_reached();
445
+}
446
+
447
static void tcg_out_ext8u(TCGContext *s, TCGReg rd, TCGReg rs)
448
{
449
tcg_out_arithi(s, rd, rs, 0xff, ARITH_AND);
450
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
451
case INDEX_op_ext8s_i64:
452
case INDEX_op_ext8u_i32:
453
case INDEX_op_ext8u_i64:
454
+ case INDEX_op_ext16s_i32:
455
+ case INDEX_op_ext16s_i64:
456
default:
457
g_assert_not_reached();
458
}
459
diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc
460
index XXXXXXX..XXXXXXX 100644
461
--- a/tcg/tci/tcg-target.c.inc
462
+++ b/tcg/tci/tcg-target.c.inc
463
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext8u(TCGContext *s, TCGReg rd, TCGReg rs)
464
}
465
}
466
467
+static void tcg_out_ext16s(TCGContext *s, TCGType type, TCGReg rd, TCGReg rs)
468
+{
469
+ switch (type) {
470
+ case TCG_TYPE_I32:
471
+ tcg_debug_assert(TCG_TARGET_HAS_ext16s_i32);
472
+ tcg_out_op_rr(s, INDEX_op_ext16s_i32, rd, rs);
473
+ break;
474
+#if TCG_TARGET_REG_BITS == 64
475
+ case TCG_TYPE_I64:
476
+ tcg_debug_assert(TCG_TARGET_HAS_ext16s_i64);
477
+ tcg_out_op_rr(s, INDEX_op_ext16s_i64, rd, rs);
478
+ break;
479
+#endif
480
+ default:
481
+ g_assert_not_reached();
482
+ }
483
+}
484
+
485
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
486
tcg_target_long imm)
487
{
488
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
489
490
CASE_32_64(neg) /* Optional (TCG_TARGET_HAS_neg_*). */
491
CASE_32_64(not) /* Optional (TCG_TARGET_HAS_not_*). */
492
- CASE_32_64(ext16s) /* Optional (TCG_TARGET_HAS_ext16s_*). */
493
CASE_32_64(ext16u) /* Optional (TCG_TARGET_HAS_ext16u_*). */
494
CASE_64(ext32s) /* Optional (TCG_TARGET_HAS_ext32s_i64). */
495
CASE_64(ext32u) /* Optional (TCG_TARGET_HAS_ext32u_i64). */
496
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
497
case INDEX_op_ext8s_i64:
498
case INDEX_op_ext8u_i32:
499
case INDEX_op_ext8u_i64:
500
+ case INDEX_op_ext16s_i32:
501
+ case INDEX_op_ext16s_i64:
502
default:
503
g_assert_not_reached();
504
}
116
--
505
--
117
2.25.1
506
2.34.1
118
507
119
508
diff view generated by jsdifflib
1
This will allow additional code sharing.
1
We will need a backend interface for performing 16-bit zero-extend.
2
No functional change.
2
Use it in tcg_reg_alloc_op in the meantime.
3
3
4
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
4
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
6
---
7
accel/tcg/cpu-exec.c | 30 ++++++++++++++++++++++++++++++
7
tcg/tcg.c | 5 +++++
8
accel/tcg/tcg-runtime.c | 22 ----------------------
8
tcg/aarch64/tcg-target.c.inc | 13 ++++++++-----
9
2 files changed, 30 insertions(+), 22 deletions(-)
9
tcg/arm/tcg-target.c.inc | 17 ++++++++++-------
10
tcg/i386/tcg-target.c.inc | 8 +++-----
11
tcg/loongarch64/tcg-target.c.inc | 7 ++-----
12
tcg/mips/tcg-target.c.inc | 5 +++++
13
tcg/ppc/tcg-target.c.inc | 4 +++-
14
tcg/riscv/tcg-target.c.inc | 7 ++-----
15
tcg/s390x/tcg-target.c.inc | 17 ++++++-----------
16
tcg/sparc64/tcg-target.c.inc | 11 +++++++++--
17
tcg/tci/tcg-target.c.inc | 14 +++++++++++++-
18
11 files changed, 66 insertions(+), 42 deletions(-)
10
19
11
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
20
diff --git a/tcg/tcg.c b/tcg/tcg.c
12
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
13
--- a/accel/tcg/cpu-exec.c
22
--- a/tcg/tcg.c
14
+++ b/accel/tcg/cpu-exec.c
23
+++ b/tcg/tcg.c
15
@@ -XXX,XX +XXX,XX @@
24
@@ -XXX,XX +XXX,XX @@ static void tcg_out_movi(TCGContext *s, TCGType type,
16
#include "exec/cpu-all.h"
25
static void tcg_out_ext8s(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg);
17
#include "sysemu/cpu-timers.h"
26
static void tcg_out_ext16s(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg);
18
#include "sysemu/replay.h"
27
static void tcg_out_ext8u(TCGContext *s, TCGReg ret, TCGReg arg);
19
+#include "exec/helper-proto.h"
28
+static void tcg_out_ext16u(TCGContext *s, TCGReg ret, TCGReg arg);
20
#include "tb-hash.h"
29
static void tcg_out_addi_ptr(TCGContext *s, TCGReg, TCGReg, tcg_target_long);
21
#include "tb-lookup.h"
30
static void tcg_out_exit_tb(TCGContext *s, uintptr_t arg);
22
#include "tb-context.h"
31
static void tcg_out_goto_tb(TCGContext *s, int which);
23
@@ -XXX,XX +XXX,XX @@ static void init_delay_params(SyncClocks *sc, const CPUState *cpu)
32
@@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op)
24
}
33
case INDEX_op_ext16s_i64:
25
#endif /* CONFIG USER ONLY */
34
tcg_out_ext16s(s, TCG_TYPE_I64, new_args[0], new_args[1]);
26
35
break;
27
+/**
36
+ case INDEX_op_ext16u_i32:
28
+ * helper_lookup_tb_ptr: quick check for next tb
37
+ case INDEX_op_ext16u_i64:
29
+ * @env: current cpu state
38
+ tcg_out_ext16u(s, new_args[0], new_args[1]);
30
+ *
39
+ break;
31
+ * Look for an existing TB matching the current cpu state.
40
default:
32
+ * If found, return the code pointer. If not found, return
41
if (def->flags & TCG_OPF_VECTOR) {
33
+ * the tcg epilogue so that we return into cpu_tb_exec.
42
tcg_out_vec_op(s, op->opc, TCGOP_VECL(op), TCGOP_VECE(op),
34
+ */
43
diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc
35
+const void *HELPER(lookup_tb_ptr)(CPUArchState *env)
44
index XXXXXXX..XXXXXXX 100644
45
--- a/tcg/aarch64/tcg-target.c.inc
46
+++ b/tcg/aarch64/tcg-target.c.inc
47
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext8u(TCGContext *s, TCGReg rd, TCGReg rn)
48
tcg_out_uxt(s, MO_8, rd, rn);
49
}
50
51
+static void tcg_out_ext16u(TCGContext *s, TCGReg rd, TCGReg rn)
36
+{
52
+{
37
+ CPUState *cpu = env_cpu(env);
53
+ tcg_out_uxt(s, MO_16, rd, rn);
38
+ TranslationBlock *tb;
39
+ target_ulong cs_base, pc;
40
+ uint32_t flags;
41
+
42
+ cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags);
43
+
44
+ tb = tb_lookup(cpu, pc, cs_base, flags, curr_cflags(cpu));
45
+ if (tb == NULL) {
46
+ return tcg_code_gen_epilogue;
47
+ }
48
+ qemu_log_mask_and_addr(CPU_LOG_EXEC, pc,
49
+ "Chain %d: %p ["
50
+ TARGET_FMT_lx "/" TARGET_FMT_lx "/%#x] %s\n",
51
+ cpu->cpu_index, tb->tc.ptr, cs_base, pc, flags,
52
+ lookup_symbol(pc));
53
+ return tb->tc.ptr;
54
+}
54
+}
55
+
55
+
56
/* Execute a TB, and fix up the CPU state afterwards if necessary */
56
static void tcg_out_addsubi(TCGContext *s, int ext, TCGReg rd,
57
/*
57
TCGReg rn, int64_t aimm)
58
* Disable CFI checks.
58
{
59
diff --git a/accel/tcg/tcg-runtime.c b/accel/tcg/tcg-runtime.c
59
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
60
index XXXXXXX..XXXXXXX 100644
60
tcg_out_ext16s(s, ext, a0, a0);
61
--- a/accel/tcg/tcg-runtime.c
61
} else if ((a2 & (TCG_BSWAP_IZ | TCG_BSWAP_OZ)) == TCG_BSWAP_OZ) {
62
+++ b/accel/tcg/tcg-runtime.c
62
/* Output must be zero-extended, but input isn't. */
63
@@ -XXX,XX +XXX,XX @@
63
- tcg_out_uxt(s, MO_16, a0, a0);
64
#include "disas/disas.h"
64
+ tcg_out_ext16u(s, a0, a0);
65
#include "exec/log.h"
65
}
66
#include "tcg/tcg.h"
66
break;
67
-#include "tb-lookup.h"
67
68
68
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
69
/* 32-bit helpers */
69
case INDEX_op_ext32s_i64:
70
70
tcg_out_sxt(s, TCG_TYPE_I64, MO_32, a0, a1);
71
@@ -XXX,XX +XXX,XX @@ uint64_t HELPER(ctpop_i64)(uint64_t arg)
71
break;
72
return ctpop64(arg);
72
- case INDEX_op_ext16u_i64:
73
}
73
- case INDEX_op_ext16u_i32:
74
74
- tcg_out_uxt(s, MO_16, a0, a1);
75
-const void *HELPER(lookup_tb_ptr)(CPUArchState *env)
75
- break;
76
-{
76
case INDEX_op_extu_i32_i64:
77
- CPUState *cpu = env_cpu(env);
77
case INDEX_op_ext32u_i64:
78
- TranslationBlock *tb;
78
tcg_out_movr(s, TCG_TYPE_I32, a0, a1);
79
- target_ulong cs_base, pc;
79
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
80
- uint32_t flags;
80
case INDEX_op_ext8u_i64:
81
case INDEX_op_ext16s_i64:
82
case INDEX_op_ext16s_i32:
83
+ case INDEX_op_ext16u_i64:
84
+ case INDEX_op_ext16u_i32:
85
default:
86
g_assert_not_reached();
87
}
88
diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc
89
index XXXXXXX..XXXXXXX 100644
90
--- a/tcg/arm/tcg-target.c.inc
91
+++ b/tcg/arm/tcg-target.c.inc
92
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext16s(TCGContext *s, TCGType t, TCGReg rd, TCGReg rn)
93
tcg_out32(s, 0x06bf0070 | (COND_AL << 28) | (rd << 12) | rn);
94
}
95
96
-static void tcg_out_ext16u(TCGContext *s, ARMCond cond, TCGReg rd, TCGReg rn)
97
+static void tcg_out_ext16u_cond(TCGContext *s, ARMCond cond,
98
+ TCGReg rd, TCGReg rn)
99
{
100
/* uxth */
101
tcg_out32(s, 0x06ff0070 | (cond << 28) | (rd << 12) | rn);
102
}
103
104
+static void tcg_out_ext16u(TCGContext *s, TCGReg rd, TCGReg rn)
105
+{
106
+ tcg_out_ext16u_cond(s, COND_AL, rd, rn);
107
+}
108
+
109
static void tcg_out_bswap16(TCGContext *s, ARMCond cond,
110
TCGReg rd, TCGReg rn, int flags)
111
{
112
@@ -XXX,XX +XXX,XX @@ DEFINE_TCG_OUT_ARG(tcg_out_arg_imm32, uint32_t, tcg_out_movi32,
113
(tcg_out_movi32(s, COND_AL, TCG_REG_TMP, arg), arg = TCG_REG_TMP))
114
DEFINE_TCG_OUT_ARG(tcg_out_arg_reg8, TCGReg, tcg_out_ext8u_cond,
115
(tcg_out_ext8u_cond(s, COND_AL, TCG_REG_TMP, arg), arg = TCG_REG_TMP))
116
-DEFINE_TCG_OUT_ARG(tcg_out_arg_reg16, TCGReg, tcg_out_ext16u,
117
- (tcg_out_ext16u(s, COND_AL, TCG_REG_TMP, arg), arg = TCG_REG_TMP))
118
+DEFINE_TCG_OUT_ARG(tcg_out_arg_reg16, TCGReg, tcg_out_ext16u_cond,
119
+ (tcg_out_ext16u_cond(s, COND_AL, TCG_REG_TMP, arg), arg = TCG_REG_TMP))
120
DEFINE_TCG_OUT_ARG(tcg_out_arg_reg32, TCGReg, tcg_out_mov_reg, )
121
122
static TCGReg tcg_out_arg_reg64(TCGContext *s, TCGReg argreg,
123
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
124
tcg_out_bswap32(s, COND_AL, args[0], args[1]);
125
break;
126
127
- case INDEX_op_ext16u_i32:
128
- tcg_out_ext16u(s, COND_AL, args[0], args[1]);
129
- break;
81
-
130
-
82
- cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags);
131
case INDEX_op_deposit_i32:
132
tcg_out_deposit(s, COND_AL, args[0], args[2],
133
args[3], args[4], const_args[2]);
134
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
135
case INDEX_op_ext8s_i32: /* Always emitted via tcg_reg_alloc_op. */
136
case INDEX_op_ext8u_i32:
137
case INDEX_op_ext16s_i32:
138
+ case INDEX_op_ext16u_i32:
139
default:
140
g_assert_not_reached();
141
}
142
diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc
143
index XXXXXXX..XXXXXXX 100644
144
--- a/tcg/i386/tcg-target.c.inc
145
+++ b/tcg/i386/tcg-target.c.inc
146
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext8s(TCGContext *s, TCGType type, TCGReg dest, TCGReg src)
147
tcg_out_modrm(s, OPC_MOVSBL + P_REXB_RM + rexw, dest, src);
148
}
149
150
-static inline void tcg_out_ext16u(TCGContext *s, int dest, int src)
151
+static void tcg_out_ext16u(TCGContext *s, TCGReg dest, TCGReg src)
152
{
153
/* movzwl */
154
tcg_out_modrm(s, OPC_MOVZWL, dest, src);
155
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
156
tcg_out_modrm(s, OPC_GRP3_Ev + rexw, EXT3_NOT, a0);
157
break;
158
159
- OP_32_64(ext16u):
160
- tcg_out_ext16u(s, a0, a1);
161
- break;
83
-
162
-
84
- tb = tb_lookup(cpu, pc, cs_base, flags, curr_cflags(cpu));
163
case INDEX_op_qemu_ld_i32:
85
- if (tb == NULL) {
164
tcg_out_qemu_ld(s, args, 0);
86
- return tcg_code_gen_epilogue;
165
break;
87
- }
166
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
88
- qemu_log_mask_and_addr(CPU_LOG_EXEC, pc,
167
case INDEX_op_ext8u_i64:
89
- "Chain %d: %p ["
168
case INDEX_op_ext16s_i32:
90
- TARGET_FMT_lx "/" TARGET_FMT_lx "/%#x] %s\n",
169
case INDEX_op_ext16s_i64:
91
- cpu->cpu_index, tb->tc.ptr, cs_base, pc, flags,
170
+ case INDEX_op_ext16u_i32:
92
- lookup_symbol(pc));
171
+ case INDEX_op_ext16u_i64:
93
- return tb->tc.ptr;
172
default:
94
-}
173
g_assert_not_reached();
174
}
175
diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc
176
index XXXXXXX..XXXXXXX 100644
177
--- a/tcg/loongarch64/tcg-target.c.inc
178
+++ b/tcg/loongarch64/tcg-target.c.inc
179
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
180
tcg_out_brcond(s, a2, a0, a1, arg_label(args[3]));
181
break;
182
183
- case INDEX_op_ext16u_i32:
184
- case INDEX_op_ext16u_i64:
185
- tcg_out_ext16u(s, a0, a1);
186
- break;
95
-
187
-
96
void HELPER(exit_atomic)(CPUArchState *env)
188
case INDEX_op_ext32u_i64:
97
{
189
case INDEX_op_extu_i32_i64:
98
cpu_loop_exit_atomic(env_cpu(env), GETPC());
190
tcg_out_ext32u(s, a0, a1);
191
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
192
case INDEX_op_ext8u_i64:
193
case INDEX_op_ext16s_i32:
194
case INDEX_op_ext16s_i64:
195
+ case INDEX_op_ext16u_i32:
196
+ case INDEX_op_ext16u_i64:
197
default:
198
g_assert_not_reached();
199
}
200
diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc
201
index XXXXXXX..XXXXXXX 100644
202
--- a/tcg/mips/tcg-target.c.inc
203
+++ b/tcg/mips/tcg-target.c.inc
204
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext16s(TCGContext *s, TCGType type, TCGReg rd, TCGReg rs)
205
tcg_out_opc_reg(s, OPC_SEH, rd, TCG_REG_ZERO, rs);
206
}
207
208
+static void tcg_out_ext16u(TCGContext *s, TCGReg rd, TCGReg rs)
209
+{
210
+ tcg_out_opc_imm(s, OPC_ANDI, rd, rs, 0xffff);
211
+}
212
+
213
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
214
tcg_target_long imm)
215
{
216
diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc
217
index XXXXXXX..XXXXXXX 100644
218
--- a/tcg/ppc/tcg-target.c.inc
219
+++ b/tcg/ppc/tcg-target.c.inc
220
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext16s(TCGContext *s, TCGType type, TCGReg dst, TCGReg src)
221
tcg_out32(s, EXTSH | RA(dst) | RS(src));
222
}
223
224
-static inline void tcg_out_ext16u(TCGContext *s, TCGReg dst, TCGReg src)
225
+static void tcg_out_ext16u(TCGContext *s, TCGReg dst, TCGReg src)
226
{
227
tcg_out32(s, ANDI | SAI(src, dst, 0xffff));
228
}
229
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
230
case INDEX_op_ext8u_i64:
231
case INDEX_op_ext16s_i32:
232
case INDEX_op_ext16s_i64:
233
+ case INDEX_op_ext16u_i32:
234
+ case INDEX_op_ext16u_i64:
235
default:
236
g_assert_not_reached();
237
}
238
diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc
239
index XXXXXXX..XXXXXXX 100644
240
--- a/tcg/riscv/tcg-target.c.inc
241
+++ b/tcg/riscv/tcg-target.c.inc
242
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
243
tcg_out_qemu_st(s, args, true);
244
break;
245
246
- case INDEX_op_ext16u_i32:
247
- case INDEX_op_ext16u_i64:
248
- tcg_out_ext16u(s, a0, a1);
249
- break;
250
-
251
case INDEX_op_ext32u_i64:
252
case INDEX_op_extu_i32_i64:
253
tcg_out_ext32u(s, a0, a1);
254
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
255
case INDEX_op_ext8u_i64:
256
case INDEX_op_ext16s_i32:
257
case INDEX_op_ext16s_i64:
258
+ case INDEX_op_ext16u_i32:
259
+ case INDEX_op_ext16u_i64:
260
default:
261
g_assert_not_reached();
262
}
263
diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc
264
index XXXXXXX..XXXXXXX 100644
265
--- a/tcg/s390x/tcg-target.c.inc
266
+++ b/tcg/s390x/tcg-target.c.inc
267
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext16s(TCGContext *s, TCGType type, TCGReg dest, TCGReg src)
268
tcg_out_insn(s, RRE, LGHR, dest, src);
269
}
270
271
-static void tgen_ext16u(TCGContext *s, TCGType type, TCGReg dest, TCGReg src)
272
+static void tcg_out_ext16u(TCGContext *s, TCGReg dest, TCGReg src)
273
{
274
tcg_out_insn(s, RRE, LLGHR, dest, src);
275
}
276
@@ -XXX,XX +XXX,XX @@ static void tgen_andi(TCGContext *s, TCGType type, TCGReg dest, uint64_t val)
277
return;
278
}
279
if ((val & valid) == 0xffff) {
280
- tgen_ext16u(s, TCG_TYPE_I64, dest, dest);
281
+ tcg_out_ext16u(s, dest, dest);
282
return;
283
}
284
285
@@ -XXX,XX +XXX,XX @@ static void tcg_out_qemu_ld_direct(TCGContext *s, MemOp opc, TCGReg data,
286
case MO_UW | MO_BSWAP:
287
/* swapped unsigned halfword load with upper bits zeroed */
288
tcg_out_insn(s, RXY, LRVH, data, base, index, disp);
289
- tgen_ext16u(s, TCG_TYPE_I64, data, data);
290
+ tcg_out_ext16u(s, data, data);
291
break;
292
case MO_UW:
293
tcg_out_insn(s, RXY, LLGH, data, base, index, disp);
294
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *lb)
295
tcg_out_ext8u(s, TCG_REG_R4, data_reg);
296
break;
297
case MO_UW:
298
- tgen_ext16u(s, TCG_TYPE_I64, TCG_REG_R4, data_reg);
299
+ tcg_out_ext16u(s, TCG_REG_R4, data_reg);
300
break;
301
case MO_UL:
302
tgen_ext32u(s, TCG_REG_R4, data_reg);
303
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
304
}
305
break;
306
307
- case INDEX_op_ext16u_i32:
308
- tgen_ext16u(s, TCG_TYPE_I32, args[0], args[1]);
309
- break;
310
-
311
case INDEX_op_bswap16_i32:
312
a0 = args[0], a1 = args[1], a2 = args[2];
313
tcg_out_insn(s, RRE, LRVR, a0, a1);
314
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
315
case INDEX_op_ext32s_i64:
316
tgen_ext32s(s, args[0], args[1]);
317
break;
318
- case INDEX_op_ext16u_i64:
319
- tgen_ext16u(s, TCG_TYPE_I64, args[0], args[1]);
320
- break;
321
case INDEX_op_extu_i32_i64:
322
case INDEX_op_ext32u_i64:
323
tgen_ext32u(s, args[0], args[1]);
324
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
325
case INDEX_op_ext8u_i64:
326
case INDEX_op_ext16s_i32:
327
case INDEX_op_ext16s_i64:
328
+ case INDEX_op_ext16u_i32:
329
+ case INDEX_op_ext16u_i64:
330
default:
331
g_assert_not_reached();
332
}
333
diff --git a/tcg/sparc64/tcg-target.c.inc b/tcg/sparc64/tcg-target.c.inc
334
index XXXXXXX..XXXXXXX 100644
335
--- a/tcg/sparc64/tcg-target.c.inc
336
+++ b/tcg/sparc64/tcg-target.c.inc
337
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext8u(TCGContext *s, TCGReg rd, TCGReg rs)
338
tcg_out_arithi(s, rd, rs, 0xff, ARITH_AND);
339
}
340
341
+static void tcg_out_ext16u(TCGContext *s, TCGReg rd, TCGReg rs)
342
+{
343
+ tcg_out_arithi(s, rd, rs, 16, SHIFT_SLL);
344
+ tcg_out_arithi(s, rd, rd, 16, SHIFT_SRL);
345
+}
346
+
347
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
348
tcg_target_long imm)
349
{
350
@@ -XXX,XX +XXX,XX @@ static void emit_extend(TCGContext *s, TCGReg r, int op)
351
tcg_out_ext8u(s, r, r);
352
break;
353
case MO_16:
354
- tcg_out_arithi(s, r, r, 16, SHIFT_SLL);
355
- tcg_out_arithi(s, r, r, 16, SHIFT_SRL);
356
+ tcg_out_ext16u(s, r, r);
357
break;
358
case MO_32:
359
tcg_out_arith(s, r, r, 0, SHIFT_SRL);
360
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
361
case INDEX_op_ext8u_i64:
362
case INDEX_op_ext16s_i32:
363
case INDEX_op_ext16s_i64:
364
+ case INDEX_op_ext16u_i32:
365
+ case INDEX_op_ext16u_i64:
366
default:
367
g_assert_not_reached();
368
}
369
diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc
370
index XXXXXXX..XXXXXXX 100644
371
--- a/tcg/tci/tcg-target.c.inc
372
+++ b/tcg/tci/tcg-target.c.inc
373
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext16s(TCGContext *s, TCGType type, TCGReg rd, TCGReg rs)
374
}
375
}
376
377
+static void tcg_out_ext16u(TCGContext *s, TCGReg rd, TCGReg rs)
378
+{
379
+ if (TCG_TARGET_REG_BITS == 64) {
380
+ tcg_debug_assert(TCG_TARGET_HAS_ext16u_i64);
381
+ tcg_out_op_rr(s, INDEX_op_ext16u_i64, rd, rs);
382
+ } else {
383
+ tcg_debug_assert(TCG_TARGET_HAS_ext16u_i32);
384
+ tcg_out_op_rr(s, INDEX_op_ext16u_i32, rd, rs);
385
+ }
386
+}
387
+
388
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
389
tcg_target_long imm)
390
{
391
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
392
393
CASE_32_64(neg) /* Optional (TCG_TARGET_HAS_neg_*). */
394
CASE_32_64(not) /* Optional (TCG_TARGET_HAS_not_*). */
395
- CASE_32_64(ext16u) /* Optional (TCG_TARGET_HAS_ext16u_*). */
396
CASE_64(ext32s) /* Optional (TCG_TARGET_HAS_ext32s_i64). */
397
CASE_64(ext32u) /* Optional (TCG_TARGET_HAS_ext32u_i64). */
398
CASE_64(ext_i32)
399
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
400
case INDEX_op_ext8u_i64:
401
case INDEX_op_ext16s_i32:
402
case INDEX_op_ext16s_i64:
403
+ case INDEX_op_ext16u_i32:
404
+ case INDEX_op_ext16u_i64:
405
default:
406
g_assert_not_reached();
407
}
99
--
408
--
100
2.25.1
409
2.34.1
101
410
102
411
diff view generated by jsdifflib
1
In tcg_region_prologue_set, we reset TCGContext.code_gen_ptr.
1
We will need a backend interface for performing 32-bit sign-extend.
2
So do that after we've used it to dump the prologue contents.
2
Use it in tcg_reg_alloc_op in the meantime.
3
3
4
Fixes: b0a0794a0f16
4
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
6
---
7
tcg/tcg.c | 4 ++--
7
tcg/tcg.c | 4 ++++
8
1 file changed, 2 insertions(+), 2 deletions(-)
8
tcg/aarch64/tcg-target.c.inc | 9 +++++++--
9
tcg/arm/tcg-target.c.inc | 5 +++++
10
tcg/i386/tcg-target.c.inc | 5 +++--
11
tcg/loongarch64/tcg-target.c.inc | 2 +-
12
tcg/mips/tcg-target.c.inc | 12 +++++++++---
13
tcg/ppc/tcg-target.c.inc | 5 +++--
14
tcg/riscv/tcg-target.c.inc | 2 +-
15
tcg/s390x/tcg-target.c.inc | 10 +++++-----
16
tcg/sparc64/tcg-target.c.inc | 11 ++++++++---
17
tcg/tci/tcg-target.c.inc | 9 ++++++++-
18
11 files changed, 54 insertions(+), 20 deletions(-)
9
19
10
diff --git a/tcg/tcg.c b/tcg/tcg.c
20
diff --git a/tcg/tcg.c b/tcg/tcg.c
11
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
12
--- a/tcg/tcg.c
22
--- a/tcg/tcg.c
13
+++ b/tcg/tcg.c
23
+++ b/tcg/tcg.c
14
@@ -XXX,XX +XXX,XX @@ void tcg_prologue_init(TCGContext *s)
24
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext8s(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg);
15
(uintptr_t)s->code_buf, prologue_size);
25
static void tcg_out_ext16s(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg);
16
#endif
26
static void tcg_out_ext8u(TCGContext *s, TCGReg ret, TCGReg arg);
17
27
static void tcg_out_ext16u(TCGContext *s, TCGReg ret, TCGReg arg);
18
- tcg_region_prologue_set(s);
28
+static void tcg_out_ext32s(TCGContext *s, TCGReg ret, TCGReg arg);
19
-
29
static void tcg_out_addi_ptr(TCGContext *s, TCGReg, TCGReg, tcg_target_long);
20
#ifdef DEBUG_DISAS
30
static void tcg_out_exit_tb(TCGContext *s, uintptr_t arg);
21
if (qemu_loglevel_mask(CPU_LOG_TB_OUT_ASM)) {
31
static void tcg_out_goto_tb(TCGContext *s, int which);
22
FILE *logfile = qemu_log_lock();
32
@@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op)
23
@@ -XXX,XX +XXX,XX @@ void tcg_prologue_init(TCGContext *s)
33
case INDEX_op_ext16u_i64:
24
tcg_debug_assert(tcg_code_gen_epilogue != NULL);
34
tcg_out_ext16u(s, new_args[0], new_args[1]);
25
}
35
break;
26
#endif
36
+ case INDEX_op_ext32s_i64:
27
+
37
+ tcg_out_ext32s(s, new_args[0], new_args[1]);
28
+ tcg_region_prologue_set(s);
38
+ break;
29
}
39
default:
30
40
if (def->flags & TCG_OPF_VECTOR) {
31
void tcg_func_start(TCGContext *s)
41
tcg_out_vec_op(s, op->opc, TCGOP_VECL(op), TCGOP_VECE(op),
42
diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc
43
index XXXXXXX..XXXXXXX 100644
44
--- a/tcg/aarch64/tcg-target.c.inc
45
+++ b/tcg/aarch64/tcg-target.c.inc
46
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext16s(TCGContext *s, TCGType type, TCGReg rd, TCGReg rn)
47
tcg_out_sxt(s, type, MO_16, rd, rn);
48
}
49
50
+static void tcg_out_ext32s(TCGContext *s, TCGReg rd, TCGReg rn)
51
+{
52
+ tcg_out_sxt(s, TCG_TYPE_I64, MO_32, rd, rn);
53
+}
54
+
55
static inline void tcg_out_uxt(TCGContext *s, MemOp s_bits,
56
TCGReg rd, TCGReg rn)
57
{
58
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
59
case INDEX_op_bswap32_i64:
60
tcg_out_rev(s, TCG_TYPE_I32, MO_32, a0, a1);
61
if (a2 & TCG_BSWAP_OS) {
62
- tcg_out_sxt(s, TCG_TYPE_I64, MO_32, a0, a0);
63
+ tcg_out_ext32s(s, a0, a0);
64
}
65
break;
66
case INDEX_op_bswap32_i32:
67
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
68
break;
69
70
case INDEX_op_ext_i32_i64:
71
- case INDEX_op_ext32s_i64:
72
tcg_out_sxt(s, TCG_TYPE_I64, MO_32, a0, a1);
73
break;
74
case INDEX_op_extu_i32_i64:
75
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
76
case INDEX_op_ext16s_i32:
77
case INDEX_op_ext16u_i64:
78
case INDEX_op_ext16u_i32:
79
+ case INDEX_op_ext32s_i64:
80
default:
81
g_assert_not_reached();
82
}
83
diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc
84
index XXXXXXX..XXXXXXX 100644
85
--- a/tcg/arm/tcg-target.c.inc
86
+++ b/tcg/arm/tcg-target.c.inc
87
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext16u(TCGContext *s, TCGReg rd, TCGReg rn)
88
tcg_out_ext16u_cond(s, COND_AL, rd, rn);
89
}
90
91
+static void tcg_out_ext32s(TCGContext *s, TCGReg rd, TCGReg rn)
92
+{
93
+ g_assert_not_reached();
94
+}
95
+
96
static void tcg_out_bswap16(TCGContext *s, ARMCond cond,
97
TCGReg rd, TCGReg rn, int flags)
98
{
99
diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc
100
index XXXXXXX..XXXXXXX 100644
101
--- a/tcg/i386/tcg-target.c.inc
102
+++ b/tcg/i386/tcg-target.c.inc
103
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_ext32u(TCGContext *s, int dest, int src)
104
tcg_out_modrm(s, OPC_MOVL_GvEv, dest, src);
105
}
106
107
-static inline void tcg_out_ext32s(TCGContext *s, int dest, int src)
108
+static void tcg_out_ext32s(TCGContext *s, TCGReg dest, TCGReg src)
109
{
110
+ tcg_debug_assert(TCG_TARGET_REG_BITS == 64);
111
tcg_out_modrm(s, OPC_MOVSLQ, dest, src);
112
}
113
114
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
115
tcg_out_ext32u(s, a0, a1);
116
break;
117
case INDEX_op_ext_i32_i64:
118
- case INDEX_op_ext32s_i64:
119
tcg_out_ext32s(s, a0, a1);
120
break;
121
case INDEX_op_extrh_i64_i32:
122
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
123
case INDEX_op_ext16s_i64:
124
case INDEX_op_ext16u_i32:
125
case INDEX_op_ext16u_i64:
126
+ case INDEX_op_ext32s_i64:
127
default:
128
g_assert_not_reached();
129
}
130
diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc
131
index XXXXXXX..XXXXXXX 100644
132
--- a/tcg/loongarch64/tcg-target.c.inc
133
+++ b/tcg/loongarch64/tcg-target.c.inc
134
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
135
tcg_out_ext32u(s, a0, a1);
136
break;
137
138
- case INDEX_op_ext32s_i64:
139
case INDEX_op_extrl_i64_i32:
140
case INDEX_op_ext_i32_i64:
141
tcg_out_ext32s(s, a0, a1);
142
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
143
case INDEX_op_ext16s_i64:
144
case INDEX_op_ext16u_i32:
145
case INDEX_op_ext16u_i64:
146
+ case INDEX_op_ext32s_i64:
147
default:
148
g_assert_not_reached();
149
}
150
diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc
151
index XXXXXXX..XXXXXXX 100644
152
--- a/tcg/mips/tcg-target.c.inc
153
+++ b/tcg/mips/tcg-target.c.inc
154
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext16u(TCGContext *s, TCGReg rd, TCGReg rs)
155
tcg_out_opc_imm(s, OPC_ANDI, rd, rs, 0xffff);
156
}
157
158
+static void tcg_out_ext32s(TCGContext *s, TCGReg rd, TCGReg rs)
159
+{
160
+ tcg_debug_assert(TCG_TARGET_REG_BITS == 64);
161
+ tcg_out_opc_sa(s, OPC_SLL, rd, rs, 0);
162
+}
163
+
164
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
165
tcg_target_long imm)
166
{
167
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *l)
168
/* delay slot */
169
if (TCG_TARGET_REG_BITS == 64 && l->type == TCG_TYPE_I32) {
170
/* we always sign-extend 32-bit loads */
171
- tcg_out_opc_sa(s, OPC_SLL, v0, TCG_REG_V0, 0);
172
+ tcg_out_ext32s(s, v0, TCG_REG_V0);
173
} else {
174
tcg_out_opc_reg(s, OPC_OR, v0, TCG_REG_V0, TCG_REG_ZERO);
175
}
176
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
177
case INDEX_op_extrh_i64_i32:
178
tcg_out_dsra(s, a0, a1, 32);
179
break;
180
- case INDEX_op_ext32s_i64:
181
case INDEX_op_ext_i32_i64:
182
case INDEX_op_extrl_i64_i32:
183
- tcg_out_opc_sa(s, OPC_SLL, a0, a1, 0);
184
+ tcg_out_ext32s(s, a0, a1);
185
break;
186
case INDEX_op_ext32u_i64:
187
case INDEX_op_extu_i32_i64:
188
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
189
case INDEX_op_ext8u_i64:
190
case INDEX_op_ext16s_i32:
191
case INDEX_op_ext16s_i64:
192
+ case INDEX_op_ext32s_i64:
193
default:
194
g_assert_not_reached();
195
}
196
diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc
197
index XXXXXXX..XXXXXXX 100644
198
--- a/tcg/ppc/tcg-target.c.inc
199
+++ b/tcg/ppc/tcg-target.c.inc
200
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext16u(TCGContext *s, TCGReg dst, TCGReg src)
201
tcg_out32(s, ANDI | SAI(src, dst, 0xffff));
202
}
203
204
-static inline void tcg_out_ext32s(TCGContext *s, TCGReg dst, TCGReg src)
205
+static void tcg_out_ext32s(TCGContext *s, TCGReg dst, TCGReg src)
206
{
207
+ tcg_debug_assert(TCG_TARGET_REG_BITS == 64);
208
tcg_out32(s, EXTSW | RA(dst) | RS(src));
209
}
210
211
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
212
break;
213
214
case INDEX_op_ext_i32_i64:
215
- case INDEX_op_ext32s_i64:
216
tcg_out_ext32s(s, args[0], args[1]);
217
break;
218
case INDEX_op_extu_i32_i64:
219
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
220
case INDEX_op_ext16s_i64:
221
case INDEX_op_ext16u_i32:
222
case INDEX_op_ext16u_i64:
223
+ case INDEX_op_ext32s_i64:
224
default:
225
g_assert_not_reached();
226
}
227
diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc
228
index XXXXXXX..XXXXXXX 100644
229
--- a/tcg/riscv/tcg-target.c.inc
230
+++ b/tcg/riscv/tcg-target.c.inc
231
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
232
tcg_out_ext32u(s, a0, a1);
233
break;
234
235
- case INDEX_op_ext32s_i64:
236
case INDEX_op_extrl_i64_i32:
237
case INDEX_op_ext_i32_i64:
238
tcg_out_ext32s(s, a0, a1);
239
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
240
case INDEX_op_ext16s_i64:
241
case INDEX_op_ext16u_i32:
242
case INDEX_op_ext16u_i64:
243
+ case INDEX_op_ext32s_i64:
244
default:
245
g_assert_not_reached();
246
}
247
diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc
248
index XXXXXXX..XXXXXXX 100644
249
--- a/tcg/s390x/tcg-target.c.inc
250
+++ b/tcg/s390x/tcg-target.c.inc
251
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext16u(TCGContext *s, TCGReg dest, TCGReg src)
252
tcg_out_insn(s, RRE, LLGHR, dest, src);
253
}
254
255
-static inline void tgen_ext32s(TCGContext *s, TCGReg dest, TCGReg src)
256
+static void tcg_out_ext32s(TCGContext *s, TCGReg dest, TCGReg src)
257
{
258
tcg_out_insn(s, RRE, LGFR, dest, src);
259
}
260
@@ -XXX,XX +XXX,XX @@ static void tcg_out_qemu_ld_direct(TCGContext *s, MemOp opc, TCGReg data,
261
case MO_SL | MO_BSWAP:
262
/* swapped sign-extended int load */
263
tcg_out_insn(s, RXY, LRV, data, base, index, disp);
264
- tgen_ext32s(s, data, data);
265
+ tcg_out_ext32s(s, data, data);
266
break;
267
case MO_SL:
268
tcg_out_insn(s, RXY, LGF, data, base, index, disp);
269
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
270
a0 = args[0], a1 = args[1], a2 = args[2];
271
tcg_out_insn(s, RRE, LRVR, a0, a1);
272
if (a2 & TCG_BSWAP_OS) {
273
- tgen_ext32s(s, a0, a0);
274
+ tcg_out_ext32s(s, a0, a0);
275
} else if ((a2 & (TCG_BSWAP_IZ | TCG_BSWAP_OZ)) == TCG_BSWAP_OZ) {
276
tgen_ext32u(s, a0, a0);
277
}
278
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
279
break;
280
281
case INDEX_op_ext_i32_i64:
282
- case INDEX_op_ext32s_i64:
283
- tgen_ext32s(s, args[0], args[1]);
284
+ tcg_out_ext32s(s, args[0], args[1]);
285
break;
286
case INDEX_op_extu_i32_i64:
287
case INDEX_op_ext32u_i64:
288
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
289
case INDEX_op_ext16s_i64:
290
case INDEX_op_ext16u_i32:
291
case INDEX_op_ext16u_i64:
292
+ case INDEX_op_ext32s_i64:
293
default:
294
g_assert_not_reached();
295
}
296
diff --git a/tcg/sparc64/tcg-target.c.inc b/tcg/sparc64/tcg-target.c.inc
297
index XXXXXXX..XXXXXXX 100644
298
--- a/tcg/sparc64/tcg-target.c.inc
299
+++ b/tcg/sparc64/tcg-target.c.inc
300
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext16u(TCGContext *s, TCGReg rd, TCGReg rs)
301
tcg_out_arithi(s, rd, rd, 16, SHIFT_SRL);
302
}
303
304
+static void tcg_out_ext32s(TCGContext *s, TCGReg rd, TCGReg rs)
305
+{
306
+ tcg_out_arithi(s, rd, rs, 0, SHIFT_SRA);
307
+}
308
+
309
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
310
tcg_target_long imm)
311
{
312
@@ -XXX,XX +XXX,XX @@ static void tcg_out_qemu_ld(TCGContext *s, TCGReg data, TCGReg addr,
313
314
/* We let the helper sign-extend SB and SW, but leave SL for here. */
315
if (is_64 && (memop & MO_SSIZE) == MO_SL) {
316
- tcg_out_arithi(s, data, TCG_REG_O0, 0, SHIFT_SRA);
317
+ tcg_out_ext32s(s, data, TCG_REG_O0);
318
} else {
319
tcg_out_mov(s, TCG_TYPE_REG, data, TCG_REG_O0);
320
}
321
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
322
c = ARITH_UDIVX;
323
goto gen_arith;
324
case INDEX_op_ext_i32_i64:
325
- case INDEX_op_ext32s_i64:
326
- tcg_out_arithi(s, a0, a1, 0, SHIFT_SRA);
327
+ tcg_out_ext32s(s, a0, a1);
328
break;
329
case INDEX_op_extu_i32_i64:
330
case INDEX_op_ext32u_i64:
331
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
332
case INDEX_op_ext16s_i64:
333
case INDEX_op_ext16u_i32:
334
case INDEX_op_ext16u_i64:
335
+ case INDEX_op_ext32s_i64:
336
default:
337
g_assert_not_reached();
338
}
339
diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc
340
index XXXXXXX..XXXXXXX 100644
341
--- a/tcg/tci/tcg-target.c.inc
342
+++ b/tcg/tci/tcg-target.c.inc
343
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext16u(TCGContext *s, TCGReg rd, TCGReg rs)
344
}
345
}
346
347
+static void tcg_out_ext32s(TCGContext *s, TCGReg rd, TCGReg rs)
348
+{
349
+ tcg_debug_assert(TCG_TARGET_REG_BITS == 64);
350
+ tcg_debug_assert(TCG_TARGET_HAS_ext32s_i64);
351
+ tcg_out_op_rr(s, INDEX_op_ext32s_i64, rd, rs);
352
+}
353
+
354
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
355
tcg_target_long imm)
356
{
357
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
358
359
CASE_32_64(neg) /* Optional (TCG_TARGET_HAS_neg_*). */
360
CASE_32_64(not) /* Optional (TCG_TARGET_HAS_not_*). */
361
- CASE_64(ext32s) /* Optional (TCG_TARGET_HAS_ext32s_i64). */
362
CASE_64(ext32u) /* Optional (TCG_TARGET_HAS_ext32u_i64). */
363
CASE_64(ext_i32)
364
CASE_64(extu_i32)
365
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
366
case INDEX_op_ext16s_i64:
367
case INDEX_op_ext16u_i32:
368
case INDEX_op_ext16u_i64:
369
+ case INDEX_op_ext32s_i64:
370
default:
371
g_assert_not_reached();
372
}
32
--
373
--
33
2.25.1
374
2.34.1
34
375
35
376
diff view generated by jsdifflib
1
From: Liren Wei <lrwei@bupt.edu.cn>
1
We will need a backend interface for performing 32-bit zero-extend.
2
Use it in tcg_reg_alloc_op in the meantime.
2
3
3
The function is called only at tcg_gen_code() when duplicated TBs
4
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
4
are translated by different threads, and when the tcg_region_tree
5
is reset. Bake it into the underlying GTree as its value destroy
6
function to unite these situations.
7
Also remove tcg_region_tree_traverse() which now becomes useless.
8
9
Signed-off-by: Liren Wei <lrwei@bupt.edu.cn>
10
Message-Id: <8dc352f08d038c4e7a1f5f56962398cdc700c3aa.1625404483.git.lrwei@bupt.edu.cn>
11
[rth: Name the new tb_tc_cmp parameter correctly.]
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
---
6
---
14
include/tcg/tcg.h | 1 -
7
tcg/tcg.c | 4 ++++
15
accel/tcg/translate-all.c | 6 ------
8
tcg/aarch64/tcg-target.c.inc | 9 +++++++--
16
tcg/region.c | 19 ++++++++-----------
9
tcg/arm/tcg-target.c.inc | 5 +++++
17
3 files changed, 8 insertions(+), 18 deletions(-)
10
tcg/i386/tcg-target.c.inc | 4 ++--
11
tcg/loongarch64/tcg-target.c.inc | 2 +-
12
tcg/mips/tcg-target.c.inc | 3 ++-
13
tcg/ppc/tcg-target.c.inc | 4 +++-
14
tcg/riscv/tcg-target.c.inc | 2 +-
15
tcg/s390x/tcg-target.c.inc | 20 ++++++++++----------
16
tcg/sparc64/tcg-target.c.inc | 17 +++++++++++------
17
tcg/tci/tcg-target.c.inc | 9 ++++++++-
18
11 files changed, 54 insertions(+), 25 deletions(-)
18
19
19
diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h
20
diff --git a/tcg/tcg.c b/tcg/tcg.c
20
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
21
--- a/include/tcg/tcg.h
22
--- a/tcg/tcg.c
22
+++ b/include/tcg/tcg.h
23
+++ b/tcg/tcg.c
23
@@ -XXX,XX +XXX,XX @@ void *tcg_malloc_internal(TCGContext *s, int size);
24
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext16s(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg);
24
void tcg_pool_reset(TCGContext *s);
25
static void tcg_out_ext8u(TCGContext *s, TCGReg ret, TCGReg arg);
25
TranslationBlock *tcg_tb_alloc(TCGContext *s);
26
static void tcg_out_ext16u(TCGContext *s, TCGReg ret, TCGReg arg);
26
27
static void tcg_out_ext32s(TCGContext *s, TCGReg ret, TCGReg arg);
27
-void tb_destroy(TranslationBlock *tb);
28
+static void tcg_out_ext32u(TCGContext *s, TCGReg ret, TCGReg arg);
28
void tcg_region_reset_all(void);
29
static void tcg_out_addi_ptr(TCGContext *s, TCGReg, TCGReg, tcg_target_long);
29
30
static void tcg_out_exit_tb(TCGContext *s, uintptr_t arg);
30
size_t tcg_code_size(void);
31
static void tcg_out_goto_tb(TCGContext *s, int which);
31
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
32
@@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op)
32
index XXXXXXX..XXXXXXX 100644
33
case INDEX_op_ext32s_i64:
33
--- a/accel/tcg/translate-all.c
34
tcg_out_ext32s(s, new_args[0], new_args[1]);
34
+++ b/accel/tcg/translate-all.c
35
break;
35
@@ -XXX,XX +XXX,XX @@ static int cpu_restore_state_from_tb(CPUState *cpu, TranslationBlock *tb,
36
+ case INDEX_op_ext32u_i64:
36
return 0;
37
+ tcg_out_ext32u(s, new_args[0], new_args[1]);
37
}
38
+ break;
38
39
default:
39
-void tb_destroy(TranslationBlock *tb)
40
if (def->flags & TCG_OPF_VECTOR) {
40
-{
41
tcg_out_vec_op(s, op->opc, TCGOP_VECL(op), TCGOP_VECE(op),
41
- qemu_spin_destroy(&tb->jmp_lock);
42
diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc
42
-}
43
index XXXXXXX..XXXXXXX 100644
43
-
44
--- a/tcg/aarch64/tcg-target.c.inc
44
bool cpu_restore_state(CPUState *cpu, uintptr_t host_pc, bool will_exit)
45
+++ b/tcg/aarch64/tcg-target.c.inc
45
{
46
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext16u(TCGContext *s, TCGReg rd, TCGReg rn)
46
/*
47
tcg_out_uxt(s, MO_16, rd, rn);
47
@@ -XXX,XX +XXX,XX @@ TranslationBlock *tb_gen_code(CPUState *cpu,
48
}
48
49
49
orig_aligned -= ROUND_UP(sizeof(*tb), qemu_icache_linesize);
50
+static void tcg_out_ext32u(TCGContext *s, TCGReg rd, TCGReg rn)
50
qatomic_set(&tcg_ctx->code_gen_ptr, (void *)orig_aligned);
51
- tb_destroy(tb);
52
tcg_tb_remove(tb);
53
return existing_tb;
54
}
55
diff --git a/tcg/region.c b/tcg/region.c
56
index XXXXXXX..XXXXXXX 100644
57
--- a/tcg/region.c
58
+++ b/tcg/region.c
59
@@ -XXX,XX +XXX,XX @@ static int ptr_cmp_tb_tc(const void *ptr, const struct tb_tc *s)
60
return 0;
61
}
62
63
-static gint tb_tc_cmp(gconstpointer ap, gconstpointer bp)
64
+static gint tb_tc_cmp(gconstpointer ap, gconstpointer bp, gpointer userdata)
65
{
66
const struct tb_tc *a = ap;
67
const struct tb_tc *b = bp;
68
@@ -XXX,XX +XXX,XX @@ static gint tb_tc_cmp(gconstpointer ap, gconstpointer bp)
69
return ptr_cmp_tb_tc(b->ptr, a);
70
}
71
72
+static void tb_destroy(gpointer value)
73
+{
51
+{
74
+ TranslationBlock *tb = value;
52
+ tcg_out_movr(s, TCG_TYPE_I32, rd, rn);
75
+ qemu_spin_destroy(&tb->jmp_lock);
76
+}
53
+}
77
+
54
+
78
static void tcg_region_trees_init(void)
55
static void tcg_out_addsubi(TCGContext *s, int ext, TCGReg rd,
79
{
56
TCGReg rn, int64_t aimm)
80
size_t i;
57
{
81
@@ -XXX,XX +XXX,XX @@ static void tcg_region_trees_init(void)
58
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
82
struct tcg_region_tree *rt = region_trees + i * tree_size;
59
tcg_out_sxt(s, TCG_TYPE_I64, MO_32, a0, a1);
83
60
break;
84
qemu_mutex_init(&rt->lock);
61
case INDEX_op_extu_i32_i64:
85
- rt->tree = g_tree_new(tb_tc_cmp);
62
- case INDEX_op_ext32u_i64:
86
+ rt->tree = g_tree_new_full(tb_tc_cmp, NULL, NULL, tb_destroy);
63
- tcg_out_movr(s, TCG_TYPE_I32, a0, a1);
87
}
64
+ tcg_out_ext32u(s, a0, a1);
88
}
65
break;
89
66
90
@@ -XXX,XX +XXX,XX @@ size_t tcg_nb_tbs(void)
67
case INDEX_op_deposit_i64:
91
return nb_tbs;
68
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
92
}
69
case INDEX_op_ext16u_i64:
93
70
case INDEX_op_ext16u_i32:
94
-static gboolean tcg_region_tree_traverse(gpointer k, gpointer v, gpointer data)
71
case INDEX_op_ext32s_i64:
95
-{
72
+ case INDEX_op_ext32u_i64:
96
- TranslationBlock *tb = v;
73
default:
97
-
74
g_assert_not_reached();
98
- tb_destroy(tb);
75
}
99
- return FALSE;
76
diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc
100
-}
77
index XXXXXXX..XXXXXXX 100644
101
-
78
--- a/tcg/arm/tcg-target.c.inc
102
static void tcg_region_tree_reset_all(void)
79
+++ b/tcg/arm/tcg-target.c.inc
103
{
80
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext32s(TCGContext *s, TCGReg rd, TCGReg rn)
104
size_t i;
81
g_assert_not_reached();
105
@@ -XXX,XX +XXX,XX @@ static void tcg_region_tree_reset_all(void)
82
}
106
for (i = 0; i < region.n; i++) {
83
107
struct tcg_region_tree *rt = region_trees + i * tree_size;
84
+static void tcg_out_ext32u(TCGContext *s, TCGReg rd, TCGReg rn)
108
85
+{
109
- g_tree_foreach(rt->tree, tcg_region_tree_traverse, NULL);
86
+ g_assert_not_reached();
110
/* Increment the refcount first so that destroy acts as a reset */
87
+}
111
g_tree_ref(rt->tree);
88
+
112
g_tree_destroy(rt->tree);
89
static void tcg_out_bswap16(TCGContext *s, ARMCond cond,
90
TCGReg rd, TCGReg rn, int flags)
91
{
92
diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc
93
index XXXXXXX..XXXXXXX 100644
94
--- a/tcg/i386/tcg-target.c.inc
95
+++ b/tcg/i386/tcg-target.c.inc
96
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext16s(TCGContext *s, TCGType type, TCGReg dest, TCGReg src)
97
tcg_out_modrm(s, OPC_MOVSWL + rexw, dest, src);
98
}
99
100
-static inline void tcg_out_ext32u(TCGContext *s, int dest, int src)
101
+static void tcg_out_ext32u(TCGContext *s, TCGReg dest, TCGReg src)
102
{
103
/* 32-bit mov zero extends. */
104
tcg_out_modrm(s, OPC_MOVL_GvEv, dest, src);
105
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
106
tcg_out_bswap64(s, a0);
107
break;
108
case INDEX_op_extu_i32_i64:
109
- case INDEX_op_ext32u_i64:
110
case INDEX_op_extrl_i64_i32:
111
tcg_out_ext32u(s, a0, a1);
112
break;
113
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
114
case INDEX_op_ext16u_i32:
115
case INDEX_op_ext16u_i64:
116
case INDEX_op_ext32s_i64:
117
+ case INDEX_op_ext32u_i64:
118
default:
119
g_assert_not_reached();
120
}
121
diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc
122
index XXXXXXX..XXXXXXX 100644
123
--- a/tcg/loongarch64/tcg-target.c.inc
124
+++ b/tcg/loongarch64/tcg-target.c.inc
125
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
126
tcg_out_brcond(s, a2, a0, a1, arg_label(args[3]));
127
break;
128
129
- case INDEX_op_ext32u_i64:
130
case INDEX_op_extu_i32_i64:
131
tcg_out_ext32u(s, a0, a1);
132
break;
133
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
134
case INDEX_op_ext16u_i32:
135
case INDEX_op_ext16u_i64:
136
case INDEX_op_ext32s_i64:
137
+ case INDEX_op_ext32u_i64:
138
default:
139
g_assert_not_reached();
140
}
141
diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc
142
index XXXXXXX..XXXXXXX 100644
143
--- a/tcg/mips/tcg-target.c.inc
144
+++ b/tcg/mips/tcg-target.c.inc
145
@@ -XXX,XX +XXX,XX @@ static void tcg_out_bswap64(TCGContext *s, TCGReg ret, TCGReg arg)
146
147
static void tcg_out_ext32u(TCGContext *s, TCGReg ret, TCGReg arg)
148
{
149
+ tcg_debug_assert(TCG_TARGET_REG_BITS == 64);
150
if (use_mips32r2_instructions) {
151
tcg_out_opc_bf(s, OPC_DEXT, ret, arg, 31, 0);
152
} else {
153
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
154
case INDEX_op_extrl_i64_i32:
155
tcg_out_ext32s(s, a0, a1);
156
break;
157
- case INDEX_op_ext32u_i64:
158
case INDEX_op_extu_i32_i64:
159
tcg_out_ext32u(s, a0, a1);
160
break;
161
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
162
case INDEX_op_ext16s_i32:
163
case INDEX_op_ext16s_i64:
164
case INDEX_op_ext32s_i64:
165
+ case INDEX_op_ext32u_i64:
166
default:
167
g_assert_not_reached();
168
}
169
diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc
170
index XXXXXXX..XXXXXXX 100644
171
--- a/tcg/ppc/tcg-target.c.inc
172
+++ b/tcg/ppc/tcg-target.c.inc
173
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext32s(TCGContext *s, TCGReg dst, TCGReg src)
174
tcg_out32(s, EXTSW | RA(dst) | RS(src));
175
}
176
177
-static inline void tcg_out_ext32u(TCGContext *s, TCGReg dst, TCGReg src)
178
+static void tcg_out_ext32u(TCGContext *s, TCGReg dst, TCGReg src)
179
{
180
+ tcg_debug_assert(TCG_TARGET_REG_BITS == 64);
181
tcg_out_rld(s, RLDICL, dst, src, 0, 32);
182
}
183
184
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
185
case INDEX_op_ext16u_i32:
186
case INDEX_op_ext16u_i64:
187
case INDEX_op_ext32s_i64:
188
+ case INDEX_op_ext32u_i64:
189
default:
190
g_assert_not_reached();
191
}
192
diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc
193
index XXXXXXX..XXXXXXX 100644
194
--- a/tcg/riscv/tcg-target.c.inc
195
+++ b/tcg/riscv/tcg-target.c.inc
196
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
197
tcg_out_qemu_st(s, args, true);
198
break;
199
200
- case INDEX_op_ext32u_i64:
201
case INDEX_op_extu_i32_i64:
202
tcg_out_ext32u(s, a0, a1);
203
break;
204
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
205
case INDEX_op_ext16u_i32:
206
case INDEX_op_ext16u_i64:
207
case INDEX_op_ext32s_i64:
208
+ case INDEX_op_ext32u_i64:
209
default:
210
g_assert_not_reached();
211
}
212
diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc
213
index XXXXXXX..XXXXXXX 100644
214
--- a/tcg/s390x/tcg-target.c.inc
215
+++ b/tcg/s390x/tcg-target.c.inc
216
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext32s(TCGContext *s, TCGReg dest, TCGReg src)
217
tcg_out_insn(s, RRE, LGFR, dest, src);
218
}
219
220
-static inline void tgen_ext32u(TCGContext *s, TCGReg dest, TCGReg src)
221
+static void tcg_out_ext32u(TCGContext *s, TCGReg dest, TCGReg src)
222
{
223
tcg_out_insn(s, RRE, LLGFR, dest, src);
224
}
225
@@ -XXX,XX +XXX,XX @@ static void tgen_andi(TCGContext *s, TCGType type, TCGReg dest, uint64_t val)
226
227
/* Look for the zero-extensions. */
228
if ((val & valid) == 0xffffffff) {
229
- tgen_ext32u(s, dest, dest);
230
+ tcg_out_ext32u(s, dest, dest);
231
return;
232
}
233
if ((val & valid) == 0xff) {
234
@@ -XXX,XX +XXX,XX @@ static void tgen_ctpop(TCGContext *s, TCGType type, TCGReg dest, TCGReg src)
235
/* With MIE3, and bit 0 of m4 set, we get the complete result. */
236
if (HAVE_FACILITY(MISC_INSN_EXT3)) {
237
if (type == TCG_TYPE_I32) {
238
- tgen_ext32u(s, dest, src);
239
+ tcg_out_ext32u(s, dest, src);
240
src = dest;
241
}
242
tcg_out_insn(s, RRFc, POPCNT, dest, src, 8);
243
@@ -XXX,XX +XXX,XX @@ static void tcg_out_qemu_ld_direct(TCGContext *s, MemOp opc, TCGReg data,
244
case MO_UL | MO_BSWAP:
245
/* swapped unsigned int load with upper bits zeroed */
246
tcg_out_insn(s, RXY, LRV, data, base, index, disp);
247
- tgen_ext32u(s, data, data);
248
+ tcg_out_ext32u(s, data, data);
249
break;
250
case MO_UL:
251
tcg_out_insn(s, RXY, LLGF, data, base, index, disp);
252
@@ -XXX,XX +XXX,XX @@ static TCGReg tcg_out_tlb_read(TCGContext *s, TCGReg addr_reg, MemOp opc,
253
offsetof(CPUTLBEntry, addend));
254
255
if (TARGET_LONG_BITS == 32) {
256
- tgen_ext32u(s, TCG_REG_R3, addr_reg);
257
+ tcg_out_ext32u(s, TCG_REG_R3, addr_reg);
258
return TCG_REG_R3;
259
}
260
return addr_reg;
261
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *lb)
262
tcg_out_ext16u(s, TCG_REG_R4, data_reg);
263
break;
264
case MO_UL:
265
- tgen_ext32u(s, TCG_REG_R4, data_reg);
266
+ tcg_out_ext32u(s, TCG_REG_R4, data_reg);
267
break;
268
case MO_UQ:
269
tcg_out_mov(s, TCG_TYPE_I64, TCG_REG_R4, data_reg);
270
@@ -XXX,XX +XXX,XX @@ static void tcg_prepare_user_ldst(TCGContext *s, TCGReg *addr_reg,
271
TCGReg *index_reg, tcg_target_long *disp)
272
{
273
if (TARGET_LONG_BITS == 32) {
274
- tgen_ext32u(s, TCG_TMP0, *addr_reg);
275
+ tcg_out_ext32u(s, TCG_TMP0, *addr_reg);
276
*addr_reg = TCG_TMP0;
277
}
278
if (guest_base < 0x80000) {
279
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
280
if (a2 & TCG_BSWAP_OS) {
281
tcg_out_ext32s(s, a0, a0);
282
} else if ((a2 & (TCG_BSWAP_IZ | TCG_BSWAP_OZ)) == TCG_BSWAP_OZ) {
283
- tgen_ext32u(s, a0, a0);
284
+ tcg_out_ext32u(s, a0, a0);
285
}
286
break;
287
288
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
289
tcg_out_ext32s(s, args[0], args[1]);
290
break;
291
case INDEX_op_extu_i32_i64:
292
- case INDEX_op_ext32u_i64:
293
- tgen_ext32u(s, args[0], args[1]);
294
+ tcg_out_ext32u(s, args[0], args[1]);
295
break;
296
297
case INDEX_op_add2_i64:
298
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
299
case INDEX_op_ext16u_i32:
300
case INDEX_op_ext16u_i64:
301
case INDEX_op_ext32s_i64:
302
+ case INDEX_op_ext32u_i64:
303
default:
304
g_assert_not_reached();
305
}
306
diff --git a/tcg/sparc64/tcg-target.c.inc b/tcg/sparc64/tcg-target.c.inc
307
index XXXXXXX..XXXXXXX 100644
308
--- a/tcg/sparc64/tcg-target.c.inc
309
+++ b/tcg/sparc64/tcg-target.c.inc
310
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext32s(TCGContext *s, TCGReg rd, TCGReg rs)
311
tcg_out_arithi(s, rd, rs, 0, SHIFT_SRA);
312
}
313
314
+static void tcg_out_ext32u(TCGContext *s, TCGReg rd, TCGReg rs)
315
+{
316
+ tcg_out_arithi(s, rd, rs, 0, SHIFT_SRL);
317
+}
318
+
319
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
320
tcg_target_long imm)
321
{
322
@@ -XXX,XX +XXX,XX @@ static void emit_extend(TCGContext *s, TCGReg r, int op)
323
tcg_out_ext16u(s, r, r);
324
break;
325
case MO_32:
326
- tcg_out_arith(s, r, r, 0, SHIFT_SRL);
327
+ tcg_out_ext32u(s, r, r);
328
break;
329
case MO_64:
330
break;
331
@@ -XXX,XX +XXX,XX @@ static TCGReg tcg_out_tlb_load(TCGContext *s, TCGReg addr, int mem_index,
332
333
/* If the guest address must be zero-extended, do so now. */
334
if (TARGET_LONG_BITS == 32) {
335
- tcg_out_arithi(s, r0, addr, 0, SHIFT_SRL);
336
+ tcg_out_ext32u(s, r0, addr);
337
return r0;
338
}
339
return addr;
340
@@ -XXX,XX +XXX,XX @@ static void tcg_out_qemu_ld(TCGContext *s, TCGReg data, TCGReg addr,
341
unsigned t_bits;
342
343
if (TARGET_LONG_BITS == 32) {
344
- tcg_out_arithi(s, TCG_REG_T1, addr, 0, SHIFT_SRL);
345
+ tcg_out_ext32u(s, TCG_REG_T1, addr);
346
addr = TCG_REG_T1;
347
}
348
349
@@ -XXX,XX +XXX,XX @@ static void tcg_out_qemu_st(TCGContext *s, TCGReg data, TCGReg addr,
350
unsigned t_bits;
351
352
if (TARGET_LONG_BITS == 32) {
353
- tcg_out_arithi(s, TCG_REG_T1, addr, 0, SHIFT_SRL);
354
+ tcg_out_ext32u(s, TCG_REG_T1, addr);
355
addr = TCG_REG_T1;
356
}
357
358
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
359
tcg_out_ext32s(s, a0, a1);
360
break;
361
case INDEX_op_extu_i32_i64:
362
- case INDEX_op_ext32u_i64:
363
- tcg_out_arithi(s, a0, a1, 0, SHIFT_SRL);
364
+ tcg_out_ext32u(s, a0, a1);
365
break;
366
case INDEX_op_extrl_i64_i32:
367
tcg_out_mov(s, TCG_TYPE_I32, a0, a1);
368
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
369
case INDEX_op_ext16u_i32:
370
case INDEX_op_ext16u_i64:
371
case INDEX_op_ext32s_i64:
372
+ case INDEX_op_ext32u_i64:
373
default:
374
g_assert_not_reached();
375
}
376
diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc
377
index XXXXXXX..XXXXXXX 100644
378
--- a/tcg/tci/tcg-target.c.inc
379
+++ b/tcg/tci/tcg-target.c.inc
380
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext32s(TCGContext *s, TCGReg rd, TCGReg rs)
381
tcg_out_op_rr(s, INDEX_op_ext32s_i64, rd, rs);
382
}
383
384
+static void tcg_out_ext32u(TCGContext *s, TCGReg rd, TCGReg rs)
385
+{
386
+ tcg_debug_assert(TCG_TARGET_REG_BITS == 64);
387
+ tcg_debug_assert(TCG_TARGET_HAS_ext32u_i64);
388
+ tcg_out_op_rr(s, INDEX_op_ext32u_i64, rd, rs);
389
+}
390
+
391
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
392
tcg_target_long imm)
393
{
394
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
395
396
CASE_32_64(neg) /* Optional (TCG_TARGET_HAS_neg_*). */
397
CASE_32_64(not) /* Optional (TCG_TARGET_HAS_not_*). */
398
- CASE_64(ext32u) /* Optional (TCG_TARGET_HAS_ext32u_i64). */
399
CASE_64(ext_i32)
400
CASE_64(extu_i32)
401
CASE_32_64(ctpop) /* Optional (TCG_TARGET_HAS_ctpop_*). */
402
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
403
case INDEX_op_ext16u_i32:
404
case INDEX_op_ext16u_i64:
405
case INDEX_op_ext32s_i64:
406
+ case INDEX_op_ext32u_i64:
407
default:
408
g_assert_not_reached();
409
}
113
--
410
--
114
2.25.1
411
2.34.1
115
412
116
413
diff view generated by jsdifflib
1
Reorder the control statements to allow using the page boundary
1
We will need a backend interface for type extension with sign.
2
check from translator_use_goto_tb().
2
Use it in tcg_reg_alloc_op in the meantime.
3
3
4
Reviewed-by: Stafford Horne <shorne@gmail.com>
4
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
6
---
7
target/openrisc/translate.c | 15 ++++++++-------
7
tcg/tcg.c | 4 ++++
8
1 file changed, 8 insertions(+), 7 deletions(-)
8
tcg/aarch64/tcg-target.c.inc | 9 ++++++---
9
tcg/arm/tcg-target.c.inc | 5 +++++
10
tcg/i386/tcg-target.c.inc | 9 ++++++---
11
tcg/loongarch64/tcg-target.c.inc | 7 ++++++-
12
tcg/mips/tcg-target.c.inc | 7 ++++++-
13
tcg/ppc/tcg-target.c.inc | 9 ++++++---
14
tcg/riscv/tcg-target.c.inc | 7 ++++++-
15
tcg/s390x/tcg-target.c.inc | 9 ++++++---
16
tcg/sparc64/tcg-target.c.inc | 9 ++++++---
17
tcg/tci/tcg-target.c.inc | 7 ++++++-
18
11 files changed, 63 insertions(+), 19 deletions(-)
9
19
10
diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c
20
diff --git a/tcg/tcg.c b/tcg/tcg.c
11
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
12
--- a/target/openrisc/translate.c
22
--- a/tcg/tcg.c
13
+++ b/target/openrisc/translate.c
23
+++ b/tcg/tcg.c
14
@@ -XXX,XX +XXX,XX @@ static void openrisc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)
24
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext8u(TCGContext *s, TCGReg ret, TCGReg arg);
15
/* fallthru */
25
static void tcg_out_ext16u(TCGContext *s, TCGReg ret, TCGReg arg);
16
26
static void tcg_out_ext32s(TCGContext *s, TCGReg ret, TCGReg arg);
17
case DISAS_TOO_MANY:
27
static void tcg_out_ext32u(TCGContext *s, TCGReg ret, TCGReg arg);
18
- if (unlikely(dc->base.singlestep_enabled)) {
28
+static void tcg_out_exts_i32_i64(TCGContext *s, TCGReg ret, TCGReg arg);
19
- tcg_gen_movi_tl(cpu_pc, jmp_dest);
29
static void tcg_out_addi_ptr(TCGContext *s, TCGReg, TCGReg, tcg_target_long);
20
- gen_exception(dc, EXCP_DEBUG);
30
static void tcg_out_exit_tb(TCGContext *s, uintptr_t arg);
21
- } else if ((dc->base.pc_first ^ jmp_dest) & TARGET_PAGE_MASK) {
31
static void tcg_out_goto_tb(TCGContext *s, int which);
22
- tcg_gen_movi_tl(cpu_pc, jmp_dest);
32
@@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op)
23
- tcg_gen_lookup_and_goto_ptr();
33
case INDEX_op_ext32u_i64:
24
- } else {
34
tcg_out_ext32u(s, new_args[0], new_args[1]);
25
+ if (translator_use_goto_tb(&dc->base, jmp_dest)) {
35
break;
26
tcg_gen_goto_tb(0);
36
+ case INDEX_op_ext_i32_i64:
27
tcg_gen_movi_tl(cpu_pc, jmp_dest);
37
+ tcg_out_exts_i32_i64(s, new_args[0], new_args[1]);
28
tcg_gen_exit_tb(dc->base.tb, 0);
38
+ break;
29
+ break;
39
default:
30
+ }
40
if (def->flags & TCG_OPF_VECTOR) {
31
+ tcg_gen_movi_tl(cpu_pc, jmp_dest);
41
tcg_out_vec_op(s, op->opc, TCGOP_VECL(op), TCGOP_VECE(op),
32
+ if (unlikely(dc->base.singlestep_enabled)) {
42
diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc
33
+ gen_exception(dc, EXCP_DEBUG);
43
index XXXXXXX..XXXXXXX 100644
34
+ } else {
44
--- a/tcg/aarch64/tcg-target.c.inc
35
+ tcg_gen_lookup_and_goto_ptr();
45
+++ b/tcg/aarch64/tcg-target.c.inc
46
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext32s(TCGContext *s, TCGReg rd, TCGReg rn)
47
tcg_out_sxt(s, TCG_TYPE_I64, MO_32, rd, rn);
48
}
49
50
+static void tcg_out_exts_i32_i64(TCGContext *s, TCGReg rd, TCGReg rn)
51
+{
52
+ tcg_out_ext32s(s, rd, rn);
53
+}
54
+
55
static inline void tcg_out_uxt(TCGContext *s, MemOp s_bits,
56
TCGReg rd, TCGReg rn)
57
{
58
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
36
}
59
}
37
break;
60
break;
38
61
62
- case INDEX_op_ext_i32_i64:
63
- tcg_out_sxt(s, TCG_TYPE_I64, MO_32, a0, a1);
64
- break;
65
case INDEX_op_extu_i32_i64:
66
tcg_out_ext32u(s, a0, a1);
67
break;
68
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
69
case INDEX_op_ext16u_i32:
70
case INDEX_op_ext32s_i64:
71
case INDEX_op_ext32u_i64:
72
+ case INDEX_op_ext_i32_i64:
73
default:
74
g_assert_not_reached();
75
}
76
diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc
77
index XXXXXXX..XXXXXXX 100644
78
--- a/tcg/arm/tcg-target.c.inc
79
+++ b/tcg/arm/tcg-target.c.inc
80
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext32u(TCGContext *s, TCGReg rd, TCGReg rn)
81
g_assert_not_reached();
82
}
83
84
+static void tcg_out_exts_i32_i64(TCGContext *s, TCGReg rd, TCGReg rn)
85
+{
86
+ g_assert_not_reached();
87
+}
88
+
89
static void tcg_out_bswap16(TCGContext *s, ARMCond cond,
90
TCGReg rd, TCGReg rn, int flags)
91
{
92
diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc
93
index XXXXXXX..XXXXXXX 100644
94
--- a/tcg/i386/tcg-target.c.inc
95
+++ b/tcg/i386/tcg-target.c.inc
96
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext32s(TCGContext *s, TCGReg dest, TCGReg src)
97
tcg_out_modrm(s, OPC_MOVSLQ, dest, src);
98
}
99
100
+static void tcg_out_exts_i32_i64(TCGContext *s, TCGReg dest, TCGReg src)
101
+{
102
+ tcg_out_ext32s(s, dest, src);
103
+}
104
+
105
static inline void tcg_out_bswap64(TCGContext *s, int reg)
106
{
107
tcg_out_opc(s, OPC_BSWAP + P_REXW + LOWREGMASK(reg), 0, reg, 0);
108
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
109
case INDEX_op_extrl_i64_i32:
110
tcg_out_ext32u(s, a0, a1);
111
break;
112
- case INDEX_op_ext_i32_i64:
113
- tcg_out_ext32s(s, a0, a1);
114
- break;
115
case INDEX_op_extrh_i64_i32:
116
tcg_out_shifti(s, SHIFT_SHR + P_REXW, a0, 32);
117
break;
118
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
119
case INDEX_op_ext16u_i64:
120
case INDEX_op_ext32s_i64:
121
case INDEX_op_ext32u_i64:
122
+ case INDEX_op_ext_i32_i64:
123
default:
124
g_assert_not_reached();
125
}
126
diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc
127
index XXXXXXX..XXXXXXX 100644
128
--- a/tcg/loongarch64/tcg-target.c.inc
129
+++ b/tcg/loongarch64/tcg-target.c.inc
130
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext32s(TCGContext *s, TCGReg ret, TCGReg arg)
131
tcg_out_opc_addi_w(s, ret, arg, 0);
132
}
133
134
+static void tcg_out_exts_i32_i64(TCGContext *s, TCGReg ret, TCGReg arg)
135
+{
136
+ tcg_out_ext32s(s, ret, arg);
137
+}
138
+
139
static void tcg_out_clzctz(TCGContext *s, LoongArchInsn opc,
140
TCGReg a0, TCGReg a1, TCGReg a2,
141
bool c2, bool is_32bit)
142
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
143
break;
144
145
case INDEX_op_extrl_i64_i32:
146
- case INDEX_op_ext_i32_i64:
147
tcg_out_ext32s(s, a0, a1);
148
break;
149
150
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
151
case INDEX_op_ext16u_i64:
152
case INDEX_op_ext32s_i64:
153
case INDEX_op_ext32u_i64:
154
+ case INDEX_op_ext_i32_i64:
155
default:
156
g_assert_not_reached();
157
}
158
diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc
159
index XXXXXXX..XXXXXXX 100644
160
--- a/tcg/mips/tcg-target.c.inc
161
+++ b/tcg/mips/tcg-target.c.inc
162
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext32s(TCGContext *s, TCGReg rd, TCGReg rs)
163
tcg_out_opc_sa(s, OPC_SLL, rd, rs, 0);
164
}
165
166
+static void tcg_out_exts_i32_i64(TCGContext *s, TCGReg rd, TCGReg rs)
167
+{
168
+ tcg_out_ext32s(s, rd, rs);
169
+}
170
+
171
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
172
tcg_target_long imm)
173
{
174
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
175
case INDEX_op_extrh_i64_i32:
176
tcg_out_dsra(s, a0, a1, 32);
177
break;
178
- case INDEX_op_ext_i32_i64:
179
case INDEX_op_extrl_i64_i32:
180
tcg_out_ext32s(s, a0, a1);
181
break;
182
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
183
case INDEX_op_ext16s_i64:
184
case INDEX_op_ext32s_i64:
185
case INDEX_op_ext32u_i64:
186
+ case INDEX_op_ext_i32_i64:
187
default:
188
g_assert_not_reached();
189
}
190
diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc
191
index XXXXXXX..XXXXXXX 100644
192
--- a/tcg/ppc/tcg-target.c.inc
193
+++ b/tcg/ppc/tcg-target.c.inc
194
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext32u(TCGContext *s, TCGReg dst, TCGReg src)
195
tcg_out_rld(s, RLDICL, dst, src, 0, 32);
196
}
197
198
+static void tcg_out_exts_i32_i64(TCGContext *s, TCGReg dst, TCGReg src)
199
+{
200
+ tcg_out_ext32s(s, dst, src);
201
+}
202
+
203
static inline void tcg_out_shli32(TCGContext *s, TCGReg dst, TCGReg src, int c)
204
{
205
tcg_out_rlw(s, RLWINM, dst, src, c, 0, 31 - c);
206
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
207
tcg_out_qemu_st(s, args, true);
208
break;
209
210
- case INDEX_op_ext_i32_i64:
211
- tcg_out_ext32s(s, args[0], args[1]);
212
- break;
213
case INDEX_op_extu_i32_i64:
214
tcg_out_ext32u(s, args[0], args[1]);
215
break;
216
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
217
case INDEX_op_ext16u_i64:
218
case INDEX_op_ext32s_i64:
219
case INDEX_op_ext32u_i64:
220
+ case INDEX_op_ext_i32_i64:
221
default:
222
g_assert_not_reached();
223
}
224
diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc
225
index XXXXXXX..XXXXXXX 100644
226
--- a/tcg/riscv/tcg-target.c.inc
227
+++ b/tcg/riscv/tcg-target.c.inc
228
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext32s(TCGContext *s, TCGReg ret, TCGReg arg)
229
tcg_out_opc_imm(s, OPC_ADDIW, ret, arg, 0);
230
}
231
232
+static void tcg_out_exts_i32_i64(TCGContext *s, TCGReg ret, TCGReg arg)
233
+{
234
+ tcg_out_ext32s(s, ret, arg);
235
+}
236
+
237
static void tcg_out_ldst(TCGContext *s, RISCVInsn opc, TCGReg data,
238
TCGReg addr, intptr_t offset)
239
{
240
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
241
break;
242
243
case INDEX_op_extrl_i64_i32:
244
- case INDEX_op_ext_i32_i64:
245
tcg_out_ext32s(s, a0, a1);
246
break;
247
248
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
249
case INDEX_op_ext16u_i64:
250
case INDEX_op_ext32s_i64:
251
case INDEX_op_ext32u_i64:
252
+ case INDEX_op_ext_i32_i64:
253
default:
254
g_assert_not_reached();
255
}
256
diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc
257
index XXXXXXX..XXXXXXX 100644
258
--- a/tcg/s390x/tcg-target.c.inc
259
+++ b/tcg/s390x/tcg-target.c.inc
260
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext32u(TCGContext *s, TCGReg dest, TCGReg src)
261
tcg_out_insn(s, RRE, LLGFR, dest, src);
262
}
263
264
+static void tcg_out_exts_i32_i64(TCGContext *s, TCGReg dest, TCGReg src)
265
+{
266
+ tcg_out_ext32s(s, dest, src);
267
+}
268
+
269
static void tgen_andi_risbg(TCGContext *s, TCGReg out, TCGReg in, uint64_t val)
270
{
271
int msb, lsb;
272
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
273
}
274
break;
275
276
- case INDEX_op_ext_i32_i64:
277
- tcg_out_ext32s(s, args[0], args[1]);
278
- break;
279
case INDEX_op_extu_i32_i64:
280
tcg_out_ext32u(s, args[0], args[1]);
281
break;
282
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
283
case INDEX_op_ext16u_i64:
284
case INDEX_op_ext32s_i64:
285
case INDEX_op_ext32u_i64:
286
+ case INDEX_op_ext_i32_i64:
287
default:
288
g_assert_not_reached();
289
}
290
diff --git a/tcg/sparc64/tcg-target.c.inc b/tcg/sparc64/tcg-target.c.inc
291
index XXXXXXX..XXXXXXX 100644
292
--- a/tcg/sparc64/tcg-target.c.inc
293
+++ b/tcg/sparc64/tcg-target.c.inc
294
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext32u(TCGContext *s, TCGReg rd, TCGReg rs)
295
tcg_out_arithi(s, rd, rs, 0, SHIFT_SRL);
296
}
297
298
+static void tcg_out_exts_i32_i64(TCGContext *s, TCGReg rd, TCGReg rs)
299
+{
300
+ tcg_out_ext32s(s, rd, rs);
301
+}
302
+
303
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
304
tcg_target_long imm)
305
{
306
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
307
case INDEX_op_divu_i64:
308
c = ARITH_UDIVX;
309
goto gen_arith;
310
- case INDEX_op_ext_i32_i64:
311
- tcg_out_ext32s(s, a0, a1);
312
- break;
313
case INDEX_op_extu_i32_i64:
314
tcg_out_ext32u(s, a0, a1);
315
break;
316
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
317
case INDEX_op_ext16u_i64:
318
case INDEX_op_ext32s_i64:
319
case INDEX_op_ext32u_i64:
320
+ case INDEX_op_ext_i32_i64:
321
default:
322
g_assert_not_reached();
323
}
324
diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc
325
index XXXXXXX..XXXXXXX 100644
326
--- a/tcg/tci/tcg-target.c.inc
327
+++ b/tcg/tci/tcg-target.c.inc
328
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext32u(TCGContext *s, TCGReg rd, TCGReg rs)
329
tcg_out_op_rr(s, INDEX_op_ext32u_i64, rd, rs);
330
}
331
332
+static void tcg_out_exts_i32_i64(TCGContext *s, TCGReg rd, TCGReg rs)
333
+{
334
+ tcg_out_ext32s(s, rd, rs);
335
+}
336
+
337
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
338
tcg_target_long imm)
339
{
340
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
341
342
CASE_32_64(neg) /* Optional (TCG_TARGET_HAS_neg_*). */
343
CASE_32_64(not) /* Optional (TCG_TARGET_HAS_not_*). */
344
- CASE_64(ext_i32)
345
CASE_64(extu_i32)
346
CASE_32_64(ctpop) /* Optional (TCG_TARGET_HAS_ctpop_*). */
347
case INDEX_op_bswap32_i32: /* Optional (TCG_TARGET_HAS_bswap32_i32). */
348
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
349
case INDEX_op_ext16u_i64:
350
case INDEX_op_ext32s_i64:
351
case INDEX_op_ext32u_i64:
352
+ case INDEX_op_ext_i32_i64:
353
default:
354
g_assert_not_reached();
355
}
39
--
356
--
40
2.25.1
357
2.34.1
41
358
42
359
diff view generated by jsdifflib
1
Since 6eea04347eb6, all tcg backends support goto_ptr.
1
We will need a backend interface for type extension with zero.
2
Remove the conditional, making support mandatory.
2
Use it in tcg_reg_alloc_op in the meantime.
3
3
4
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
4
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
6
---
7
include/tcg/tcg-opc.h | 3 +--
7
tcg/tcg.c | 4 ++++
8
tcg/aarch64/tcg-target.h | 1 -
8
tcg/aarch64/tcg-target.c.inc | 10 ++++++----
9
tcg/arm/tcg-target.h | 1 -
9
tcg/arm/tcg-target.c.inc | 5 +++++
10
tcg/i386/tcg-target.h | 1 -
10
tcg/i386/tcg-target.c.inc | 7 ++++++-
11
tcg/mips/tcg-target.h | 1 -
11
tcg/loongarch64/tcg-target.c.inc | 10 ++++++----
12
tcg/ppc/tcg-target.h | 1 -
12
tcg/mips/tcg-target.c.inc | 9 ++++++---
13
tcg/riscv/tcg-target.h | 1 -
13
tcg/ppc/tcg-target.c.inc | 10 ++++++----
14
tcg/s390/tcg-target.h | 1 -
14
tcg/riscv/tcg-target.c.inc | 10 ++++++----
15
tcg/sparc/tcg-target.h | 1 -
15
tcg/s390x/tcg-target.c.inc | 10 ++++++----
16
tcg/tci/tcg-target.h | 1 -
16
tcg/sparc64/tcg-target.c.inc | 9 ++++++---
17
tcg/tcg-op.c | 2 +-
17
tcg/tci/tcg-target.c.inc | 7 ++++++-
18
tcg/tcg.c | 8 ++------
18
11 files changed, 63 insertions(+), 28 deletions(-)
19
12 files changed, 4 insertions(+), 18 deletions(-)
20
19
21
diff --git a/include/tcg/tcg-opc.h b/include/tcg/tcg-opc.h
22
index XXXXXXX..XXXXXXX 100644
23
--- a/include/tcg/tcg-opc.h
24
+++ b/include/tcg/tcg-opc.h
25
@@ -XXX,XX +XXX,XX @@ DEF(insn_start, 0, 0, TLADDR_ARGS * TARGET_INSN_START_WORDS,
26
TCG_OPF_NOT_PRESENT)
27
DEF(exit_tb, 0, 0, 1, TCG_OPF_BB_EXIT | TCG_OPF_BB_END)
28
DEF(goto_tb, 0, 0, 1, TCG_OPF_BB_EXIT | TCG_OPF_BB_END)
29
-DEF(goto_ptr, 0, 1, 0,
30
- TCG_OPF_BB_EXIT | TCG_OPF_BB_END | IMPL(TCG_TARGET_HAS_goto_ptr))
31
+DEF(goto_ptr, 0, 1, 0, TCG_OPF_BB_EXIT | TCG_OPF_BB_END)
32
33
DEF(plugin_cb_start, 0, 0, 3, TCG_OPF_NOT_PRESENT)
34
DEF(plugin_cb_end, 0, 0, 0, TCG_OPF_NOT_PRESENT)
35
diff --git a/tcg/aarch64/tcg-target.h b/tcg/aarch64/tcg-target.h
36
index XXXXXXX..XXXXXXX 100644
37
--- a/tcg/aarch64/tcg-target.h
38
+++ b/tcg/aarch64/tcg-target.h
39
@@ -XXX,XX +XXX,XX @@ typedef enum {
40
#define TCG_TARGET_HAS_mulsh_i32 0
41
#define TCG_TARGET_HAS_extrl_i64_i32 0
42
#define TCG_TARGET_HAS_extrh_i64_i32 0
43
-#define TCG_TARGET_HAS_goto_ptr 1
44
#define TCG_TARGET_HAS_qemu_st8_i32 0
45
46
#define TCG_TARGET_HAS_div_i64 1
47
diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h
48
index XXXXXXX..XXXXXXX 100644
49
--- a/tcg/arm/tcg-target.h
50
+++ b/tcg/arm/tcg-target.h
51
@@ -XXX,XX +XXX,XX @@ extern bool use_neon_instructions;
52
#define TCG_TARGET_HAS_mulsh_i32 0
53
#define TCG_TARGET_HAS_div_i32 use_idiv_instructions
54
#define TCG_TARGET_HAS_rem_i32 0
55
-#define TCG_TARGET_HAS_goto_ptr 1
56
#define TCG_TARGET_HAS_direct_jump 0
57
#define TCG_TARGET_HAS_qemu_st8_i32 0
58
59
diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h
60
index XXXXXXX..XXXXXXX 100644
61
--- a/tcg/i386/tcg-target.h
62
+++ b/tcg/i386/tcg-target.h
63
@@ -XXX,XX +XXX,XX @@ extern bool have_movbe;
64
#define TCG_TARGET_HAS_muls2_i32 1
65
#define TCG_TARGET_HAS_muluh_i32 0
66
#define TCG_TARGET_HAS_mulsh_i32 0
67
-#define TCG_TARGET_HAS_goto_ptr 1
68
#define TCG_TARGET_HAS_direct_jump 1
69
70
#if TCG_TARGET_REG_BITS == 64
71
diff --git a/tcg/mips/tcg-target.h b/tcg/mips/tcg-target.h
72
index XXXXXXX..XXXXXXX 100644
73
--- a/tcg/mips/tcg-target.h
74
+++ b/tcg/mips/tcg-target.h
75
@@ -XXX,XX +XXX,XX @@ extern bool use_mips32r2_instructions;
76
#define TCG_TARGET_HAS_muluh_i32 1
77
#define TCG_TARGET_HAS_mulsh_i32 1
78
#define TCG_TARGET_HAS_bswap32_i32 1
79
-#define TCG_TARGET_HAS_goto_ptr 1
80
#define TCG_TARGET_HAS_direct_jump 1
81
82
#if TCG_TARGET_REG_BITS == 64
83
diff --git a/tcg/ppc/tcg-target.h b/tcg/ppc/tcg-target.h
84
index XXXXXXX..XXXXXXX 100644
85
--- a/tcg/ppc/tcg-target.h
86
+++ b/tcg/ppc/tcg-target.h
87
@@ -XXX,XX +XXX,XX @@ extern bool have_vsx;
88
#define TCG_TARGET_HAS_muls2_i32 0
89
#define TCG_TARGET_HAS_muluh_i32 1
90
#define TCG_TARGET_HAS_mulsh_i32 1
91
-#define TCG_TARGET_HAS_goto_ptr 1
92
#define TCG_TARGET_HAS_direct_jump 1
93
#define TCG_TARGET_HAS_qemu_st8_i32 0
94
95
diff --git a/tcg/riscv/tcg-target.h b/tcg/riscv/tcg-target.h
96
index XXXXXXX..XXXXXXX 100644
97
--- a/tcg/riscv/tcg-target.h
98
+++ b/tcg/riscv/tcg-target.h
99
@@ -XXX,XX +XXX,XX @@ typedef enum {
100
#define TCG_TARGET_CALL_STACK_OFFSET 0
101
102
/* optional instructions */
103
-#define TCG_TARGET_HAS_goto_ptr 1
104
#define TCG_TARGET_HAS_movcond_i32 0
105
#define TCG_TARGET_HAS_div_i32 1
106
#define TCG_TARGET_HAS_rem_i32 1
107
diff --git a/tcg/s390/tcg-target.h b/tcg/s390/tcg-target.h
108
index XXXXXXX..XXXXXXX 100644
109
--- a/tcg/s390/tcg-target.h
110
+++ b/tcg/s390/tcg-target.h
111
@@ -XXX,XX +XXX,XX @@ extern uint64_t s390_facilities;
112
#define TCG_TARGET_HAS_mulsh_i32 0
113
#define TCG_TARGET_HAS_extrl_i64_i32 0
114
#define TCG_TARGET_HAS_extrh_i64_i32 0
115
-#define TCG_TARGET_HAS_goto_ptr 1
116
#define TCG_TARGET_HAS_direct_jump (s390_facilities & FACILITY_GEN_INST_EXT)
117
#define TCG_TARGET_HAS_qemu_st8_i32 0
118
119
diff --git a/tcg/sparc/tcg-target.h b/tcg/sparc/tcg-target.h
120
index XXXXXXX..XXXXXXX 100644
121
--- a/tcg/sparc/tcg-target.h
122
+++ b/tcg/sparc/tcg-target.h
123
@@ -XXX,XX +XXX,XX @@ extern bool use_vis3_instructions;
124
#define TCG_TARGET_HAS_muls2_i32 1
125
#define TCG_TARGET_HAS_muluh_i32 0
126
#define TCG_TARGET_HAS_mulsh_i32 0
127
-#define TCG_TARGET_HAS_goto_ptr 1
128
#define TCG_TARGET_HAS_direct_jump 1
129
#define TCG_TARGET_HAS_qemu_st8_i32 0
130
131
diff --git a/tcg/tci/tcg-target.h b/tcg/tci/tcg-target.h
132
index XXXXXXX..XXXXXXX 100644
133
--- a/tcg/tci/tcg-target.h
134
+++ b/tcg/tci/tcg-target.h
135
@@ -XXX,XX +XXX,XX @@
136
#define TCG_TARGET_HAS_muls2_i32 1
137
#define TCG_TARGET_HAS_muluh_i32 0
138
#define TCG_TARGET_HAS_mulsh_i32 0
139
-#define TCG_TARGET_HAS_goto_ptr 1
140
#define TCG_TARGET_HAS_direct_jump 0
141
#define TCG_TARGET_HAS_qemu_st8_i32 0
142
143
diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
144
index XXXXXXX..XXXXXXX 100644
145
--- a/tcg/tcg-op.c
146
+++ b/tcg/tcg-op.c
147
@@ -XXX,XX +XXX,XX @@ void tcg_gen_goto_tb(unsigned idx)
148
149
void tcg_gen_lookup_and_goto_ptr(void)
150
{
151
- if (TCG_TARGET_HAS_goto_ptr && !qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) {
152
+ if (!qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) {
153
TCGv_ptr ptr;
154
155
plugin_gen_disable_mem_helpers();
156
diff --git a/tcg/tcg.c b/tcg/tcg.c
20
diff --git a/tcg/tcg.c b/tcg/tcg.c
157
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
158
--- a/tcg/tcg.c
22
--- a/tcg/tcg.c
159
+++ b/tcg/tcg.c
23
+++ b/tcg/tcg.c
160
@@ -XXX,XX +XXX,XX @@ void tcg_prologue_init(TCGContext *s)
24
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext16u(TCGContext *s, TCGReg ret, TCGReg arg);
161
* For tci, we use NULL as the signal to return from the interpreter,
25
static void tcg_out_ext32s(TCGContext *s, TCGReg ret, TCGReg arg);
162
* so skip this check.
26
static void tcg_out_ext32u(TCGContext *s, TCGReg ret, TCGReg arg);
163
*/
27
static void tcg_out_exts_i32_i64(TCGContext *s, TCGReg ret, TCGReg arg);
164
- if (TCG_TARGET_HAS_goto_ptr) {
28
+static void tcg_out_extu_i32_i64(TCGContext *s, TCGReg ret, TCGReg arg);
165
- tcg_debug_assert(tcg_code_gen_epilogue != NULL);
29
static void tcg_out_addi_ptr(TCGContext *s, TCGReg, TCGReg, tcg_target_long);
166
- }
30
static void tcg_out_exit_tb(TCGContext *s, uintptr_t arg);
167
+ tcg_debug_assert(tcg_code_gen_epilogue != NULL);
31
static void tcg_out_goto_tb(TCGContext *s, int which);
168
#endif
32
@@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op)
169
33
case INDEX_op_ext_i32_i64:
170
tcg_region_prologue_set(s);
34
tcg_out_exts_i32_i64(s, new_args[0], new_args[1]);
171
@@ -XXX,XX +XXX,XX @@ bool tcg_op_supported(TCGOpcode op)
35
break;
172
case INDEX_op_insn_start:
36
+ case INDEX_op_extu_i32_i64:
173
case INDEX_op_exit_tb:
37
+ tcg_out_extu_i32_i64(s, new_args[0], new_args[1]);
174
case INDEX_op_goto_tb:
38
+ break;
175
+ case INDEX_op_goto_ptr:
39
default:
176
case INDEX_op_qemu_ld_i32:
40
if (def->flags & TCG_OPF_VECTOR) {
177
case INDEX_op_qemu_st_i32:
41
tcg_out_vec_op(s, op->opc, TCGOP_VECL(op), TCGOP_VECE(op),
178
case INDEX_op_qemu_ld_i64:
42
diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc
179
@@ -XXX,XX +XXX,XX @@ bool tcg_op_supported(TCGOpcode op)
43
index XXXXXXX..XXXXXXX 100644
180
case INDEX_op_qemu_st8_i32:
44
--- a/tcg/aarch64/tcg-target.c.inc
181
return TCG_TARGET_HAS_qemu_st8_i32;
45
+++ b/tcg/aarch64/tcg-target.c.inc
182
46
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext32u(TCGContext *s, TCGReg rd, TCGReg rn)
183
- case INDEX_op_goto_ptr:
47
tcg_out_movr(s, TCG_TYPE_I32, rd, rn);
184
- return TCG_TARGET_HAS_goto_ptr;
48
}
185
-
49
186
case INDEX_op_mov_i32:
50
+static void tcg_out_extu_i32_i64(TCGContext *s, TCGReg rd, TCGReg rn)
51
+{
52
+ tcg_out_ext32u(s, rd, rn);
53
+}
54
+
55
static void tcg_out_addsubi(TCGContext *s, int ext, TCGReg rd,
56
TCGReg rn, int64_t aimm)
57
{
58
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
59
}
60
break;
61
62
- case INDEX_op_extu_i32_i64:
63
- tcg_out_ext32u(s, a0, a1);
64
- break;
65
-
66
case INDEX_op_deposit_i64:
67
case INDEX_op_deposit_i32:
68
tcg_out_dep(s, ext, a0, REG0(2), args[3], args[4]);
69
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
70
case INDEX_op_ext32s_i64:
71
case INDEX_op_ext32u_i64:
72
case INDEX_op_ext_i32_i64:
73
+ case INDEX_op_extu_i32_i64:
74
default:
75
g_assert_not_reached();
76
}
77
diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc
78
index XXXXXXX..XXXXXXX 100644
79
--- a/tcg/arm/tcg-target.c.inc
80
+++ b/tcg/arm/tcg-target.c.inc
81
@@ -XXX,XX +XXX,XX @@ static void tcg_out_exts_i32_i64(TCGContext *s, TCGReg rd, TCGReg rn)
82
g_assert_not_reached();
83
}
84
85
+static void tcg_out_extu_i32_i64(TCGContext *s, TCGReg rd, TCGReg rn)
86
+{
87
+ g_assert_not_reached();
88
+}
89
+
90
static void tcg_out_bswap16(TCGContext *s, ARMCond cond,
91
TCGReg rd, TCGReg rn, int flags)
92
{
93
diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc
94
index XXXXXXX..XXXXXXX 100644
95
--- a/tcg/i386/tcg-target.c.inc
96
+++ b/tcg/i386/tcg-target.c.inc
97
@@ -XXX,XX +XXX,XX @@ static void tcg_out_exts_i32_i64(TCGContext *s, TCGReg dest, TCGReg src)
98
tcg_out_ext32s(s, dest, src);
99
}
100
101
+static void tcg_out_extu_i32_i64(TCGContext *s, TCGReg dest, TCGReg src)
102
+{
103
+ tcg_out_ext32u(s, dest, src);
104
+}
105
+
106
static inline void tcg_out_bswap64(TCGContext *s, int reg)
107
{
108
tcg_out_opc(s, OPC_BSWAP + P_REXW + LOWREGMASK(reg), 0, reg, 0);
109
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
110
case INDEX_op_bswap64_i64:
111
tcg_out_bswap64(s, a0);
112
break;
113
- case INDEX_op_extu_i32_i64:
114
case INDEX_op_extrl_i64_i32:
115
tcg_out_ext32u(s, a0, a1);
116
break;
117
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
118
case INDEX_op_ext32s_i64:
119
case INDEX_op_ext32u_i64:
120
case INDEX_op_ext_i32_i64:
121
+ case INDEX_op_extu_i32_i64:
122
default:
123
g_assert_not_reached();
124
}
125
diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc
126
index XXXXXXX..XXXXXXX 100644
127
--- a/tcg/loongarch64/tcg-target.c.inc
128
+++ b/tcg/loongarch64/tcg-target.c.inc
129
@@ -XXX,XX +XXX,XX @@ static void tcg_out_exts_i32_i64(TCGContext *s, TCGReg ret, TCGReg arg)
130
tcg_out_ext32s(s, ret, arg);
131
}
132
133
+static void tcg_out_extu_i32_i64(TCGContext *s, TCGReg ret, TCGReg arg)
134
+{
135
+ tcg_out_ext32u(s, ret, arg);
136
+}
137
+
138
static void tcg_out_clzctz(TCGContext *s, LoongArchInsn opc,
139
TCGReg a0, TCGReg a1, TCGReg a2,
140
bool c2, bool is_32bit)
141
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
142
tcg_out_brcond(s, a2, a0, a1, arg_label(args[3]));
143
break;
144
145
- case INDEX_op_extu_i32_i64:
146
- tcg_out_ext32u(s, a0, a1);
147
- break;
148
-
149
case INDEX_op_extrl_i64_i32:
150
tcg_out_ext32s(s, a0, a1);
151
break;
152
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
153
case INDEX_op_ext32s_i64:
154
case INDEX_op_ext32u_i64:
155
case INDEX_op_ext_i32_i64:
156
+ case INDEX_op_extu_i32_i64:
157
default:
158
g_assert_not_reached();
159
}
160
diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc
161
index XXXXXXX..XXXXXXX 100644
162
--- a/tcg/mips/tcg-target.c.inc
163
+++ b/tcg/mips/tcg-target.c.inc
164
@@ -XXX,XX +XXX,XX @@ static void tcg_out_exts_i32_i64(TCGContext *s, TCGReg rd, TCGReg rs)
165
tcg_out_ext32s(s, rd, rs);
166
}
167
168
+static void tcg_out_extu_i32_i64(TCGContext *s, TCGReg rd, TCGReg rs)
169
+{
170
+ tcg_out_ext32u(s, rd, rs);
171
+}
172
+
173
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
174
tcg_target_long imm)
175
{
176
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
177
case INDEX_op_extrl_i64_i32:
178
tcg_out_ext32s(s, a0, a1);
179
break;
180
- case INDEX_op_extu_i32_i64:
181
- tcg_out_ext32u(s, a0, a1);
182
- break;
183
184
case INDEX_op_sar_i32:
185
i1 = OPC_SRAV, i2 = OPC_SRA;
186
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
187
case INDEX_op_ext32s_i64:
188
case INDEX_op_ext32u_i64:
189
case INDEX_op_ext_i32_i64:
190
+ case INDEX_op_extu_i32_i64:
191
default:
192
g_assert_not_reached();
193
}
194
diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc
195
index XXXXXXX..XXXXXXX 100644
196
--- a/tcg/ppc/tcg-target.c.inc
197
+++ b/tcg/ppc/tcg-target.c.inc
198
@@ -XXX,XX +XXX,XX @@ static void tcg_out_exts_i32_i64(TCGContext *s, TCGReg dst, TCGReg src)
199
tcg_out_ext32s(s, dst, src);
200
}
201
202
+static void tcg_out_extu_i32_i64(TCGContext *s, TCGReg dst, TCGReg src)
203
+{
204
+ tcg_out_ext32u(s, dst, src);
205
+}
206
+
207
static inline void tcg_out_shli32(TCGContext *s, TCGReg dst, TCGReg src, int c)
208
{
209
tcg_out_rlw(s, RLWINM, dst, src, c, 0, 31 - c);
210
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
211
tcg_out_qemu_st(s, args, true);
212
break;
213
214
- case INDEX_op_extu_i32_i64:
215
- tcg_out_ext32u(s, args[0], args[1]);
216
- break;
217
-
187
case INDEX_op_setcond_i32:
218
case INDEX_op_setcond_i32:
188
case INDEX_op_brcond_i32:
219
tcg_out_setcond(s, TCG_TYPE_I32, args[3], args[0], args[1], args[2],
220
const_args[2]);
221
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
222
case INDEX_op_ext32s_i64:
223
case INDEX_op_ext32u_i64:
224
case INDEX_op_ext_i32_i64:
225
+ case INDEX_op_extu_i32_i64:
226
default:
227
g_assert_not_reached();
228
}
229
diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc
230
index XXXXXXX..XXXXXXX 100644
231
--- a/tcg/riscv/tcg-target.c.inc
232
+++ b/tcg/riscv/tcg-target.c.inc
233
@@ -XXX,XX +XXX,XX @@ static void tcg_out_exts_i32_i64(TCGContext *s, TCGReg ret, TCGReg arg)
234
tcg_out_ext32s(s, ret, arg);
235
}
236
237
+static void tcg_out_extu_i32_i64(TCGContext *s, TCGReg ret, TCGReg arg)
238
+{
239
+ tcg_out_ext32u(s, ret, arg);
240
+}
241
+
242
static void tcg_out_ldst(TCGContext *s, RISCVInsn opc, TCGReg data,
243
TCGReg addr, intptr_t offset)
244
{
245
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
246
tcg_out_qemu_st(s, args, true);
247
break;
248
249
- case INDEX_op_extu_i32_i64:
250
- tcg_out_ext32u(s, a0, a1);
251
- break;
252
-
253
case INDEX_op_extrl_i64_i32:
254
tcg_out_ext32s(s, a0, a1);
255
break;
256
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
257
case INDEX_op_ext32s_i64:
258
case INDEX_op_ext32u_i64:
259
case INDEX_op_ext_i32_i64:
260
+ case INDEX_op_extu_i32_i64:
261
default:
262
g_assert_not_reached();
263
}
264
diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc
265
index XXXXXXX..XXXXXXX 100644
266
--- a/tcg/s390x/tcg-target.c.inc
267
+++ b/tcg/s390x/tcg-target.c.inc
268
@@ -XXX,XX +XXX,XX @@ static void tcg_out_exts_i32_i64(TCGContext *s, TCGReg dest, TCGReg src)
269
tcg_out_ext32s(s, dest, src);
270
}
271
272
+static void tcg_out_extu_i32_i64(TCGContext *s, TCGReg dest, TCGReg src)
273
+{
274
+ tcg_out_ext32u(s, dest, src);
275
+}
276
+
277
static void tgen_andi_risbg(TCGContext *s, TCGReg out, TCGReg in, uint64_t val)
278
{
279
int msb, lsb;
280
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
281
}
282
break;
283
284
- case INDEX_op_extu_i32_i64:
285
- tcg_out_ext32u(s, args[0], args[1]);
286
- break;
287
-
288
case INDEX_op_add2_i64:
289
if (const_args[4]) {
290
if ((int64_t)args[4] >= 0) {
291
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
292
case INDEX_op_ext32s_i64:
293
case INDEX_op_ext32u_i64:
294
case INDEX_op_ext_i32_i64:
295
+ case INDEX_op_extu_i32_i64:
296
default:
297
g_assert_not_reached();
298
}
299
diff --git a/tcg/sparc64/tcg-target.c.inc b/tcg/sparc64/tcg-target.c.inc
300
index XXXXXXX..XXXXXXX 100644
301
--- a/tcg/sparc64/tcg-target.c.inc
302
+++ b/tcg/sparc64/tcg-target.c.inc
303
@@ -XXX,XX +XXX,XX @@ static void tcg_out_exts_i32_i64(TCGContext *s, TCGReg rd, TCGReg rs)
304
tcg_out_ext32s(s, rd, rs);
305
}
306
307
+static void tcg_out_extu_i32_i64(TCGContext *s, TCGReg rd, TCGReg rs)
308
+{
309
+ tcg_out_ext32u(s, rd, rs);
310
+}
311
+
312
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
313
tcg_target_long imm)
314
{
315
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
316
case INDEX_op_divu_i64:
317
c = ARITH_UDIVX;
318
goto gen_arith;
319
- case INDEX_op_extu_i32_i64:
320
- tcg_out_ext32u(s, a0, a1);
321
- break;
322
case INDEX_op_extrl_i64_i32:
323
tcg_out_mov(s, TCG_TYPE_I32, a0, a1);
324
break;
325
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
326
case INDEX_op_ext32s_i64:
327
case INDEX_op_ext32u_i64:
328
case INDEX_op_ext_i32_i64:
329
+ case INDEX_op_extu_i32_i64:
330
default:
331
g_assert_not_reached();
332
}
333
diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc
334
index XXXXXXX..XXXXXXX 100644
335
--- a/tcg/tci/tcg-target.c.inc
336
+++ b/tcg/tci/tcg-target.c.inc
337
@@ -XXX,XX +XXX,XX @@ static void tcg_out_exts_i32_i64(TCGContext *s, TCGReg rd, TCGReg rs)
338
tcg_out_ext32s(s, rd, rs);
339
}
340
341
+static void tcg_out_extu_i32_i64(TCGContext *s, TCGReg rd, TCGReg rs)
342
+{
343
+ tcg_out_ext32u(s, rd, rs);
344
+}
345
+
346
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
347
tcg_target_long imm)
348
{
349
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
350
351
CASE_32_64(neg) /* Optional (TCG_TARGET_HAS_neg_*). */
352
CASE_32_64(not) /* Optional (TCG_TARGET_HAS_not_*). */
353
- CASE_64(extu_i32)
354
CASE_32_64(ctpop) /* Optional (TCG_TARGET_HAS_ctpop_*). */
355
case INDEX_op_bswap32_i32: /* Optional (TCG_TARGET_HAS_bswap32_i32). */
356
case INDEX_op_bswap64_i64: /* Optional (TCG_TARGET_HAS_bswap64_i64). */
357
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
358
case INDEX_op_ext32s_i64:
359
case INDEX_op_ext32u_i64:
360
case INDEX_op_ext_i32_i64:
361
+ case INDEX_op_extu_i32_i64:
362
default:
363
g_assert_not_reached();
364
}
189
--
365
--
190
2.25.1
366
2.34.1
191
367
192
368
diff view generated by jsdifflib
1
We lost the ',' following the called function name.
1
We will need a backend interface for type truncation. For those backends
2
that did not enable TCG_TARGET_HAS_extrl_i64_i32, use tcg_out_mov.
3
Use it in tcg_reg_alloc_op in the meantime.
2
4
3
Fixes: 3e92aa34434
5
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
4
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
---
7
tcg/tcg.c | 2 +-
8
tcg/tcg.c | 4 ++++
8
1 file changed, 1 insertion(+), 1 deletion(-)
9
tcg/aarch64/tcg-target.c.inc | 6 ++++++
10
tcg/arm/tcg-target.c.inc | 5 +++++
11
tcg/i386/tcg-target.c.inc | 9 ++++++---
12
tcg/loongarch64/tcg-target.c.inc | 10 ++++++----
13
tcg/mips/tcg-target.c.inc | 9 ++++++---
14
tcg/ppc/tcg-target.c.inc | 7 +++++++
15
tcg/riscv/tcg-target.c.inc | 10 ++++++----
16
tcg/s390x/tcg-target.c.inc | 6 ++++++
17
tcg/sparc64/tcg-target.c.inc | 9 ++++++---
18
tcg/tci/tcg-target.c.inc | 7 +++++++
19
11 files changed, 65 insertions(+), 17 deletions(-)
9
20
10
diff --git a/tcg/tcg.c b/tcg/tcg.c
21
diff --git a/tcg/tcg.c b/tcg/tcg.c
11
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
12
--- a/tcg/tcg.c
23
--- a/tcg/tcg.c
13
+++ b/tcg/tcg.c
24
+++ b/tcg/tcg.c
14
@@ -XXX,XX +XXX,XX @@ static void tcg_dump_ops(TCGContext *s, bool have_prefs)
25
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext32s(TCGContext *s, TCGReg ret, TCGReg arg);
15
col += qemu_log("plugin(%p)", func);
26
static void tcg_out_ext32u(TCGContext *s, TCGReg ret, TCGReg arg);
16
}
27
static void tcg_out_exts_i32_i64(TCGContext *s, TCGReg ret, TCGReg arg);
17
28
static void tcg_out_extu_i32_i64(TCGContext *s, TCGReg ret, TCGReg arg);
18
- col += qemu_log("$0x%x,$%d", info->flags, nb_oargs);
29
+static void tcg_out_extrl_i64_i32(TCGContext *s, TCGReg ret, TCGReg arg);
19
+ col += qemu_log(",$0x%x,$%d", info->flags, nb_oargs);
30
static void tcg_out_addi_ptr(TCGContext *s, TCGReg, TCGReg, tcg_target_long);
20
for (i = 0; i < nb_oargs; i++) {
31
static void tcg_out_exit_tb(TCGContext *s, uintptr_t arg);
21
col += qemu_log(",%s", tcg_get_arg_str(s, buf, sizeof(buf),
32
static void tcg_out_goto_tb(TCGContext *s, int which);
22
op->args[i]));
33
@@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op)
34
case INDEX_op_extu_i32_i64:
35
tcg_out_extu_i32_i64(s, new_args[0], new_args[1]);
36
break;
37
+ case INDEX_op_extrl_i64_i32:
38
+ tcg_out_extrl_i64_i32(s, new_args[0], new_args[1]);
39
+ break;
40
default:
41
if (def->flags & TCG_OPF_VECTOR) {
42
tcg_out_vec_op(s, op->opc, TCGOP_VECL(op), TCGOP_VECE(op),
43
diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc
44
index XXXXXXX..XXXXXXX 100644
45
--- a/tcg/aarch64/tcg-target.c.inc
46
+++ b/tcg/aarch64/tcg-target.c.inc
47
@@ -XXX,XX +XXX,XX @@ static void tcg_out_extu_i32_i64(TCGContext *s, TCGReg rd, TCGReg rn)
48
tcg_out_ext32u(s, rd, rn);
49
}
50
51
+static void tcg_out_extrl_i64_i32(TCGContext *s, TCGReg rd, TCGReg rn)
52
+{
53
+ tcg_out_mov(s, TCG_TYPE_I32, rd, rn);
54
+}
55
+
56
static void tcg_out_addsubi(TCGContext *s, int ext, TCGReg rd,
57
TCGReg rn, int64_t aimm)
58
{
59
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
60
case INDEX_op_ext32u_i64:
61
case INDEX_op_ext_i32_i64:
62
case INDEX_op_extu_i32_i64:
63
+ case INDEX_op_extrl_i64_i32:
64
default:
65
g_assert_not_reached();
66
}
67
diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc
68
index XXXXXXX..XXXXXXX 100644
69
--- a/tcg/arm/tcg-target.c.inc
70
+++ b/tcg/arm/tcg-target.c.inc
71
@@ -XXX,XX +XXX,XX @@ static void tcg_out_extu_i32_i64(TCGContext *s, TCGReg rd, TCGReg rn)
72
g_assert_not_reached();
73
}
74
75
+static void tcg_out_extrl_i64_i32(TCGContext *s, TCGReg rd, TCGReg rn)
76
+{
77
+ g_assert_not_reached();
78
+}
79
+
80
static void tcg_out_bswap16(TCGContext *s, ARMCond cond,
81
TCGReg rd, TCGReg rn, int flags)
82
{
83
diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc
84
index XXXXXXX..XXXXXXX 100644
85
--- a/tcg/i386/tcg-target.c.inc
86
+++ b/tcg/i386/tcg-target.c.inc
87
@@ -XXX,XX +XXX,XX @@ static void tcg_out_extu_i32_i64(TCGContext *s, TCGReg dest, TCGReg src)
88
tcg_out_ext32u(s, dest, src);
89
}
90
91
+static void tcg_out_extrl_i64_i32(TCGContext *s, TCGReg dest, TCGReg src)
92
+{
93
+ tcg_out_ext32u(s, dest, src);
94
+}
95
+
96
static inline void tcg_out_bswap64(TCGContext *s, int reg)
97
{
98
tcg_out_opc(s, OPC_BSWAP + P_REXW + LOWREGMASK(reg), 0, reg, 0);
99
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
100
case INDEX_op_bswap64_i64:
101
tcg_out_bswap64(s, a0);
102
break;
103
- case INDEX_op_extrl_i64_i32:
104
- tcg_out_ext32u(s, a0, a1);
105
- break;
106
case INDEX_op_extrh_i64_i32:
107
tcg_out_shifti(s, SHIFT_SHR + P_REXW, a0, 32);
108
break;
109
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
110
case INDEX_op_ext32u_i64:
111
case INDEX_op_ext_i32_i64:
112
case INDEX_op_extu_i32_i64:
113
+ case INDEX_op_extrl_i64_i32:
114
default:
115
g_assert_not_reached();
116
}
117
diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc
118
index XXXXXXX..XXXXXXX 100644
119
--- a/tcg/loongarch64/tcg-target.c.inc
120
+++ b/tcg/loongarch64/tcg-target.c.inc
121
@@ -XXX,XX +XXX,XX @@ static void tcg_out_extu_i32_i64(TCGContext *s, TCGReg ret, TCGReg arg)
122
tcg_out_ext32u(s, ret, arg);
123
}
124
125
+static void tcg_out_extrl_i64_i32(TCGContext *s, TCGReg ret, TCGReg arg)
126
+{
127
+ tcg_out_ext32s(s, ret, arg);
128
+}
129
+
130
static void tcg_out_clzctz(TCGContext *s, LoongArchInsn opc,
131
TCGReg a0, TCGReg a1, TCGReg a2,
132
bool c2, bool is_32bit)
133
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
134
tcg_out_brcond(s, a2, a0, a1, arg_label(args[3]));
135
break;
136
137
- case INDEX_op_extrl_i64_i32:
138
- tcg_out_ext32s(s, a0, a1);
139
- break;
140
-
141
case INDEX_op_extrh_i64_i32:
142
tcg_out_opc_srai_d(s, a0, a1, 32);
143
break;
144
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
145
case INDEX_op_ext32u_i64:
146
case INDEX_op_ext_i32_i64:
147
case INDEX_op_extu_i32_i64:
148
+ case INDEX_op_extrl_i64_i32:
149
default:
150
g_assert_not_reached();
151
}
152
diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc
153
index XXXXXXX..XXXXXXX 100644
154
--- a/tcg/mips/tcg-target.c.inc
155
+++ b/tcg/mips/tcg-target.c.inc
156
@@ -XXX,XX +XXX,XX @@ static void tcg_out_extu_i32_i64(TCGContext *s, TCGReg rd, TCGReg rs)
157
tcg_out_ext32u(s, rd, rs);
158
}
159
160
+static void tcg_out_extrl_i64_i32(TCGContext *s, TCGReg rd, TCGReg rs)
161
+{
162
+ tcg_out_ext32s(s, rd, rs);
163
+}
164
+
165
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
166
tcg_target_long imm)
167
{
168
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
169
case INDEX_op_extrh_i64_i32:
170
tcg_out_dsra(s, a0, a1, 32);
171
break;
172
- case INDEX_op_extrl_i64_i32:
173
- tcg_out_ext32s(s, a0, a1);
174
- break;
175
176
case INDEX_op_sar_i32:
177
i1 = OPC_SRAV, i2 = OPC_SRA;
178
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
179
case INDEX_op_ext32u_i64:
180
case INDEX_op_ext_i32_i64:
181
case INDEX_op_extu_i32_i64:
182
+ case INDEX_op_extrl_i64_i32:
183
default:
184
g_assert_not_reached();
185
}
186
diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc
187
index XXXXXXX..XXXXXXX 100644
188
--- a/tcg/ppc/tcg-target.c.inc
189
+++ b/tcg/ppc/tcg-target.c.inc
190
@@ -XXX,XX +XXX,XX @@ static void tcg_out_extu_i32_i64(TCGContext *s, TCGReg dst, TCGReg src)
191
tcg_out_ext32u(s, dst, src);
192
}
193
194
+static void tcg_out_extrl_i64_i32(TCGContext *s, TCGReg rd, TCGReg rn)
195
+{
196
+ tcg_debug_assert(TCG_TARGET_REG_BITS == 64);
197
+ tcg_out_mov(s, TCG_TYPE_I32, rd, rn);
198
+}
199
+
200
static inline void tcg_out_shli32(TCGContext *s, TCGReg dst, TCGReg src, int c)
201
{
202
tcg_out_rlw(s, RLWINM, dst, src, c, 0, 31 - c);
203
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
204
case INDEX_op_ext32u_i64:
205
case INDEX_op_ext_i32_i64:
206
case INDEX_op_extu_i32_i64:
207
+ case INDEX_op_extrl_i64_i32:
208
default:
209
g_assert_not_reached();
210
}
211
diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc
212
index XXXXXXX..XXXXXXX 100644
213
--- a/tcg/riscv/tcg-target.c.inc
214
+++ b/tcg/riscv/tcg-target.c.inc
215
@@ -XXX,XX +XXX,XX @@ static void tcg_out_extu_i32_i64(TCGContext *s, TCGReg ret, TCGReg arg)
216
tcg_out_ext32u(s, ret, arg);
217
}
218
219
+static void tcg_out_extrl_i64_i32(TCGContext *s, TCGReg ret, TCGReg arg)
220
+{
221
+ tcg_out_ext32s(s, ret, arg);
222
+}
223
+
224
static void tcg_out_ldst(TCGContext *s, RISCVInsn opc, TCGReg data,
225
TCGReg addr, intptr_t offset)
226
{
227
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
228
tcg_out_qemu_st(s, args, true);
229
break;
230
231
- case INDEX_op_extrl_i64_i32:
232
- tcg_out_ext32s(s, a0, a1);
233
- break;
234
-
235
case INDEX_op_extrh_i64_i32:
236
tcg_out_opc_imm(s, OPC_SRAI, a0, a1, 32);
237
break;
238
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
239
case INDEX_op_ext32u_i64:
240
case INDEX_op_ext_i32_i64:
241
case INDEX_op_extu_i32_i64:
242
+ case INDEX_op_extrl_i64_i32:
243
default:
244
g_assert_not_reached();
245
}
246
diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc
247
index XXXXXXX..XXXXXXX 100644
248
--- a/tcg/s390x/tcg-target.c.inc
249
+++ b/tcg/s390x/tcg-target.c.inc
250
@@ -XXX,XX +XXX,XX @@ static void tcg_out_extu_i32_i64(TCGContext *s, TCGReg dest, TCGReg src)
251
tcg_out_ext32u(s, dest, src);
252
}
253
254
+static void tcg_out_extrl_i64_i32(TCGContext *s, TCGReg dest, TCGReg src)
255
+{
256
+ tcg_out_mov(s, TCG_TYPE_I32, dest, src);
257
+}
258
+
259
static void tgen_andi_risbg(TCGContext *s, TCGReg out, TCGReg in, uint64_t val)
260
{
261
int msb, lsb;
262
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
263
case INDEX_op_ext32u_i64:
264
case INDEX_op_ext_i32_i64:
265
case INDEX_op_extu_i32_i64:
266
+ case INDEX_op_extrl_i64_i32:
267
default:
268
g_assert_not_reached();
269
}
270
diff --git a/tcg/sparc64/tcg-target.c.inc b/tcg/sparc64/tcg-target.c.inc
271
index XXXXXXX..XXXXXXX 100644
272
--- a/tcg/sparc64/tcg-target.c.inc
273
+++ b/tcg/sparc64/tcg-target.c.inc
274
@@ -XXX,XX +XXX,XX @@ static void tcg_out_extu_i32_i64(TCGContext *s, TCGReg rd, TCGReg rs)
275
tcg_out_ext32u(s, rd, rs);
276
}
277
278
+static void tcg_out_extrl_i64_i32(TCGContext *s, TCGReg rd, TCGReg rs)
279
+{
280
+ tcg_out_mov(s, TCG_TYPE_I32, rd, rs);
281
+}
282
+
283
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
284
tcg_target_long imm)
285
{
286
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
287
case INDEX_op_divu_i64:
288
c = ARITH_UDIVX;
289
goto gen_arith;
290
- case INDEX_op_extrl_i64_i32:
291
- tcg_out_mov(s, TCG_TYPE_I32, a0, a1);
292
- break;
293
case INDEX_op_extrh_i64_i32:
294
tcg_out_arithi(s, a0, a1, 32, SHIFT_SRLX);
295
break;
296
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
297
case INDEX_op_ext32u_i64:
298
case INDEX_op_ext_i32_i64:
299
case INDEX_op_extu_i32_i64:
300
+ case INDEX_op_extrl_i64_i32:
301
default:
302
g_assert_not_reached();
303
}
304
diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc
305
index XXXXXXX..XXXXXXX 100644
306
--- a/tcg/tci/tcg-target.c.inc
307
+++ b/tcg/tci/tcg-target.c.inc
308
@@ -XXX,XX +XXX,XX @@ static void tcg_out_extu_i32_i64(TCGContext *s, TCGReg rd, TCGReg rs)
309
tcg_out_ext32u(s, rd, rs);
310
}
311
312
+static void tcg_out_extrl_i64_i32(TCGContext *s, TCGReg rd, TCGReg rs)
313
+{
314
+ tcg_debug_assert(TCG_TARGET_REG_BITS == 64);
315
+ tcg_out_mov(s, TCG_TYPE_I32, rd, rs);
316
+}
317
+
318
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
319
tcg_target_long imm)
320
{
321
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
322
case INDEX_op_ext32u_i64:
323
case INDEX_op_ext_i32_i64:
324
case INDEX_op_extu_i32_i64:
325
+ case INDEX_op_extrl_i64_i32:
326
default:
327
g_assert_not_reached();
328
}
23
--
329
--
24
2.25.1
330
2.34.1
25
331
26
332
diff view generated by jsdifflib
Deleted patch
1
From: Liren Wei <lrwei@bupt.edu.cn>
2
1
3
TranslationBlocks not inserted into the corresponding region
4
tree shall be regarded as partially initialized objects, and
5
needs to be finalized first before inserting into QHT.
6
7
Signed-off-by: Liren Wei <lrwei@bupt.edu.cn>
8
Message-Id: <f9fc263f71e11b6308d8c1fbc0dd366bf4aeb532.1625404483.git.lrwei@bupt.edu.cn>
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
---
11
accel/tcg/translate-all.c | 9 ++++++++-
12
1 file changed, 8 insertions(+), 1 deletion(-)
13
14
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/accel/tcg/translate-all.c
17
+++ b/accel/tcg/translate-all.c
18
@@ -XXX,XX +XXX,XX @@ TranslationBlock *tb_gen_code(CPUState *cpu,
19
return tb;
20
}
21
22
+ /*
23
+ * Insert TB into the corresponding region tree before publishing it
24
+ * through QHT. Otherwise rewinding happened in the TB might fail to
25
+ * lookup itself using host PC.
26
+ */
27
+ tcg_tb_insert(tb);
28
+
29
/* check next page if needed */
30
virt_page2 = (pc + tb->size - 1) & TARGET_PAGE_MASK;
31
phys_page2 = -1;
32
@@ -XXX,XX +XXX,XX @@ TranslationBlock *tb_gen_code(CPUState *cpu,
33
orig_aligned -= ROUND_UP(sizeof(*tb), qemu_icache_linesize);
34
qatomic_set(&tcg_ctx->code_gen_ptr, (void *)orig_aligned);
35
tb_destroy(tb);
36
+ tcg_tb_remove(tb);
37
return existing_tb;
38
}
39
- tcg_tb_insert(tb);
40
return tb;
41
}
42
43
--
44
2.25.1
45
46
diff view generated by jsdifflib
Deleted patch
1
We can call do_tb_phys_invalidate from an iocontext, which has
2
no per-thread tcg_ctx. Move this to tb_ctx, which is global.
3
The actual update still takes place with a lock held, so only
4
an atomic set is required, not an atomic increment.
5
1
6
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/457
7
Tested-by: Viktor Ashirov <vashirov@redhat.com>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
---
10
accel/tcg/tb-context.h | 1 +
11
include/tcg/tcg.h | 3 ---
12
accel/tcg/translate-all.c | 8 ++++----
13
tcg/region.c | 14 --------------
14
4 files changed, 5 insertions(+), 21 deletions(-)
15
16
diff --git a/accel/tcg/tb-context.h b/accel/tcg/tb-context.h
17
index XXXXXXX..XXXXXXX 100644
18
--- a/accel/tcg/tb-context.h
19
+++ b/accel/tcg/tb-context.h
20
@@ -XXX,XX +XXX,XX @@ struct TBContext {
21
22
/* statistics */
23
unsigned tb_flush_count;
24
+ unsigned tb_phys_invalidate_count;
25
};
26
27
extern TBContext tb_ctx;
28
diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h
29
index XXXXXXX..XXXXXXX 100644
30
--- a/include/tcg/tcg.h
31
+++ b/include/tcg/tcg.h
32
@@ -XXX,XX +XXX,XX @@ struct TCGContext {
33
/* Threshold to flush the translated code buffer. */
34
void *code_gen_highwater;
35
36
- size_t tb_phys_invalidate_count;
37
-
38
/* Track which vCPU triggers events */
39
CPUState *cpu; /* *_trans */
40
41
@@ -XXX,XX +XXX,XX @@ size_t tcg_code_capacity(void);
42
43
void tcg_tb_insert(TranslationBlock *tb);
44
void tcg_tb_remove(TranslationBlock *tb);
45
-size_t tcg_tb_phys_invalidate_count(void);
46
TranslationBlock *tcg_tb_lookup(uintptr_t tc_ptr);
47
void tcg_tb_foreach(GTraverseFunc func, gpointer user_data);
48
size_t tcg_nb_tbs(void);
49
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
50
index XXXXXXX..XXXXXXX 100644
51
--- a/accel/tcg/translate-all.c
52
+++ b/accel/tcg/translate-all.c
53
@@ -XXX,XX +XXX,XX @@ static void do_tb_phys_invalidate(TranslationBlock *tb, bool rm_from_page_list)
54
/* suppress any remaining jumps to this TB */
55
tb_jmp_unlink(tb);
56
57
- qatomic_set(&tcg_ctx->tb_phys_invalidate_count,
58
- tcg_ctx->tb_phys_invalidate_count + 1);
59
+ qatomic_set(&tb_ctx.tb_phys_invalidate_count,
60
+ tb_ctx.tb_phys_invalidate_count + 1);
61
}
62
63
static void tb_phys_invalidate__locked(TranslationBlock *tb)
64
@@ -XXX,XX +XXX,XX @@ void dump_exec_info(void)
65
qemu_printf("\nStatistics:\n");
66
qemu_printf("TB flush count %u\n",
67
qatomic_read(&tb_ctx.tb_flush_count));
68
- qemu_printf("TB invalidate count %zu\n",
69
- tcg_tb_phys_invalidate_count());
70
+ qemu_printf("TB invalidate count %u\n",
71
+ qatomic_read(&tb_ctx.tb_phys_invalidate_count));
72
73
tlb_flush_counts(&flush_full, &flush_part, &flush_elide);
74
qemu_printf("TLB full flushes %zu\n", flush_full);
75
diff --git a/tcg/region.c b/tcg/region.c
76
index XXXXXXX..XXXXXXX 100644
77
--- a/tcg/region.c
78
+++ b/tcg/region.c
79
@@ -XXX,XX +XXX,XX @@ size_t tcg_code_capacity(void)
80
81
return capacity;
82
}
83
-
84
-size_t tcg_tb_phys_invalidate_count(void)
85
-{
86
- unsigned int n_ctxs = qatomic_read(&tcg_cur_ctxs);
87
- unsigned int i;
88
- size_t total = 0;
89
-
90
- for (i = 0; i < n_ctxs; i++) {
91
- const TCGContext *s = qatomic_read(&tcg_ctxs[i]);
92
-
93
- total += qatomic_read(&s->tb_phys_invalidate_count);
94
- }
95
- return total;
96
-}
97
--
98
2.25.1
99
100
diff view generated by jsdifflib
1
Just use translator_use_goto_tb directly at the one call site,
1
This is common code in most qemu_{ld,st} slow paths, extending the
2
rather than maintaining a local wrapper.
2
input value for the store helper data argument or extending the
3
return value from the load helper.
3
4
4
Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
5
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
---
7
target/tricore/translate.c | 17 ++---------------
8
tcg/tcg.c | 63 ++++++++++++++++++++++++++++++++
8
1 file changed, 2 insertions(+), 15 deletions(-)
9
tcg/aarch64/tcg-target.c.inc | 8 +---
10
tcg/arm/tcg-target.c.inc | 16 ++------
11
tcg/i386/tcg-target.c.inc | 30 +++------------
12
tcg/loongarch64/tcg-target.c.inc | 53 ++++-----------------------
13
tcg/ppc/tcg-target.c.inc | 38 +++++--------------
14
tcg/riscv/tcg-target.c.inc | 13 +------
15
tcg/s390x/tcg-target.c.inc | 19 ++--------
16
tcg/sparc64/tcg-target.c.inc | 31 +++-------------
17
9 files changed, 103 insertions(+), 168 deletions(-)
9
18
10
diff --git a/target/tricore/translate.c b/target/tricore/translate.c
19
diff --git a/tcg/tcg.c b/tcg/tcg.c
11
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
12
--- a/target/tricore/translate.c
21
--- a/tcg/tcg.c
13
+++ b/target/tricore/translate.c
22
+++ b/tcg/tcg.c
14
@@ -XXX,XX +XXX,XX @@ static inline void gen_save_pc(target_ulong pc)
23
@@ -XXX,XX +XXX,XX @@ void tcg_raise_tb_overflow(TCGContext *s)
15
tcg_gen_movi_tl(cpu_PC, pc);
24
siglongjmp(s->jmp_trans, -2);
16
}
25
}
17
26
18
-static inline bool use_goto_tb(DisasContext *ctx, target_ulong dest)
27
+/**
19
-{
28
+ * tcg_out_movext -- move and extend
20
- if (unlikely(ctx->base.singlestep_enabled)) {
29
+ * @s: tcg context
21
- return false;
30
+ * @dst_type: integral type for destination
31
+ * @dst: destination register
32
+ * @src_type: integral type for source
33
+ * @src_ext: extension to apply to source
34
+ * @src: source register
35
+ *
36
+ * Move or extend @src into @dst, depending on @src_ext and the types.
37
+ */
38
+static void __attribute__((unused))
39
+tcg_out_movext(TCGContext *s, TCGType dst_type, TCGReg dst,
40
+ TCGType src_type, MemOp src_ext, TCGReg src)
41
+{
42
+ switch (src_ext) {
43
+ case MO_UB:
44
+ tcg_out_ext8u(s, dst, src);
45
+ break;
46
+ case MO_SB:
47
+ tcg_out_ext8s(s, dst_type, dst, src);
48
+ break;
49
+ case MO_UW:
50
+ tcg_out_ext16u(s, dst, src);
51
+ break;
52
+ case MO_SW:
53
+ tcg_out_ext16s(s, dst_type, dst, src);
54
+ break;
55
+ case MO_UL:
56
+ case MO_SL:
57
+ if (dst_type == TCG_TYPE_I32) {
58
+ if (src_type == TCG_TYPE_I32) {
59
+ tcg_out_mov(s, TCG_TYPE_I32, dst, src);
60
+ } else {
61
+ tcg_out_extrl_i64_i32(s, dst, src);
62
+ }
63
+ } else if (src_type == TCG_TYPE_I32) {
64
+ if (src_ext & MO_SIGN) {
65
+ tcg_out_exts_i32_i64(s, dst, src);
66
+ } else {
67
+ tcg_out_extu_i32_i64(s, dst, src);
68
+ }
69
+ } else {
70
+ if (src_ext & MO_SIGN) {
71
+ tcg_out_ext32s(s, dst, src);
72
+ } else {
73
+ tcg_out_ext32u(s, dst, src);
74
+ }
75
+ }
76
+ break;
77
+ case MO_UQ:
78
+ tcg_debug_assert(TCG_TARGET_REG_BITS == 64);
79
+ if (dst_type == TCG_TYPE_I32) {
80
+ tcg_out_extrl_i64_i32(s, dst, src);
81
+ } else {
82
+ tcg_out_mov(s, TCG_TYPE_I64, dst, src);
83
+ }
84
+ break;
85
+ default:
86
+ g_assert_not_reached();
87
+ }
88
+}
89
+
90
#define C_PFX1(P, A) P##A
91
#define C_PFX2(P, A, B) P##A##_##B
92
#define C_PFX3(P, A, B, C) P##A##_##B##_##C
93
diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc
94
index XXXXXXX..XXXXXXX 100644
95
--- a/tcg/aarch64/tcg-target.c.inc
96
+++ b/tcg/aarch64/tcg-target.c.inc
97
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *lb)
98
{
99
MemOpIdx oi = lb->oi;
100
MemOp opc = get_memop(oi);
101
- MemOp size = opc & MO_SIZE;
102
103
if (!reloc_pc19(lb->label_ptr[0], tcg_splitwx_to_rx(s->code_ptr))) {
104
return false;
105
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *lb)
106
tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_X2, oi);
107
tcg_out_adr(s, TCG_REG_X3, lb->raddr);
108
tcg_out_call_int(s, qemu_ld_helpers[opc & MO_SIZE]);
109
- if (opc & MO_SIGN) {
110
- tcg_out_sxt(s, lb->type, size, lb->datalo_reg, TCG_REG_X0);
111
- } else {
112
- tcg_out_mov(s, size == MO_64, lb->datalo_reg, TCG_REG_X0);
113
- }
114
115
+ tcg_out_movext(s, lb->type, lb->datalo_reg,
116
+ TCG_TYPE_REG, opc & MO_SSIZE, TCG_REG_X0);
117
tcg_out_goto(s, lb->raddr);
118
return true;
119
}
120
diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc
121
index XXXXXXX..XXXXXXX 100644
122
--- a/tcg/arm/tcg-target.c.inc
123
+++ b/tcg/arm/tcg-target.c.inc
124
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *lb)
125
126
datalo = lb->datalo_reg;
127
datahi = lb->datahi_reg;
128
- switch (opc & MO_SSIZE) {
129
- case MO_SB:
130
- tcg_out_ext8s(s, TCG_TYPE_I32, datalo, TCG_REG_R0);
131
- break;
132
- case MO_SW:
133
- tcg_out_ext16s(s, TCG_TYPE_I32, datalo, TCG_REG_R0);
134
- break;
135
- default:
136
- tcg_out_mov_reg(s, COND_AL, datalo, TCG_REG_R0);
137
- break;
138
- case MO_UQ:
139
+ if ((opc & MO_SIZE) == MO_64) {
140
if (datalo != TCG_REG_R1) {
141
tcg_out_mov_reg(s, COND_AL, datalo, TCG_REG_R0);
142
tcg_out_mov_reg(s, COND_AL, datahi, TCG_REG_R1);
143
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *lb)
144
tcg_out_mov_reg(s, COND_AL, datahi, TCG_REG_R1);
145
tcg_out_mov_reg(s, COND_AL, datalo, TCG_REG_TMP);
146
}
147
- break;
148
+ } else {
149
+ tcg_out_movext(s, TCG_TYPE_I32, datalo,
150
+ TCG_TYPE_I32, opc & MO_SSIZE, TCG_REG_R0);
151
}
152
153
tcg_out_goto(s, COND_AL, lb->raddr);
154
diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc
155
index XXXXXXX..XXXXXXX 100644
156
--- a/tcg/i386/tcg-target.c.inc
157
+++ b/tcg/i386/tcg-target.c.inc
158
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *l)
159
tcg_out_branch(s, 1, qemu_ld_helpers[opc & (MO_BSWAP | MO_SIZE)]);
160
161
data_reg = l->datalo_reg;
162
- switch (opc & MO_SSIZE) {
163
- case MO_SB:
164
- tcg_out_ext8s(s, l->type, data_reg, TCG_REG_EAX);
165
- break;
166
- case MO_SW:
167
- tcg_out_ext16s(s, l->type, data_reg, TCG_REG_EAX);
168
- break;
169
-#if TCG_TARGET_REG_BITS == 64
170
- case MO_SL:
171
- tcg_out_ext32s(s, data_reg, TCG_REG_EAX);
172
- break;
173
-#endif
174
- case MO_UB:
175
- case MO_UW:
176
- /* Note that the helpers have zero-extended to tcg_target_long. */
177
- case MO_UL:
178
- tcg_out_mov(s, TCG_TYPE_I32, data_reg, TCG_REG_EAX);
179
- break;
180
- case MO_UQ:
181
- if (TCG_TARGET_REG_BITS == 64) {
182
- tcg_out_mov(s, TCG_TYPE_I64, data_reg, TCG_REG_RAX);
183
- } else if (data_reg == TCG_REG_EDX) {
184
+ if (TCG_TARGET_REG_BITS == 32 && (opc & MO_SIZE) == MO_64) {
185
+ if (data_reg == TCG_REG_EDX) {
186
/* xchg %edx, %eax */
187
tcg_out_opc(s, OPC_XCHG_ax_r32 + TCG_REG_EDX, 0, 0, 0);
188
tcg_out_mov(s, TCG_TYPE_I32, l->datahi_reg, TCG_REG_EAX);
189
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *l)
190
tcg_out_mov(s, TCG_TYPE_I32, data_reg, TCG_REG_EAX);
191
tcg_out_mov(s, TCG_TYPE_I32, l->datahi_reg, TCG_REG_EDX);
192
}
193
- break;
194
- default:
195
- g_assert_not_reached();
196
+ } else {
197
+ tcg_out_movext(s, l->type, data_reg,
198
+ TCG_TYPE_REG, opc & MO_SSIZE, TCG_REG_EAX);
199
}
200
201
/* Jump to the code corresponding to next IR of qemu_st */
202
diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc
203
index XXXXXXX..XXXXXXX 100644
204
--- a/tcg/loongarch64/tcg-target.c.inc
205
+++ b/tcg/loongarch64/tcg-target.c.inc
206
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *l)
207
MemOpIdx oi = l->oi;
208
MemOp opc = get_memop(oi);
209
MemOp size = opc & MO_SIZE;
210
- TCGType type = l->type;
211
212
/* resolve label address */
213
if (!reloc_br_sk16(l->label_ptr[0], tcg_splitwx_to_rx(s->code_ptr))) {
214
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *l)
215
216
tcg_out_call_int(s, qemu_ld_helpers[size], false);
217
218
- switch (opc & MO_SSIZE) {
219
- case MO_SB:
220
- tcg_out_ext8s(s, type, l->datalo_reg, TCG_REG_A0);
221
- break;
222
- case MO_SW:
223
- tcg_out_ext16s(s, type, l->datalo_reg, TCG_REG_A0);
224
- break;
225
- case MO_SL:
226
- tcg_out_ext32s(s, l->datalo_reg, TCG_REG_A0);
227
- break;
228
- case MO_UL:
229
- if (type == TCG_TYPE_I32) {
230
- /* MO_UL loads of i32 should be sign-extended too */
231
- tcg_out_ext32s(s, l->datalo_reg, TCG_REG_A0);
232
- break;
233
- }
234
- /* fallthrough */
235
- default:
236
- tcg_out_mov(s, type, l->datalo_reg, TCG_REG_A0);
237
- break;
22
- }
238
- }
23
-
239
-
24
-#ifndef CONFIG_USER_ONLY
240
+ tcg_out_movext(s, l->type, l->datalo_reg,
25
- return (ctx->base.tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK);
241
+ TCG_TYPE_REG, opc & MO_SSIZE, TCG_REG_A0);
26
-#else
242
return tcg_out_goto(s, l->raddr);
27
- return true;
243
}
28
-#endif
244
245
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *l)
246
/* call store helper */
247
tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_A0, TCG_AREG0);
248
tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_A1, l->addrlo_reg);
249
- switch (size) {
250
- case MO_8:
251
- tcg_out_ext8u(s, TCG_REG_A2, l->datalo_reg);
252
- break;
253
- case MO_16:
254
- tcg_out_ext16u(s, TCG_REG_A2, l->datalo_reg);
255
- break;
256
- case MO_32:
257
- tcg_out_ext32u(s, TCG_REG_A2, l->datalo_reg);
258
- break;
259
- case MO_64:
260
- tcg_out_mov(s, TCG_TYPE_I64, TCG_REG_A2, l->datalo_reg);
261
- break;
262
- default:
263
- g_assert_not_reached();
264
- break;
265
- }
266
+ tcg_out_movext(s, size == MO_64 ? TCG_TYPE_I32 : TCG_TYPE_I32, TCG_REG_A2,
267
+ l->type, size, l->datalo_reg);
268
tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_A3, oi);
269
tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_A4, (tcg_target_long)l->raddr);
270
271
@@ -XXX,XX +XXX,XX @@ static void tcg_out_qemu_st_indexed(TCGContext *s, TCGReg data,
272
}
273
}
274
275
-static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args)
276
+static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, TCGType type)
277
{
278
TCGReg addr_regl;
279
TCGReg data_regl;
280
@@ -XXX,XX +XXX,XX @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args)
281
tcg_out_tlb_load(s, addr_regl, oi, label_ptr, 0);
282
base = tcg_out_zext_addr_if_32_bit(s, addr_regl, TCG_REG_TMP0);
283
tcg_out_qemu_st_indexed(s, data_regl, base, TCG_REG_TMP2, opc);
284
- add_qemu_ldst_label(s, 0, oi,
285
- 0, /* type param is unused for stores */
286
+ add_qemu_ldst_label(s, 0, oi, type,
287
data_regl, addr_regl,
288
s->code_ptr, label_ptr);
289
#else
290
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
291
tcg_out_qemu_ld(s, args, TCG_TYPE_I64);
292
break;
293
case INDEX_op_qemu_st_i32:
294
- tcg_out_qemu_st(s, args);
295
+ tcg_out_qemu_st(s, args, TCG_TYPE_I32);
296
break;
297
case INDEX_op_qemu_st_i64:
298
- tcg_out_qemu_st(s, args);
299
+ tcg_out_qemu_st(s, args, TCG_TYPE_I64);
300
break;
301
302
case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */
303
diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc
304
index XXXXXXX..XXXXXXX 100644
305
--- a/tcg/ppc/tcg-target.c.inc
306
+++ b/tcg/ppc/tcg-target.c.inc
307
@@ -XXX,XX +XXX,XX @@ static const uint32_t qemu_stx_opc[(MO_SIZE + MO_BSWAP) + 1] = {
308
[MO_BSWAP | MO_UQ] = STDBRX,
309
};
310
311
-static const uint32_t qemu_exts_opc[4] = {
312
- EXTSB, EXTSH, EXTSW, 0
313
-};
314
-
315
#if defined (CONFIG_SOFTMMU)
316
/* helper signature: helper_ld_mmu(CPUState *env, target_ulong addr,
317
* int mmu_idx, uintptr_t ra)
318
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *lb)
319
if (TCG_TARGET_REG_BITS == 32 && (opc & MO_SIZE) == MO_64) {
320
tcg_out_mov(s, TCG_TYPE_I32, lo, TCG_REG_R4);
321
tcg_out_mov(s, TCG_TYPE_I32, hi, TCG_REG_R3);
322
- } else if (opc & MO_SIGN) {
323
- uint32_t insn = qemu_exts_opc[opc & MO_SIZE];
324
- tcg_out32(s, insn | RA(lo) | RS(TCG_REG_R3));
325
} else {
326
- tcg_out_mov(s, TCG_TYPE_REG, lo, TCG_REG_R3);
327
+ tcg_out_movext(s, lb->type, lo,
328
+ TCG_TYPE_REG, opc & MO_SSIZE, TCG_REG_R3);
329
}
330
331
tcg_out_b(s, 0, lb->raddr);
332
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *lb)
333
334
lo = lb->datalo_reg;
335
hi = lb->datahi_reg;
336
- if (TCG_TARGET_REG_BITS == 32) {
337
- switch (s_bits) {
338
- case MO_64:
339
- arg |= (TCG_TARGET_CALL_ARG_I64 == TCG_CALL_ARG_EVEN);
340
- tcg_out_mov(s, TCG_TYPE_I32, arg++, hi);
341
- /* FALLTHRU */
342
- case MO_32:
343
- tcg_out_mov(s, TCG_TYPE_I32, arg++, lo);
344
- break;
345
- default:
346
- tcg_out_rlw(s, RLWINM, arg++, lo, 0, 32 - (8 << s_bits), 31);
347
- break;
348
- }
349
+ if (TCG_TARGET_REG_BITS == 32 && s_bits == MO_64) {
350
+ arg |= (TCG_TARGET_CALL_ARG_I64 == TCG_CALL_ARG_EVEN);
351
+ tcg_out_mov(s, TCG_TYPE_I32, arg++, hi);
352
+ tcg_out_mov(s, TCG_TYPE_I32, arg++, lo);
353
} else {
354
- if (s_bits == MO_64) {
355
- tcg_out_mov(s, TCG_TYPE_I64, arg++, lo);
356
- } else {
357
- tcg_out_rld(s, RLDICL, arg++, lo, 0, 64 - (8 << s_bits));
358
- }
359
+ tcg_out_movext(s, s_bits == MO_64 ? TCG_TYPE_I64 : TCG_TYPE_I32,
360
+ arg++, lb->type, s_bits, lo);
361
}
362
363
tcg_out_movi(s, TCG_TYPE_I32, arg++, oi);
364
@@ -XXX,XX +XXX,XX @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, bool is_64)
365
} else {
366
insn = qemu_ldx_opc[opc & (MO_SIZE | MO_BSWAP)];
367
tcg_out32(s, insn | TAB(datalo, rbase, addrlo));
368
- insn = qemu_exts_opc[s_bits];
369
- tcg_out32(s, insn | RA(datalo) | RS(datalo));
370
+ tcg_out_movext(s, TCG_TYPE_REG, datalo,
371
+ TCG_TYPE_REG, opc & MO_SSIZE, datalo);
372
}
373
}
374
375
diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc
376
index XXXXXXX..XXXXXXX 100644
377
--- a/tcg/riscv/tcg-target.c.inc
378
+++ b/tcg/riscv/tcg-target.c.inc
379
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *l)
380
/* call store helper */
381
tcg_out_mov(s, TCG_TYPE_PTR, a0, TCG_AREG0);
382
tcg_out_mov(s, TCG_TYPE_PTR, a1, l->addrlo_reg);
383
- tcg_out_mov(s, TCG_TYPE_PTR, a2, l->datalo_reg);
384
- switch (s_bits) {
385
- case MO_8:
386
- tcg_out_ext8u(s, a2, a2);
387
- break;
388
- case MO_16:
389
- tcg_out_ext16u(s, a2, a2);
390
- break;
391
- default:
392
- break;
393
- }
394
+ tcg_out_movext(s, s_bits == MO_64 ? TCG_TYPE_I64 : TCG_TYPE_I32, a2,
395
+ l->type, s_bits, l->datalo_reg);
396
tcg_out_movi(s, TCG_TYPE_PTR, a3, oi);
397
tcg_out_movi(s, TCG_TYPE_PTR, a4, (tcg_target_long)l->raddr);
398
399
diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc
400
index XXXXXXX..XXXXXXX 100644
401
--- a/tcg/s390x/tcg-target.c.inc
402
+++ b/tcg/s390x/tcg-target.c.inc
403
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *lb)
404
TCGReg data_reg = lb->datalo_reg;
405
MemOpIdx oi = lb->oi;
406
MemOp opc = get_memop(oi);
407
+ MemOp size = opc & MO_SIZE;
408
409
if (!patch_reloc(lb->label_ptr[0], R_390_PC16DBL,
410
(intptr_t)tcg_splitwx_to_rx(s->code_ptr), 2)) {
411
@@ -XXX,XX +XXX,XX @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *lb)
412
if (TARGET_LONG_BITS == 64) {
413
tcg_out_mov(s, TCG_TYPE_I64, TCG_REG_R3, addr_reg);
414
}
415
- switch (opc & MO_SIZE) {
416
- case MO_UB:
417
- tcg_out_ext8u(s, TCG_REG_R4, data_reg);
418
- break;
419
- case MO_UW:
420
- tcg_out_ext16u(s, TCG_REG_R4, data_reg);
421
- break;
422
- case MO_UL:
423
- tcg_out_ext32u(s, TCG_REG_R4, data_reg);
424
- break;
425
- case MO_UQ:
426
- tcg_out_mov(s, TCG_TYPE_I64, TCG_REG_R4, data_reg);
427
- break;
428
- default:
429
- g_assert_not_reached();
430
- }
431
+ tcg_out_movext(s, size == MO_64 ? TCG_TYPE_I64 : TCG_TYPE_I32,
432
+ TCG_REG_R4, lb->type, size, data_reg);
433
tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_R5, oi);
434
tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_R6, (uintptr_t)lb->raddr);
435
tcg_out_call_int(s, qemu_st_helpers[opc & (MO_BSWAP | MO_SIZE)]);
436
diff --git a/tcg/sparc64/tcg-target.c.inc b/tcg/sparc64/tcg-target.c.inc
437
index XXXXXXX..XXXXXXX 100644
438
--- a/tcg/sparc64/tcg-target.c.inc
439
+++ b/tcg/sparc64/tcg-target.c.inc
440
@@ -XXX,XX +XXX,XX @@ static void tcg_out_mb(TCGContext *s, TCGArg a0)
441
static const tcg_insn_unit *qemu_ld_trampoline[(MO_SSIZE | MO_BSWAP) + 1];
442
static const tcg_insn_unit *qemu_st_trampoline[(MO_SIZE | MO_BSWAP) + 1];
443
444
-static void emit_extend(TCGContext *s, TCGReg r, int op)
445
-{
446
- /* Emit zero extend of 8, 16 or 32 bit data as
447
- * required by the MO_* value op; do nothing for 64 bit.
448
- */
449
- switch (op & MO_SIZE) {
450
- case MO_8:
451
- tcg_out_ext8u(s, r, r);
452
- break;
453
- case MO_16:
454
- tcg_out_ext16u(s, r, r);
455
- break;
456
- case MO_32:
457
- tcg_out_ext32u(s, r, r);
458
- break;
459
- case MO_64:
460
- break;
461
- }
29
-}
462
-}
30
-
463
-
31
static void generate_qemu_excp(DisasContext *ctx, int excp)
464
static void build_trampolines(TCGContext *s)
32
{
465
{
33
TCGv_i32 tmp = tcg_const_i32(excp);
466
static void * const qemu_ld_helpers[] = {
34
@@ -XXX,XX +XXX,XX @@ static void generate_qemu_excp(DisasContext *ctx, int excp)
467
@@ -XXX,XX +XXX,XX @@ static void build_trampolines(TCGContext *s)
35
tcg_temp_free(tmp);
468
}
469
qemu_st_trampoline[i] = tcg_splitwx_to_rx(s->code_ptr);
470
471
- emit_extend(s, TCG_REG_O2, i);
472
-
473
/* Set the retaddr operand. */
474
tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_O4, TCG_REG_O7);
475
476
@@ -XXX,XX +XXX,XX @@ static void tcg_out_qemu_ld(TCGContext *s, TCGReg data, TCGReg addr,
36
}
477
}
37
478
38
-static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
479
static void tcg_out_qemu_st(TCGContext *s, TCGReg data, TCGReg addr,
39
+static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
480
- MemOpIdx oi)
481
+ MemOpIdx oi, TCGType data_type)
40
{
482
{
41
- if (use_goto_tb(ctx, dest)) {
483
MemOp memop = get_memop(oi);
42
+ if (translator_use_goto_tb(&ctx->base, dest)) {
484
tcg_insn_unit *label_ptr;
43
tcg_gen_goto_tb(n);
485
@@ -XXX,XX +XXX,XX @@ static void tcg_out_qemu_st(TCGContext *s, TCGReg data, TCGReg addr,
44
gen_save_pc(dest);
486
/* TLB Miss. */
45
tcg_gen_exit_tb(ctx->base.tb, n);
487
488
tcg_out_mov(s, TCG_TYPE_REG, TCG_REG_O1, addrz);
489
- tcg_out_mov(s, TCG_TYPE_REG, TCG_REG_O2, data);
490
+ tcg_out_movext(s, (memop & MO_SIZE) == MO_64 ? TCG_TYPE_I64 : TCG_TYPE_I32,
491
+ TCG_REG_O2, data_type, memop & MO_SIZE, data);
492
493
func = qemu_st_trampoline[memop & (MO_BSWAP | MO_SIZE)];
494
tcg_debug_assert(func != NULL);
495
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
496
tcg_out_qemu_ld(s, a0, a1, a2, true);
497
break;
498
case INDEX_op_qemu_st_i32:
499
+ tcg_out_qemu_st(s, a0, a1, a2, TCG_TYPE_I32);
500
+ break;
501
case INDEX_op_qemu_st_i64:
502
- tcg_out_qemu_st(s, a0, a1, a2);
503
+ tcg_out_qemu_st(s, a0, a1, a2, TCG_TYPE_I64);
504
break;
505
506
case INDEX_op_ld32s_i64:
46
--
507
--
47
2.25.1
508
2.34.1
48
509
49
510
diff view generated by jsdifflib
1
Add a generic version of the common use_goto_tb test.
1
We will want a backend interface for register swapping.
2
2
This is only properly defined for x86; all others get a
3
Various targets avoid the page crossing test for CONFIG_USER_ONLY,
3
stub version that always indicates failure.
4
but that is wrong: mmap and mprotect can change page permissions.
4
5
5
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6
Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
7
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
---
7
---
10
include/exec/translator.h | 10 ++++++++++
8
tcg/tcg.c | 2 ++
11
accel/tcg/translator.c | 11 +++++++++++
9
tcg/aarch64/tcg-target.c.inc | 5 +++++
12
2 files changed, 21 insertions(+)
10
tcg/arm/tcg-target.c.inc | 5 +++++
13
11
tcg/i386/tcg-target.c.inc | 8 ++++++++
14
diff --git a/include/exec/translator.h b/include/exec/translator.h
12
tcg/loongarch64/tcg-target.c.inc | 5 +++++
15
index XXXXXXX..XXXXXXX 100644
13
tcg/mips/tcg-target.c.inc | 5 +++++
16
--- a/include/exec/translator.h
14
tcg/ppc/tcg-target.c.inc | 5 +++++
17
+++ b/include/exec/translator.h
15
tcg/riscv/tcg-target.c.inc | 5 +++++
18
@@ -XXX,XX +XXX,XX @@ void translator_loop(const TranslatorOps *ops, DisasContextBase *db,
16
tcg/s390x/tcg-target.c.inc | 5 +++++
19
17
tcg/sparc64/tcg-target.c.inc | 5 +++++
20
void translator_loop_temp_check(DisasContextBase *db);
18
tcg/tci/tcg-target.c.inc | 5 +++++
21
19
11 files changed, 55 insertions(+)
22
+/**
20
23
+ * translator_use_goto_tb
21
diff --git a/tcg/tcg.c b/tcg/tcg.c
24
+ * @db: Disassembly context
22
index XXXXXXX..XXXXXXX 100644
25
+ * @dest: target pc of the goto
23
--- a/tcg/tcg.c
26
+ *
24
+++ b/tcg/tcg.c
27
+ * Return true if goto_tb is allowed between the current TB
25
@@ -XXX,XX +XXX,XX @@ static void tcg_out_exts_i32_i64(TCGContext *s, TCGReg ret, TCGReg arg);
28
+ * and the destination PC.
26
static void tcg_out_extu_i32_i64(TCGContext *s, TCGReg ret, TCGReg arg);
29
+ */
27
static void tcg_out_extrl_i64_i32(TCGContext *s, TCGReg ret, TCGReg arg);
30
+bool translator_use_goto_tb(DisasContextBase *db, target_ulong dest);
28
static void tcg_out_addi_ptr(TCGContext *s, TCGReg, TCGReg, tcg_target_long);
31
+
29
+static bool tcg_out_xchg(TCGContext *s, TCGType type, TCGReg r1, TCGReg r2)
32
/*
30
+ __attribute__((unused));
33
* Translator Load Functions
31
static void tcg_out_exit_tb(TCGContext *s, uintptr_t arg);
34
*
32
static void tcg_out_goto_tb(TCGContext *s, int which);
35
diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c
33
static void tcg_out_op(TCGContext *s, TCGOpcode opc,
36
index XXXXXXX..XXXXXXX 100644
34
diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc
37
--- a/accel/tcg/translator.c
35
index XXXXXXX..XXXXXXX 100644
38
+++ b/accel/tcg/translator.c
36
--- a/tcg/aarch64/tcg-target.c.inc
39
@@ -XXX,XX +XXX,XX @@ void translator_loop_temp_check(DisasContextBase *db)
37
+++ b/tcg/aarch64/tcg-target.c.inc
38
@@ -XXX,XX +XXX,XX @@ static void tcg_out_movi(TCGContext *s, TCGType type, TCGReg rd,
39
tcg_out_insn(s, 3305, LDR, 0, rd);
40
}
41
42
+static bool tcg_out_xchg(TCGContext *s, TCGType type, TCGReg r1, TCGReg r2)
43
+{
44
+ return false;
45
+}
46
+
47
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
48
tcg_target_long imm)
49
{
50
diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc
51
index XXXXXXX..XXXXXXX 100644
52
--- a/tcg/arm/tcg-target.c.inc
53
+++ b/tcg/arm/tcg-target.c.inc
54
@@ -XXX,XX +XXX,XX @@ static void tcg_out_movi(TCGContext *s, TCGType type,
55
tcg_out_movi32(s, COND_AL, ret, arg);
56
}
57
58
+static bool tcg_out_xchg(TCGContext *s, TCGType type, TCGReg r1, TCGReg r2)
59
+{
60
+ return false;
61
+}
62
+
63
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
64
tcg_target_long imm)
65
{
66
diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc
67
index XXXXXXX..XXXXXXX 100644
68
--- a/tcg/i386/tcg-target.c.inc
69
+++ b/tcg/i386/tcg-target.c.inc
70
@@ -XXX,XX +XXX,XX @@ static bool tcg_target_const_match(int64_t val, TCGType type, int ct)
71
#define OPC_VPTERNLOGQ (0x25 | P_EXT3A | P_DATA16 | P_VEXW | P_EVEX)
72
#define OPC_VZEROUPPER (0x77 | P_EXT)
73
#define OPC_XCHG_ax_r32    (0x90)
74
+#define OPC_XCHG_EvGv (0x87)
75
76
#define OPC_GRP3_Eb (0xf6)
77
#define OPC_GRP3_Ev (0xf7)
78
@@ -XXX,XX +XXX,XX @@ static void tcg_out_movi(TCGContext *s, TCGType type,
40
}
79
}
41
}
80
}
42
81
43
+bool translator_use_goto_tb(DisasContextBase *db, target_ulong dest)
82
+static bool tcg_out_xchg(TCGContext *s, TCGType type, TCGReg r1, TCGReg r2)
44
+{
83
+{
45
+ /* Suppress goto_tb in the case of single-steping. */
84
+ int rexw = type == TCG_TYPE_I32 ? 0 : P_REXW;
46
+ if (db->singlestep_enabled || singlestep) {
85
+ tcg_out_modrm(s, OPC_XCHG_EvGv + rexw, r1, r2);
47
+ return false;
86
+ return true;
48
+ }
87
+}
49
+
88
+
50
+ /* Check for the dest on the same page as the start of the TB. */
89
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
51
+ return ((db->pc_first ^ dest) & TARGET_PAGE_MASK) == 0;
90
tcg_target_long imm)
52
+}
91
{
53
+
92
diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc
54
void translator_loop(const TranslatorOps *ops, DisasContextBase *db,
93
index XXXXXXX..XXXXXXX 100644
55
CPUState *cpu, TranslationBlock *tb, int max_insns)
94
--- a/tcg/loongarch64/tcg-target.c.inc
95
+++ b/tcg/loongarch64/tcg-target.c.inc
96
@@ -XXX,XX +XXX,XX @@ static void tcg_out_addi(TCGContext *s, TCGType type, TCGReg rd,
97
}
98
}
99
100
+static bool tcg_out_xchg(TCGContext *s, TCGType type, TCGReg r1, TCGReg r2)
101
+{
102
+ return false;
103
+}
104
+
105
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
106
tcg_target_long imm)
107
{
108
diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc
109
index XXXXXXX..XXXXXXX 100644
110
--- a/tcg/mips/tcg-target.c.inc
111
+++ b/tcg/mips/tcg-target.c.inc
112
@@ -XXX,XX +XXX,XX @@ static void tcg_out_extrl_i64_i32(TCGContext *s, TCGReg rd, TCGReg rs)
113
tcg_out_ext32s(s, rd, rs);
114
}
115
116
+static bool tcg_out_xchg(TCGContext *s, TCGType type, TCGReg r1, TCGReg r2)
117
+{
118
+ return false;
119
+}
120
+
121
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
122
tcg_target_long imm)
123
{
124
diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc
125
index XXXXXXX..XXXXXXX 100644
126
--- a/tcg/ppc/tcg-target.c.inc
127
+++ b/tcg/ppc/tcg-target.c.inc
128
@@ -XXX,XX +XXX,XX @@ static void tcg_out_movi(TCGContext *s, TCGType type, TCGReg ret,
129
}
130
}
131
132
+static bool tcg_out_xchg(TCGContext *s, TCGType type, TCGReg r1, TCGReg r2)
133
+{
134
+ return false;
135
+}
136
+
137
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
138
tcg_target_long imm)
139
{
140
diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc
141
index XXXXXXX..XXXXXXX 100644
142
--- a/tcg/riscv/tcg-target.c.inc
143
+++ b/tcg/riscv/tcg-target.c.inc
144
@@ -XXX,XX +XXX,XX @@ static void tcg_out_movi(TCGContext *s, TCGType type, TCGReg rd,
145
tcg_out_opc_imm(s, OPC_LD, rd, rd, 0);
146
}
147
148
+static bool tcg_out_xchg(TCGContext *s, TCGType type, TCGReg r1, TCGReg r2)
149
+{
150
+ return false;
151
+}
152
+
153
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
154
tcg_target_long imm)
155
{
156
diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc
157
index XXXXXXX..XXXXXXX 100644
158
--- a/tcg/s390x/tcg-target.c.inc
159
+++ b/tcg/s390x/tcg-target.c.inc
160
@@ -XXX,XX +XXX,XX @@ static inline bool tcg_out_sti(TCGContext *s, TCGType type, TCGArg val,
161
return false;
162
}
163
164
+static bool tcg_out_xchg(TCGContext *s, TCGType type, TCGReg r1, TCGReg r2)
165
+{
166
+ return false;
167
+}
168
+
169
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
170
tcg_target_long imm)
171
{
172
diff --git a/tcg/sparc64/tcg-target.c.inc b/tcg/sparc64/tcg-target.c.inc
173
index XXXXXXX..XXXXXXX 100644
174
--- a/tcg/sparc64/tcg-target.c.inc
175
+++ b/tcg/sparc64/tcg-target.c.inc
176
@@ -XXX,XX +XXX,XX @@ static void tcg_out_extrl_i64_i32(TCGContext *s, TCGReg rd, TCGReg rs)
177
tcg_out_mov(s, TCG_TYPE_I32, rd, rs);
178
}
179
180
+static bool tcg_out_xchg(TCGContext *s, TCGType type, TCGReg r1, TCGReg r2)
181
+{
182
+ return false;
183
+}
184
+
185
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
186
tcg_target_long imm)
187
{
188
diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc
189
index XXXXXXX..XXXXXXX 100644
190
--- a/tcg/tci/tcg-target.c.inc
191
+++ b/tcg/tci/tcg-target.c.inc
192
@@ -XXX,XX +XXX,XX @@ static void tcg_out_extrl_i64_i32(TCGContext *s, TCGReg rd, TCGReg rs)
193
tcg_out_mov(s, TCG_TYPE_I32, rd, rs);
194
}
195
196
+static bool tcg_out_xchg(TCGContext *s, TCGType type, TCGReg r1, TCGReg r2)
197
+{
198
+ return false;
199
+}
200
+
201
static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
202
tcg_target_long imm)
56
{
203
{
57
--
204
--
58
2.25.1
205
2.34.1
59
206
60
207
diff view generated by jsdifflib
Deleted patch
1
We have not needed to end a TB for I/O since ba3e7926691
2
("icount: clean up cpu_can_io at the entry to the block").
3
We do not need to use exit_tb for singlestep, which only
4
means generate one insn per TB.
5
1
6
Which leaves only singlestep_enabled, which means raise a
7
debug trap after every TB, which does not use exit_tb,
8
which would leave the function mis-named.
9
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
12
---
13
target/alpha/translate.c | 15 ++-------------
14
1 file changed, 2 insertions(+), 13 deletions(-)
15
16
diff --git a/target/alpha/translate.c b/target/alpha/translate.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/alpha/translate.c
19
+++ b/target/alpha/translate.c
20
@@ -XXX,XX +XXX,XX @@ static bool in_superpage(DisasContext *ctx, int64_t addr)
21
#endif
22
}
23
24
-static bool use_exit_tb(DisasContext *ctx)
25
-{
26
- return ((tb_cflags(ctx->base.tb) & CF_LAST_IO)
27
- || ctx->base.singlestep_enabled
28
- || singlestep);
29
-}
30
-
31
static bool use_goto_tb(DisasContext *ctx, uint64_t dest)
32
{
33
- /* Suppress goto_tb in the case of single-steping and IO. */
34
- if (unlikely(use_exit_tb(ctx))) {
35
- return false;
36
- }
37
#ifndef CONFIG_USER_ONLY
38
/* If the destination is in the superpage, the page perms can't change. */
39
if (in_superpage(ctx, dest)) {
40
@@ -XXX,XX +XXX,XX @@ static DisasJumpType gen_call_pal(DisasContext *ctx, int palcode)
41
need the page permissions check. We'll see the existence of
42
the page when we create the TB, and we'll flush all TBs if
43
we change the PAL base register. */
44
- if (!use_exit_tb(ctx)) {
45
+ if (!ctx->base.singlestep_enabled) {
46
tcg_gen_goto_tb(0);
47
tcg_gen_movi_i64(cpu_pc, entry);
48
tcg_gen_exit_tb(ctx->base.tb, 0);
49
@@ -XXX,XX +XXX,XX @@ static void alpha_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
50
tcg_gen_movi_i64(cpu_pc, ctx->base.pc_next);
51
/* FALLTHRU */
52
case DISAS_PC_UPDATED:
53
- if (!use_exit_tb(ctx)) {
54
+ if (!ctx->base.singlestep_enabled) {
55
tcg_gen_lookup_and_goto_ptr();
56
break;
57
}
58
--
59
2.25.1
60
61
diff view generated by jsdifflib
Deleted patch
1
The number of links across (normal) pages using this is low,
2
and it will shortly violate the contract for breakpoints.
3
1
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
target/alpha/translate.c | 24 ++----------------------
8
1 file changed, 2 insertions(+), 22 deletions(-)
9
10
diff --git a/target/alpha/translate.c b/target/alpha/translate.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/alpha/translate.c
13
+++ b/target/alpha/translate.c
14
@@ -XXX,XX +XXX,XX @@ static DisasJumpType gen_store_conditional(DisasContext *ctx, int ra, int rb,
15
return DISAS_NEXT;
16
}
17
18
-static bool in_superpage(DisasContext *ctx, int64_t addr)
19
-{
20
-#ifndef CONFIG_USER_ONLY
21
- return ((ctx->tbflags & ENV_FLAG_PS_USER) == 0
22
- && addr >> TARGET_VIRT_ADDR_SPACE_BITS == -1
23
- && ((addr >> 41) & 3) == 2);
24
-#else
25
- return false;
26
-#endif
27
-}
28
-
29
static bool use_goto_tb(DisasContext *ctx, uint64_t dest)
30
{
31
#ifndef CONFIG_USER_ONLY
32
- /* If the destination is in the superpage, the page perms can't change. */
33
- if (in_superpage(ctx, dest)) {
34
- return true;
35
- }
36
/* Check for the dest on the same page as the start of the TB. */
37
return ((ctx->base.tb->pc ^ dest) & TARGET_PAGE_MASK) == 0;
38
#else
39
@@ -XXX,XX +XXX,XX @@ static void alpha_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cpu)
40
{
41
DisasContext *ctx = container_of(dcbase, DisasContext, base);
42
CPUAlphaState *env = cpu->env_ptr;
43
- int64_t bound, mask;
44
+ int64_t bound;
45
46
ctx->tbflags = ctx->base.tb->flags;
47
ctx->mem_idx = cpu_mmu_index(env, false);
48
@@ -XXX,XX +XXX,XX @@ static void alpha_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cpu)
49
ctx->lit = NULL;
50
51
/* Bound the number of insns to execute to those left on the page. */
52
- if (in_superpage(ctx, ctx->base.pc_first)) {
53
- mask = -1ULL << 41;
54
- } else {
55
- mask = TARGET_PAGE_MASK;
56
- }
57
- bound = -(ctx->base.pc_first | mask) / 4;
58
+ bound = -(ctx->base.pc_first | TARGET_PAGE_MASK) / 4;
59
ctx->base.max_insns = MIN(ctx->base.max_insns, bound);
60
}
61
62
--
63
2.25.1
64
65
diff view generated by jsdifflib
Deleted patch
1
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3
---
4
target/alpha/translate.c | 7 +------
5
1 file changed, 1 insertion(+), 6 deletions(-)
6
1
7
diff --git a/target/alpha/translate.c b/target/alpha/translate.c
8
index XXXXXXX..XXXXXXX 100644
9
--- a/target/alpha/translate.c
10
+++ b/target/alpha/translate.c
11
@@ -XXX,XX +XXX,XX @@ static DisasJumpType gen_store_conditional(DisasContext *ctx, int ra, int rb,
12
13
static bool use_goto_tb(DisasContext *ctx, uint64_t dest)
14
{
15
-#ifndef CONFIG_USER_ONLY
16
- /* Check for the dest on the same page as the start of the TB. */
17
- return ((ctx->base.tb->pc ^ dest) & TARGET_PAGE_MASK) == 0;
18
-#else
19
- return true;
20
-#endif
21
+ return translator_use_goto_tb(&ctx->base, dest);
22
}
23
24
static DisasJumpType gen_bdirect(DisasContext *ctx, int ra, int32_t disp)
25
--
26
2.25.1
27
28
diff view generated by jsdifflib
Deleted patch
1
Using gen_goto_tb directly misses the single-step check.
2
Let the branch or debug exception be emitted by arm_tr_tb_stop.
3
1
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
target/arm/translate.c | 4 ++--
8
1 file changed, 2 insertions(+), 2 deletions(-)
9
10
diff --git a/target/arm/translate.c b/target/arm/translate.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/arm/translate.c
13
+++ b/target/arm/translate.c
14
@@ -XXX,XX +XXX,XX @@ static bool trans_ISB(DisasContext *s, arg_ISB *a)
15
* self-modifying code correctly and also to take
16
* any pending interrupts immediately.
17
*/
18
- gen_goto_tb(s, 0, s->base.pc_next);
19
+ s->base.is_jmp = DISAS_TOO_MANY;
20
return true;
21
}
22
23
@@ -XXX,XX +XXX,XX @@ static bool trans_SB(DisasContext *s, arg_SB *a)
24
* for TCG; MB and end the TB instead.
25
*/
26
tcg_gen_mb(TCG_MO_ALL | TCG_BAR_SC);
27
- gen_goto_tb(s, 0, s->base.pc_next);
28
+ s->base.is_jmp = DISAS_TOO_MANY;
29
return true;
30
}
31
32
--
33
2.25.1
34
35
diff view generated by jsdifflib
Deleted patch
1
We have not needed to end a TB for I/O since ba3e7926691
2
("icount: clean up cpu_can_io at the entry to the block"),
3
and gdbstub singlestep is handled by the generic function.
4
1
5
Drop the unused 'n' argument to use_goto_tb.
6
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
---
10
target/arm/translate-a64.c | 25 +++++--------------------
11
1 file changed, 5 insertions(+), 20 deletions(-)
12
13
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/translate-a64.c
16
+++ b/target/arm/translate-a64.c
17
@@ -XXX,XX +XXX,XX @@ static void gen_step_complete_exception(DisasContext *s)
18
s->base.is_jmp = DISAS_NORETURN;
19
}
20
21
-static inline bool use_goto_tb(DisasContext *s, int n, uint64_t dest)
22
+static inline bool use_goto_tb(DisasContext *s, uint64_t dest)
23
{
24
- /* No direct tb linking with singlestep (either QEMU's or the ARM
25
- * debug architecture kind) or deterministic io
26
- */
27
- if (s->base.singlestep_enabled || s->ss_active ||
28
- (tb_cflags(s->base.tb) & CF_LAST_IO)) {
29
+ if (s->ss_active) {
30
return false;
31
}
32
-
33
-#ifndef CONFIG_USER_ONLY
34
- /* Only link tbs from inside the same guest page */
35
- if ((s->base.tb->pc & TARGET_PAGE_MASK) != (dest & TARGET_PAGE_MASK)) {
36
- return false;
37
- }
38
-#endif
39
-
40
- return true;
41
+ return translator_use_goto_tb(&s->base, dest);
42
}
43
44
static inline void gen_goto_tb(DisasContext *s, int n, uint64_t dest)
45
{
46
- const TranslationBlock *tb;
47
-
48
- tb = s->base.tb;
49
- if (use_goto_tb(s, n, dest)) {
50
+ if (use_goto_tb(s, dest)) {
51
tcg_gen_goto_tb(n);
52
gen_a64_set_pc_im(dest);
53
- tcg_gen_exit_tb(tb, n);
54
+ tcg_gen_exit_tb(s->base.tb, n);
55
s->base.is_jmp = DISAS_NORETURN;
56
} else {
57
gen_a64_set_pc_im(dest);
58
--
59
2.25.1
60
61
diff view generated by jsdifflib
Deleted patch
1
Just use translator_use_goto_tb directly at the one call site,
2
rather than maintaining a local wrapper.
3
1
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
target/arm/translate.c | 12 +-----------
8
1 file changed, 1 insertion(+), 11 deletions(-)
9
10
diff --git a/target/arm/translate.c b/target/arm/translate.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/arm/translate.c
13
+++ b/target/arm/translate.c
14
@@ -XXX,XX +XXX,XX @@ static int disas_dsp_insn(DisasContext *s, uint32_t insn)
15
return 1;
16
}
17
18
-static inline bool use_goto_tb(DisasContext *s, target_ulong dest)
19
-{
20
-#ifndef CONFIG_USER_ONLY
21
- return (s->base.tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK) ||
22
- ((s->base.pc_next - 1) & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK);
23
-#else
24
- return true;
25
-#endif
26
-}
27
-
28
static void gen_goto_ptr(void)
29
{
30
tcg_gen_lookup_and_goto_ptr();
31
@@ -XXX,XX +XXX,XX @@ static void gen_goto_ptr(void)
32
*/
33
static void gen_goto_tb(DisasContext *s, int n, target_ulong dest)
34
{
35
- if (use_goto_tb(s, dest)) {
36
+ if (translator_use_goto_tb(&s->base, dest)) {
37
tcg_gen_goto_tb(n);
38
gen_set_pc_im(s, dest);
39
tcg_gen_exit_tb(s->base.tb, n);
40
--
41
2.25.1
42
43
diff view generated by jsdifflib
Deleted patch
1
Single stepping is not the only reason not to use goto_tb.
2
If goto_tb is disallowed, and single-stepping is not enabled,
3
then use tcg_gen_lookup_and_goto_tb to indirectly chain.
4
1
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
---
8
target/avr/translate.c | 9 ++++++---
9
1 file changed, 6 insertions(+), 3 deletions(-)
10
11
diff --git a/target/avr/translate.c b/target/avr/translate.c
12
index XXXXXXX..XXXXXXX 100644
13
--- a/target/avr/translate.c
14
+++ b/target/avr/translate.c
15
@@ -XXX,XX +XXX,XX @@ static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
16
{
17
const TranslationBlock *tb = ctx->base.tb;
18
19
- if (!ctx->base.singlestep_enabled) {
20
+ if (translator_use_goto_tb(&ctx->base, dest)) {
21
tcg_gen_goto_tb(n);
22
tcg_gen_movi_i32(cpu_pc, dest);
23
tcg_gen_exit_tb(tb, n);
24
} else {
25
tcg_gen_movi_i32(cpu_pc, dest);
26
- gen_helper_debug(cpu_env);
27
- tcg_gen_exit_tb(NULL, 0);
28
+ if (ctx->base.singlestep_enabled) {
29
+ gen_helper_debug(cpu_env);
30
+ } else {
31
+ tcg_gen_lookup_and_goto_ptr();
32
+ }
33
}
34
ctx->base.is_jmp = DISAS_NORETURN;
35
}
36
--
37
2.25.1
38
39
diff view generated by jsdifflib
Deleted patch
1
All of these helpers end with cpu_loop_exit.
2
1
3
Reviewed-by: Michael Rolnik <mrolnik@gmail.com>
4
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
target/avr/helper.h | 8 ++++----
8
1 file changed, 4 insertions(+), 4 deletions(-)
9
10
diff --git a/target/avr/helper.h b/target/avr/helper.h
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/avr/helper.h
13
+++ b/target/avr/helper.h
14
@@ -XXX,XX +XXX,XX @@
15
*/
16
17
DEF_HELPER_1(wdr, void, env)
18
-DEF_HELPER_1(debug, void, env)
19
-DEF_HELPER_1(break, void, env)
20
-DEF_HELPER_1(sleep, void, env)
21
-DEF_HELPER_1(unsupported, void, env)
22
+DEF_HELPER_1(debug, noreturn, env)
23
+DEF_HELPER_1(break, noreturn, env)
24
+DEF_HELPER_1(sleep, noreturn, env)
25
+DEF_HELPER_1(unsupported, noreturn, env)
26
DEF_HELPER_3(outb, void, env, i32, i32)
27
DEF_HELPER_2(inb, tl, env, i32)
28
DEF_HELPER_3(fullwr, void, env, i32, i32)
29
--
30
2.25.1
31
32
diff view generated by jsdifflib
Deleted patch
1
The test for singlestepping is done in translator_use_goto_tb,
2
so we may elide it from cris_tr_tb_stop.
3
1
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
target/cris/translate.c | 5 ++---
8
1 file changed, 2 insertions(+), 3 deletions(-)
9
10
diff --git a/target/cris/translate.c b/target/cris/translate.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/cris/translate.c
13
+++ b/target/cris/translate.c
14
@@ -XXX,XX +XXX,XX @@ static void t_gen_swapr(TCGv d, TCGv s)
15
16
static bool use_goto_tb(DisasContext *dc, target_ulong dest)
17
{
18
- return ((dest ^ dc->base.pc_first) & TARGET_PAGE_MASK) == 0;
19
+ return translator_use_goto_tb(&dc->base, dest);
20
}
21
22
static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest)
23
@@ -XXX,XX +XXX,XX @@ static void cris_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
24
* Use a conditional branch if either taken or not-taken path
25
* can use goto_tb. If neither can, then treat it as indirect.
26
*/
27
- if (likely(!dc->base.singlestep_enabled)
28
- && likely(!dc->cpustate_changed)
29
+ if (likely(!dc->cpustate_changed)
30
&& (use_goto_tb(dc, dc->jmp_pc) || use_goto_tb(dc, npc))) {
31
TCGLabel *not_taken = gen_new_label();
32
33
--
34
2.25.1
35
36
diff view generated by jsdifflib
Deleted patch
1
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3
---
4
target/hppa/translate.c | 5 +----
5
1 file changed, 1 insertion(+), 4 deletions(-)
6
1
7
diff --git a/target/hppa/translate.c b/target/hppa/translate.c
8
index XXXXXXX..XXXXXXX 100644
9
--- a/target/hppa/translate.c
10
+++ b/target/hppa/translate.c
11
@@ -XXX,XX +XXX,XX @@ static bool gen_illegal(DisasContext *ctx)
12
13
static bool use_goto_tb(DisasContext *ctx, target_ureg dest)
14
{
15
- /* Suppress goto_tb for page crossing, IO, or single-steping. */
16
- return !(((ctx->base.pc_first ^ dest) & TARGET_PAGE_MASK)
17
- || (tb_cflags(ctx->base.tb) & CF_LAST_IO)
18
- || ctx->base.singlestep_enabled);
19
+ return translator_use_goto_tb(&ctx->base, dest);
20
}
21
22
/* If the next insn is to be nullified, and it's on the same page,
23
--
24
2.25.1
25
26
diff view generated by jsdifflib
Deleted patch
1
Just use translator_use_goto_tb directly at the one call site,
2
rather than maintaining a local wrapper.
3
1
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
target/i386/tcg/translate.c | 14 ++------------
8
1 file changed, 2 insertions(+), 12 deletions(-)
9
10
diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/i386/tcg/translate.c
13
+++ b/target/i386/tcg/translate.c
14
@@ -XXX,XX +XXX,XX @@ static inline int insn_const_size(MemOp ot)
15
}
16
}
17
18
-static inline bool use_goto_tb(DisasContext *s, target_ulong pc)
19
-{
20
-#ifndef CONFIG_USER_ONLY
21
- return (pc & TARGET_PAGE_MASK) == (s->base.tb->pc & TARGET_PAGE_MASK) ||
22
- (pc & TARGET_PAGE_MASK) == (s->pc_start & TARGET_PAGE_MASK);
23
-#else
24
- return true;
25
-#endif
26
-}
27
-
28
-static inline void gen_goto_tb(DisasContext *s, int tb_num, target_ulong eip)
29
+static void gen_goto_tb(DisasContext *s, int tb_num, target_ulong eip)
30
{
31
target_ulong pc = s->cs_base + eip;
32
33
- if (use_goto_tb(s, pc)) {
34
+ if (translator_use_goto_tb(&s->base, pc)) {
35
/* jump to same page: we can use a direct jump */
36
tcg_gen_goto_tb(tb_num);
37
gen_jmp_im(s, eip);
38
--
39
2.25.1
40
41
diff view generated by jsdifflib
Deleted patch
1
Just use translator_use_goto_tb directly at the one call site,
2
rather than maintaining a local wrapper.
3
1
4
Acked-by: Laurent Vivier <laurent@vivier.eu>
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
---
8
target/m68k/translate.c | 12 +-----------
9
1 file changed, 1 insertion(+), 11 deletions(-)
10
11
diff --git a/target/m68k/translate.c b/target/m68k/translate.c
12
index XXXXXXX..XXXXXXX 100644
13
--- a/target/m68k/translate.c
14
+++ b/target/m68k/translate.c
15
@@ -XXX,XX +XXX,XX @@ static void gen_exit_tb(DisasContext *s)
16
} \
17
} while (0)
18
19
-static inline bool use_goto_tb(DisasContext *s, uint32_t dest)
20
-{
21
-#ifndef CONFIG_USER_ONLY
22
- return (s->base.pc_first & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)
23
- || (s->base.pc_next & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK);
24
-#else
25
- return true;
26
-#endif
27
-}
28
-
29
/* Generate a jump to an immediate address. */
30
static void gen_jmp_tb(DisasContext *s, int n, uint32_t dest)
31
{
32
@@ -XXX,XX +XXX,XX @@ static void gen_jmp_tb(DisasContext *s, int n, uint32_t dest)
33
update_cc_op(s);
34
tcg_gen_movi_i32(QREG_PC, dest);
35
gen_singlestep_exception(s);
36
- } else if (use_goto_tb(s, dest)) {
37
+ } else if (translator_use_goto_tb(&s->base, dest)) {
38
tcg_gen_goto_tb(n);
39
tcg_gen_movi_i32(QREG_PC, dest);
40
tcg_gen_exit_tb(s->base.tb, n);
41
--
42
2.25.1
43
44
diff view generated by jsdifflib
Deleted patch
1
Just use translator_use_goto_tb directly at the one call site,
2
rather than maintaining a local wrapper.
3
1
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
target/microblaze/translate.c | 11 +----------
8
1 file changed, 1 insertion(+), 10 deletions(-)
9
10
diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/microblaze/translate.c
13
+++ b/target/microblaze/translate.c
14
@@ -XXX,XX +XXX,XX @@ static void gen_raise_hw_excp(DisasContext *dc, uint32_t esr_ec)
15
gen_raise_exception_sync(dc, EXCP_HW_EXCP);
16
}
17
18
-static inline bool use_goto_tb(DisasContext *dc, target_ulong dest)
19
-{
20
-#ifndef CONFIG_USER_ONLY
21
- return (dc->base.pc_first & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK);
22
-#else
23
- return true;
24
-#endif
25
-}
26
-
27
static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest)
28
{
29
if (dc->base.singlestep_enabled) {
30
@@ -XXX,XX +XXX,XX @@ static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest)
31
tcg_gen_movi_i32(cpu_pc, dest);
32
gen_helper_raise_exception(cpu_env, tmp);
33
tcg_temp_free_i32(tmp);
34
- } else if (use_goto_tb(dc, dest)) {
35
+ } else if (translator_use_goto_tb(&dc->base, dest)) {
36
tcg_gen_goto_tb(n);
37
tcg_gen_movi_i32(cpu_pc, dest);
38
tcg_gen_exit_tb(dc->base.tb, n);
39
--
40
2.25.1
41
42
diff view generated by jsdifflib
Deleted patch
1
Just use translator_use_goto_tb directly at the one call site,
2
rather than maintaining a local wrapper.
3
1
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
target/mips/tcg/translate.c | 17 ++---------------
8
1 file changed, 2 insertions(+), 15 deletions(-)
9
10
diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/mips/tcg/translate.c
13
+++ b/target/mips/tcg/translate.c
14
@@ -XXX,XX +XXX,XX @@ static void gen_trap(DisasContext *ctx, uint32_t opc,
15
tcg_temp_free(t1);
16
}
17
18
-static inline bool use_goto_tb(DisasContext *ctx, target_ulong dest)
19
+static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
20
{
21
- if (unlikely(ctx->base.singlestep_enabled)) {
22
- return false;
23
- }
24
-
25
-#ifndef CONFIG_USER_ONLY
26
- return (ctx->base.tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK);
27
-#else
28
- return true;
29
-#endif
30
-}
31
-
32
-static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
33
-{
34
- if (use_goto_tb(ctx, dest)) {
35
+ if (translator_use_goto_tb(&ctx->base, dest)) {
36
tcg_gen_goto_tb(n);
37
gen_save_pc(dest);
38
tcg_gen_exit_tb(ctx->base.tb, n);
39
--
40
2.25.1
41
42
diff view generated by jsdifflib
Deleted patch
1
Do not emit dead code for the singlestep_enabled case,
2
after having exited the TB with a debug exception.
3
1
4
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
target/mips/tcg/translate.c | 3 ++-
8
1 file changed, 2 insertions(+), 1 deletion(-)
9
10
diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/mips/tcg/translate.c
13
+++ b/target/mips/tcg/translate.c
14
@@ -XXX,XX +XXX,XX @@ static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
15
if (ctx->base.singlestep_enabled) {
16
save_cpu_state(ctx, 0);
17
gen_helper_raise_exception_debug(cpu_env);
18
+ } else {
19
+ tcg_gen_lookup_and_goto_ptr();
20
}
21
- tcg_gen_lookup_and_goto_ptr();
22
}
23
}
24
25
--
26
2.25.1
27
28
diff view generated by jsdifflib
Deleted patch
1
Just use translator_use_goto_tb directly at the one call site,
2
rather than maintaining a local wrapper.
3
1
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
target/nios2/translate.c | 15 +--------------
8
1 file changed, 1 insertion(+), 14 deletions(-)
9
10
diff --git a/target/nios2/translate.c b/target/nios2/translate.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/nios2/translate.c
13
+++ b/target/nios2/translate.c
14
@@ -XXX,XX +XXX,XX @@ static void t_gen_helper_raise_exception(DisasContext *dc,
15
dc->base.is_jmp = DISAS_NORETURN;
16
}
17
18
-static bool use_goto_tb(DisasContext *dc, uint32_t dest)
19
-{
20
- if (unlikely(dc->base.singlestep_enabled)) {
21
- return false;
22
- }
23
-
24
-#ifndef CONFIG_USER_ONLY
25
- return (dc->base.pc_first & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK);
26
-#else
27
- return true;
28
-#endif
29
-}
30
-
31
static void gen_goto_tb(DisasContext *dc, int n, uint32_t dest)
32
{
33
const TranslationBlock *tb = dc->base.tb;
34
35
- if (use_goto_tb(dc, dest)) {
36
+ if (translator_use_goto_tb(&dc->base, dest)) {
37
tcg_gen_goto_tb(n);
38
tcg_gen_movi_tl(cpu_R[R_PC], dest);
39
tcg_gen_exit_tb(tb, n);
40
--
41
2.25.1
42
43
diff view generated by jsdifflib
Deleted patch
1
Reviewed-by: Luis Pires <luis.pires@eldorado.org.br>
2
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3
---
4
target/ppc/translate.c | 10 +---------
5
1 file changed, 1 insertion(+), 9 deletions(-)
6
1
7
diff --git a/target/ppc/translate.c b/target/ppc/translate.c
8
index XXXXXXX..XXXXXXX 100644
9
--- a/target/ppc/translate.c
10
+++ b/target/ppc/translate.c
11
@@ -XXX,XX +XXX,XX @@ static inline void gen_update_cfar(DisasContext *ctx, target_ulong nip)
12
13
static inline bool use_goto_tb(DisasContext *ctx, target_ulong dest)
14
{
15
- if (unlikely(ctx->singlestep_enabled)) {
16
- return false;
17
- }
18
-
19
-#ifndef CONFIG_USER_ONLY
20
- return (ctx->base.tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK);
21
-#else
22
- return true;
23
-#endif
24
+ return translator_use_goto_tb(&ctx->base, dest);
25
}
26
27
static void gen_lookup_and_goto_ptr(DisasContext *ctx)
28
--
29
2.25.1
30
31
diff view generated by jsdifflib
Deleted patch
1
Just use translator_use_goto_tb directly at the one call site,
2
rather than maintaining a local wrapper.
3
1
4
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
target/riscv/translate.c | 20 +-------------------
8
1 file changed, 1 insertion(+), 19 deletions(-)
9
10
diff --git a/target/riscv/translate.c b/target/riscv/translate.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/riscv/translate.c
13
+++ b/target/riscv/translate.c
14
@@ -XXX,XX +XXX,XX @@ static void gen_exception_inst_addr_mis(DisasContext *ctx)
15
generate_exception_mtval(ctx, RISCV_EXCP_INST_ADDR_MIS);
16
}
17
18
-static inline bool use_goto_tb(DisasContext *ctx, target_ulong dest)
19
-{
20
- if (unlikely(ctx->base.singlestep_enabled)) {
21
- return false;
22
- }
23
-
24
-#ifndef CONFIG_USER_ONLY
25
- return (ctx->base.tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK);
26
-#else
27
- return true;
28
-#endif
29
-}
30
-
31
static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
32
{
33
- if (use_goto_tb(ctx, dest)) {
34
- /* chaining is only allowed when the jump is to the same page */
35
+ if (translator_use_goto_tb(&ctx->base, dest)) {
36
tcg_gen_goto_tb(n);
37
tcg_gen_movi_tl(cpu_pc, dest);
38
-
39
- /* No need to check for single stepping here as use_goto_tb() will
40
- * return false in case of single stepping.
41
- */
42
tcg_gen_exit_tb(ctx->base.tb, n);
43
} else {
44
tcg_gen_movi_tl(cpu_pc, dest);
45
--
46
2.25.1
47
48
diff view generated by jsdifflib
Deleted patch
1
Just use translator_use_goto_tb directly at the one call site,
2
rather than maintaining a local wrapper.
3
1
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
target/rx/translate.c | 11 +----------
8
1 file changed, 1 insertion(+), 10 deletions(-)
9
10
diff --git a/target/rx/translate.c b/target/rx/translate.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/rx/translate.c
13
+++ b/target/rx/translate.c
14
@@ -XXX,XX +XXX,XX @@ void rx_cpu_dump_state(CPUState *cs, FILE *f, int flags)
15
}
16
}
17
18
-static bool use_goto_tb(DisasContext *dc, target_ulong dest)
19
-{
20
- if (unlikely(dc->base.singlestep_enabled)) {
21
- return false;
22
- } else {
23
- return true;
24
- }
25
-}
26
-
27
static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest)
28
{
29
- if (use_goto_tb(dc, dest)) {
30
+ if (translator_use_goto_tb(&dc->base, dest)) {
31
tcg_gen_goto_tb(n);
32
tcg_gen_movi_i32(cpu_pc, dest);
33
tcg_gen_exit_tb(dc->base.tb, n);
34
--
35
2.25.1
36
37
diff view generated by jsdifflib
Deleted patch
1
Reviewed-by: David Hildenbrand <david@redhat.com>
2
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3
---
4
target/s390x/translate.c | 7 +------
5
1 file changed, 1 insertion(+), 6 deletions(-)
6
1
7
diff --git a/target/s390x/translate.c b/target/s390x/translate.c
8
index XXXXXXX..XXXXXXX 100644
9
--- a/target/s390x/translate.c
10
+++ b/target/s390x/translate.c
11
@@ -XXX,XX +XXX,XX @@ static bool use_goto_tb(DisasContext *s, uint64_t dest)
12
if (unlikely(use_exit_tb(s))) {
13
return false;
14
}
15
-#ifndef CONFIG_USER_ONLY
16
- return (dest & TARGET_PAGE_MASK) == (s->base.tb->pc & TARGET_PAGE_MASK) ||
17
- (dest & TARGET_PAGE_MASK) == (s->base.pc_next & TARGET_PAGE_MASK);
18
-#else
19
- return true;
20
-#endif
21
+ return translator_use_goto_tb(&s->base, dest);
22
}
23
24
static void account_noninline_branch(DisasContext *s, int cc_op)
25
--
26
2.25.1
27
28
diff view generated by jsdifflib
Deleted patch
1
We have not needed to end a TB for I/O since ba3e7926691
2
("icount: clean up cpu_can_io at the entry to the block").
3
1
4
In use_goto_tb, the check for singlestep_enabled is in the
5
generic translator_use_goto_tb. In s390x_tr_tb_stop, the
6
check for singlestep_enabled is in the preceding do_debug test.
7
8
Which leaves only FLAG_MASK_PER: fold that test alone into
9
the two callers of use_exit tb.
10
11
Reviewed-by: David Hildenbrand <david@redhat.com>
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
---
14
target/s390x/translate.c | 11 ++---------
15
1 file changed, 2 insertions(+), 9 deletions(-)
16
17
diff --git a/target/s390x/translate.c b/target/s390x/translate.c
18
index XXXXXXX..XXXXXXX 100644
19
--- a/target/s390x/translate.c
20
+++ b/target/s390x/translate.c
21
@@ -XXX,XX +XXX,XX @@ static void gen_op_calc_cc(DisasContext *s)
22
set_cc_static(s);
23
}
24
25
-static bool use_exit_tb(DisasContext *s)
26
-{
27
- return s->base.singlestep_enabled ||
28
- (tb_cflags(s->base.tb) & CF_LAST_IO) ||
29
- (s->base.tb->flags & FLAG_MASK_PER);
30
-}
31
-
32
static bool use_goto_tb(DisasContext *s, uint64_t dest)
33
{
34
- if (unlikely(use_exit_tb(s))) {
35
+ if (unlikely(s->base.tb->flags & FLAG_MASK_PER)) {
36
return false;
37
}
38
return translator_use_goto_tb(&s->base, dest);
39
@@ -XXX,XX +XXX,XX @@ static void s390x_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)
40
/* Exit the TB, either by raising a debug exception or by return. */
41
if (dc->do_debug) {
42
gen_exception(EXCP_DEBUG);
43
- } else if (use_exit_tb(dc) ||
44
+ } else if ((dc->base.tb->flags & FLAG_MASK_PER) ||
45
dc->base.is_jmp == DISAS_PC_STALE_NOCHAIN) {
46
tcg_gen_exit_tb(NULL, 0);
47
} else {
48
--
49
2.25.1
50
51
diff view generated by jsdifflib
Deleted patch
1
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3
---
4
target/sh4/translate.c | 11 +++--------
5
1 file changed, 3 insertions(+), 8 deletions(-)
6
1
7
diff --git a/target/sh4/translate.c b/target/sh4/translate.c
8
index XXXXXXX..XXXXXXX 100644
9
--- a/target/sh4/translate.c
10
+++ b/target/sh4/translate.c
11
@@ -XXX,XX +XXX,XX @@ static inline bool use_exit_tb(DisasContext *ctx)
12
return (ctx->tbflags & GUSA_EXCLUSIVE) != 0;
13
}
14
15
-static inline bool use_goto_tb(DisasContext *ctx, target_ulong dest)
16
+static bool use_goto_tb(DisasContext *ctx, target_ulong dest)
17
{
18
- /* Use a direct jump if in same page and singlestep not enabled */
19
- if (unlikely(ctx->base.singlestep_enabled || use_exit_tb(ctx))) {
20
+ if (use_exit_tb(ctx)) {
21
return false;
22
}
23
-#ifndef CONFIG_USER_ONLY
24
- return (ctx->base.tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK);
25
-#else
26
- return true;
27
-#endif
28
+ return translator_use_goto_tb(&ctx->base, dest);
29
}
30
31
static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
32
--
33
2.25.1
34
35
diff view generated by jsdifflib
Deleted patch
1
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3
---
4
target/sparc/translate.c | 19 +++++--------------
5
1 file changed, 5 insertions(+), 14 deletions(-)
6
1
7
diff --git a/target/sparc/translate.c b/target/sparc/translate.c
8
index XXXXXXX..XXXXXXX 100644
9
--- a/target/sparc/translate.c
10
+++ b/target/sparc/translate.c
11
@@ -XXX,XX +XXX,XX @@ static inline TCGv gen_dest_gpr(DisasContext *dc, int reg)
12
}
13
}
14
15
-static inline bool use_goto_tb(DisasContext *s, target_ulong pc,
16
- target_ulong npc)
17
+static bool use_goto_tb(DisasContext *s, target_ulong pc, target_ulong npc)
18
{
19
- if (unlikely(s->base.singlestep_enabled || singlestep)) {
20
- return false;
21
- }
22
-
23
-#ifndef CONFIG_USER_ONLY
24
- return (pc & TARGET_PAGE_MASK) == (s->base.tb->pc & TARGET_PAGE_MASK) &&
25
- (npc & TARGET_PAGE_MASK) == (s->base.tb->pc & TARGET_PAGE_MASK);
26
-#else
27
- return true;
28
-#endif
29
+ return translator_use_goto_tb(&s->base, pc) &&
30
+ translator_use_goto_tb(&s->base, npc);
31
}
32
33
-static inline void gen_goto_tb(DisasContext *s, int tb_num,
34
- target_ulong pc, target_ulong npc)
35
+static void gen_goto_tb(DisasContext *s, int tb_num,
36
+ target_ulong pc, target_ulong npc)
37
{
38
if (use_goto_tb(s, pc, npc)) {
39
/* jump to same page: we can use a direct jump */
40
--
41
2.25.1
42
43
diff view generated by jsdifflib
1
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3
---
3
---
4
accel/tcg/cpu-exec.c | 6 +++---
4
tcg/tcg-ldst.c.inc | 1 +
5
1 file changed, 3 insertions(+), 3 deletions(-)
5
1 file changed, 1 insertion(+)
6
6
7
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
7
diff --git a/tcg/tcg-ldst.c.inc b/tcg/tcg-ldst.c.inc
8
index XXXXXXX..XXXXXXX 100644
8
index XXXXXXX..XXXXXXX 100644
9
--- a/accel/tcg/cpu-exec.c
9
--- a/tcg/tcg-ldst.c.inc
10
+++ b/accel/tcg/cpu-exec.c
10
+++ b/tcg/tcg-ldst.c.inc
11
@@ -XXX,XX +XXX,XX @@ static inline void log_cpu_exec(target_ulong pc, CPUState *cpu,
11
@@ -XXX,XX +XXX,XX @@ static inline TCGLabelQemuLdst *new_ldst_label(TCGContext *s)
12
12
{
13
qemu_log_mask(CPU_LOG_EXEC,
13
TCGLabelQemuLdst *l = tcg_malloc(sizeof(*l));
14
"Trace %d: %p [" TARGET_FMT_lx
14
15
- "/" TARGET_FMT_lx "/%#x] %s\n",
15
+ memset(l, 0, sizeof(*l));
16
- cpu->cpu_index, tb->tc.ptr, tb->cs_base, pc, tb->flags,
16
QSIMPLEQ_INSERT_TAIL(&s->ldst_labels, l, next);
17
- lookup_symbol(pc));
17
18
+ "/" TARGET_FMT_lx "/%08x/%08x] %s\n",
18
return l;
19
+ cpu->cpu_index, tb->tc.ptr, tb->cs_base, pc,
20
+ tb->flags, tb->cflags, lookup_symbol(pc));
21
22
#if defined(DEBUG_DISAS)
23
if (qemu_loglevel_mask(CPU_LOG_TB_CPU)) {
24
--
19
--
25
2.25.1
20
2.34.1
26
21
27
22
diff view generated by jsdifflib
1
Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
1
Since TCG_TYPE_I32 values are kept sign-extended in registers, via "w"
2
instructions, we don't need to extend if the register matches.
3
This is already relied upon by comparisons.
4
5
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
2
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3
---
7
---
4
target/xtensa/translate.c | 6 +-----
8
tcg/riscv/tcg-target.c.inc | 4 +++-
5
1 file changed, 1 insertion(+), 5 deletions(-)
9
1 file changed, 3 insertions(+), 1 deletion(-)
6
10
7
diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c
11
diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc
8
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
9
--- a/target/xtensa/translate.c
13
--- a/tcg/riscv/tcg-target.c.inc
10
+++ b/target/xtensa/translate.c
14
+++ b/tcg/riscv/tcg-target.c.inc
11
@@ -XXX,XX +XXX,XX @@ static void gen_jump(DisasContext *dc, TCGv dest)
15
@@ -XXX,XX +XXX,XX @@ static void tcg_out_ext32s(TCGContext *s, TCGReg ret, TCGReg arg)
12
16
13
static int adjust_jump_slot(DisasContext *dc, uint32_t dest, int slot)
17
static void tcg_out_exts_i32_i64(TCGContext *s, TCGReg ret, TCGReg arg)
14
{
18
{
15
- if (((dc->base.pc_first ^ dest) & TARGET_PAGE_MASK) != 0) {
19
- tcg_out_ext32s(s, ret, arg);
16
- return -1;
20
+ if (ret != arg) {
17
- } else {
21
+ tcg_out_ext32s(s, ret, arg);
18
- return slot;
22
+ }
19
- }
20
+ return translator_use_goto_tb(&dc->base, dest) ? slot : -1;
21
}
23
}
22
24
23
static void gen_jumpi(DisasContext *dc, uint32_t dest, int slot)
25
static void tcg_out_extu_i32_i64(TCGContext *s, TCGReg ret, TCGReg arg)
24
--
26
--
25
2.25.1
27
2.34.1
26
27
diff view generated by jsdifflib
Deleted patch
1
The loop is performing a simple boolean test for the existence
2
of a BP_CPU breakpoint at EIP. Plus it gets the iteration wrong,
3
if we happen to have a BP_GDB breakpoint at the same address.
4
1
5
We have a function for this: cpu_breakpoint_test.
6
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
9
Message-Id: <20210620062317.1399034-1-richard.henderson@linaro.org>
10
---
11
target/i386/tcg/sysemu/bpt_helper.c | 12 +++---------
12
1 file changed, 3 insertions(+), 9 deletions(-)
13
14
diff --git a/target/i386/tcg/sysemu/bpt_helper.c b/target/i386/tcg/sysemu/bpt_helper.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/i386/tcg/sysemu/bpt_helper.c
17
+++ b/target/i386/tcg/sysemu/bpt_helper.c
18
@@ -XXX,XX +XXX,XX @@ void breakpoint_handler(CPUState *cs)
19
{
20
X86CPU *cpu = X86_CPU(cs);
21
CPUX86State *env = &cpu->env;
22
- CPUBreakpoint *bp;
23
24
if (cs->watchpoint_hit) {
25
if (cs->watchpoint_hit->flags & BP_CPU) {
26
@@ -XXX,XX +XXX,XX @@ void breakpoint_handler(CPUState *cs)
27
}
28
}
29
} else {
30
- QTAILQ_FOREACH(bp, &cs->breakpoints, entry) {
31
- if (bp->pc == env->eip) {
32
- if (bp->flags & BP_CPU) {
33
- check_hw_breakpoints(env, true);
34
- raise_exception(env, EXCP01_DB);
35
- }
36
- break;
37
- }
38
+ if (cpu_breakpoint_test(cs, env->eip, BP_CPU)) {
39
+ check_hw_breakpoints(env, true);
40
+ raise_exception(env, EXCP01_DB);
41
}
42
}
43
}
44
--
45
2.25.1
46
47
diff view generated by jsdifflib