1 | The following changes since commit b0dd9a7d6dd15a6898e9c585b521e6bec79b25aa: | 1 | v3: One more try to fix macos issues. |
---|---|---|---|
2 | 2 | ||
3 | Open 8.2 development tree (2023-08-22 07:14:07 -0700) | 3 | |
4 | r~ | ||
5 | |||
6 | |||
7 | |||
8 | The following changes since commit e0209297cddd5e10a07e15fac5cca7aa1a8e0e59: | ||
9 | |||
10 | Merge tag 'pull-ufs-20250217' of https://gitlab.com/jeuk20.kim/qemu into staging (2025-02-18 10:58:48 +0800) | ||
4 | 11 | ||
5 | are available in the Git repository at: | 12 | are available in the Git repository at: |
6 | 13 | ||
7 | https://gitlab.com/rth7680/qemu.git tags/pull-tcg-20230823 | 14 | https://gitlab.com/rth7680/qemu.git tags/pull-tcg-20250215-3 |
8 | 15 | ||
9 | for you to fetch changes up to 05e09d2a830a74d651ca6106e2002ec4f7b6997a: | 16 | for you to fetch changes up to e726f65867087d86436de05e9f372a86ec1381a6: |
10 | 17 | ||
11 | tcg: spelling fixes (2023-08-23 13:20:47 -0700) | 18 | tcg: Remove TCG_TARGET_HAS_{br,set}cond2 from riscv and loongarch64 (2025-02-18 08:29:03 -0800) |
12 | 19 | ||
13 | ---------------------------------------------------------------- | 20 | ---------------------------------------------------------------- |
14 | accel/*: Widen pc/saved_insn for *_sw_breakpoint | 21 | tcg: Remove last traces of TCG_TARGET_NEED_POOL_LABELS |
15 | accel/tcg: Replace remaining target_ulong in system-mode accel | 22 | tcg: Cleanups after disallowing 64-on-32 |
16 | tcg: spelling fixes | 23 | tcg: Introduce constraint for zero register |
17 | tcg: Document bswap, hswap, wswap byte patterns | 24 | tcg: Remove TCG_TARGET_HAS_{br,set}cond2 from riscv and loongarch64 |
18 | tcg: Introduce negsetcond opcodes | 25 | tcg/i386: Use tcg_{high,unsigned}_cond in tcg_out_brcond2 |
19 | tcg: Fold deposit with zero to and | 26 | linux-user: Move TARGET_SA_RESTORER out of generic/signal.h |
20 | tcg: Unify TCG_TARGET_HAS_extr[lh]_i64_i32 | 27 | linux-user: Fix alignment when unmapping excess reservation |
21 | tcg/i386: Drop BYTEH deposits for 64-bit | 28 | target/sparc: Fix register selection for all F*TOx and FxTO* instructions |
22 | tcg/i386: Allow immediate as input to deposit | 29 | target/sparc: Fix gdbstub incorrectly handling registers f32-f62 |
23 | target/*: Use tcg_gen_negsetcond_* | 30 | target/sparc: fake UltraSPARC T1 PCR and PIC registers |
24 | 31 | ||
25 | ---------------------------------------------------------------- | 32 | ---------------------------------------------------------------- |
26 | Anton Johansson via (9): | 33 | Andreas Schwab (1): |
27 | accel/kvm: Widen pc/saved_insn for kvm_sw_breakpoint | 34 | linux-user: Move TARGET_SA_RESTORER out of generic/signal.h |
28 | accel/hvf: Widen pc/saved_insn for hvf_sw_breakpoint | ||
29 | sysemu/kvm: Use vaddr for kvm_arch_[insert|remove]_hw_breakpoint | ||
30 | sysemu/hvf: Use vaddr for hvf_arch_[insert|remove]_hw_breakpoint | ||
31 | include/exec: Replace target_ulong with abi_ptr in cpu_[st|ld]*() | ||
32 | include/exec: typedef abi_ptr to vaddr in softmmu | ||
33 | include/exec: Widen tlb_hit/tlb_hit_page() | ||
34 | accel/tcg: Widen address arg in tlb_compare_set() | ||
35 | accel/tcg: Update run_on_cpu_data static assert | ||
36 | 35 | ||
37 | Mark Cave-Ayland (1): | 36 | Artyom Tarasenko (1): |
38 | docs/devel/tcg-ops: fix missing newlines in "Host vector operations" | 37 | target/sparc: fake UltraSPARC T1 PCR and PIC registers |
39 | 38 | ||
40 | Michael Tokarev (1): | 39 | Fabiano Rosas (1): |
41 | tcg: spelling fixes | 40 | elfload: Fix alignment when unmapping excess reservation |
42 | 41 | ||
43 | Philippe Mathieu-Daudé (9): | 42 | Mikael Szreder (2): |
44 | docs/devel/tcg-ops: Bury mentions of trunc_shr_i64_i32() | 43 | target/sparc: Fix register selection for all F*TOx and FxTO* instructions |
45 | tcg/tcg-op: Document bswap16_i32() byte pattern | 44 | target/sparc: Fix gdbstub incorrectly handling registers f32-f62 |
46 | tcg/tcg-op: Document bswap16_i64() byte pattern | ||
47 | tcg/tcg-op: Document bswap32_i32() byte pattern | ||
48 | tcg/tcg-op: Document bswap32_i64() byte pattern | ||
49 | tcg/tcg-op: Document bswap64_i64() byte pattern | ||
50 | tcg/tcg-op: Document hswap_i32/64() byte pattern | ||
51 | tcg/tcg-op: Document wswap_i64() byte pattern | ||
52 | target/cris: Fix a typo in gen_swapr() | ||
53 | 45 | ||
54 | Richard Henderson (28): | 46 | Richard Henderson (23): |
55 | target/m68k: Use tcg_gen_deposit_i32 in gen_partset_reg | 47 | tcg: Remove last traces of TCG_TARGET_NEED_POOL_LABELS |
56 | tcg/i386: Drop BYTEH deposits for 64-bit | 48 | tcg: Remove TCG_OVERSIZED_GUEST |
57 | tcg: Fold deposit with zero to and | 49 | tcg: Drop support for two address registers in gen_ldst |
58 | tcg/i386: Allow immediate as input to deposit_* | 50 | tcg: Merge INDEX_op_qemu_*_{a32,a64}_* |
59 | tcg: Unify TCG_TARGET_HAS_extr[lh]_i64_i32 | 51 | tcg/arm: Drop addrhi from prepare_host_addr |
60 | tcg: Introduce negsetcond opcodes | 52 | tcg/i386: Drop addrhi from prepare_host_addr |
61 | tcg: Use tcg_gen_negsetcond_* | 53 | tcg/mips: Drop addrhi from prepare_host_addr |
62 | target/alpha: Use tcg_gen_movcond_i64 in gen_fold_mzero | 54 | tcg/ppc: Drop addrhi from prepare_host_addr |
63 | target/arm: Use tcg_gen_negsetcond_* | 55 | tcg: Replace addr{lo,hi}_reg with addr_reg in TCGLabelQemuLdst |
64 | target/m68k: Use tcg_gen_negsetcond_* | 56 | plugins: Fix qemu_plugin_read_memory_vaddr parameters |
65 | target/openrisc: Use tcg_gen_negsetcond_* | 57 | accel/tcg: Fix tlb_set_page_with_attrs, tlb_set_page |
66 | target/ppc: Use tcg_gen_negsetcond_* | 58 | target/loongarch: Use VADDR_PRIx for logging pc_next |
67 | target/sparc: Use tcg_gen_movcond_i64 in gen_edge | 59 | target/mips: Use VADDR_PRIx for logging pc_next |
68 | target/tricore: Replace gen_cond_w with tcg_gen_negsetcond_tl | 60 | include/exec: Change vaddr to uintptr_t |
69 | tcg/ppc: Implement negsetcond_* | 61 | include/exec: Use uintptr_t in CPUTLBEntry |
70 | tcg/ppc: Use the Set Boolean Extension | 62 | tcg: Introduce the 'z' constraint for a hardware zero register |
71 | tcg/aarch64: Implement negsetcond_* | 63 | tcg/aarch64: Use 'z' constraint |
72 | tcg/arm: Implement negsetcond_i32 | 64 | tcg/loongarch64: Use 'z' constraint |
73 | tcg/riscv: Implement negsetcond_* | 65 | tcg/mips: Use 'z' constraint |
74 | tcg/s390x: Implement negsetcond_* | 66 | tcg/riscv: Use 'z' constraint |
75 | tcg/sparc64: Implement negsetcond_* | 67 | tcg/sparc64: Use 'z' constraint |
76 | tcg/i386: Merge tcg_out_brcond{32,64} | 68 | tcg/i386: Use tcg_{high,unsigned}_cond in tcg_out_brcond2 |
77 | tcg/i386: Merge tcg_out_setcond{32,64} | 69 | tcg: Remove TCG_TARGET_HAS_{br,set}cond2 from riscv and loongarch64 |
78 | tcg/i386: Merge tcg_out_movcond{32,64} | ||
79 | tcg/i386: Use CMP+SBB in tcg_out_setcond | ||
80 | tcg/i386: Clear dest first in tcg_out_setcond if possible | ||
81 | tcg/i386: Use shift in tcg_out_setcond | ||
82 | tcg/i386: Implement negsetcond_* | ||
83 | 70 | ||
84 | docs/devel/tcg-ops.rst | 15 +- | 71 | include/exec/tlb-common.h | 10 +- |
85 | accel/tcg/atomic_template.h | 16 +- | 72 | include/exec/vaddr.h | 16 +- |
86 | include/exec/cpu-all.h | 4 +- | 73 | include/qemu/atomic.h | 18 +- |
87 | include/exec/cpu_ldst.h | 28 +-- | 74 | include/tcg/oversized-guest.h | 23 --- |
88 | include/sysemu/hvf.h | 12 +- | 75 | include/tcg/tcg-opc.h | 28 +-- |
89 | include/sysemu/kvm.h | 12 +- | 76 | include/tcg/tcg.h | 3 +- |
90 | include/tcg/tcg-op-common.h | 4 + | 77 | linux-user/aarch64/target_signal.h | 2 + |
91 | include/tcg/tcg-op.h | 2 + | 78 | linux-user/arm/target_signal.h | 2 + |
92 | include/tcg/tcg-opc.h | 6 +- | 79 | linux-user/generic/signal.h | 1 - |
93 | include/tcg/tcg.h | 4 +- | 80 | linux-user/i386/target_signal.h | 2 + |
94 | tcg/aarch64/tcg-target.h | 5 +- | 81 | linux-user/m68k/target_signal.h | 1 + |
95 | tcg/arm/tcg-target.h | 1 + | 82 | linux-user/microblaze/target_signal.h | 2 + |
96 | tcg/i386/tcg-target-con-set.h | 2 +- | 83 | linux-user/ppc/target_signal.h | 2 + |
97 | tcg/i386/tcg-target-con-str.h | 1 - | 84 | linux-user/s390x/target_signal.h | 2 + |
98 | tcg/i386/tcg-target.h | 9 +- | 85 | linux-user/sh4/target_signal.h | 2 + |
99 | tcg/loongarch64/tcg-target.h | 6 +- | 86 | linux-user/x86_64/target_signal.h | 2 + |
100 | tcg/mips/tcg-target.h | 5 +- | 87 | linux-user/xtensa/target_signal.h | 2 + |
101 | tcg/ppc/tcg-target.h | 5 +- | 88 | tcg/aarch64/tcg-target-con-set.h | 12 +- |
102 | tcg/riscv/tcg-target.h | 5 +- | 89 | tcg/aarch64/tcg-target.h | 2 + |
103 | tcg/s390x/tcg-target.h | 5 +- | 90 | tcg/loongarch64/tcg-target-con-set.h | 15 +- |
104 | tcg/sparc64/tcg-target.h | 5 +- | 91 | tcg/loongarch64/tcg-target-con-str.h | 1 - |
105 | tcg/tci/tcg-target.h | 5 +- | 92 | tcg/loongarch64/tcg-target-has.h | 2 - |
106 | accel/hvf/hvf-accel-ops.c | 4 +- | 93 | tcg/loongarch64/tcg-target.h | 2 + |
107 | accel/hvf/hvf-all.c | 2 +- | 94 | tcg/mips/tcg-target-con-set.h | 26 +-- |
108 | accel/kvm/kvm-all.c | 3 +- | 95 | tcg/mips/tcg-target-con-str.h | 1 - |
109 | accel/tcg/cputlb.c | 17 +- | 96 | tcg/mips/tcg-target.h | 2 + |
110 | target/alpha/translate.c | 7 +- | 97 | tcg/riscv/tcg-target-con-set.h | 10 +- |
111 | target/arm/hvf/hvf.c | 4 +- | 98 | tcg/riscv/tcg-target-con-str.h | 1 - |
112 | target/arm/kvm64.c | 6 +- | 99 | tcg/riscv/tcg-target-has.h | 2 - |
113 | target/arm/tcg/translate-a64.c | 22 +-- | 100 | tcg/riscv/tcg-target.h | 2 + |
114 | target/arm/tcg/translate.c | 12 +- | 101 | tcg/sparc64/tcg-target-con-set.h | 12 +- |
115 | target/cris/translate.c | 20 +- | 102 | tcg/sparc64/tcg-target-con-str.h | 1 - |
116 | target/i386/hvf/hvf.c | 4 +- | 103 | tcg/sparc64/tcg-target.h | 3 +- |
117 | target/i386/kvm/kvm.c | 8 +- | 104 | tcg/tci/tcg-target.h | 1 - |
118 | target/m68k/translate.c | 35 ++-- | 105 | accel/tcg/cputlb.c | 32 +--- |
119 | target/openrisc/translate.c | 6 +- | 106 | accel/tcg/tcg-all.c | 9 +- |
120 | target/ppc/kvm.c | 13 +- | 107 | linux-user/elfload.c | 4 +- |
121 | target/riscv/vector_helper.c | 2 +- | 108 | plugins/api.c | 2 +- |
122 | target/rx/op_helper.c | 6 +- | 109 | target/arm/ptw.c | 34 ---- |
123 | target/s390x/kvm/kvm.c | 6 +- | 110 | target/loongarch/tcg/translate.c | 2 +- |
124 | target/sparc/translate.c | 17 +- | 111 | target/mips/tcg/octeon_translate.c | 4 +- |
125 | target/tricore/translate.c | 16 +- | 112 | target/riscv/cpu_helper.c | 13 +- |
126 | tcg/optimize.c | 78 +++++++- | 113 | target/sparc/gdbstub.c | 18 +- |
127 | tcg/tcg-op-gvec.c | 6 +- | 114 | target/sparc/translate.c | 19 +++ |
128 | tcg/tcg-op.c | 151 ++++++++++++--- | 115 | tcg/optimize.c | 21 +-- |
129 | tcg/tcg.c | 9 +- | 116 | tcg/tcg-op-ldst.c | 103 +++-------- |
130 | target/ppc/translate/fixedpoint-impl.c.inc | 6 +- | 117 | tcg/tcg.c | 97 +++++------ |
131 | target/ppc/translate/vmx-impl.c.inc | 8 +- | 118 | tcg/tci.c | 119 +++---------- |
132 | tcg/aarch64/tcg-target.c.inc | 14 +- | 119 | docs/devel/multi-thread-tcg.rst | 1 - |
133 | tcg/arm/tcg-target.c.inc | 19 +- | 120 | docs/devel/tcg-ops.rst | 4 +- |
134 | tcg/i386/tcg-target.c.inc | 291 ++++++++++++++++++----------- | 121 | target/loongarch/tcg/insn_trans/trans_atomic.c.inc | 2 +- |
135 | tcg/ppc/tcg-target.c.inc | 149 ++++++++++----- | 122 | target/sparc/insns.decode | 19 ++- |
136 | tcg/riscv/tcg-target.c.inc | 49 ++++- | 123 | tcg/aarch64/tcg-target.c.inc | 86 ++++------ |
137 | tcg/s390x/tcg-target.c.inc | 78 +++++--- | 124 | tcg/arm/tcg-target.c.inc | 114 ++++--------- |
138 | tcg/sparc64/tcg-target.c.inc | 40 +++- | 125 | tcg/i386/tcg-target.c.inc | 190 +++++---------------- |
139 | 55 files changed, 832 insertions(+), 433 deletions(-) | 126 | tcg/loongarch64/tcg-target.c.inc | 72 +++----- |
140 | 127 | tcg/mips/tcg-target.c.inc | 169 ++++++------------ | |
128 | tcg/ppc/tcg-target.c.inc | 164 +++++------------- | ||
129 | tcg/riscv/tcg-target.c.inc | 56 +++--- | ||
130 | tcg/s390x/tcg-target.c.inc | 40 ++--- | ||
131 | tcg/sparc64/tcg-target.c.inc | 45 ++--- | ||
132 | tcg/tci/tcg-target.c.inc | 60 ++----- | ||
133 | 62 files changed, 550 insertions(+), 1162 deletions(-) | ||
134 | delete mode 100644 include/tcg/oversized-guest.h | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Anton Johansson via <qemu-devel@nongnu.org> | ||
2 | 1 | ||
3 | Widens the pc and saved_insn fields of kvm_sw_breakpoint from | ||
4 | target_ulong to vaddr. The pc argument of kvm_find_sw_breakpoint is also | ||
5 | widened to match. | ||
6 | |||
7 | Signed-off-by: Anton Johansson <anjo@rev.ng> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-Id: <20230807155706.9580-2-anjo@rev.ng> | ||
10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | --- | ||
12 | include/sysemu/kvm.h | 6 +++--- | ||
13 | accel/kvm/kvm-all.c | 3 +-- | ||
14 | 2 files changed, 4 insertions(+), 5 deletions(-) | ||
15 | |||
16 | diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/include/sysemu/kvm.h | ||
19 | +++ b/include/sysemu/kvm.h | ||
20 | @@ -XXX,XX +XXX,XX @@ struct kvm_guest_debug; | ||
21 | struct kvm_debug_exit_arch; | ||
22 | |||
23 | struct kvm_sw_breakpoint { | ||
24 | - target_ulong pc; | ||
25 | - target_ulong saved_insn; | ||
26 | + vaddr pc; | ||
27 | + vaddr saved_insn; | ||
28 | int use_count; | ||
29 | QTAILQ_ENTRY(kvm_sw_breakpoint) entry; | ||
30 | }; | ||
31 | |||
32 | struct kvm_sw_breakpoint *kvm_find_sw_breakpoint(CPUState *cpu, | ||
33 | - target_ulong pc); | ||
34 | + vaddr pc); | ||
35 | |||
36 | int kvm_sw_breakpoints_active(CPUState *cpu); | ||
37 | |||
38 | diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/accel/kvm/kvm-all.c | ||
41 | +++ b/accel/kvm/kvm-all.c | ||
42 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_supports_user_irq(void) | ||
43 | } | ||
44 | |||
45 | #ifdef KVM_CAP_SET_GUEST_DEBUG | ||
46 | -struct kvm_sw_breakpoint *kvm_find_sw_breakpoint(CPUState *cpu, | ||
47 | - target_ulong pc) | ||
48 | +struct kvm_sw_breakpoint *kvm_find_sw_breakpoint(CPUState *cpu, vaddr pc) | ||
49 | { | ||
50 | struct kvm_sw_breakpoint *bp; | ||
51 | |||
52 | -- | ||
53 | 2.34.1 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Anton Johansson via <qemu-devel@nongnu.org> | ||
2 | 1 | ||
3 | Widens the pc and saved_insn fields of hvf_sw_breakpoint from | ||
4 | target_ulong to vaddr. Other hvf_* functions accessing hvf_sw_breakpoint | ||
5 | are also widened to match. | ||
6 | |||
7 | Signed-off-by: Anton Johansson <anjo@rev.ng> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-Id: <20230807155706.9580-3-anjo@rev.ng> | ||
10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | --- | ||
12 | include/sysemu/hvf.h | 6 +++--- | ||
13 | accel/hvf/hvf-accel-ops.c | 4 ++-- | ||
14 | accel/hvf/hvf-all.c | 2 +- | ||
15 | 3 files changed, 6 insertions(+), 6 deletions(-) | ||
16 | |||
17 | diff --git a/include/sysemu/hvf.h b/include/sysemu/hvf.h | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/include/sysemu/hvf.h | ||
20 | +++ b/include/sysemu/hvf.h | ||
21 | @@ -XXX,XX +XXX,XX @@ DECLARE_INSTANCE_CHECKER(HVFState, HVF_STATE, | ||
22 | |||
23 | #ifdef NEED_CPU_H | ||
24 | struct hvf_sw_breakpoint { | ||
25 | - target_ulong pc; | ||
26 | - target_ulong saved_insn; | ||
27 | + vaddr pc; | ||
28 | + vaddr saved_insn; | ||
29 | int use_count; | ||
30 | QTAILQ_ENTRY(hvf_sw_breakpoint) entry; | ||
31 | }; | ||
32 | |||
33 | struct hvf_sw_breakpoint *hvf_find_sw_breakpoint(CPUState *cpu, | ||
34 | - target_ulong pc); | ||
35 | + vaddr pc); | ||
36 | int hvf_sw_breakpoints_active(CPUState *cpu); | ||
37 | |||
38 | int hvf_arch_insert_sw_breakpoint(CPUState *cpu, struct hvf_sw_breakpoint *bp); | ||
39 | diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c | ||
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/accel/hvf/hvf-accel-ops.c | ||
42 | +++ b/accel/hvf/hvf-accel-ops.c | ||
43 | @@ -XXX,XX +XXX,XX @@ static void hvf_start_vcpu_thread(CPUState *cpu) | ||
44 | cpu, QEMU_THREAD_JOINABLE); | ||
45 | } | ||
46 | |||
47 | -static int hvf_insert_breakpoint(CPUState *cpu, int type, hwaddr addr, hwaddr len) | ||
48 | +static int hvf_insert_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len) | ||
49 | { | ||
50 | struct hvf_sw_breakpoint *bp; | ||
51 | int err; | ||
52 | @@ -XXX,XX +XXX,XX @@ static int hvf_insert_breakpoint(CPUState *cpu, int type, hwaddr addr, hwaddr le | ||
53 | return 0; | ||
54 | } | ||
55 | |||
56 | -static int hvf_remove_breakpoint(CPUState *cpu, int type, hwaddr addr, hwaddr len) | ||
57 | +static int hvf_remove_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len) | ||
58 | { | ||
59 | struct hvf_sw_breakpoint *bp; | ||
60 | int err; | ||
61 | diff --git a/accel/hvf/hvf-all.c b/accel/hvf/hvf-all.c | ||
62 | index XXXXXXX..XXXXXXX 100644 | ||
63 | --- a/accel/hvf/hvf-all.c | ||
64 | +++ b/accel/hvf/hvf-all.c | ||
65 | @@ -XXX,XX +XXX,XX @@ void assert_hvf_ok(hv_return_t ret) | ||
66 | abort(); | ||
67 | } | ||
68 | |||
69 | -struct hvf_sw_breakpoint *hvf_find_sw_breakpoint(CPUState *cpu, target_ulong pc) | ||
70 | +struct hvf_sw_breakpoint *hvf_find_sw_breakpoint(CPUState *cpu, vaddr pc) | ||
71 | { | ||
72 | struct hvf_sw_breakpoint *bp; | ||
73 | |||
74 | -- | ||
75 | 2.34.1 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Anton Johansson via <qemu-devel@nongnu.org> | ||
2 | 1 | ||
3 | Changes the signature of the target-defined functions for | ||
4 | inserting/removing kvm hw breakpoints. The address and length arguments | ||
5 | are now of vaddr type, which both matches the type used internally in | ||
6 | accel/kvm/kvm-all.c and makes the api target-agnostic. | ||
7 | |||
8 | Signed-off-by: Anton Johansson <anjo@rev.ng> | ||
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Message-Id: <20230807155706.9580-4-anjo@rev.ng> | ||
11 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
12 | --- | ||
13 | include/sysemu/kvm.h | 6 ++---- | ||
14 | target/arm/kvm64.c | 6 ++---- | ||
15 | target/i386/kvm/kvm.c | 8 +++----- | ||
16 | target/ppc/kvm.c | 13 ++++++------- | ||
17 | target/s390x/kvm/kvm.c | 6 ++---- | ||
18 | 5 files changed, 15 insertions(+), 24 deletions(-) | ||
19 | |||
20 | diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/include/sysemu/kvm.h | ||
23 | +++ b/include/sysemu/kvm.h | ||
24 | @@ -XXX,XX +XXX,XX @@ int kvm_arch_insert_sw_breakpoint(CPUState *cpu, | ||
25 | struct kvm_sw_breakpoint *bp); | ||
26 | int kvm_arch_remove_sw_breakpoint(CPUState *cpu, | ||
27 | struct kvm_sw_breakpoint *bp); | ||
28 | -int kvm_arch_insert_hw_breakpoint(target_ulong addr, | ||
29 | - target_ulong len, int type); | ||
30 | -int kvm_arch_remove_hw_breakpoint(target_ulong addr, | ||
31 | - target_ulong len, int type); | ||
32 | +int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type); | ||
33 | +int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type); | ||
34 | void kvm_arch_remove_all_hw_breakpoints(void); | ||
35 | |||
36 | void kvm_arch_update_guest_debug(CPUState *cpu, struct kvm_guest_debug *dbg); | ||
37 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c | ||
38 | index XXXXXXX..XXXXXXX 100644 | ||
39 | --- a/target/arm/kvm64.c | ||
40 | +++ b/target/arm/kvm64.c | ||
41 | @@ -XXX,XX +XXX,XX @@ void kvm_arm_init_debug(KVMState *s) | ||
42 | return; | ||
43 | } | ||
44 | |||
45 | -int kvm_arch_insert_hw_breakpoint(target_ulong addr, | ||
46 | - target_ulong len, int type) | ||
47 | +int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type) | ||
48 | { | ||
49 | switch (type) { | ||
50 | case GDB_BREAKPOINT_HW: | ||
51 | @@ -XXX,XX +XXX,XX @@ int kvm_arch_insert_hw_breakpoint(target_ulong addr, | ||
52 | } | ||
53 | } | ||
54 | |||
55 | -int kvm_arch_remove_hw_breakpoint(target_ulong addr, | ||
56 | - target_ulong len, int type) | ||
57 | +int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type) | ||
58 | { | ||
59 | switch (type) { | ||
60 | case GDB_BREAKPOINT_HW: | ||
61 | diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c | ||
62 | index XXXXXXX..XXXXXXX 100644 | ||
63 | --- a/target/i386/kvm/kvm.c | ||
64 | +++ b/target/i386/kvm/kvm.c | ||
65 | @@ -XXX,XX +XXX,XX @@ MemTxAttrs kvm_arch_post_run(CPUState *cpu, struct kvm_run *run) | ||
66 | kvm_rate_limit_on_bus_lock(); | ||
67 | } | ||
68 | |||
69 | -#ifdef CONFIG_XEN_EMU | ||
70 | +#ifdef CONFIG_XEN_EMU | ||
71 | /* | ||
72 | * If the callback is asserted as a GSI (or PCI INTx) then check if | ||
73 | * vcpu_info->evtchn_upcall_pending has been cleared, and deassert | ||
74 | @@ -XXX,XX +XXX,XX @@ static int find_hw_breakpoint(target_ulong addr, int len, int type) | ||
75 | return -1; | ||
76 | } | ||
77 | |||
78 | -int kvm_arch_insert_hw_breakpoint(target_ulong addr, | ||
79 | - target_ulong len, int type) | ||
80 | +int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type) | ||
81 | { | ||
82 | switch (type) { | ||
83 | case GDB_BREAKPOINT_HW: | ||
84 | @@ -XXX,XX +XXX,XX @@ int kvm_arch_insert_hw_breakpoint(target_ulong addr, | ||
85 | return 0; | ||
86 | } | ||
87 | |||
88 | -int kvm_arch_remove_hw_breakpoint(target_ulong addr, | ||
89 | - target_ulong len, int type) | ||
90 | +int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type) | ||
91 | { | ||
92 | int n; | ||
93 | |||
94 | diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c | ||
95 | index XXXXXXX..XXXXXXX 100644 | ||
96 | --- a/target/ppc/kvm.c | ||
97 | +++ b/target/ppc/kvm.c | ||
98 | @@ -XXX,XX +XXX,XX @@ static int find_hw_watchpoint(target_ulong addr, int *flag) | ||
99 | return -1; | ||
100 | } | ||
101 | |||
102 | -int kvm_arch_insert_hw_breakpoint(target_ulong addr, | ||
103 | - target_ulong len, int type) | ||
104 | +int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type) | ||
105 | { | ||
106 | - if ((nb_hw_breakpoint + nb_hw_watchpoint) >= ARRAY_SIZE(hw_debug_points)) { | ||
107 | + const unsigned breakpoint_index = nb_hw_breakpoint + nb_hw_watchpoint; | ||
108 | + if (breakpoint_index >= ARRAY_SIZE(hw_debug_points)) { | ||
109 | return -ENOBUFS; | ||
110 | } | ||
111 | |||
112 | - hw_debug_points[nb_hw_breakpoint + nb_hw_watchpoint].addr = addr; | ||
113 | - hw_debug_points[nb_hw_breakpoint + nb_hw_watchpoint].type = type; | ||
114 | + hw_debug_points[breakpoint_index].addr = addr; | ||
115 | + hw_debug_points[breakpoint_index].type = type; | ||
116 | |||
117 | switch (type) { | ||
118 | case GDB_BREAKPOINT_HW: | ||
119 | @@ -XXX,XX +XXX,XX @@ int kvm_arch_insert_hw_breakpoint(target_ulong addr, | ||
120 | return 0; | ||
121 | } | ||
122 | |||
123 | -int kvm_arch_remove_hw_breakpoint(target_ulong addr, | ||
124 | - target_ulong len, int type) | ||
125 | +int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type) | ||
126 | { | ||
127 | int n; | ||
128 | |||
129 | diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c | ||
130 | index XXXXXXX..XXXXXXX 100644 | ||
131 | --- a/target/s390x/kvm/kvm.c | ||
132 | +++ b/target/s390x/kvm/kvm.c | ||
133 | @@ -XXX,XX +XXX,XX @@ static int insert_hw_breakpoint(target_ulong addr, int len, int type) | ||
134 | return 0; | ||
135 | } | ||
136 | |||
137 | -int kvm_arch_insert_hw_breakpoint(target_ulong addr, | ||
138 | - target_ulong len, int type) | ||
139 | +int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type) | ||
140 | { | ||
141 | switch (type) { | ||
142 | case GDB_BREAKPOINT_HW: | ||
143 | @@ -XXX,XX +XXX,XX @@ int kvm_arch_insert_hw_breakpoint(target_ulong addr, | ||
144 | return insert_hw_breakpoint(addr, len, type); | ||
145 | } | ||
146 | |||
147 | -int kvm_arch_remove_hw_breakpoint(target_ulong addr, | ||
148 | - target_ulong len, int type) | ||
149 | +int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type) | ||
150 | { | ||
151 | int size; | ||
152 | struct kvm_hw_breakpoint *bp = find_hw_breakpoint(addr, len, type); | ||
153 | -- | ||
154 | 2.34.1 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Anton Johansson via <qemu-devel@nongnu.org> | ||
2 | 1 | ||
3 | Changes the signature of the target-defined functions for | ||
4 | inserting/removing hvf hw breakpoints. The address and length arguments | ||
5 | are now of vaddr type, which both matches the type used internally in | ||
6 | accel/hvf/hvf-all.c and makes the api target-agnostic. | ||
7 | |||
8 | Signed-off-by: Anton Johansson <anjo@rev.ng> | ||
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Message-Id: <20230807155706.9580-5-anjo@rev.ng> | ||
11 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
12 | --- | ||
13 | include/sysemu/hvf.h | 6 ++---- | ||
14 | target/arm/hvf/hvf.c | 4 ++-- | ||
15 | target/i386/hvf/hvf.c | 4 ++-- | ||
16 | 3 files changed, 6 insertions(+), 8 deletions(-) | ||
17 | |||
18 | diff --git a/include/sysemu/hvf.h b/include/sysemu/hvf.h | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/include/sysemu/hvf.h | ||
21 | +++ b/include/sysemu/hvf.h | ||
22 | @@ -XXX,XX +XXX,XX @@ int hvf_sw_breakpoints_active(CPUState *cpu); | ||
23 | |||
24 | int hvf_arch_insert_sw_breakpoint(CPUState *cpu, struct hvf_sw_breakpoint *bp); | ||
25 | int hvf_arch_remove_sw_breakpoint(CPUState *cpu, struct hvf_sw_breakpoint *bp); | ||
26 | -int hvf_arch_insert_hw_breakpoint(target_ulong addr, target_ulong len, | ||
27 | - int type); | ||
28 | -int hvf_arch_remove_hw_breakpoint(target_ulong addr, target_ulong len, | ||
29 | - int type); | ||
30 | +int hvf_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type); | ||
31 | +int hvf_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type); | ||
32 | void hvf_arch_remove_all_hw_breakpoints(void); | ||
33 | |||
34 | /* | ||
35 | diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c | ||
36 | index XXXXXXX..XXXXXXX 100644 | ||
37 | --- a/target/arm/hvf/hvf.c | ||
38 | +++ b/target/arm/hvf/hvf.c | ||
39 | @@ -XXX,XX +XXX,XX @@ int hvf_arch_remove_sw_breakpoint(CPUState *cpu, struct hvf_sw_breakpoint *bp) | ||
40 | return 0; | ||
41 | } | ||
42 | |||
43 | -int hvf_arch_insert_hw_breakpoint(target_ulong addr, target_ulong len, int type) | ||
44 | +int hvf_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type) | ||
45 | { | ||
46 | switch (type) { | ||
47 | case GDB_BREAKPOINT_HW: | ||
48 | @@ -XXX,XX +XXX,XX @@ int hvf_arch_insert_hw_breakpoint(target_ulong addr, target_ulong len, int type) | ||
49 | } | ||
50 | } | ||
51 | |||
52 | -int hvf_arch_remove_hw_breakpoint(target_ulong addr, target_ulong len, int type) | ||
53 | +int hvf_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type) | ||
54 | { | ||
55 | switch (type) { | ||
56 | case GDB_BREAKPOINT_HW: | ||
57 | diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c | ||
58 | index XXXXXXX..XXXXXXX 100644 | ||
59 | --- a/target/i386/hvf/hvf.c | ||
60 | +++ b/target/i386/hvf/hvf.c | ||
61 | @@ -XXX,XX +XXX,XX @@ int hvf_arch_remove_sw_breakpoint(CPUState *cpu, struct hvf_sw_breakpoint *bp) | ||
62 | return -ENOSYS; | ||
63 | } | ||
64 | |||
65 | -int hvf_arch_insert_hw_breakpoint(target_ulong addr, target_ulong len, int type) | ||
66 | +int hvf_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type) | ||
67 | { | ||
68 | return -ENOSYS; | ||
69 | } | ||
70 | |||
71 | -int hvf_arch_remove_hw_breakpoint(target_ulong addr, target_ulong len, int type) | ||
72 | +int hvf_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type) | ||
73 | { | ||
74 | return -ENOSYS; | ||
75 | } | ||
76 | -- | ||
77 | 2.34.1 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Anton Johansson via <qemu-devel@nongnu.org> | ||
2 | 1 | ||
3 | Changes the address type of the guest memory read/write functions from | ||
4 | target_ulong to abi_ptr. (abi_ptr is currently typedef'd to target_ulong | ||
5 | but that will change in a following commit.) This will reduce the | ||
6 | coupling between accel/ and target/. | ||
7 | |||
8 | Note: Function pointers that point to cpu_[st|ld]*() in target/riscv and | ||
9 | target/rx are also updated in this commit. | ||
10 | |||
11 | Signed-off-by: Anton Johansson <anjo@rev.ng> | ||
12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | Message-Id: <20230807155706.9580-6-anjo@rev.ng> | ||
14 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
15 | --- | ||
16 | accel/tcg/atomic_template.h | 16 ++++++++-------- | ||
17 | include/exec/cpu_ldst.h | 24 ++++++++++++------------ | ||
18 | accel/tcg/cputlb.c | 10 +++++----- | ||
19 | target/riscv/vector_helper.c | 2 +- | ||
20 | target/rx/op_helper.c | 6 +++--- | ||
21 | 5 files changed, 29 insertions(+), 29 deletions(-) | ||
22 | |||
23 | diff --git a/accel/tcg/atomic_template.h b/accel/tcg/atomic_template.h | ||
24 | index XXXXXXX..XXXXXXX 100644 | ||
25 | --- a/accel/tcg/atomic_template.h | ||
26 | +++ b/accel/tcg/atomic_template.h | ||
27 | @@ -XXX,XX +XXX,XX @@ | ||
28 | # define END _le | ||
29 | #endif | ||
30 | |||
31 | -ABI_TYPE ATOMIC_NAME(cmpxchg)(CPUArchState *env, target_ulong addr, | ||
32 | +ABI_TYPE ATOMIC_NAME(cmpxchg)(CPUArchState *env, abi_ptr addr, | ||
33 | ABI_TYPE cmpv, ABI_TYPE newv, | ||
34 | MemOpIdx oi, uintptr_t retaddr) | ||
35 | { | ||
36 | @@ -XXX,XX +XXX,XX @@ ABI_TYPE ATOMIC_NAME(cmpxchg)(CPUArchState *env, target_ulong addr, | ||
37 | } | ||
38 | |||
39 | #if DATA_SIZE < 16 | ||
40 | -ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, target_ulong addr, ABI_TYPE val, | ||
41 | +ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, abi_ptr addr, ABI_TYPE val, | ||
42 | MemOpIdx oi, uintptr_t retaddr) | ||
43 | { | ||
44 | DATA_TYPE *haddr = atomic_mmu_lookup(env, addr, oi, DATA_SIZE, retaddr); | ||
45 | @@ -XXX,XX +XXX,XX @@ ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, target_ulong addr, ABI_TYPE val, | ||
46 | } | ||
47 | |||
48 | #define GEN_ATOMIC_HELPER(X) \ | ||
49 | -ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulong addr, \ | ||
50 | +ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, abi_ptr addr, \ | ||
51 | ABI_TYPE val, MemOpIdx oi, uintptr_t retaddr) \ | ||
52 | { \ | ||
53 | DATA_TYPE *haddr, ret; \ | ||
54 | @@ -XXX,XX +XXX,XX @@ GEN_ATOMIC_HELPER(xor_fetch) | ||
55 | * of CF_PARALLEL's value, we'll trace just a read and a write. | ||
56 | */ | ||
57 | #define GEN_ATOMIC_HELPER_FN(X, FN, XDATA_TYPE, RET) \ | ||
58 | -ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulong addr, \ | ||
59 | +ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, abi_ptr addr, \ | ||
60 | ABI_TYPE xval, MemOpIdx oi, uintptr_t retaddr) \ | ||
61 | { \ | ||
62 | XDATA_TYPE *haddr, cmp, old, new, val = xval; \ | ||
63 | @@ -XXX,XX +XXX,XX @@ GEN_ATOMIC_HELPER_FN(umax_fetch, MAX, DATA_TYPE, new) | ||
64 | # define END _be | ||
65 | #endif | ||
66 | |||
67 | -ABI_TYPE ATOMIC_NAME(cmpxchg)(CPUArchState *env, target_ulong addr, | ||
68 | +ABI_TYPE ATOMIC_NAME(cmpxchg)(CPUArchState *env, abi_ptr addr, | ||
69 | ABI_TYPE cmpv, ABI_TYPE newv, | ||
70 | MemOpIdx oi, uintptr_t retaddr) | ||
71 | { | ||
72 | @@ -XXX,XX +XXX,XX @@ ABI_TYPE ATOMIC_NAME(cmpxchg)(CPUArchState *env, target_ulong addr, | ||
73 | } | ||
74 | |||
75 | #if DATA_SIZE < 16 | ||
76 | -ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, target_ulong addr, ABI_TYPE val, | ||
77 | +ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, abi_ptr addr, ABI_TYPE val, | ||
78 | MemOpIdx oi, uintptr_t retaddr) | ||
79 | { | ||
80 | DATA_TYPE *haddr = atomic_mmu_lookup(env, addr, oi, DATA_SIZE, retaddr); | ||
81 | @@ -XXX,XX +XXX,XX @@ ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, target_ulong addr, ABI_TYPE val, | ||
82 | } | ||
83 | |||
84 | #define GEN_ATOMIC_HELPER(X) \ | ||
85 | -ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulong addr, \ | ||
86 | +ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, abi_ptr addr, \ | ||
87 | ABI_TYPE val, MemOpIdx oi, uintptr_t retaddr) \ | ||
88 | { \ | ||
89 | DATA_TYPE *haddr, ret; \ | ||
90 | @@ -XXX,XX +XXX,XX @@ GEN_ATOMIC_HELPER(xor_fetch) | ||
91 | * of CF_PARALLEL's value, we'll trace just a read and a write. | ||
92 | */ | ||
93 | #define GEN_ATOMIC_HELPER_FN(X, FN, XDATA_TYPE, RET) \ | ||
94 | -ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulong addr, \ | ||
95 | +ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, abi_ptr addr, \ | ||
96 | ABI_TYPE xval, MemOpIdx oi, uintptr_t retaddr) \ | ||
97 | { \ | ||
98 | XDATA_TYPE *haddr, ldo, ldn, old, new, val = xval; \ | ||
99 | diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h | ||
100 | index XXXXXXX..XXXXXXX 100644 | ||
101 | --- a/include/exec/cpu_ldst.h | ||
102 | +++ b/include/exec/cpu_ldst.h | ||
103 | @@ -XXX,XX +XXX,XX @@ void cpu_stq_mmu(CPUArchState *env, abi_ptr ptr, uint64_t val, | ||
104 | void cpu_st16_mmu(CPUArchState *env, abi_ptr addr, Int128 val, | ||
105 | MemOpIdx oi, uintptr_t ra); | ||
106 | |||
107 | -uint32_t cpu_atomic_cmpxchgb_mmu(CPUArchState *env, target_ulong addr, | ||
108 | +uint32_t cpu_atomic_cmpxchgb_mmu(CPUArchState *env, abi_ptr addr, | ||
109 | uint32_t cmpv, uint32_t newv, | ||
110 | MemOpIdx oi, uintptr_t retaddr); | ||
111 | -uint32_t cpu_atomic_cmpxchgw_le_mmu(CPUArchState *env, target_ulong addr, | ||
112 | +uint32_t cpu_atomic_cmpxchgw_le_mmu(CPUArchState *env, abi_ptr addr, | ||
113 | uint32_t cmpv, uint32_t newv, | ||
114 | MemOpIdx oi, uintptr_t retaddr); | ||
115 | -uint32_t cpu_atomic_cmpxchgl_le_mmu(CPUArchState *env, target_ulong addr, | ||
116 | +uint32_t cpu_atomic_cmpxchgl_le_mmu(CPUArchState *env, abi_ptr addr, | ||
117 | uint32_t cmpv, uint32_t newv, | ||
118 | MemOpIdx oi, uintptr_t retaddr); | ||
119 | -uint64_t cpu_atomic_cmpxchgq_le_mmu(CPUArchState *env, target_ulong addr, | ||
120 | +uint64_t cpu_atomic_cmpxchgq_le_mmu(CPUArchState *env, abi_ptr addr, | ||
121 | uint64_t cmpv, uint64_t newv, | ||
122 | MemOpIdx oi, uintptr_t retaddr); | ||
123 | -uint32_t cpu_atomic_cmpxchgw_be_mmu(CPUArchState *env, target_ulong addr, | ||
124 | +uint32_t cpu_atomic_cmpxchgw_be_mmu(CPUArchState *env, abi_ptr addr, | ||
125 | uint32_t cmpv, uint32_t newv, | ||
126 | MemOpIdx oi, uintptr_t retaddr); | ||
127 | -uint32_t cpu_atomic_cmpxchgl_be_mmu(CPUArchState *env, target_ulong addr, | ||
128 | +uint32_t cpu_atomic_cmpxchgl_be_mmu(CPUArchState *env, abi_ptr addr, | ||
129 | uint32_t cmpv, uint32_t newv, | ||
130 | MemOpIdx oi, uintptr_t retaddr); | ||
131 | -uint64_t cpu_atomic_cmpxchgq_be_mmu(CPUArchState *env, target_ulong addr, | ||
132 | +uint64_t cpu_atomic_cmpxchgq_be_mmu(CPUArchState *env, abi_ptr addr, | ||
133 | uint64_t cmpv, uint64_t newv, | ||
134 | MemOpIdx oi, uintptr_t retaddr); | ||
135 | |||
136 | -#define GEN_ATOMIC_HELPER(NAME, TYPE, SUFFIX) \ | ||
137 | -TYPE cpu_atomic_ ## NAME ## SUFFIX ## _mmu \ | ||
138 | - (CPUArchState *env, target_ulong addr, TYPE val, \ | ||
139 | +#define GEN_ATOMIC_HELPER(NAME, TYPE, SUFFIX) \ | ||
140 | +TYPE cpu_atomic_ ## NAME ## SUFFIX ## _mmu \ | ||
141 | + (CPUArchState *env, abi_ptr addr, TYPE val, \ | ||
142 | MemOpIdx oi, uintptr_t retaddr); | ||
143 | |||
144 | #ifdef CONFIG_ATOMIC64 | ||
145 | @@ -XXX,XX +XXX,XX @@ GEN_ATOMIC_HELPER_ALL(xchg) | ||
146 | #undef GEN_ATOMIC_HELPER_ALL | ||
147 | #undef GEN_ATOMIC_HELPER | ||
148 | |||
149 | -Int128 cpu_atomic_cmpxchgo_le_mmu(CPUArchState *env, target_ulong addr, | ||
150 | +Int128 cpu_atomic_cmpxchgo_le_mmu(CPUArchState *env, abi_ptr addr, | ||
151 | Int128 cmpv, Int128 newv, | ||
152 | MemOpIdx oi, uintptr_t retaddr); | ||
153 | -Int128 cpu_atomic_cmpxchgo_be_mmu(CPUArchState *env, target_ulong addr, | ||
154 | +Int128 cpu_atomic_cmpxchgo_be_mmu(CPUArchState *env, abi_ptr addr, | ||
155 | Int128 cmpv, Int128 newv, | ||
156 | MemOpIdx oi, uintptr_t retaddr); | ||
157 | |||
158 | diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c | ||
159 | index XXXXXXX..XXXXXXX 100644 | ||
160 | --- a/accel/tcg/cputlb.c | ||
161 | +++ b/accel/tcg/cputlb.c | ||
162 | @@ -XXX,XX +XXX,XX @@ static void plugin_store_cb(CPUArchState *env, abi_ptr addr, MemOpIdx oi) | ||
163 | qemu_plugin_vcpu_mem_cb(env_cpu(env), addr, oi, QEMU_PLUGIN_MEM_W); | ||
164 | } | ||
165 | |||
166 | -void cpu_stb_mmu(CPUArchState *env, target_ulong addr, uint8_t val, | ||
167 | +void cpu_stb_mmu(CPUArchState *env, abi_ptr addr, uint8_t val, | ||
168 | MemOpIdx oi, uintptr_t retaddr) | ||
169 | { | ||
170 | helper_stb_mmu(env, addr, val, oi, retaddr); | ||
171 | plugin_store_cb(env, addr, oi); | ||
172 | } | ||
173 | |||
174 | -void cpu_stw_mmu(CPUArchState *env, target_ulong addr, uint16_t val, | ||
175 | +void cpu_stw_mmu(CPUArchState *env, abi_ptr addr, uint16_t val, | ||
176 | MemOpIdx oi, uintptr_t retaddr) | ||
177 | { | ||
178 | tcg_debug_assert((get_memop(oi) & MO_SIZE) == MO_16); | ||
179 | @@ -XXX,XX +XXX,XX @@ void cpu_stw_mmu(CPUArchState *env, target_ulong addr, uint16_t val, | ||
180 | plugin_store_cb(env, addr, oi); | ||
181 | } | ||
182 | |||
183 | -void cpu_stl_mmu(CPUArchState *env, target_ulong addr, uint32_t val, | ||
184 | +void cpu_stl_mmu(CPUArchState *env, abi_ptr addr, uint32_t val, | ||
185 | MemOpIdx oi, uintptr_t retaddr) | ||
186 | { | ||
187 | tcg_debug_assert((get_memop(oi) & MO_SIZE) == MO_32); | ||
188 | @@ -XXX,XX +XXX,XX @@ void cpu_stl_mmu(CPUArchState *env, target_ulong addr, uint32_t val, | ||
189 | plugin_store_cb(env, addr, oi); | ||
190 | } | ||
191 | |||
192 | -void cpu_stq_mmu(CPUArchState *env, target_ulong addr, uint64_t val, | ||
193 | +void cpu_stq_mmu(CPUArchState *env, abi_ptr addr, uint64_t val, | ||
194 | MemOpIdx oi, uintptr_t retaddr) | ||
195 | { | ||
196 | tcg_debug_assert((get_memop(oi) & MO_SIZE) == MO_64); | ||
197 | @@ -XXX,XX +XXX,XX @@ void cpu_stq_mmu(CPUArchState *env, target_ulong addr, uint64_t val, | ||
198 | plugin_store_cb(env, addr, oi); | ||
199 | } | ||
200 | |||
201 | -void cpu_st16_mmu(CPUArchState *env, target_ulong addr, Int128 val, | ||
202 | +void cpu_st16_mmu(CPUArchState *env, abi_ptr addr, Int128 val, | ||
203 | MemOpIdx oi, uintptr_t retaddr) | ||
204 | { | ||
205 | tcg_debug_assert((get_memop(oi) & MO_SIZE) == MO_128); | ||
206 | diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c | ||
207 | index XXXXXXX..XXXXXXX 100644 | ||
208 | --- a/target/riscv/vector_helper.c | ||
209 | +++ b/target/riscv/vector_helper.c | ||
210 | @@ -XXX,XX +XXX,XX @@ static inline int vext_elem_mask(void *v0, int index) | ||
211 | } | ||
212 | |||
213 | /* elements operations for load and store */ | ||
214 | -typedef void vext_ldst_elem_fn(CPURISCVState *env, target_ulong addr, | ||
215 | +typedef void vext_ldst_elem_fn(CPURISCVState *env, abi_ptr addr, | ||
216 | uint32_t idx, void *vd, uintptr_t retaddr); | ||
217 | |||
218 | #define GEN_VEXT_LD_ELEM(NAME, ETYPE, H, LDSUF) \ | ||
219 | diff --git a/target/rx/op_helper.c b/target/rx/op_helper.c | ||
220 | index XXXXXXX..XXXXXXX 100644 | ||
221 | --- a/target/rx/op_helper.c | ||
222 | +++ b/target/rx/op_helper.c | ||
223 | @@ -XXX,XX +XXX,XX @@ void helper_scmpu(CPURXState *env) | ||
224 | } | ||
225 | |||
226 | static uint32_t (* const cpu_ldufn[])(CPUArchState *env, | ||
227 | - target_ulong ptr, | ||
228 | + abi_ptr ptr, | ||
229 | uintptr_t retaddr) = { | ||
230 | cpu_ldub_data_ra, cpu_lduw_data_ra, cpu_ldl_data_ra, | ||
231 | }; | ||
232 | |||
233 | static uint32_t (* const cpu_ldfn[])(CPUArchState *env, | ||
234 | - target_ulong ptr, | ||
235 | + abi_ptr ptr, | ||
236 | uintptr_t retaddr) = { | ||
237 | cpu_ldub_data_ra, cpu_lduw_data_ra, cpu_ldl_data_ra, | ||
238 | }; | ||
239 | |||
240 | static void (* const cpu_stfn[])(CPUArchState *env, | ||
241 | - target_ulong ptr, | ||
242 | + abi_ptr ptr, | ||
243 | uint32_t val, | ||
244 | uintptr_t retaddr) = { | ||
245 | cpu_stb_data_ra, cpu_stw_data_ra, cpu_stl_data_ra, | ||
246 | -- | ||
247 | 2.34.1 | diff view generated by jsdifflib |
1 | From: Anton Johansson via <qemu-devel@nongnu.org> | 1 | DisasContextBase.pc_next has type vaddr; use the correct log format. |
---|---|---|---|
2 | 2 | ||
3 | In system mode, abi_ptr is primarily used for representing addresses | 3 | Fixes: 85c19af63e7 ("include/exec: Use vaddr in DisasContextBase for virtual addresses") |
4 | when accessing guest memory with cpu_[st|ld]*(). Widening it from | ||
5 | target_ulong to vaddr reduces the target dependence of these functions | ||
6 | and is step towards building accel/ once for system mode. | ||
7 | |||
8 | Signed-off-by: Anton Johansson <anjo@rev.ng> | ||
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Message-Id: <20230807155706.9580-7-anjo@rev.ng> | ||
11 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
12 | --- | 5 | --- |
13 | include/exec/cpu_ldst.h | 4 ++-- | 6 | target/mips/tcg/octeon_translate.c | 4 ++-- |
14 | 1 file changed, 2 insertions(+), 2 deletions(-) | 7 | 1 file changed, 2 insertions(+), 2 deletions(-) |
15 | 8 | ||
16 | diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h | 9 | diff --git a/target/mips/tcg/octeon_translate.c b/target/mips/tcg/octeon_translate.c |
17 | index XXXXXXX..XXXXXXX 100644 | 10 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/include/exec/cpu_ldst.h | 11 | --- a/target/mips/tcg/octeon_translate.c |
19 | +++ b/include/exec/cpu_ldst.h | 12 | +++ b/target/mips/tcg/octeon_translate.c |
20 | @@ -XXX,XX +XXX,XX @@ static inline bool guest_range_valid_untagged(abi_ulong start, abi_ulong len) | 13 | @@ -XXX,XX +XXX,XX @@ static bool trans_BBIT(DisasContext *ctx, arg_BBIT *a) |
21 | h2g_nocheck(x); \ | 14 | TCGv p; |
22 | }) | 15 | |
23 | #else | 16 | if (ctx->hflags & MIPS_HFLAG_BMASK) { |
24 | -typedef target_ulong abi_ptr; | 17 | - LOG_DISAS("Branch in delay / forbidden slot at PC 0x" |
25 | -#define TARGET_ABI_FMT_ptr TARGET_FMT_lx | 18 | - TARGET_FMT_lx "\n", ctx->base.pc_next); |
26 | +typedef vaddr abi_ptr; | 19 | + LOG_DISAS("Branch in delay / forbidden slot at PC 0x%" VADDR_PRIx "\n", |
27 | +#define TARGET_ABI_FMT_ptr "%016" VADDR_PRIx | 20 | + ctx->base.pc_next); |
28 | #endif | 21 | generate_exception_end(ctx, EXCP_RI); |
29 | 22 | return true; | |
30 | uint32_t cpu_ldub_data(CPUArchState *env, abi_ptr ptr); | 23 | } |
31 | -- | 24 | -- |
32 | 2.34.1 | 25 | 2.43.0 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Anton Johansson via <qemu-devel@nongnu.org> | ||
2 | 1 | ||
3 | tlb_addr is changed from target_ulong to uint64_t to match the type of | ||
4 | a CPUTLBEntry value, and the addressed is changed to vaddr. | ||
5 | |||
6 | Signed-off-by: Anton Johansson <anjo@rev.ng> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-Id: <20230807155706.9580-8-anjo@rev.ng> | ||
9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | --- | ||
11 | include/exec/cpu-all.h | 4 ++-- | ||
12 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
13 | |||
14 | diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/include/exec/cpu-all.h | ||
17 | +++ b/include/exec/cpu-all.h | ||
18 | @@ -XXX,XX +XXX,XX @@ QEMU_BUILD_BUG_ON(TLB_FLAGS_MASK & TLB_SLOW_FLAGS_MASK); | ||
19 | * @addr: virtual address to test (must be page aligned) | ||
20 | * @tlb_addr: TLB entry address (a CPUTLBEntry addr_read/write/code value) | ||
21 | */ | ||
22 | -static inline bool tlb_hit_page(target_ulong tlb_addr, target_ulong addr) | ||
23 | +static inline bool tlb_hit_page(uint64_t tlb_addr, vaddr addr) | ||
24 | { | ||
25 | return addr == (tlb_addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK)); | ||
26 | } | ||
27 | @@ -XXX,XX +XXX,XX @@ static inline bool tlb_hit_page(target_ulong tlb_addr, target_ulong addr) | ||
28 | * @addr: virtual address to test (need not be page aligned) | ||
29 | * @tlb_addr: TLB entry address (a CPUTLBEntry addr_read/write/code value) | ||
30 | */ | ||
31 | -static inline bool tlb_hit(target_ulong tlb_addr, target_ulong addr) | ||
32 | +static inline bool tlb_hit(uint64_t tlb_addr, vaddr addr) | ||
33 | { | ||
34 | return tlb_hit_page(tlb_addr, addr & TARGET_PAGE_MASK); | ||
35 | } | ||
36 | -- | ||
37 | 2.34.1 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Anton Johansson via <qemu-devel@nongnu.org> | ||
2 | 1 | ||
3 | Signed-off-by: Anton Johansson <anjo@rev.ng> | ||
4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | Message-Id: <20230807155706.9580-9-anjo@rev.ng> | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | --- | ||
8 | accel/tcg/cputlb.c | 2 +- | ||
9 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
10 | |||
11 | diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/accel/tcg/cputlb.c | ||
14 | +++ b/accel/tcg/cputlb.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static void tlb_add_large_page(CPUArchState *env, int mmu_idx, | ||
16 | } | ||
17 | |||
18 | static inline void tlb_set_compare(CPUTLBEntryFull *full, CPUTLBEntry *ent, | ||
19 | - target_ulong address, int flags, | ||
20 | + vaddr address, int flags, | ||
21 | MMUAccessType access_type, bool enable) | ||
22 | { | ||
23 | if (enable) { | ||
24 | -- | ||
25 | 2.34.1 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Anton Johansson via <qemu-devel@nongnu.org> | ||
2 | 1 | ||
3 | As we are now using vaddr for representing guest addresses, update the | ||
4 | static assert to check that vaddr fits in the run_on_cpu_data union. | ||
5 | |||
6 | Signed-off-by: Anton Johansson <anjo@rev.ng> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-Id: <20230807155706.9580-10-anjo@rev.ng> | ||
9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | --- | ||
11 | accel/tcg/cputlb.c | 5 +++-- | ||
12 | 1 file changed, 3 insertions(+), 2 deletions(-) | ||
13 | |||
14 | diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/accel/tcg/cputlb.c | ||
17 | +++ b/accel/tcg/cputlb.c | ||
18 | @@ -XXX,XX +XXX,XX @@ | ||
19 | } while (0) | ||
20 | |||
21 | /* run_on_cpu_data.target_ptr should always be big enough for a | ||
22 | - * target_ulong even on 32 bit builds */ | ||
23 | -QEMU_BUILD_BUG_ON(sizeof(target_ulong) > sizeof(run_on_cpu_data)); | ||
24 | + * vaddr even on 32 bit builds | ||
25 | + */ | ||
26 | +QEMU_BUILD_BUG_ON(sizeof(vaddr) > sizeof(run_on_cpu_data)); | ||
27 | |||
28 | /* We currently can't handle more than 16 bits in the MMUIDX bitmask. | ||
29 | */ | ||
30 | -- | ||
31 | 2.34.1 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
2 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
3 | --- | ||
4 | target/m68k/translate.c | 11 ++--------- | ||
5 | 1 file changed, 2 insertions(+), 9 deletions(-) | ||
6 | 1 | ||
7 | diff --git a/target/m68k/translate.c b/target/m68k/translate.c | ||
8 | index XXXXXXX..XXXXXXX 100644 | ||
9 | --- a/target/m68k/translate.c | ||
10 | +++ b/target/m68k/translate.c | ||
11 | @@ -XXX,XX +XXX,XX @@ static inline int ext_opsize(int ext, int pos) | ||
12 | */ | ||
13 | static void gen_partset_reg(int opsize, TCGv reg, TCGv val) | ||
14 | { | ||
15 | - TCGv tmp; | ||
16 | switch (opsize) { | ||
17 | case OS_BYTE: | ||
18 | - tcg_gen_andi_i32(reg, reg, 0xffffff00); | ||
19 | - tmp = tcg_temp_new(); | ||
20 | - tcg_gen_ext8u_i32(tmp, val); | ||
21 | - tcg_gen_or_i32(reg, reg, tmp); | ||
22 | + tcg_gen_deposit_i32(reg, reg, val, 0, 8); | ||
23 | break; | ||
24 | case OS_WORD: | ||
25 | - tcg_gen_andi_i32(reg, reg, 0xffff0000); | ||
26 | - tmp = tcg_temp_new(); | ||
27 | - tcg_gen_ext16u_i32(tmp, val); | ||
28 | - tcg_gen_or_i32(reg, reg, tmp); | ||
29 | + tcg_gen_deposit_i32(reg, reg, val, 0, 16); | ||
30 | break; | ||
31 | case OS_LONG: | ||
32 | case OS_SINGLE: | ||
33 | -- | ||
34 | 2.34.1 | ||
35 | |||
36 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | It is more useful to allow low-part deposits into all registers | ||
2 | than to restrict allocation for high-byte deposits. | ||
3 | 1 | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | --- | ||
7 | tcg/i386/tcg-target-con-set.h | 2 +- | ||
8 | tcg/i386/tcg-target-con-str.h | 1 - | ||
9 | tcg/i386/tcg-target.h | 4 ++-- | ||
10 | tcg/i386/tcg-target.c.inc | 7 +++---- | ||
11 | 4 files changed, 6 insertions(+), 8 deletions(-) | ||
12 | |||
13 | diff --git a/tcg/i386/tcg-target-con-set.h b/tcg/i386/tcg-target-con-set.h | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/tcg/i386/tcg-target-con-set.h | ||
16 | +++ b/tcg/i386/tcg-target-con-set.h | ||
17 | @@ -XXX,XX +XXX,XX @@ C_O1_I1(r, q) | ||
18 | C_O1_I1(r, r) | ||
19 | C_O1_I1(x, r) | ||
20 | C_O1_I1(x, x) | ||
21 | -C_O1_I2(Q, 0, Q) | ||
22 | +C_O1_I2(q, 0, q) | ||
23 | C_O1_I2(q, r, re) | ||
24 | C_O1_I2(r, 0, ci) | ||
25 | C_O1_I2(r, 0, r) | ||
26 | diff --git a/tcg/i386/tcg-target-con-str.h b/tcg/i386/tcg-target-con-str.h | ||
27 | index XXXXXXX..XXXXXXX 100644 | ||
28 | --- a/tcg/i386/tcg-target-con-str.h | ||
29 | +++ b/tcg/i386/tcg-target-con-str.h | ||
30 | @@ -XXX,XX +XXX,XX @@ REGS('D', 1u << TCG_REG_EDI) | ||
31 | REGS('r', ALL_GENERAL_REGS) | ||
32 | REGS('x', ALL_VECTOR_REGS) | ||
33 | REGS('q', ALL_BYTEL_REGS) /* regs that can be used as a byte operand */ | ||
34 | -REGS('Q', ALL_BYTEH_REGS) /* regs with a second byte (e.g. %ah) */ | ||
35 | REGS('L', ALL_GENERAL_REGS & ~SOFTMMU_RESERVE_REGS) /* qemu_ld/st */ | ||
36 | REGS('s', ALL_BYTEL_REGS & ~SOFTMMU_RESERVE_REGS) /* qemu_st8_i32 data */ | ||
37 | |||
38 | diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/tcg/i386/tcg-target.h | ||
41 | +++ b/tcg/i386/tcg-target.h | ||
42 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
43 | #define TCG_TARGET_HAS_cmpsel_vec -1 | ||
44 | |||
45 | #define TCG_TARGET_deposit_i32_valid(ofs, len) \ | ||
46 | - (((ofs) == 0 && (len) == 8) || ((ofs) == 8 && (len) == 8) || \ | ||
47 | - ((ofs) == 0 && (len) == 16)) | ||
48 | + (((ofs) == 0 && ((len) == 8 || (len) == 16)) || \ | ||
49 | + (TCG_TARGET_REG_BITS == 32 && (ofs) == 8 && (len) == 8)) | ||
50 | #define TCG_TARGET_deposit_i64_valid TCG_TARGET_deposit_i32_valid | ||
51 | |||
52 | /* Check for the possibility of high-byte extraction and, for 64-bit, | ||
53 | diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc | ||
54 | index XXXXXXX..XXXXXXX 100644 | ||
55 | --- a/tcg/i386/tcg-target.c.inc | ||
56 | +++ b/tcg/i386/tcg-target.c.inc | ||
57 | @@ -XXX,XX +XXX,XX @@ static TCGReg tcg_target_call_oarg_reg(TCGCallReturnKind kind, int slot) | ||
58 | # define TCG_REG_L1 TCG_REG_EDX | ||
59 | #endif | ||
60 | |||
61 | -#define ALL_BYTEH_REGS 0x0000000fu | ||
62 | #if TCG_TARGET_REG_BITS == 64 | ||
63 | # define ALL_GENERAL_REGS 0x0000ffffu | ||
64 | # define ALL_VECTOR_REGS 0xffff0000u | ||
65 | @@ -XXX,XX +XXX,XX @@ static TCGReg tcg_target_call_oarg_reg(TCGCallReturnKind kind, int slot) | ||
66 | #else | ||
67 | # define ALL_GENERAL_REGS 0x000000ffu | ||
68 | # define ALL_VECTOR_REGS 0x00ff0000u | ||
69 | -# define ALL_BYTEL_REGS ALL_BYTEH_REGS | ||
70 | +# define ALL_BYTEL_REGS 0x0000000fu | ||
71 | #endif | ||
72 | #ifdef CONFIG_SOFTMMU | ||
73 | # define SOFTMMU_RESERVE_REGS ((1 << TCG_REG_L0) | (1 << TCG_REG_L1)) | ||
74 | @@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, | ||
75 | if (args[3] == 0 && args[4] == 8) { | ||
76 | /* load bits 0..7 */ | ||
77 | tcg_out_modrm(s, OPC_MOVB_EvGv | P_REXB_R | P_REXB_RM, a2, a0); | ||
78 | - } else if (args[3] == 8 && args[4] == 8) { | ||
79 | + } else if (TCG_TARGET_REG_BITS == 32 && args[3] == 8 && args[4] == 8) { | ||
80 | /* load bits 8..15 */ | ||
81 | tcg_out_modrm(s, OPC_MOVB_EvGv, a2, a0 + 4); | ||
82 | } else if (args[3] == 0 && args[4] == 16) { | ||
83 | @@ -XXX,XX +XXX,XX @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) | ||
84 | |||
85 | case INDEX_op_deposit_i32: | ||
86 | case INDEX_op_deposit_i64: | ||
87 | - return C_O1_I2(Q, 0, Q); | ||
88 | + return C_O1_I2(q, 0, q); | ||
89 | |||
90 | case INDEX_op_setcond_i32: | ||
91 | case INDEX_op_setcond_i64: | ||
92 | -- | ||
93 | 2.34.1 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Inserting a zero into a value, or inserting a value | ||
2 | into zero at offset 0 may be implemented with AND. | ||
3 | 1 | ||
4 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | --- | ||
8 | tcg/optimize.c | 37 +++++++++++++++++++++++++++++++++++++ | ||
9 | 1 file changed, 37 insertions(+) | ||
10 | |||
11 | diff --git a/tcg/optimize.c b/tcg/optimize.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/tcg/optimize.c | ||
14 | +++ b/tcg/optimize.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool fold_ctpop(OptContext *ctx, TCGOp *op) | ||
16 | |||
17 | static bool fold_deposit(OptContext *ctx, TCGOp *op) | ||
18 | { | ||
19 | + TCGOpcode and_opc; | ||
20 | + | ||
21 | if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) { | ||
22 | uint64_t t1 = arg_info(op->args[1])->val; | ||
23 | uint64_t t2 = arg_info(op->args[2])->val; | ||
24 | @@ -XXX,XX +XXX,XX @@ static bool fold_deposit(OptContext *ctx, TCGOp *op) | ||
25 | return tcg_opt_gen_movi(ctx, op, op->args[0], t1); | ||
26 | } | ||
27 | |||
28 | + switch (ctx->type) { | ||
29 | + case TCG_TYPE_I32: | ||
30 | + and_opc = INDEX_op_and_i32; | ||
31 | + break; | ||
32 | + case TCG_TYPE_I64: | ||
33 | + and_opc = INDEX_op_and_i64; | ||
34 | + break; | ||
35 | + default: | ||
36 | + g_assert_not_reached(); | ||
37 | + } | ||
38 | + | ||
39 | + /* Inserting a value into zero at offset 0. */ | ||
40 | + if (arg_is_const(op->args[1]) | ||
41 | + && arg_info(op->args[1])->val == 0 | ||
42 | + && op->args[3] == 0) { | ||
43 | + uint64_t mask = MAKE_64BIT_MASK(0, op->args[4]); | ||
44 | + | ||
45 | + op->opc = and_opc; | ||
46 | + op->args[1] = op->args[2]; | ||
47 | + op->args[2] = temp_arg(tcg_constant_internal(ctx->type, mask)); | ||
48 | + ctx->z_mask = mask & arg_info(op->args[1])->z_mask; | ||
49 | + return false; | ||
50 | + } | ||
51 | + | ||
52 | + /* Inserting zero into a value. */ | ||
53 | + if (arg_is_const(op->args[2]) | ||
54 | + && arg_info(op->args[2])->val == 0) { | ||
55 | + uint64_t mask = deposit64(-1, op->args[3], op->args[4], 0); | ||
56 | + | ||
57 | + op->opc = and_opc; | ||
58 | + op->args[2] = temp_arg(tcg_constant_internal(ctx->type, mask)); | ||
59 | + ctx->z_mask = mask & arg_info(op->args[1])->z_mask; | ||
60 | + return false; | ||
61 | + } | ||
62 | + | ||
63 | ctx->z_mask = deposit64(arg_info(op->args[1])->z_mask, | ||
64 | op->args[3], op->args[4], | ||
65 | arg_info(op->args[2])->z_mask); | ||
66 | -- | ||
67 | 2.34.1 | ||
68 | |||
69 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | We can use MOVB and MOVW with an immediate just as easily | ||
2 | as with a register input. | ||
3 | 1 | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | --- | ||
7 | tcg/i386/tcg-target-con-set.h | 2 +- | ||
8 | tcg/i386/tcg-target.c.inc | 26 ++++++++++++++++++++++---- | ||
9 | 2 files changed, 23 insertions(+), 5 deletions(-) | ||
10 | |||
11 | diff --git a/tcg/i386/tcg-target-con-set.h b/tcg/i386/tcg-target-con-set.h | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/tcg/i386/tcg-target-con-set.h | ||
14 | +++ b/tcg/i386/tcg-target-con-set.h | ||
15 | @@ -XXX,XX +XXX,XX @@ C_O1_I1(r, q) | ||
16 | C_O1_I1(r, r) | ||
17 | C_O1_I1(x, r) | ||
18 | C_O1_I1(x, x) | ||
19 | -C_O1_I2(q, 0, q) | ||
20 | +C_O1_I2(q, 0, qi) | ||
21 | C_O1_I2(q, r, re) | ||
22 | C_O1_I2(r, 0, ci) | ||
23 | C_O1_I2(r, 0, r) | ||
24 | diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc | ||
25 | index XXXXXXX..XXXXXXX 100644 | ||
26 | --- a/tcg/i386/tcg-target.c.inc | ||
27 | +++ b/tcg/i386/tcg-target.c.inc | ||
28 | @@ -XXX,XX +XXX,XX @@ static bool tcg_target_const_match(int64_t val, TCGType type, int ct) | ||
29 | #define OPC_MOVL_GvEv (0x8b) /* loads, more or less */ | ||
30 | #define OPC_MOVB_EvIz (0xc6) | ||
31 | #define OPC_MOVL_EvIz (0xc7) | ||
32 | +#define OPC_MOVB_Ib (0xb0) | ||
33 | #define OPC_MOVL_Iv (0xb8) | ||
34 | #define OPC_MOVBE_GyMy (0xf0 | P_EXT38) | ||
35 | #define OPC_MOVBE_MyGy (0xf1 | P_EXT38) | ||
36 | @@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, | ||
37 | OP_32_64(deposit): | ||
38 | if (args[3] == 0 && args[4] == 8) { | ||
39 | /* load bits 0..7 */ | ||
40 | - tcg_out_modrm(s, OPC_MOVB_EvGv | P_REXB_R | P_REXB_RM, a2, a0); | ||
41 | + if (const_a2) { | ||
42 | + tcg_out_opc(s, OPC_MOVB_Ib | P_REXB_RM | LOWREGMASK(a0), | ||
43 | + 0, a0, 0); | ||
44 | + tcg_out8(s, a2); | ||
45 | + } else { | ||
46 | + tcg_out_modrm(s, OPC_MOVB_EvGv | P_REXB_R | P_REXB_RM, a2, a0); | ||
47 | + } | ||
48 | } else if (TCG_TARGET_REG_BITS == 32 && args[3] == 8 && args[4] == 8) { | ||
49 | /* load bits 8..15 */ | ||
50 | - tcg_out_modrm(s, OPC_MOVB_EvGv, a2, a0 + 4); | ||
51 | + if (const_a2) { | ||
52 | + tcg_out8(s, OPC_MOVB_Ib + a0 + 4); | ||
53 | + tcg_out8(s, a2); | ||
54 | + } else { | ||
55 | + tcg_out_modrm(s, OPC_MOVB_EvGv, a2, a0 + 4); | ||
56 | + } | ||
57 | } else if (args[3] == 0 && args[4] == 16) { | ||
58 | /* load bits 0..15 */ | ||
59 | - tcg_out_modrm(s, OPC_MOVL_EvGv | P_DATA16, a2, a0); | ||
60 | + if (const_a2) { | ||
61 | + tcg_out_opc(s, OPC_MOVL_Iv | P_DATA16 | LOWREGMASK(a0), | ||
62 | + 0, a0, 0); | ||
63 | + tcg_out16(s, a2); | ||
64 | + } else { | ||
65 | + tcg_out_modrm(s, OPC_MOVL_EvGv | P_DATA16, a2, a0); | ||
66 | + } | ||
67 | } else { | ||
68 | g_assert_not_reached(); | ||
69 | } | ||
70 | @@ -XXX,XX +XXX,XX @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) | ||
71 | |||
72 | case INDEX_op_deposit_i32: | ||
73 | case INDEX_op_deposit_i64: | ||
74 | - return C_O1_I2(q, 0, q); | ||
75 | + return C_O1_I2(q, 0, qi); | ||
76 | |||
77 | case INDEX_op_setcond_i32: | ||
78 | case INDEX_op_setcond_i64: | ||
79 | -- | ||
80 | 2.34.1 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
2 | 1 | ||
3 | Commit 609ad70562 ("tcg: Split trunc_shr_i32 opcode into | ||
4 | extr[lh]_i64_i32") remove trunc_shr_i64_i32(). Update the | ||
5 | backend documentation. | ||
6 | |||
7 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-Id: <20230822162847.71206-1-philmd@linaro.org> | ||
10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | --- | ||
12 | docs/devel/tcg-ops.rst | 7 ++++--- | ||
13 | 1 file changed, 4 insertions(+), 3 deletions(-) | ||
14 | |||
15 | diff --git a/docs/devel/tcg-ops.rst b/docs/devel/tcg-ops.rst | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/docs/devel/tcg-ops.rst | ||
18 | +++ b/docs/devel/tcg-ops.rst | ||
19 | @@ -XXX,XX +XXX,XX @@ sub2_i32, brcond2_i32). | ||
20 | On a 64 bit target, the values are transferred between 32 and 64-bit | ||
21 | registers using the following ops: | ||
22 | |||
23 | -- trunc_shr_i64_i32 | ||
24 | +- extrl_i64_i32 | ||
25 | +- extrh_i64_i32 | ||
26 | - ext_i32_i64 | ||
27 | - extu_i32_i64 | ||
28 | |||
29 | They ensure that the values are correctly truncated or extended when | ||
30 | moved from a 32-bit to a 64-bit register or vice-versa. Note that the | ||
31 | -trunc_shr_i64_i32 is an optional op. It is not necessary to implement | ||
32 | -it if all the following conditions are met: | ||
33 | +extrl_i64_i32 and extrh_i64_i32 are optional ops. It is not necessary | ||
34 | +to implement them if all the following conditions are met: | ||
35 | |||
36 | - 64-bit registers can hold 32-bit values | ||
37 | - 32-bit values in a 64-bit register do not need to stay zero or | ||
38 | -- | ||
39 | 2.34.1 | ||
40 | |||
41 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Replace the separate defines with TCG_TARGET_HAS_extr_i64_i32, | ||
2 | so that the two parts of backend-specific type changing cannot | ||
3 | be out of sync. | ||
4 | 1 | ||
5 | Reported-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
6 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: <20230822175127.1173698-1-richard.henderson@linaro.org> | ||
9 | --- | ||
10 | include/tcg/tcg-opc.h | 4 ++-- | ||
11 | include/tcg/tcg.h | 3 +-- | ||
12 | tcg/aarch64/tcg-target.h | 3 +-- | ||
13 | tcg/i386/tcg-target.h | 3 +-- | ||
14 | tcg/loongarch64/tcg-target.h | 3 +-- | ||
15 | tcg/mips/tcg-target.h | 3 +-- | ||
16 | tcg/ppc/tcg-target.h | 3 +-- | ||
17 | tcg/riscv/tcg-target.h | 3 +-- | ||
18 | tcg/s390x/tcg-target.h | 3 +-- | ||
19 | tcg/sparc64/tcg-target.h | 3 +-- | ||
20 | tcg/tci/tcg-target.h | 3 +-- | ||
21 | tcg/tcg-op.c | 4 ++-- | ||
22 | tcg/tcg.c | 3 +-- | ||
23 | 13 files changed, 15 insertions(+), 26 deletions(-) | ||
24 | |||
25 | diff --git a/include/tcg/tcg-opc.h b/include/tcg/tcg-opc.h | ||
26 | index XXXXXXX..XXXXXXX 100644 | ||
27 | --- a/include/tcg/tcg-opc.h | ||
28 | +++ b/include/tcg/tcg-opc.h | ||
29 | @@ -XXX,XX +XXX,XX @@ DEF(extract2_i64, 1, 2, 1, IMPL64 | IMPL(TCG_TARGET_HAS_extract2_i64)) | ||
30 | DEF(ext_i32_i64, 1, 1, 0, IMPL64) | ||
31 | DEF(extu_i32_i64, 1, 1, 0, IMPL64) | ||
32 | DEF(extrl_i64_i32, 1, 1, 0, | ||
33 | - IMPL(TCG_TARGET_HAS_extrl_i64_i32) | ||
34 | + IMPL(TCG_TARGET_HAS_extr_i64_i32) | ||
35 | | (TCG_TARGET_REG_BITS == 32 ? TCG_OPF_NOT_PRESENT : 0)) | ||
36 | DEF(extrh_i64_i32, 1, 1, 0, | ||
37 | - IMPL(TCG_TARGET_HAS_extrh_i64_i32) | ||
38 | + IMPL(TCG_TARGET_HAS_extr_i64_i32) | ||
39 | | (TCG_TARGET_REG_BITS == 32 ? TCG_OPF_NOT_PRESENT : 0)) | ||
40 | |||
41 | DEF(brcond_i64, 0, 2, 2, TCG_OPF_BB_END | TCG_OPF_COND_BRANCH | IMPL64) | ||
42 | diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h | ||
43 | index XXXXXXX..XXXXXXX 100644 | ||
44 | --- a/include/tcg/tcg.h | ||
45 | +++ b/include/tcg/tcg.h | ||
46 | @@ -XXX,XX +XXX,XX @@ typedef uint64_t TCGRegSet; | ||
47 | |||
48 | #if TCG_TARGET_REG_BITS == 32 | ||
49 | /* Turn some undef macros into false macros. */ | ||
50 | -#define TCG_TARGET_HAS_extrl_i64_i32 0 | ||
51 | -#define TCG_TARGET_HAS_extrh_i64_i32 0 | ||
52 | +#define TCG_TARGET_HAS_extr_i64_i32 0 | ||
53 | #define TCG_TARGET_HAS_div_i64 0 | ||
54 | #define TCG_TARGET_HAS_rem_i64 0 | ||
55 | #define TCG_TARGET_HAS_div2_i64 0 | ||
56 | diff --git a/tcg/aarch64/tcg-target.h b/tcg/aarch64/tcg-target.h | ||
57 | index XXXXXXX..XXXXXXX 100644 | ||
58 | --- a/tcg/aarch64/tcg-target.h | ||
59 | +++ b/tcg/aarch64/tcg-target.h | ||
60 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
61 | #define TCG_TARGET_HAS_muls2_i32 0 | ||
62 | #define TCG_TARGET_HAS_muluh_i32 0 | ||
63 | #define TCG_TARGET_HAS_mulsh_i32 0 | ||
64 | -#define TCG_TARGET_HAS_extrl_i64_i32 0 | ||
65 | -#define TCG_TARGET_HAS_extrh_i64_i32 0 | ||
66 | +#define TCG_TARGET_HAS_extr_i64_i32 0 | ||
67 | #define TCG_TARGET_HAS_qemu_st8_i32 0 | ||
68 | |||
69 | #define TCG_TARGET_HAS_div_i64 1 | ||
70 | diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h | ||
71 | index XXXXXXX..XXXXXXX 100644 | ||
72 | --- a/tcg/i386/tcg-target.h | ||
73 | +++ b/tcg/i386/tcg-target.h | ||
74 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
75 | |||
76 | #if TCG_TARGET_REG_BITS == 64 | ||
77 | /* Keep 32-bit values zero-extended in a register. */ | ||
78 | -#define TCG_TARGET_HAS_extrl_i64_i32 1 | ||
79 | -#define TCG_TARGET_HAS_extrh_i64_i32 1 | ||
80 | +#define TCG_TARGET_HAS_extr_i64_i32 1 | ||
81 | #define TCG_TARGET_HAS_div2_i64 1 | ||
82 | #define TCG_TARGET_HAS_rot_i64 1 | ||
83 | #define TCG_TARGET_HAS_ext8s_i64 1 | ||
84 | diff --git a/tcg/loongarch64/tcg-target.h b/tcg/loongarch64/tcg-target.h | ||
85 | index XXXXXXX..XXXXXXX 100644 | ||
86 | --- a/tcg/loongarch64/tcg-target.h | ||
87 | +++ b/tcg/loongarch64/tcg-target.h | ||
88 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
89 | #define TCG_TARGET_HAS_extract_i64 1 | ||
90 | #define TCG_TARGET_HAS_sextract_i64 0 | ||
91 | #define TCG_TARGET_HAS_extract2_i64 0 | ||
92 | -#define TCG_TARGET_HAS_extrl_i64_i32 1 | ||
93 | -#define TCG_TARGET_HAS_extrh_i64_i32 1 | ||
94 | +#define TCG_TARGET_HAS_extr_i64_i32 1 | ||
95 | #define TCG_TARGET_HAS_ext8s_i64 1 | ||
96 | #define TCG_TARGET_HAS_ext16s_i64 1 | ||
97 | #define TCG_TARGET_HAS_ext32s_i64 1 | ||
98 | diff --git a/tcg/mips/tcg-target.h b/tcg/mips/tcg-target.h | ||
99 | index XXXXXXX..XXXXXXX 100644 | ||
100 | --- a/tcg/mips/tcg-target.h | ||
101 | +++ b/tcg/mips/tcg-target.h | ||
102 | @@ -XXX,XX +XXX,XX @@ extern bool use_mips32r2_instructions; | ||
103 | #if TCG_TARGET_REG_BITS == 64 | ||
104 | #define TCG_TARGET_HAS_add2_i32 0 | ||
105 | #define TCG_TARGET_HAS_sub2_i32 0 | ||
106 | -#define TCG_TARGET_HAS_extrl_i64_i32 1 | ||
107 | -#define TCG_TARGET_HAS_extrh_i64_i32 1 | ||
108 | +#define TCG_TARGET_HAS_extr_i64_i32 1 | ||
109 | #define TCG_TARGET_HAS_div_i64 1 | ||
110 | #define TCG_TARGET_HAS_rem_i64 1 | ||
111 | #define TCG_TARGET_HAS_not_i64 1 | ||
112 | diff --git a/tcg/ppc/tcg-target.h b/tcg/ppc/tcg-target.h | ||
113 | index XXXXXXX..XXXXXXX 100644 | ||
114 | --- a/tcg/ppc/tcg-target.h | ||
115 | +++ b/tcg/ppc/tcg-target.h | ||
116 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
117 | #if TCG_TARGET_REG_BITS == 64 | ||
118 | #define TCG_TARGET_HAS_add2_i32 0 | ||
119 | #define TCG_TARGET_HAS_sub2_i32 0 | ||
120 | -#define TCG_TARGET_HAS_extrl_i64_i32 0 | ||
121 | -#define TCG_TARGET_HAS_extrh_i64_i32 0 | ||
122 | +#define TCG_TARGET_HAS_extr_i64_i32 0 | ||
123 | #define TCG_TARGET_HAS_div_i64 1 | ||
124 | #define TCG_TARGET_HAS_rem_i64 have_isa_3_00 | ||
125 | #define TCG_TARGET_HAS_rot_i64 1 | ||
126 | diff --git a/tcg/riscv/tcg-target.h b/tcg/riscv/tcg-target.h | ||
127 | index XXXXXXX..XXXXXXX 100644 | ||
128 | --- a/tcg/riscv/tcg-target.h | ||
129 | +++ b/tcg/riscv/tcg-target.h | ||
130 | @@ -XXX,XX +XXX,XX @@ extern bool have_zbb; | ||
131 | #define TCG_TARGET_HAS_extract_i64 0 | ||
132 | #define TCG_TARGET_HAS_sextract_i64 0 | ||
133 | #define TCG_TARGET_HAS_extract2_i64 0 | ||
134 | -#define TCG_TARGET_HAS_extrl_i64_i32 1 | ||
135 | -#define TCG_TARGET_HAS_extrh_i64_i32 1 | ||
136 | +#define TCG_TARGET_HAS_extr_i64_i32 1 | ||
137 | #define TCG_TARGET_HAS_ext8s_i64 1 | ||
138 | #define TCG_TARGET_HAS_ext16s_i64 1 | ||
139 | #define TCG_TARGET_HAS_ext32s_i64 1 | ||
140 | diff --git a/tcg/s390x/tcg-target.h b/tcg/s390x/tcg-target.h | ||
141 | index XXXXXXX..XXXXXXX 100644 | ||
142 | --- a/tcg/s390x/tcg-target.h | ||
143 | +++ b/tcg/s390x/tcg-target.h | ||
144 | @@ -XXX,XX +XXX,XX @@ extern uint64_t s390_facilities[3]; | ||
145 | #define TCG_TARGET_HAS_muls2_i32 0 | ||
146 | #define TCG_TARGET_HAS_muluh_i32 0 | ||
147 | #define TCG_TARGET_HAS_mulsh_i32 0 | ||
148 | -#define TCG_TARGET_HAS_extrl_i64_i32 0 | ||
149 | -#define TCG_TARGET_HAS_extrh_i64_i32 0 | ||
150 | +#define TCG_TARGET_HAS_extr_i64_i32 0 | ||
151 | #define TCG_TARGET_HAS_qemu_st8_i32 0 | ||
152 | |||
153 | #define TCG_TARGET_HAS_div2_i64 1 | ||
154 | diff --git a/tcg/sparc64/tcg-target.h b/tcg/sparc64/tcg-target.h | ||
155 | index XXXXXXX..XXXXXXX 100644 | ||
156 | --- a/tcg/sparc64/tcg-target.h | ||
157 | +++ b/tcg/sparc64/tcg-target.h | ||
158 | @@ -XXX,XX +XXX,XX @@ extern bool use_vis3_instructions; | ||
159 | #define TCG_TARGET_HAS_mulsh_i32 0 | ||
160 | #define TCG_TARGET_HAS_qemu_st8_i32 0 | ||
161 | |||
162 | -#define TCG_TARGET_HAS_extrl_i64_i32 1 | ||
163 | -#define TCG_TARGET_HAS_extrh_i64_i32 1 | ||
164 | +#define TCG_TARGET_HAS_extr_i64_i32 1 | ||
165 | #define TCG_TARGET_HAS_div_i64 1 | ||
166 | #define TCG_TARGET_HAS_rem_i64 0 | ||
167 | #define TCG_TARGET_HAS_rot_i64 0 | ||
168 | diff --git a/tcg/tci/tcg-target.h b/tcg/tci/tcg-target.h | ||
169 | index XXXXXXX..XXXXXXX 100644 | ||
170 | --- a/tcg/tci/tcg-target.h | ||
171 | +++ b/tcg/tci/tcg-target.h | ||
172 | @@ -XXX,XX +XXX,XX @@ | ||
173 | #define TCG_TARGET_HAS_qemu_st8_i32 0 | ||
174 | |||
175 | #if TCG_TARGET_REG_BITS == 64 | ||
176 | -#define TCG_TARGET_HAS_extrl_i64_i32 0 | ||
177 | -#define TCG_TARGET_HAS_extrh_i64_i32 0 | ||
178 | +#define TCG_TARGET_HAS_extr_i64_i32 0 | ||
179 | #define TCG_TARGET_HAS_bswap16_i64 1 | ||
180 | #define TCG_TARGET_HAS_bswap32_i64 1 | ||
181 | #define TCG_TARGET_HAS_bswap64_i64 1 | ||
182 | diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c | ||
183 | index XXXXXXX..XXXXXXX 100644 | ||
184 | --- a/tcg/tcg-op.c | ||
185 | +++ b/tcg/tcg-op.c | ||
186 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_extrl_i64_i32(TCGv_i32 ret, TCGv_i64 arg) | ||
187 | { | ||
188 | if (TCG_TARGET_REG_BITS == 32) { | ||
189 | tcg_gen_mov_i32(ret, TCGV_LOW(arg)); | ||
190 | - } else if (TCG_TARGET_HAS_extrl_i64_i32) { | ||
191 | + } else if (TCG_TARGET_HAS_extr_i64_i32) { | ||
192 | tcg_gen_op2(INDEX_op_extrl_i64_i32, | ||
193 | tcgv_i32_arg(ret), tcgv_i64_arg(arg)); | ||
194 | } else { | ||
195 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_extrh_i64_i32(TCGv_i32 ret, TCGv_i64 arg) | ||
196 | { | ||
197 | if (TCG_TARGET_REG_BITS == 32) { | ||
198 | tcg_gen_mov_i32(ret, TCGV_HIGH(arg)); | ||
199 | - } else if (TCG_TARGET_HAS_extrh_i64_i32) { | ||
200 | + } else if (TCG_TARGET_HAS_extr_i64_i32) { | ||
201 | tcg_gen_op2(INDEX_op_extrh_i64_i32, | ||
202 | tcgv_i32_arg(ret), tcgv_i64_arg(arg)); | ||
203 | } else { | ||
204 | diff --git a/tcg/tcg.c b/tcg/tcg.c | ||
205 | index XXXXXXX..XXXXXXX 100644 | ||
206 | --- a/tcg/tcg.c | ||
207 | +++ b/tcg/tcg.c | ||
208 | @@ -XXX,XX +XXX,XX @@ bool tcg_op_supported(TCGOpcode op) | ||
209 | case INDEX_op_extract2_i64: | ||
210 | return TCG_TARGET_HAS_extract2_i64; | ||
211 | case INDEX_op_extrl_i64_i32: | ||
212 | - return TCG_TARGET_HAS_extrl_i64_i32; | ||
213 | case INDEX_op_extrh_i64_i32: | ||
214 | - return TCG_TARGET_HAS_extrh_i64_i32; | ||
215 | + return TCG_TARGET_HAS_extr_i64_i32; | ||
216 | case INDEX_op_ext8s_i64: | ||
217 | return TCG_TARGET_HAS_ext8s_i64; | ||
218 | case INDEX_op_ext16s_i64: | ||
219 | -- | ||
220 | 2.34.1 | ||
221 | |||
222 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Introduce a new opcode for negative setcond. | ||
2 | 1 | ||
3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | --- | ||
6 | docs/devel/tcg-ops.rst | 6 ++++++ | ||
7 | include/tcg/tcg-op-common.h | 4 ++++ | ||
8 | include/tcg/tcg-op.h | 2 ++ | ||
9 | include/tcg/tcg-opc.h | 2 ++ | ||
10 | include/tcg/tcg.h | 1 + | ||
11 | tcg/aarch64/tcg-target.h | 2 ++ | ||
12 | tcg/arm/tcg-target.h | 1 + | ||
13 | tcg/i386/tcg-target.h | 2 ++ | ||
14 | tcg/loongarch64/tcg-target.h | 3 +++ | ||
15 | tcg/mips/tcg-target.h | 2 ++ | ||
16 | tcg/ppc/tcg-target.h | 2 ++ | ||
17 | tcg/riscv/tcg-target.h | 2 ++ | ||
18 | tcg/s390x/tcg-target.h | 2 ++ | ||
19 | tcg/sparc64/tcg-target.h | 2 ++ | ||
20 | tcg/tci/tcg-target.h | 2 ++ | ||
21 | tcg/optimize.c | 41 +++++++++++++++++++++++++++++++++++- | ||
22 | tcg/tcg-op.c | 36 +++++++++++++++++++++++++++++++ | ||
23 | tcg/tcg.c | 6 ++++++ | ||
24 | 18 files changed, 117 insertions(+), 1 deletion(-) | ||
25 | |||
26 | diff --git a/docs/devel/tcg-ops.rst b/docs/devel/tcg-ops.rst | ||
27 | index XXXXXXX..XXXXXXX 100644 | ||
28 | --- a/docs/devel/tcg-ops.rst | ||
29 | +++ b/docs/devel/tcg-ops.rst | ||
30 | @@ -XXX,XX +XXX,XX @@ Conditional moves | ||
31 | | | ||
32 | | Set *dest* to 1 if (*t1* *cond* *t2*) is true, otherwise set to 0. | ||
33 | |||
34 | + * - negsetcond_i32/i64 *dest*, *t1*, *t2*, *cond* | ||
35 | + | ||
36 | + - | *dest* = -(*t1* *cond* *t2*) | ||
37 | + | | ||
38 | + | Set *dest* to -1 if (*t1* *cond* *t2*) is true, otherwise set to 0. | ||
39 | + | ||
40 | * - movcond_i32/i64 *dest*, *c1*, *c2*, *v1*, *v2*, *cond* | ||
41 | |||
42 | - | *dest* = (*c1* *cond* *c2* ? *v1* : *v2*) | ||
43 | diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h | ||
44 | index XXXXXXX..XXXXXXX 100644 | ||
45 | --- a/include/tcg/tcg-op-common.h | ||
46 | +++ b/include/tcg/tcg-op-common.h | ||
47 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_setcond_i32(TCGCond cond, TCGv_i32 ret, | ||
48 | TCGv_i32 arg1, TCGv_i32 arg2); | ||
49 | void tcg_gen_setcondi_i32(TCGCond cond, TCGv_i32 ret, | ||
50 | TCGv_i32 arg1, int32_t arg2); | ||
51 | +void tcg_gen_negsetcond_i32(TCGCond cond, TCGv_i32 ret, | ||
52 | + TCGv_i32 arg1, TCGv_i32 arg2); | ||
53 | void tcg_gen_movcond_i32(TCGCond cond, TCGv_i32 ret, TCGv_i32 c1, | ||
54 | TCGv_i32 c2, TCGv_i32 v1, TCGv_i32 v2); | ||
55 | void tcg_gen_add2_i32(TCGv_i32 rl, TCGv_i32 rh, TCGv_i32 al, | ||
56 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_setcond_i64(TCGCond cond, TCGv_i64 ret, | ||
57 | TCGv_i64 arg1, TCGv_i64 arg2); | ||
58 | void tcg_gen_setcondi_i64(TCGCond cond, TCGv_i64 ret, | ||
59 | TCGv_i64 arg1, int64_t arg2); | ||
60 | +void tcg_gen_negsetcond_i64(TCGCond cond, TCGv_i64 ret, | ||
61 | + TCGv_i64 arg1, TCGv_i64 arg2); | ||
62 | void tcg_gen_movcond_i64(TCGCond cond, TCGv_i64 ret, TCGv_i64 c1, | ||
63 | TCGv_i64 c2, TCGv_i64 v1, TCGv_i64 v2); | ||
64 | void tcg_gen_add2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 al, | ||
65 | diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h | ||
66 | index XXXXXXX..XXXXXXX 100644 | ||
67 | --- a/include/tcg/tcg-op.h | ||
68 | +++ b/include/tcg/tcg-op.h | ||
69 | @@ -XXX,XX +XXX,XX @@ DEF_ATOMIC2(tcg_gen_atomic_umax_fetch, i64) | ||
70 | #define tcg_gen_brcondi_tl tcg_gen_brcondi_i64 | ||
71 | #define tcg_gen_setcond_tl tcg_gen_setcond_i64 | ||
72 | #define tcg_gen_setcondi_tl tcg_gen_setcondi_i64 | ||
73 | +#define tcg_gen_negsetcond_tl tcg_gen_negsetcond_i64 | ||
74 | #define tcg_gen_mul_tl tcg_gen_mul_i64 | ||
75 | #define tcg_gen_muli_tl tcg_gen_muli_i64 | ||
76 | #define tcg_gen_div_tl tcg_gen_div_i64 | ||
77 | @@ -XXX,XX +XXX,XX @@ DEF_ATOMIC2(tcg_gen_atomic_umax_fetch, i64) | ||
78 | #define tcg_gen_brcondi_tl tcg_gen_brcondi_i32 | ||
79 | #define tcg_gen_setcond_tl tcg_gen_setcond_i32 | ||
80 | #define tcg_gen_setcondi_tl tcg_gen_setcondi_i32 | ||
81 | +#define tcg_gen_negsetcond_tl tcg_gen_negsetcond_i32 | ||
82 | #define tcg_gen_mul_tl tcg_gen_mul_i32 | ||
83 | #define tcg_gen_muli_tl tcg_gen_muli_i32 | ||
84 | #define tcg_gen_div_tl tcg_gen_div_i32 | ||
85 | diff --git a/include/tcg/tcg-opc.h b/include/tcg/tcg-opc.h | ||
86 | index XXXXXXX..XXXXXXX 100644 | ||
87 | --- a/include/tcg/tcg-opc.h | ||
88 | +++ b/include/tcg/tcg-opc.h | ||
89 | @@ -XXX,XX +XXX,XX @@ DEF(mb, 0, 0, 1, 0) | ||
90 | |||
91 | DEF(mov_i32, 1, 1, 0, TCG_OPF_NOT_PRESENT) | ||
92 | DEF(setcond_i32, 1, 2, 1, 0) | ||
93 | +DEF(negsetcond_i32, 1, 2, 1, IMPL(TCG_TARGET_HAS_negsetcond_i32)) | ||
94 | DEF(movcond_i32, 1, 4, 1, IMPL(TCG_TARGET_HAS_movcond_i32)) | ||
95 | /* load/store */ | ||
96 | DEF(ld8u_i32, 1, 1, 1, 0) | ||
97 | @@ -XXX,XX +XXX,XX @@ DEF(ctpop_i32, 1, 1, 0, IMPL(TCG_TARGET_HAS_ctpop_i32)) | ||
98 | |||
99 | DEF(mov_i64, 1, 1, 0, TCG_OPF_64BIT | TCG_OPF_NOT_PRESENT) | ||
100 | DEF(setcond_i64, 1, 2, 1, IMPL64) | ||
101 | +DEF(negsetcond_i64, 1, 2, 1, IMPL64 | IMPL(TCG_TARGET_HAS_negsetcond_i64)) | ||
102 | DEF(movcond_i64, 1, 4, 1, IMPL64 | IMPL(TCG_TARGET_HAS_movcond_i64)) | ||
103 | /* load/store */ | ||
104 | DEF(ld8u_i64, 1, 1, 1, IMPL64) | ||
105 | diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h | ||
106 | index XXXXXXX..XXXXXXX 100644 | ||
107 | --- a/include/tcg/tcg.h | ||
108 | +++ b/include/tcg/tcg.h | ||
109 | @@ -XXX,XX +XXX,XX @@ typedef uint64_t TCGRegSet; | ||
110 | #define TCG_TARGET_HAS_sextract_i64 0 | ||
111 | #define TCG_TARGET_HAS_extract2_i64 0 | ||
112 | #define TCG_TARGET_HAS_movcond_i64 0 | ||
113 | +#define TCG_TARGET_HAS_negsetcond_i64 0 | ||
114 | #define TCG_TARGET_HAS_add2_i64 0 | ||
115 | #define TCG_TARGET_HAS_sub2_i64 0 | ||
116 | #define TCG_TARGET_HAS_mulu2_i64 0 | ||
117 | diff --git a/tcg/aarch64/tcg-target.h b/tcg/aarch64/tcg-target.h | ||
118 | index XXXXXXX..XXXXXXX 100644 | ||
119 | --- a/tcg/aarch64/tcg-target.h | ||
120 | +++ b/tcg/aarch64/tcg-target.h | ||
121 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
122 | #define TCG_TARGET_HAS_sextract_i32 1 | ||
123 | #define TCG_TARGET_HAS_extract2_i32 1 | ||
124 | #define TCG_TARGET_HAS_movcond_i32 1 | ||
125 | +#define TCG_TARGET_HAS_negsetcond_i32 0 | ||
126 | #define TCG_TARGET_HAS_add2_i32 1 | ||
127 | #define TCG_TARGET_HAS_sub2_i32 1 | ||
128 | #define TCG_TARGET_HAS_mulu2_i32 0 | ||
129 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
130 | #define TCG_TARGET_HAS_sextract_i64 1 | ||
131 | #define TCG_TARGET_HAS_extract2_i64 1 | ||
132 | #define TCG_TARGET_HAS_movcond_i64 1 | ||
133 | +#define TCG_TARGET_HAS_negsetcond_i64 0 | ||
134 | #define TCG_TARGET_HAS_add2_i64 1 | ||
135 | #define TCG_TARGET_HAS_sub2_i64 1 | ||
136 | #define TCG_TARGET_HAS_mulu2_i64 0 | ||
137 | diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h | ||
138 | index XXXXXXX..XXXXXXX 100644 | ||
139 | --- a/tcg/arm/tcg-target.h | ||
140 | +++ b/tcg/arm/tcg-target.h | ||
141 | @@ -XXX,XX +XXX,XX @@ extern bool use_neon_instructions; | ||
142 | #define TCG_TARGET_HAS_sextract_i32 use_armv7_instructions | ||
143 | #define TCG_TARGET_HAS_extract2_i32 1 | ||
144 | #define TCG_TARGET_HAS_movcond_i32 1 | ||
145 | +#define TCG_TARGET_HAS_negsetcond_i32 0 | ||
146 | #define TCG_TARGET_HAS_mulu2_i32 1 | ||
147 | #define TCG_TARGET_HAS_muls2_i32 1 | ||
148 | #define TCG_TARGET_HAS_muluh_i32 0 | ||
149 | diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h | ||
150 | index XXXXXXX..XXXXXXX 100644 | ||
151 | --- a/tcg/i386/tcg-target.h | ||
152 | +++ b/tcg/i386/tcg-target.h | ||
153 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
154 | #define TCG_TARGET_HAS_sextract_i32 1 | ||
155 | #define TCG_TARGET_HAS_extract2_i32 1 | ||
156 | #define TCG_TARGET_HAS_movcond_i32 1 | ||
157 | +#define TCG_TARGET_HAS_negsetcond_i32 0 | ||
158 | #define TCG_TARGET_HAS_add2_i32 1 | ||
159 | #define TCG_TARGET_HAS_sub2_i32 1 | ||
160 | #define TCG_TARGET_HAS_mulu2_i32 1 | ||
161 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
162 | #define TCG_TARGET_HAS_sextract_i64 0 | ||
163 | #define TCG_TARGET_HAS_extract2_i64 1 | ||
164 | #define TCG_TARGET_HAS_movcond_i64 1 | ||
165 | +#define TCG_TARGET_HAS_negsetcond_i64 0 | ||
166 | #define TCG_TARGET_HAS_add2_i64 1 | ||
167 | #define TCG_TARGET_HAS_sub2_i64 1 | ||
168 | #define TCG_TARGET_HAS_mulu2_i64 1 | ||
169 | diff --git a/tcg/loongarch64/tcg-target.h b/tcg/loongarch64/tcg-target.h | ||
170 | index XXXXXXX..XXXXXXX 100644 | ||
171 | --- a/tcg/loongarch64/tcg-target.h | ||
172 | +++ b/tcg/loongarch64/tcg-target.h | ||
173 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
174 | |||
175 | /* optional instructions */ | ||
176 | #define TCG_TARGET_HAS_movcond_i32 1 | ||
177 | +#define TCG_TARGET_HAS_negsetcond_i32 0 | ||
178 | #define TCG_TARGET_HAS_div_i32 1 | ||
179 | #define TCG_TARGET_HAS_rem_i32 1 | ||
180 | #define TCG_TARGET_HAS_div2_i32 0 | ||
181 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
182 | |||
183 | /* 64-bit operations */ | ||
184 | #define TCG_TARGET_HAS_movcond_i64 1 | ||
185 | +#define TCG_TARGET_HAS_negsetcond_i64 0 | ||
186 | #define TCG_TARGET_HAS_div_i64 1 | ||
187 | #define TCG_TARGET_HAS_rem_i64 1 | ||
188 | #define TCG_TARGET_HAS_div2_i64 0 | ||
189 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
190 | #define TCG_TARGET_HAS_muls2_i64 0 | ||
191 | #define TCG_TARGET_HAS_muluh_i64 1 | ||
192 | #define TCG_TARGET_HAS_mulsh_i64 1 | ||
193 | + | ||
194 | #define TCG_TARGET_HAS_qemu_ldst_i128 0 | ||
195 | |||
196 | #define TCG_TARGET_DEFAULT_MO (0) | ||
197 | diff --git a/tcg/mips/tcg-target.h b/tcg/mips/tcg-target.h | ||
198 | index XXXXXXX..XXXXXXX 100644 | ||
199 | --- a/tcg/mips/tcg-target.h | ||
200 | +++ b/tcg/mips/tcg-target.h | ||
201 | @@ -XXX,XX +XXX,XX @@ extern bool use_mips32r2_instructions; | ||
202 | #define TCG_TARGET_HAS_muluh_i32 1 | ||
203 | #define TCG_TARGET_HAS_mulsh_i32 1 | ||
204 | #define TCG_TARGET_HAS_bswap32_i32 1 | ||
205 | +#define TCG_TARGET_HAS_negsetcond_i32 0 | ||
206 | |||
207 | #if TCG_TARGET_REG_BITS == 64 | ||
208 | #define TCG_TARGET_HAS_add2_i32 0 | ||
209 | @@ -XXX,XX +XXX,XX @@ extern bool use_mips32r2_instructions; | ||
210 | #define TCG_TARGET_HAS_mulsh_i64 1 | ||
211 | #define TCG_TARGET_HAS_ext32s_i64 1 | ||
212 | #define TCG_TARGET_HAS_ext32u_i64 1 | ||
213 | +#define TCG_TARGET_HAS_negsetcond_i64 0 | ||
214 | #endif | ||
215 | |||
216 | /* optional instructions detected at runtime */ | ||
217 | diff --git a/tcg/ppc/tcg-target.h b/tcg/ppc/tcg-target.h | ||
218 | index XXXXXXX..XXXXXXX 100644 | ||
219 | --- a/tcg/ppc/tcg-target.h | ||
220 | +++ b/tcg/ppc/tcg-target.h | ||
221 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
222 | #define TCG_TARGET_HAS_sextract_i32 0 | ||
223 | #define TCG_TARGET_HAS_extract2_i32 0 | ||
224 | #define TCG_TARGET_HAS_movcond_i32 1 | ||
225 | +#define TCG_TARGET_HAS_negsetcond_i32 0 | ||
226 | #define TCG_TARGET_HAS_mulu2_i32 0 | ||
227 | #define TCG_TARGET_HAS_muls2_i32 0 | ||
228 | #define TCG_TARGET_HAS_muluh_i32 1 | ||
229 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
230 | #define TCG_TARGET_HAS_sextract_i64 0 | ||
231 | #define TCG_TARGET_HAS_extract2_i64 0 | ||
232 | #define TCG_TARGET_HAS_movcond_i64 1 | ||
233 | +#define TCG_TARGET_HAS_negsetcond_i64 0 | ||
234 | #define TCG_TARGET_HAS_add2_i64 1 | ||
235 | #define TCG_TARGET_HAS_sub2_i64 1 | ||
236 | #define TCG_TARGET_HAS_mulu2_i64 0 | ||
237 | diff --git a/tcg/riscv/tcg-target.h b/tcg/riscv/tcg-target.h | ||
238 | index XXXXXXX..XXXXXXX 100644 | ||
239 | --- a/tcg/riscv/tcg-target.h | ||
240 | +++ b/tcg/riscv/tcg-target.h | ||
241 | @@ -XXX,XX +XXX,XX @@ extern bool have_zbb; | ||
242 | |||
243 | /* optional instructions */ | ||
244 | #define TCG_TARGET_HAS_movcond_i32 1 | ||
245 | +#define TCG_TARGET_HAS_negsetcond_i32 0 | ||
246 | #define TCG_TARGET_HAS_div_i32 1 | ||
247 | #define TCG_TARGET_HAS_rem_i32 1 | ||
248 | #define TCG_TARGET_HAS_div2_i32 0 | ||
249 | @@ -XXX,XX +XXX,XX @@ extern bool have_zbb; | ||
250 | #define TCG_TARGET_HAS_qemu_st8_i32 0 | ||
251 | |||
252 | #define TCG_TARGET_HAS_movcond_i64 1 | ||
253 | +#define TCG_TARGET_HAS_negsetcond_i64 0 | ||
254 | #define TCG_TARGET_HAS_div_i64 1 | ||
255 | #define TCG_TARGET_HAS_rem_i64 1 | ||
256 | #define TCG_TARGET_HAS_div2_i64 0 | ||
257 | diff --git a/tcg/s390x/tcg-target.h b/tcg/s390x/tcg-target.h | ||
258 | index XXXXXXX..XXXXXXX 100644 | ||
259 | --- a/tcg/s390x/tcg-target.h | ||
260 | +++ b/tcg/s390x/tcg-target.h | ||
261 | @@ -XXX,XX +XXX,XX @@ extern uint64_t s390_facilities[3]; | ||
262 | #define TCG_TARGET_HAS_sextract_i32 0 | ||
263 | #define TCG_TARGET_HAS_extract2_i32 0 | ||
264 | #define TCG_TARGET_HAS_movcond_i32 1 | ||
265 | +#define TCG_TARGET_HAS_negsetcond_i32 0 | ||
266 | #define TCG_TARGET_HAS_add2_i32 1 | ||
267 | #define TCG_TARGET_HAS_sub2_i32 1 | ||
268 | #define TCG_TARGET_HAS_mulu2_i32 0 | ||
269 | @@ -XXX,XX +XXX,XX @@ extern uint64_t s390_facilities[3]; | ||
270 | #define TCG_TARGET_HAS_sextract_i64 0 | ||
271 | #define TCG_TARGET_HAS_extract2_i64 0 | ||
272 | #define TCG_TARGET_HAS_movcond_i64 1 | ||
273 | +#define TCG_TARGET_HAS_negsetcond_i64 0 | ||
274 | #define TCG_TARGET_HAS_add2_i64 1 | ||
275 | #define TCG_TARGET_HAS_sub2_i64 1 | ||
276 | #define TCG_TARGET_HAS_mulu2_i64 1 | ||
277 | diff --git a/tcg/sparc64/tcg-target.h b/tcg/sparc64/tcg-target.h | ||
278 | index XXXXXXX..XXXXXXX 100644 | ||
279 | --- a/tcg/sparc64/tcg-target.h | ||
280 | +++ b/tcg/sparc64/tcg-target.h | ||
281 | @@ -XXX,XX +XXX,XX @@ extern bool use_vis3_instructions; | ||
282 | #define TCG_TARGET_HAS_sextract_i32 0 | ||
283 | #define TCG_TARGET_HAS_extract2_i32 0 | ||
284 | #define TCG_TARGET_HAS_movcond_i32 1 | ||
285 | +#define TCG_TARGET_HAS_negsetcond_i32 0 | ||
286 | #define TCG_TARGET_HAS_add2_i32 1 | ||
287 | #define TCG_TARGET_HAS_sub2_i32 1 | ||
288 | #define TCG_TARGET_HAS_mulu2_i32 1 | ||
289 | @@ -XXX,XX +XXX,XX @@ extern bool use_vis3_instructions; | ||
290 | #define TCG_TARGET_HAS_sextract_i64 0 | ||
291 | #define TCG_TARGET_HAS_extract2_i64 0 | ||
292 | #define TCG_TARGET_HAS_movcond_i64 1 | ||
293 | +#define TCG_TARGET_HAS_negsetcond_i64 0 | ||
294 | #define TCG_TARGET_HAS_add2_i64 1 | ||
295 | #define TCG_TARGET_HAS_sub2_i64 1 | ||
296 | #define TCG_TARGET_HAS_mulu2_i64 0 | ||
297 | diff --git a/tcg/tci/tcg-target.h b/tcg/tci/tcg-target.h | ||
298 | index XXXXXXX..XXXXXXX 100644 | ||
299 | --- a/tcg/tci/tcg-target.h | ||
300 | +++ b/tcg/tci/tcg-target.h | ||
301 | @@ -XXX,XX +XXX,XX @@ | ||
302 | #define TCG_TARGET_HAS_orc_i32 1 | ||
303 | #define TCG_TARGET_HAS_rot_i32 1 | ||
304 | #define TCG_TARGET_HAS_movcond_i32 1 | ||
305 | +#define TCG_TARGET_HAS_negsetcond_i32 0 | ||
306 | #define TCG_TARGET_HAS_muls2_i32 1 | ||
307 | #define TCG_TARGET_HAS_muluh_i32 0 | ||
308 | #define TCG_TARGET_HAS_mulsh_i32 0 | ||
309 | @@ -XXX,XX +XXX,XX @@ | ||
310 | #define TCG_TARGET_HAS_orc_i64 1 | ||
311 | #define TCG_TARGET_HAS_rot_i64 1 | ||
312 | #define TCG_TARGET_HAS_movcond_i64 1 | ||
313 | +#define TCG_TARGET_HAS_negsetcond_i64 0 | ||
314 | #define TCG_TARGET_HAS_muls2_i64 1 | ||
315 | #define TCG_TARGET_HAS_add2_i32 1 | ||
316 | #define TCG_TARGET_HAS_sub2_i32 1 | ||
317 | diff --git a/tcg/optimize.c b/tcg/optimize.c | ||
318 | index XXXXXXX..XXXXXXX 100644 | ||
319 | --- a/tcg/optimize.c | ||
320 | +++ b/tcg/optimize.c | ||
321 | @@ -XXX,XX +XXX,XX @@ static bool fold_movcond(OptContext *ctx, TCGOp *op) | ||
322 | if (arg_is_const(op->args[3]) && arg_is_const(op->args[4])) { | ||
323 | uint64_t tv = arg_info(op->args[3])->val; | ||
324 | uint64_t fv = arg_info(op->args[4])->val; | ||
325 | - TCGOpcode opc; | ||
326 | + TCGOpcode opc, negopc = 0; | ||
327 | |||
328 | switch (ctx->type) { | ||
329 | case TCG_TYPE_I32: | ||
330 | opc = INDEX_op_setcond_i32; | ||
331 | + if (TCG_TARGET_HAS_negsetcond_i32) { | ||
332 | + negopc = INDEX_op_negsetcond_i32; | ||
333 | + } | ||
334 | + tv = (int32_t)tv; | ||
335 | + fv = (int32_t)fv; | ||
336 | break; | ||
337 | case TCG_TYPE_I64: | ||
338 | opc = INDEX_op_setcond_i64; | ||
339 | + if (TCG_TARGET_HAS_negsetcond_i64) { | ||
340 | + negopc = INDEX_op_negsetcond_i64; | ||
341 | + } | ||
342 | break; | ||
343 | default: | ||
344 | g_assert_not_reached(); | ||
345 | @@ -XXX,XX +XXX,XX @@ static bool fold_movcond(OptContext *ctx, TCGOp *op) | ||
346 | } else if (fv == 1 && tv == 0) { | ||
347 | op->opc = opc; | ||
348 | op->args[3] = tcg_invert_cond(cond); | ||
349 | + } else if (negopc) { | ||
350 | + if (tv == -1 && fv == 0) { | ||
351 | + op->opc = negopc; | ||
352 | + op->args[3] = cond; | ||
353 | + } else if (fv == -1 && tv == 0) { | ||
354 | + op->opc = negopc; | ||
355 | + op->args[3] = tcg_invert_cond(cond); | ||
356 | + } | ||
357 | } | ||
358 | } | ||
359 | return false; | ||
360 | @@ -XXX,XX +XXX,XX @@ static bool fold_setcond(OptContext *ctx, TCGOp *op) | ||
361 | return false; | ||
362 | } | ||
363 | |||
364 | +static bool fold_negsetcond(OptContext *ctx, TCGOp *op) | ||
365 | +{ | ||
366 | + TCGCond cond = op->args[3]; | ||
367 | + int i; | ||
368 | + | ||
369 | + if (swap_commutative(op->args[0], &op->args[1], &op->args[2])) { | ||
370 | + op->args[3] = cond = tcg_swap_cond(cond); | ||
371 | + } | ||
372 | + | ||
373 | + i = do_constant_folding_cond(ctx->type, op->args[1], op->args[2], cond); | ||
374 | + if (i >= 0) { | ||
375 | + return tcg_opt_gen_movi(ctx, op, op->args[0], -i); | ||
376 | + } | ||
377 | + | ||
378 | + /* Value is {0,-1} so all bits are repetitions of the sign. */ | ||
379 | + ctx->s_mask = -1; | ||
380 | + return false; | ||
381 | +} | ||
382 | + | ||
383 | + | ||
384 | static bool fold_setcond2(OptContext *ctx, TCGOp *op) | ||
385 | { | ||
386 | TCGCond cond = op->args[5]; | ||
387 | @@ -XXX,XX +XXX,XX @@ void tcg_optimize(TCGContext *s) | ||
388 | CASE_OP_32_64(setcond): | ||
389 | done = fold_setcond(&ctx, op); | ||
390 | break; | ||
391 | + CASE_OP_32_64(negsetcond): | ||
392 | + done = fold_negsetcond(&ctx, op); | ||
393 | + break; | ||
394 | case INDEX_op_setcond2_i32: | ||
395 | done = fold_setcond2(&ctx, op); | ||
396 | break; | ||
397 | diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c | ||
398 | index XXXXXXX..XXXXXXX 100644 | ||
399 | --- a/tcg/tcg-op.c | ||
400 | +++ b/tcg/tcg-op.c | ||
401 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_setcondi_i32(TCGCond cond, TCGv_i32 ret, | ||
402 | tcg_gen_setcond_i32(cond, ret, arg1, tcg_constant_i32(arg2)); | ||
403 | } | ||
404 | |||
405 | +void tcg_gen_negsetcond_i32(TCGCond cond, TCGv_i32 ret, | ||
406 | + TCGv_i32 arg1, TCGv_i32 arg2) | ||
407 | +{ | ||
408 | + if (cond == TCG_COND_ALWAYS) { | ||
409 | + tcg_gen_movi_i32(ret, -1); | ||
410 | + } else if (cond == TCG_COND_NEVER) { | ||
411 | + tcg_gen_movi_i32(ret, 0); | ||
412 | + } else if (TCG_TARGET_HAS_negsetcond_i32) { | ||
413 | + tcg_gen_op4i_i32(INDEX_op_negsetcond_i32, ret, arg1, arg2, cond); | ||
414 | + } else { | ||
415 | + tcg_gen_setcond_i32(cond, ret, arg1, arg2); | ||
416 | + tcg_gen_neg_i32(ret, ret); | ||
417 | + } | ||
418 | +} | ||
419 | + | ||
420 | void tcg_gen_muli_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2) | ||
421 | { | ||
422 | if (arg2 == 0) { | ||
423 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_setcondi_i64(TCGCond cond, TCGv_i64 ret, | ||
424 | } | ||
425 | } | ||
426 | |||
427 | +void tcg_gen_negsetcond_i64(TCGCond cond, TCGv_i64 ret, | ||
428 | + TCGv_i64 arg1, TCGv_i64 arg2) | ||
429 | +{ | ||
430 | + if (cond == TCG_COND_ALWAYS) { | ||
431 | + tcg_gen_movi_i64(ret, -1); | ||
432 | + } else if (cond == TCG_COND_NEVER) { | ||
433 | + tcg_gen_movi_i64(ret, 0); | ||
434 | + } else if (TCG_TARGET_HAS_negsetcond_i64) { | ||
435 | + tcg_gen_op4i_i64(INDEX_op_negsetcond_i64, ret, arg1, arg2, cond); | ||
436 | + } else if (TCG_TARGET_REG_BITS == 32) { | ||
437 | + tcg_gen_op6i_i32(INDEX_op_setcond2_i32, TCGV_LOW(ret), | ||
438 | + TCGV_LOW(arg1), TCGV_HIGH(arg1), | ||
439 | + TCGV_LOW(arg2), TCGV_HIGH(arg2), cond); | ||
440 | + tcg_gen_neg_i32(TCGV_LOW(ret), TCGV_LOW(ret)); | ||
441 | + tcg_gen_mov_i32(TCGV_HIGH(ret), TCGV_LOW(ret)); | ||
442 | + } else { | ||
443 | + tcg_gen_setcond_i64(cond, ret, arg1, arg2); | ||
444 | + tcg_gen_neg_i64(ret, ret); | ||
445 | + } | ||
446 | +} | ||
447 | + | ||
448 | void tcg_gen_muli_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2) | ||
449 | { | ||
450 | if (arg2 == 0) { | ||
451 | diff --git a/tcg/tcg.c b/tcg/tcg.c | ||
452 | index XXXXXXX..XXXXXXX 100644 | ||
453 | --- a/tcg/tcg.c | ||
454 | +++ b/tcg/tcg.c | ||
455 | @@ -XXX,XX +XXX,XX @@ bool tcg_op_supported(TCGOpcode op) | ||
456 | case INDEX_op_sar_i32: | ||
457 | return true; | ||
458 | |||
459 | + case INDEX_op_negsetcond_i32: | ||
460 | + return TCG_TARGET_HAS_negsetcond_i32; | ||
461 | case INDEX_op_movcond_i32: | ||
462 | return TCG_TARGET_HAS_movcond_i32; | ||
463 | case INDEX_op_div_i32: | ||
464 | @@ -XXX,XX +XXX,XX @@ bool tcg_op_supported(TCGOpcode op) | ||
465 | case INDEX_op_extu_i32_i64: | ||
466 | return TCG_TARGET_REG_BITS == 64; | ||
467 | |||
468 | + case INDEX_op_negsetcond_i64: | ||
469 | + return TCG_TARGET_HAS_negsetcond_i64; | ||
470 | case INDEX_op_movcond_i64: | ||
471 | return TCG_TARGET_HAS_movcond_i64; | ||
472 | case INDEX_op_div_i64: | ||
473 | @@ -XXX,XX +XXX,XX @@ static void tcg_dump_ops(TCGContext *s, FILE *f, bool have_prefs) | ||
474 | switch (c) { | ||
475 | case INDEX_op_brcond_i32: | ||
476 | case INDEX_op_setcond_i32: | ||
477 | + case INDEX_op_negsetcond_i32: | ||
478 | case INDEX_op_movcond_i32: | ||
479 | case INDEX_op_brcond2_i32: | ||
480 | case INDEX_op_setcond2_i32: | ||
481 | case INDEX_op_brcond_i64: | ||
482 | case INDEX_op_setcond_i64: | ||
483 | + case INDEX_op_negsetcond_i64: | ||
484 | case INDEX_op_movcond_i64: | ||
485 | case INDEX_op_cmp_vec: | ||
486 | case INDEX_op_cmpsel_vec: | ||
487 | -- | ||
488 | 2.34.1 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
2 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | --- | ||
5 | tcg/tcg-op-gvec.c | 6 ++---- | ||
6 | tcg/tcg-op.c | 6 ++---- | ||
7 | 2 files changed, 4 insertions(+), 8 deletions(-) | ||
8 | 1 | ||
9 | diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c | ||
10 | index XXXXXXX..XXXXXXX 100644 | ||
11 | --- a/tcg/tcg-op-gvec.c | ||
12 | +++ b/tcg/tcg-op-gvec.c | ||
13 | @@ -XXX,XX +XXX,XX @@ static void expand_cmp_i32(uint32_t dofs, uint32_t aofs, uint32_t bofs, | ||
14 | for (i = 0; i < oprsz; i += 4) { | ||
15 | tcg_gen_ld_i32(t0, cpu_env, aofs + i); | ||
16 | tcg_gen_ld_i32(t1, cpu_env, bofs + i); | ||
17 | - tcg_gen_setcond_i32(cond, t0, t0, t1); | ||
18 | - tcg_gen_neg_i32(t0, t0); | ||
19 | + tcg_gen_negsetcond_i32(cond, t0, t0, t1); | ||
20 | tcg_gen_st_i32(t0, cpu_env, dofs + i); | ||
21 | } | ||
22 | tcg_temp_free_i32(t1); | ||
23 | @@ -XXX,XX +XXX,XX @@ static void expand_cmp_i64(uint32_t dofs, uint32_t aofs, uint32_t bofs, | ||
24 | for (i = 0; i < oprsz; i += 8) { | ||
25 | tcg_gen_ld_i64(t0, cpu_env, aofs + i); | ||
26 | tcg_gen_ld_i64(t1, cpu_env, bofs + i); | ||
27 | - tcg_gen_setcond_i64(cond, t0, t0, t1); | ||
28 | - tcg_gen_neg_i64(t0, t0); | ||
29 | + tcg_gen_negsetcond_i64(cond, t0, t0, t1); | ||
30 | tcg_gen_st_i64(t0, cpu_env, dofs + i); | ||
31 | } | ||
32 | tcg_temp_free_i64(t1); | ||
33 | diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c | ||
34 | index XXXXXXX..XXXXXXX 100644 | ||
35 | --- a/tcg/tcg-op.c | ||
36 | +++ b/tcg/tcg-op.c | ||
37 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_movcond_i32(TCGCond cond, TCGv_i32 ret, TCGv_i32 c1, | ||
38 | } else { | ||
39 | TCGv_i32 t0 = tcg_temp_ebb_new_i32(); | ||
40 | TCGv_i32 t1 = tcg_temp_ebb_new_i32(); | ||
41 | - tcg_gen_setcond_i32(cond, t0, c1, c2); | ||
42 | - tcg_gen_neg_i32(t0, t0); | ||
43 | + tcg_gen_negsetcond_i32(cond, t0, c1, c2); | ||
44 | tcg_gen_and_i32(t1, v1, t0); | ||
45 | tcg_gen_andc_i32(ret, v2, t0); | ||
46 | tcg_gen_or_i32(ret, ret, t1); | ||
47 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_movcond_i64(TCGCond cond, TCGv_i64 ret, TCGv_i64 c1, | ||
48 | } else { | ||
49 | TCGv_i64 t0 = tcg_temp_ebb_new_i64(); | ||
50 | TCGv_i64 t1 = tcg_temp_ebb_new_i64(); | ||
51 | - tcg_gen_setcond_i64(cond, t0, c1, c2); | ||
52 | - tcg_gen_neg_i64(t0, t0); | ||
53 | + tcg_gen_negsetcond_i64(cond, t0, c1, c2); | ||
54 | tcg_gen_and_i64(t1, v1, t0); | ||
55 | tcg_gen_andc_i64(ret, v2, t0); | ||
56 | tcg_gen_or_i64(ret, ret, t1); | ||
57 | -- | ||
58 | 2.34.1 | ||
59 | |||
60 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | The setcond + neg + and sequence is a complex method of | ||
2 | performing a conditional move. | ||
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 | 7 +++---- | ||
8 | 1 file changed, 3 insertions(+), 4 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 void gen_fold_mzero(TCGCond cond, TCGv dest, TCGv src) | ||
15 | |||
16 | case TCG_COND_GE: | ||
17 | case TCG_COND_LT: | ||
18 | - /* For >= or <, map -0.0 to +0.0 via comparison and mask. */ | ||
19 | - tcg_gen_setcondi_i64(TCG_COND_NE, dest, src, mzero); | ||
20 | - tcg_gen_neg_i64(dest, dest); | ||
21 | - tcg_gen_and_i64(dest, dest, src); | ||
22 | + /* For >= or <, map -0.0 to +0.0. */ | ||
23 | + tcg_gen_movcond_i64(TCG_COND_NE, dest, src, tcg_constant_i64(mzero), | ||
24 | + src, tcg_constant_i64(0)); | ||
25 | break; | ||
26 | |||
27 | default: | ||
28 | -- | ||
29 | 2.34.1 | 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/arm/tcg/translate-a64.c | 22 +++++++++------------- | ||
5 | target/arm/tcg/translate.c | 12 ++++-------- | ||
6 | 2 files changed, 13 insertions(+), 21 deletions(-) | ||
7 | 1 | ||
8 | diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c | ||
9 | index XXXXXXX..XXXXXXX 100644 | ||
10 | --- a/target/arm/tcg/translate-a64.c | ||
11 | +++ b/target/arm/tcg/translate-a64.c | ||
12 | @@ -XXX,XX +XXX,XX @@ static void disas_cond_select(DisasContext *s, uint32_t insn) | ||
13 | |||
14 | if (rn == 31 && rm == 31 && (else_inc ^ else_inv)) { | ||
15 | /* CSET & CSETM. */ | ||
16 | - tcg_gen_setcond_i64(tcg_invert_cond(c.cond), tcg_rd, c.value, zero); | ||
17 | if (else_inv) { | ||
18 | - tcg_gen_neg_i64(tcg_rd, tcg_rd); | ||
19 | + tcg_gen_negsetcond_i64(tcg_invert_cond(c.cond), | ||
20 | + tcg_rd, c.value, zero); | ||
21 | + } else { | ||
22 | + tcg_gen_setcond_i64(tcg_invert_cond(c.cond), | ||
23 | + tcg_rd, c.value, zero); | ||
24 | } | ||
25 | } else { | ||
26 | TCGv_i64 t_true = cpu_reg(s, rn); | ||
27 | @@ -XXX,XX +XXX,XX @@ static void handle_3same_64(DisasContext *s, int opcode, bool u, | ||
28 | } | ||
29 | break; | ||
30 | case 0x6: /* CMGT, CMHI */ | ||
31 | - /* 64 bit integer comparison, result = test ? (2^64 - 1) : 0. | ||
32 | - * We implement this using setcond (test) and then negating. | ||
33 | - */ | ||
34 | cond = u ? TCG_COND_GTU : TCG_COND_GT; | ||
35 | do_cmop: | ||
36 | - tcg_gen_setcond_i64(cond, tcg_rd, tcg_rn, tcg_rm); | ||
37 | - tcg_gen_neg_i64(tcg_rd, tcg_rd); | ||
38 | + /* 64 bit integer comparison, result = test ? -1 : 0. */ | ||
39 | + tcg_gen_negsetcond_i64(cond, tcg_rd, tcg_rn, tcg_rm); | ||
40 | break; | ||
41 | case 0x7: /* CMGE, CMHS */ | ||
42 | cond = u ? TCG_COND_GEU : TCG_COND_GE; | ||
43 | @@ -XXX,XX +XXX,XX @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u, | ||
44 | } | ||
45 | break; | ||
46 | case 0xa: /* CMLT */ | ||
47 | - /* 64 bit integer comparison against zero, result is | ||
48 | - * test ? (2^64 - 1) : 0. We implement via setcond(!test) and | ||
49 | - * subtracting 1. | ||
50 | - */ | ||
51 | cond = TCG_COND_LT; | ||
52 | do_cmop: | ||
53 | - tcg_gen_setcondi_i64(cond, tcg_rd, tcg_rn, 0); | ||
54 | - tcg_gen_neg_i64(tcg_rd, tcg_rd); | ||
55 | + /* 64 bit integer comparison against zero, result is test ? -1 : 0. */ | ||
56 | + tcg_gen_negsetcond_i64(cond, tcg_rd, tcg_rn, tcg_constant_i64(0)); | ||
57 | break; | ||
58 | case 0x8: /* CMGT, CMGE */ | ||
59 | cond = u ? TCG_COND_GE : TCG_COND_GT; | ||
60 | diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c | ||
61 | index XXXXXXX..XXXXXXX 100644 | ||
62 | --- a/target/arm/tcg/translate.c | ||
63 | +++ b/target/arm/tcg/translate.c | ||
64 | @@ -XXX,XX +XXX,XX @@ void gen_gvec_sqrdmlsh_qc(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, | ||
65 | #define GEN_CMP0(NAME, COND) \ | ||
66 | static void gen_##NAME##0_i32(TCGv_i32 d, TCGv_i32 a) \ | ||
67 | { \ | ||
68 | - tcg_gen_setcondi_i32(COND, d, a, 0); \ | ||
69 | - tcg_gen_neg_i32(d, d); \ | ||
70 | + tcg_gen_negsetcond_i32(COND, d, a, tcg_constant_i32(0)); \ | ||
71 | } \ | ||
72 | static void gen_##NAME##0_i64(TCGv_i64 d, TCGv_i64 a) \ | ||
73 | { \ | ||
74 | - tcg_gen_setcondi_i64(COND, d, a, 0); \ | ||
75 | - tcg_gen_neg_i64(d, d); \ | ||
76 | + tcg_gen_negsetcond_i64(COND, d, a, tcg_constant_i64(0)); \ | ||
77 | } \ | ||
78 | static void gen_##NAME##0_vec(unsigned vece, TCGv_vec d, TCGv_vec a) \ | ||
79 | { \ | ||
80 | @@ -XXX,XX +XXX,XX @@ void gen_gvec_mls(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, | ||
81 | static void gen_cmtst_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b) | ||
82 | { | ||
83 | tcg_gen_and_i32(d, a, b); | ||
84 | - tcg_gen_setcondi_i32(TCG_COND_NE, d, d, 0); | ||
85 | - tcg_gen_neg_i32(d, d); | ||
86 | + tcg_gen_negsetcond_i32(TCG_COND_NE, d, d, tcg_constant_i32(0)); | ||
87 | } | ||
88 | |||
89 | void gen_cmtst_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b) | ||
90 | { | ||
91 | tcg_gen_and_i64(d, a, b); | ||
92 | - tcg_gen_setcondi_i64(TCG_COND_NE, d, d, 0); | ||
93 | - tcg_gen_neg_i64(d, d); | ||
94 | + tcg_gen_negsetcond_i64(TCG_COND_NE, d, d, tcg_constant_i64(0)); | ||
95 | } | ||
96 | |||
97 | static void gen_cmtst_vec(unsigned vece, TCGv_vec d, TCGv_vec a, TCGv_vec b) | ||
98 | -- | ||
99 | 2.34.1 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
2 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | --- | ||
5 | target/m68k/translate.c | 24 ++++++++++-------------- | ||
6 | 1 file changed, 10 insertions(+), 14 deletions(-) | ||
7 | 1 | ||
8 | diff --git a/target/m68k/translate.c b/target/m68k/translate.c | ||
9 | index XXXXXXX..XXXXXXX 100644 | ||
10 | --- a/target/m68k/translate.c | ||
11 | +++ b/target/m68k/translate.c | ||
12 | @@ -XXX,XX +XXX,XX @@ static void gen_cc_cond(DisasCompare *c, DisasContext *s, int cond) | ||
13 | case 14: /* GT (!(Z || (N ^ V))) */ | ||
14 | case 15: /* LE (Z || (N ^ V)) */ | ||
15 | c->v1 = tmp = tcg_temp_new(); | ||
16 | - tcg_gen_setcond_i32(TCG_COND_EQ, tmp, QREG_CC_Z, c->v2); | ||
17 | - tcg_gen_neg_i32(tmp, tmp); | ||
18 | + tcg_gen_negsetcond_i32(TCG_COND_EQ, tmp, QREG_CC_Z, c->v2); | ||
19 | tmp2 = tcg_temp_new(); | ||
20 | tcg_gen_xor_i32(tmp2, QREG_CC_N, QREG_CC_V); | ||
21 | tcg_gen_or_i32(tmp, tmp, tmp2); | ||
22 | @@ -XXX,XX +XXX,XX @@ DISAS_INSN(scc) | ||
23 | gen_cc_cond(&c, s, cond); | ||
24 | |||
25 | tmp = tcg_temp_new(); | ||
26 | - tcg_gen_setcond_i32(c.tcond, tmp, c.v1, c.v2); | ||
27 | + tcg_gen_negsetcond_i32(c.tcond, tmp, c.v1, c.v2); | ||
28 | |||
29 | - tcg_gen_neg_i32(tmp, tmp); | ||
30 | DEST_EA(env, insn, OS_BYTE, tmp, NULL); | ||
31 | } | ||
32 | |||
33 | @@ -XXX,XX +XXX,XX @@ DISAS_INSN(mull) | ||
34 | tcg_gen_muls2_i32(QREG_CC_N, QREG_CC_V, src1, DREG(ext, 12)); | ||
35 | /* QREG_CC_V is -(QREG_CC_V != (QREG_CC_N >> 31)) */ | ||
36 | tcg_gen_sari_i32(QREG_CC_Z, QREG_CC_N, 31); | ||
37 | - tcg_gen_setcond_i32(TCG_COND_NE, QREG_CC_V, QREG_CC_V, QREG_CC_Z); | ||
38 | + tcg_gen_negsetcond_i32(TCG_COND_NE, QREG_CC_V, | ||
39 | + QREG_CC_V, QREG_CC_Z); | ||
40 | } else { | ||
41 | tcg_gen_mulu2_i32(QREG_CC_N, QREG_CC_V, src1, DREG(ext, 12)); | ||
42 | /* QREG_CC_V is -(QREG_CC_V != 0), use QREG_CC_C as 0 */ | ||
43 | - tcg_gen_setcond_i32(TCG_COND_NE, QREG_CC_V, QREG_CC_V, QREG_CC_C); | ||
44 | + tcg_gen_negsetcond_i32(TCG_COND_NE, QREG_CC_V, | ||
45 | + QREG_CC_V, QREG_CC_C); | ||
46 | } | ||
47 | - tcg_gen_neg_i32(QREG_CC_V, QREG_CC_V); | ||
48 | tcg_gen_mov_i32(DREG(ext, 12), QREG_CC_N); | ||
49 | |||
50 | tcg_gen_mov_i32(QREG_CC_Z, QREG_CC_N); | ||
51 | @@ -XXX,XX +XXX,XX @@ static inline void shift_im(DisasContext *s, uint16_t insn, int opsize) | ||
52 | if (!logical && m68k_feature(s->env, M68K_FEATURE_M68K)) { | ||
53 | /* if shift count >= bits, V is (reg != 0) */ | ||
54 | if (count >= bits) { | ||
55 | - tcg_gen_setcond_i32(TCG_COND_NE, QREG_CC_V, reg, QREG_CC_V); | ||
56 | + tcg_gen_negsetcond_i32(TCG_COND_NE, QREG_CC_V, reg, QREG_CC_V); | ||
57 | } else { | ||
58 | TCGv t0 = tcg_temp_new(); | ||
59 | tcg_gen_sari_i32(QREG_CC_V, reg, bits - 1); | ||
60 | tcg_gen_sari_i32(t0, reg, bits - count - 1); | ||
61 | - tcg_gen_setcond_i32(TCG_COND_NE, QREG_CC_V, QREG_CC_V, t0); | ||
62 | + tcg_gen_negsetcond_i32(TCG_COND_NE, QREG_CC_V, QREG_CC_V, t0); | ||
63 | } | ||
64 | - tcg_gen_neg_i32(QREG_CC_V, QREG_CC_V); | ||
65 | } | ||
66 | } else { | ||
67 | tcg_gen_shri_i32(QREG_CC_C, reg, count - 1); | ||
68 | @@ -XXX,XX +XXX,XX @@ static inline void shift_reg(DisasContext *s, uint16_t insn, int opsize) | ||
69 | /* Ignore the bits below the sign bit. */ | ||
70 | tcg_gen_andi_i64(t64, t64, -1ULL << (bits - 1)); | ||
71 | /* If any bits remain set, we have overflow. */ | ||
72 | - tcg_gen_setcondi_i64(TCG_COND_NE, t64, t64, 0); | ||
73 | + tcg_gen_negsetcond_i64(TCG_COND_NE, t64, t64, tcg_constant_i64(0)); | ||
74 | tcg_gen_extrl_i64_i32(QREG_CC_V, t64); | ||
75 | - tcg_gen_neg_i32(QREG_CC_V, QREG_CC_V); | ||
76 | } | ||
77 | } else { | ||
78 | tcg_gen_shli_i64(t64, t64, 32); | ||
79 | @@ -XXX,XX +XXX,XX @@ DISAS_INSN(fscc) | ||
80 | gen_fcc_cond(&c, s, cond); | ||
81 | |||
82 | tmp = tcg_temp_new(); | ||
83 | - tcg_gen_setcond_i32(c.tcond, tmp, c.v1, c.v2); | ||
84 | + tcg_gen_negsetcond_i32(c.tcond, tmp, c.v1, c.v2); | ||
85 | |||
86 | - tcg_gen_neg_i32(tmp, tmp); | ||
87 | DEST_EA(env, insn, OS_BYTE, tmp, NULL); | ||
88 | } | ||
89 | |||
90 | -- | ||
91 | 2.34.1 | ||
92 | |||
93 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
2 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | --- | ||
5 | target/openrisc/translate.c | 6 ++---- | ||
6 | 1 file changed, 2 insertions(+), 4 deletions(-) | ||
7 | 1 | ||
8 | diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c | ||
9 | index XXXXXXX..XXXXXXX 100644 | ||
10 | --- a/target/openrisc/translate.c | ||
11 | +++ b/target/openrisc/translate.c | ||
12 | @@ -XXX,XX +XXX,XX @@ static void gen_mul(DisasContext *dc, TCGv dest, TCGv srca, TCGv srcb) | ||
13 | |||
14 | tcg_gen_muls2_tl(dest, cpu_sr_ov, srca, srcb); | ||
15 | tcg_gen_sari_tl(t0, dest, TARGET_LONG_BITS - 1); | ||
16 | - tcg_gen_setcond_tl(TCG_COND_NE, cpu_sr_ov, cpu_sr_ov, t0); | ||
17 | + tcg_gen_negsetcond_tl(TCG_COND_NE, cpu_sr_ov, cpu_sr_ov, t0); | ||
18 | |||
19 | - tcg_gen_neg_tl(cpu_sr_ov, cpu_sr_ov); | ||
20 | gen_ove_ov(dc); | ||
21 | } | ||
22 | |||
23 | @@ -XXX,XX +XXX,XX @@ static void gen_muld(DisasContext *dc, TCGv srca, TCGv srcb) | ||
24 | |||
25 | tcg_gen_muls2_i64(cpu_mac, high, t1, t2); | ||
26 | tcg_gen_sari_i64(t1, cpu_mac, 63); | ||
27 | - tcg_gen_setcond_i64(TCG_COND_NE, t1, t1, high); | ||
28 | + tcg_gen_negsetcond_i64(TCG_COND_NE, t1, t1, high); | ||
29 | tcg_gen_trunc_i64_tl(cpu_sr_ov, t1); | ||
30 | - tcg_gen_neg_tl(cpu_sr_ov, cpu_sr_ov); | ||
31 | |||
32 | gen_ove_ov(dc); | ||
33 | } | ||
34 | -- | ||
35 | 2.34.1 | ||
36 | |||
37 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Tested-by: Nicholas Piggin <npiggin@gmail.com> | ||
2 | Reviewed-by: Nicholas Piggin <npiggin@gmail.com> | ||
3 | Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com> | ||
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | --- | ||
6 | target/ppc/translate/fixedpoint-impl.c.inc | 6 ++++-- | ||
7 | target/ppc/translate/vmx-impl.c.inc | 8 +++----- | ||
8 | 2 files changed, 7 insertions(+), 7 deletions(-) | ||
9 | 1 | ||
10 | diff --git a/target/ppc/translate/fixedpoint-impl.c.inc b/target/ppc/translate/fixedpoint-impl.c.inc | ||
11 | index XXXXXXX..XXXXXXX 100644 | ||
12 | --- a/target/ppc/translate/fixedpoint-impl.c.inc | ||
13 | +++ b/target/ppc/translate/fixedpoint-impl.c.inc | ||
14 | @@ -XXX,XX +XXX,XX @@ static bool do_set_bool_cond(DisasContext *ctx, arg_X_bi *a, bool neg, bool rev) | ||
15 | uint32_t mask = 0x08 >> (a->bi & 0x03); | ||
16 | TCGCond cond = rev ? TCG_COND_EQ : TCG_COND_NE; | ||
17 | TCGv temp = tcg_temp_new(); | ||
18 | + TCGv zero = tcg_constant_tl(0); | ||
19 | |||
20 | tcg_gen_extu_i32_tl(temp, cpu_crf[a->bi >> 2]); | ||
21 | tcg_gen_andi_tl(temp, temp, mask); | ||
22 | - tcg_gen_setcondi_tl(cond, cpu_gpr[a->rt], temp, 0); | ||
23 | if (neg) { | ||
24 | - tcg_gen_neg_tl(cpu_gpr[a->rt], cpu_gpr[a->rt]); | ||
25 | + tcg_gen_negsetcond_tl(cond, cpu_gpr[a->rt], temp, zero); | ||
26 | + } else { | ||
27 | + tcg_gen_setcond_tl(cond, cpu_gpr[a->rt], temp, zero); | ||
28 | } | ||
29 | return true; | ||
30 | } | ||
31 | diff --git a/target/ppc/translate/vmx-impl.c.inc b/target/ppc/translate/vmx-impl.c.inc | ||
32 | index XXXXXXX..XXXXXXX 100644 | ||
33 | --- a/target/ppc/translate/vmx-impl.c.inc | ||
34 | +++ b/target/ppc/translate/vmx-impl.c.inc | ||
35 | @@ -XXX,XX +XXX,XX @@ static bool trans_VCMPEQUQ(DisasContext *ctx, arg_VC *a) | ||
36 | tcg_gen_xor_i64(t1, t0, t1); | ||
37 | |||
38 | tcg_gen_or_i64(t1, t1, t2); | ||
39 | - tcg_gen_setcondi_i64(TCG_COND_EQ, t1, t1, 0); | ||
40 | - tcg_gen_neg_i64(t1, t1); | ||
41 | + tcg_gen_negsetcond_i64(TCG_COND_EQ, t1, t1, tcg_constant_i64(0)); | ||
42 | |||
43 | set_avr64(a->vrt, t1, true); | ||
44 | set_avr64(a->vrt, t1, false); | ||
45 | @@ -XXX,XX +XXX,XX @@ static bool do_vcmpgtq(DisasContext *ctx, arg_VC *a, bool sign) | ||
46 | |||
47 | get_avr64(t0, a->vra, false); | ||
48 | get_avr64(t1, a->vrb, false); | ||
49 | - tcg_gen_setcond_i64(TCG_COND_GTU, t2, t0, t1); | ||
50 | + tcg_gen_negsetcond_i64(TCG_COND_GTU, t2, t0, t1); | ||
51 | |||
52 | get_avr64(t0, a->vra, true); | ||
53 | get_avr64(t1, a->vrb, true); | ||
54 | tcg_gen_movcond_i64(TCG_COND_EQ, t2, t0, t1, t2, tcg_constant_i64(0)); | ||
55 | - tcg_gen_setcond_i64(sign ? TCG_COND_GT : TCG_COND_GTU, t1, t0, t1); | ||
56 | + tcg_gen_negsetcond_i64(sign ? TCG_COND_GT : TCG_COND_GTU, t1, t0, t1); | ||
57 | |||
58 | tcg_gen_or_i64(t1, t1, t2); | ||
59 | - tcg_gen_neg_i64(t1, t1); | ||
60 | |||
61 | set_avr64(a->vrt, t1, true); | ||
62 | set_avr64(a->vrt, t1, false); | ||
63 | -- | ||
64 | 2.34.1 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | The setcond + neg + or sequence is a complex method of | ||
2 | performing a conditional move. | ||
3 | 1 | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | --- | ||
7 | target/sparc/translate.c | 17 ++++------------- | ||
8 | 1 file changed, 4 insertions(+), 13 deletions(-) | ||
9 | |||
10 | diff --git a/target/sparc/translate.c b/target/sparc/translate.c | ||
11 | index XXXXXXX..XXXXXXX 100644 | ||
12 | --- a/target/sparc/translate.c | ||
13 | +++ b/target/sparc/translate.c | ||
14 | @@ -XXX,XX +XXX,XX @@ static void gen_edge(DisasContext *dc, TCGv dst, TCGv s1, TCGv s2, | ||
15 | |||
16 | tcg_gen_shr_tl(lo1, tcg_constant_tl(tabl), lo1); | ||
17 | tcg_gen_shr_tl(lo2, tcg_constant_tl(tabr), lo2); | ||
18 | - tcg_gen_andi_tl(dst, lo1, omask); | ||
19 | + tcg_gen_andi_tl(lo1, lo1, omask); | ||
20 | tcg_gen_andi_tl(lo2, lo2, omask); | ||
21 | |||
22 | amask = -8; | ||
23 | @@ -XXX,XX +XXX,XX @@ static void gen_edge(DisasContext *dc, TCGv dst, TCGv s1, TCGv s2, | ||
24 | tcg_gen_andi_tl(s1, s1, amask); | ||
25 | tcg_gen_andi_tl(s2, s2, amask); | ||
26 | |||
27 | - /* We want to compute | ||
28 | - dst = (s1 == s2 ? lo1 : lo1 & lo2). | ||
29 | - We've already done dst = lo1, so this reduces to | ||
30 | - dst &= (s1 == s2 ? -1 : lo2) | ||
31 | - Which we perform by | ||
32 | - lo2 |= -(s1 == s2) | ||
33 | - dst &= lo2 | ||
34 | - */ | ||
35 | - tcg_gen_setcond_tl(TCG_COND_EQ, lo1, s1, s2); | ||
36 | - tcg_gen_neg_tl(lo1, lo1); | ||
37 | - tcg_gen_or_tl(lo2, lo2, lo1); | ||
38 | - tcg_gen_and_tl(dst, dst, lo2); | ||
39 | + /* Compute dst = (s1 == s2 ? lo1 : lo1 & lo2). */ | ||
40 | + tcg_gen_and_tl(lo2, lo2, lo1); | ||
41 | + tcg_gen_movcond_tl(TCG_COND_EQ, dst, s1, s2, lo1, lo2); | ||
42 | } | ||
43 | |||
44 | static void gen_alignaddr(TCGv dst, TCGv s1, TCGv s2, bool left) | ||
45 | -- | ||
46 | 2.34.1 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
2 | Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | --- | ||
5 | target/tricore/translate.c | 16 ++++++---------- | ||
6 | 1 file changed, 6 insertions(+), 10 deletions(-) | ||
7 | 1 | ||
8 | diff --git a/target/tricore/translate.c b/target/tricore/translate.c | ||
9 | index XXXXXXX..XXXXXXX 100644 | ||
10 | --- a/target/tricore/translate.c | ||
11 | +++ b/target/tricore/translate.c | ||
12 | @@ -XXX,XX +XXX,XX @@ gen_accumulating_condi(int cond, TCGv ret, TCGv r1, int32_t con, | ||
13 | gen_accumulating_cond(cond, ret, r1, temp, op); | ||
14 | } | ||
15 | |||
16 | -/* ret = (r1 cond r2) ? 0xFFFFFFFF ? 0x00000000;*/ | ||
17 | -static inline void gen_cond_w(TCGCond cond, TCGv ret, TCGv r1, TCGv r2) | ||
18 | -{ | ||
19 | - tcg_gen_setcond_tl(cond, ret, r1, r2); | ||
20 | - tcg_gen_neg_tl(ret, ret); | ||
21 | -} | ||
22 | - | ||
23 | static inline void gen_eqany_bi(TCGv ret, TCGv r1, int32_t con) | ||
24 | { | ||
25 | TCGv b0 = tcg_temp_new(); | ||
26 | @@ -XXX,XX +XXX,XX @@ static void decode_rr_accumulator(DisasContext *ctx) | ||
27 | gen_helper_eq_h(cpu_gpr_d[r3], cpu_gpr_d[r1], cpu_gpr_d[r2]); | ||
28 | break; | ||
29 | case OPC2_32_RR_EQ_W: | ||
30 | - gen_cond_w(TCG_COND_EQ, cpu_gpr_d[r3], cpu_gpr_d[r1], cpu_gpr_d[r2]); | ||
31 | + tcg_gen_negsetcond_tl(TCG_COND_EQ, cpu_gpr_d[r3], | ||
32 | + cpu_gpr_d[r1], cpu_gpr_d[r2]); | ||
33 | break; | ||
34 | case OPC2_32_RR_EQANY_B: | ||
35 | gen_helper_eqany_b(cpu_gpr_d[r3], cpu_gpr_d[r1], cpu_gpr_d[r2]); | ||
36 | @@ -XXX,XX +XXX,XX @@ static void decode_rr_accumulator(DisasContext *ctx) | ||
37 | gen_helper_lt_hu(cpu_gpr_d[r3], cpu_gpr_d[r1], cpu_gpr_d[r2]); | ||
38 | break; | ||
39 | case OPC2_32_RR_LT_W: | ||
40 | - gen_cond_w(TCG_COND_LT, cpu_gpr_d[r3], cpu_gpr_d[r1], cpu_gpr_d[r2]); | ||
41 | + tcg_gen_negsetcond_tl(TCG_COND_LT, cpu_gpr_d[r3], | ||
42 | + cpu_gpr_d[r1], cpu_gpr_d[r2]); | ||
43 | break; | ||
44 | case OPC2_32_RR_LT_WU: | ||
45 | - gen_cond_w(TCG_COND_LTU, cpu_gpr_d[r3], cpu_gpr_d[r1], cpu_gpr_d[r2]); | ||
46 | + tcg_gen_negsetcond_tl(TCG_COND_LTU, cpu_gpr_d[r3], | ||
47 | + cpu_gpr_d[r1], cpu_gpr_d[r2]); | ||
48 | break; | ||
49 | case OPC2_32_RR_MAX: | ||
50 | tcg_gen_movcond_tl(TCG_COND_GT, cpu_gpr_d[r3], cpu_gpr_d[r1], | ||
51 | -- | ||
52 | 2.34.1 | ||
53 | |||
54 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | In the general case we simply negate. However with isel we | ||
2 | may load -1 instead of 1 with no extra effort. | ||
3 | 1 | ||
4 | Consolidate EQ0 and NE0 logic. Replace the NE0 zero-extension | ||
5 | with inversion+negation of EQ0, which is never worse and may | ||
6 | eliminate one insn. Provide a special case for -EQ0. | ||
7 | |||
8 | Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com> | ||
9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | --- | ||
11 | tcg/ppc/tcg-target.h | 4 +- | ||
12 | tcg/ppc/tcg-target.c.inc | 127 ++++++++++++++++++++++++--------------- | ||
13 | 2 files changed, 82 insertions(+), 49 deletions(-) | ||
14 | |||
15 | diff --git a/tcg/ppc/tcg-target.h b/tcg/ppc/tcg-target.h | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/tcg/ppc/tcg-target.h | ||
18 | +++ b/tcg/ppc/tcg-target.h | ||
19 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
20 | #define TCG_TARGET_HAS_sextract_i32 0 | ||
21 | #define TCG_TARGET_HAS_extract2_i32 0 | ||
22 | #define TCG_TARGET_HAS_movcond_i32 1 | ||
23 | -#define TCG_TARGET_HAS_negsetcond_i32 0 | ||
24 | +#define TCG_TARGET_HAS_negsetcond_i32 1 | ||
25 | #define TCG_TARGET_HAS_mulu2_i32 0 | ||
26 | #define TCG_TARGET_HAS_muls2_i32 0 | ||
27 | #define TCG_TARGET_HAS_muluh_i32 1 | ||
28 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
29 | #define TCG_TARGET_HAS_sextract_i64 0 | ||
30 | #define TCG_TARGET_HAS_extract2_i64 0 | ||
31 | #define TCG_TARGET_HAS_movcond_i64 1 | ||
32 | -#define TCG_TARGET_HAS_negsetcond_i64 0 | ||
33 | +#define TCG_TARGET_HAS_negsetcond_i64 1 | ||
34 | #define TCG_TARGET_HAS_add2_i64 1 | ||
35 | #define TCG_TARGET_HAS_sub2_i64 1 | ||
36 | #define TCG_TARGET_HAS_mulu2_i64 0 | ||
37 | diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc | ||
38 | index XXXXXXX..XXXXXXX 100644 | ||
39 | --- a/tcg/ppc/tcg-target.c.inc | ||
40 | +++ b/tcg/ppc/tcg-target.c.inc | ||
41 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_cmp(TCGContext *s, int cond, TCGArg arg1, TCGArg arg2, | ||
42 | } | ||
43 | |||
44 | static void tcg_out_setcond_eq0(TCGContext *s, TCGType type, | ||
45 | - TCGReg dst, TCGReg src) | ||
46 | + TCGReg dst, TCGReg src, bool neg) | ||
47 | { | ||
48 | + if (neg && (TCG_TARGET_REG_BITS == 32 || type == TCG_TYPE_I64)) { | ||
49 | + /* | ||
50 | + * X != 0 implies X + -1 generates a carry. | ||
51 | + * RT = (~X + X) + CA | ||
52 | + * = -1 + CA | ||
53 | + * = CA ? 0 : -1 | ||
54 | + */ | ||
55 | + tcg_out32(s, ADDIC | TAI(TCG_REG_R0, src, -1)); | ||
56 | + tcg_out32(s, SUBFE | TAB(dst, src, src)); | ||
57 | + return; | ||
58 | + } | ||
59 | + | ||
60 | if (type == TCG_TYPE_I32) { | ||
61 | tcg_out32(s, CNTLZW | RS(src) | RA(dst)); | ||
62 | tcg_out_shri32(s, dst, dst, 5); | ||
63 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_setcond_eq0(TCGContext *s, TCGType type, | ||
64 | tcg_out32(s, CNTLZD | RS(src) | RA(dst)); | ||
65 | tcg_out_shri64(s, dst, dst, 6); | ||
66 | } | ||
67 | + if (neg) { | ||
68 | + tcg_out32(s, NEG | RT(dst) | RA(dst)); | ||
69 | + } | ||
70 | } | ||
71 | |||
72 | -static void tcg_out_setcond_ne0(TCGContext *s, TCGReg dst, TCGReg src) | ||
73 | +static void tcg_out_setcond_ne0(TCGContext *s, TCGType type, | ||
74 | + TCGReg dst, TCGReg src, bool neg) | ||
75 | { | ||
76 | - /* X != 0 implies X + -1 generates a carry. Extra addition | ||
77 | - trickery means: R = X-1 + ~X + C = X-1 + (-X+1) + C = C. */ | ||
78 | - if (dst != src) { | ||
79 | - tcg_out32(s, ADDIC | TAI(dst, src, -1)); | ||
80 | - tcg_out32(s, SUBFE | TAB(dst, dst, src)); | ||
81 | - } else { | ||
82 | + if (!neg && (TCG_TARGET_REG_BITS == 32 || type == TCG_TYPE_I64)) { | ||
83 | + /* | ||
84 | + * X != 0 implies X + -1 generates a carry. Extra addition | ||
85 | + * trickery means: R = X-1 + ~X + C = X-1 + (-X+1) + C = C. | ||
86 | + */ | ||
87 | tcg_out32(s, ADDIC | TAI(TCG_REG_R0, src, -1)); | ||
88 | tcg_out32(s, SUBFE | TAB(dst, TCG_REG_R0, src)); | ||
89 | + return; | ||
90 | + } | ||
91 | + tcg_out_setcond_eq0(s, type, dst, src, false); | ||
92 | + if (neg) { | ||
93 | + tcg_out32(s, ADDI | TAI(dst, dst, -1)); | ||
94 | + } else { | ||
95 | + tcg_out_xori32(s, dst, dst, 1); | ||
96 | } | ||
97 | } | ||
98 | |||
99 | @@ -XXX,XX +XXX,XX @@ static TCGReg tcg_gen_setcond_xor(TCGContext *s, TCGReg arg1, TCGArg arg2, | ||
100 | |||
101 | static void tcg_out_setcond(TCGContext *s, TCGType type, TCGCond cond, | ||
102 | TCGArg arg0, TCGArg arg1, TCGArg arg2, | ||
103 | - int const_arg2) | ||
104 | + int const_arg2, bool neg) | ||
105 | { | ||
106 | - int crop, sh; | ||
107 | + int sh; | ||
108 | + bool inv; | ||
109 | |||
110 | tcg_debug_assert(TCG_TARGET_REG_BITS == 64 || type == TCG_TYPE_I32); | ||
111 | |||
112 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_setcond(TCGContext *s, TCGType type, TCGCond cond, | ||
113 | if (arg2 == 0) { | ||
114 | switch (cond) { | ||
115 | case TCG_COND_EQ: | ||
116 | - tcg_out_setcond_eq0(s, type, arg0, arg1); | ||
117 | + tcg_out_setcond_eq0(s, type, arg0, arg1, neg); | ||
118 | return; | ||
119 | case TCG_COND_NE: | ||
120 | - if (TCG_TARGET_REG_BITS == 64 && type == TCG_TYPE_I32) { | ||
121 | - tcg_out_ext32u(s, TCG_REG_R0, arg1); | ||
122 | - arg1 = TCG_REG_R0; | ||
123 | - } | ||
124 | - tcg_out_setcond_ne0(s, arg0, arg1); | ||
125 | + tcg_out_setcond_ne0(s, type, arg0, arg1, neg); | ||
126 | return; | ||
127 | case TCG_COND_GE: | ||
128 | tcg_out32(s, NOR | SAB(arg1, arg0, arg1)); | ||
129 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_setcond(TCGContext *s, TCGType type, TCGCond cond, | ||
130 | case TCG_COND_LT: | ||
131 | /* Extract the sign bit. */ | ||
132 | if (type == TCG_TYPE_I32) { | ||
133 | - tcg_out_shri32(s, arg0, arg1, 31); | ||
134 | + if (neg) { | ||
135 | + tcg_out_sari32(s, arg0, arg1, 31); | ||
136 | + } else { | ||
137 | + tcg_out_shri32(s, arg0, arg1, 31); | ||
138 | + } | ||
139 | } else { | ||
140 | - tcg_out_shri64(s, arg0, arg1, 63); | ||
141 | + if (neg) { | ||
142 | + tcg_out_sari64(s, arg0, arg1, 63); | ||
143 | + } else { | ||
144 | + tcg_out_shri64(s, arg0, arg1, 63); | ||
145 | + } | ||
146 | } | ||
147 | return; | ||
148 | default: | ||
149 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_setcond(TCGContext *s, TCGType type, TCGCond cond, | ||
150 | |||
151 | isel = tcg_to_isel[cond]; | ||
152 | |||
153 | - tcg_out_movi(s, type, arg0, 1); | ||
154 | + tcg_out_movi(s, type, arg0, neg ? -1 : 1); | ||
155 | if (isel & 1) { | ||
156 | /* arg0 = (bc ? 0 : 1) */ | ||
157 | tab = TAB(arg0, 0, arg0); | ||
158 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_setcond(TCGContext *s, TCGType type, TCGCond cond, | ||
159 | return; | ||
160 | } | ||
161 | |||
162 | + inv = false; | ||
163 | switch (cond) { | ||
164 | case TCG_COND_EQ: | ||
165 | arg1 = tcg_gen_setcond_xor(s, arg1, arg2, const_arg2); | ||
166 | - tcg_out_setcond_eq0(s, type, arg0, arg1); | ||
167 | - return; | ||
168 | + tcg_out_setcond_eq0(s, type, arg0, arg1, neg); | ||
169 | + break; | ||
170 | |||
171 | case TCG_COND_NE: | ||
172 | arg1 = tcg_gen_setcond_xor(s, arg1, arg2, const_arg2); | ||
173 | - /* Discard the high bits only once, rather than both inputs. */ | ||
174 | - if (TCG_TARGET_REG_BITS == 64 && type == TCG_TYPE_I32) { | ||
175 | - tcg_out_ext32u(s, TCG_REG_R0, arg1); | ||
176 | - arg1 = TCG_REG_R0; | ||
177 | - } | ||
178 | - tcg_out_setcond_ne0(s, arg0, arg1); | ||
179 | - return; | ||
180 | + tcg_out_setcond_ne0(s, type, arg0, arg1, neg); | ||
181 | + break; | ||
182 | |||
183 | + case TCG_COND_LE: | ||
184 | + case TCG_COND_LEU: | ||
185 | + inv = true; | ||
186 | + /* fall through */ | ||
187 | case TCG_COND_GT: | ||
188 | case TCG_COND_GTU: | ||
189 | - sh = 30; | ||
190 | - crop = 0; | ||
191 | - goto crtest; | ||
192 | - | ||
193 | - case TCG_COND_LT: | ||
194 | - case TCG_COND_LTU: | ||
195 | - sh = 29; | ||
196 | - crop = 0; | ||
197 | + sh = 30; /* CR7 CR_GT */ | ||
198 | goto crtest; | ||
199 | |||
200 | case TCG_COND_GE: | ||
201 | case TCG_COND_GEU: | ||
202 | - sh = 31; | ||
203 | - crop = CRNOR | BT(7, CR_EQ) | BA(7, CR_LT) | BB(7, CR_LT); | ||
204 | + inv = true; | ||
205 | + /* fall through */ | ||
206 | + case TCG_COND_LT: | ||
207 | + case TCG_COND_LTU: | ||
208 | + sh = 29; /* CR7 CR_LT */ | ||
209 | goto crtest; | ||
210 | |||
211 | - case TCG_COND_LE: | ||
212 | - case TCG_COND_LEU: | ||
213 | - sh = 31; | ||
214 | - crop = CRNOR | BT(7, CR_EQ) | BA(7, CR_GT) | BB(7, CR_GT); | ||
215 | crtest: | ||
216 | tcg_out_cmp(s, cond, arg1, arg2, const_arg2, 7, type); | ||
217 | - if (crop) { | ||
218 | - tcg_out32(s, crop); | ||
219 | - } | ||
220 | tcg_out32(s, MFOCRF | RT(TCG_REG_R0) | FXM(7)); | ||
221 | tcg_out_rlw(s, RLWINM, arg0, TCG_REG_R0, sh, 31, 31); | ||
222 | + if (neg && inv) { | ||
223 | + tcg_out32(s, ADDI | TAI(arg0, arg0, -1)); | ||
224 | + } else if (neg) { | ||
225 | + tcg_out32(s, NEG | RT(arg0) | RA(arg0)); | ||
226 | + } else if (inv) { | ||
227 | + tcg_out_xori32(s, arg0, arg0, 1); | ||
228 | + } | ||
229 | break; | ||
230 | |||
231 | default: | ||
232 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, | ||
233 | |||
234 | case INDEX_op_setcond_i32: | ||
235 | tcg_out_setcond(s, TCG_TYPE_I32, args[3], args[0], args[1], args[2], | ||
236 | - const_args[2]); | ||
237 | + const_args[2], false); | ||
238 | break; | ||
239 | case INDEX_op_setcond_i64: | ||
240 | tcg_out_setcond(s, TCG_TYPE_I64, args[3], args[0], args[1], args[2], | ||
241 | - const_args[2]); | ||
242 | + const_args[2], false); | ||
243 | + break; | ||
244 | + case INDEX_op_negsetcond_i32: | ||
245 | + tcg_out_setcond(s, TCG_TYPE_I32, args[3], args[0], args[1], args[2], | ||
246 | + const_args[2], true); | ||
247 | + break; | ||
248 | + case INDEX_op_negsetcond_i64: | ||
249 | + tcg_out_setcond(s, TCG_TYPE_I64, args[3], args[0], args[1], args[2], | ||
250 | + const_args[2], true); | ||
251 | break; | ||
252 | case INDEX_op_setcond2_i32: | ||
253 | tcg_out_setcond2(s, args, const_args); | ||
254 | @@ -XXX,XX +XXX,XX @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) | ||
255 | case INDEX_op_rotl_i32: | ||
256 | case INDEX_op_rotr_i32: | ||
257 | case INDEX_op_setcond_i32: | ||
258 | + case INDEX_op_negsetcond_i32: | ||
259 | case INDEX_op_and_i64: | ||
260 | case INDEX_op_andc_i64: | ||
261 | case INDEX_op_shl_i64: | ||
262 | @@ -XXX,XX +XXX,XX @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) | ||
263 | case INDEX_op_rotl_i64: | ||
264 | case INDEX_op_rotr_i64: | ||
265 | case INDEX_op_setcond_i64: | ||
266 | + case INDEX_op_negsetcond_i64: | ||
267 | return C_O1_I2(r, r, ri); | ||
268 | |||
269 | case INDEX_op_mul_i32: | ||
270 | -- | ||
271 | 2.34.1 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | The SETBC family of instructions requires exactly two insns for | ||
2 | all comparisions, saving 0-3 insns per (neg)setcond. | ||
3 | 1 | ||
4 | Tested-by: Nicholas Piggin <npiggin@gmail.com> | ||
5 | Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com> | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | --- | ||
8 | tcg/ppc/tcg-target.c.inc | 22 ++++++++++++++++++++++ | ||
9 | 1 file changed, 22 insertions(+) | ||
10 | |||
11 | diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/tcg/ppc/tcg-target.c.inc | ||
14 | +++ b/tcg/ppc/tcg-target.c.inc | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool tcg_target_const_match(int64_t val, TCGType type, int ct) | ||
16 | #define TW XO31( 4) | ||
17 | #define TRAP (TW | TO(31)) | ||
18 | |||
19 | +#define SETBC XO31(384) /* v3.10 */ | ||
20 | +#define SETBCR XO31(416) /* v3.10 */ | ||
21 | +#define SETNBC XO31(448) /* v3.10 */ | ||
22 | +#define SETNBCR XO31(480) /* v3.10 */ | ||
23 | + | ||
24 | #define NOP ORI /* ori 0,0,0 */ | ||
25 | |||
26 | #define LVX XO31(103) | ||
27 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_setcond(TCGContext *s, TCGType type, TCGCond cond, | ||
28 | arg2 = (uint32_t)arg2; | ||
29 | } | ||
30 | |||
31 | + /* With SETBC/SETBCR, we can always implement with 2 insns. */ | ||
32 | + if (have_isa_3_10) { | ||
33 | + tcg_insn_unit bi, opc; | ||
34 | + | ||
35 | + tcg_out_cmp(s, cond, arg1, arg2, const_arg2, 7, type); | ||
36 | + | ||
37 | + /* Re-use tcg_to_bc for BI and BO_COND_{TRUE,FALSE}. */ | ||
38 | + bi = tcg_to_bc[cond] & (0x1f << 16); | ||
39 | + if (tcg_to_bc[cond] & BO(8)) { | ||
40 | + opc = neg ? SETNBC : SETBC; | ||
41 | + } else { | ||
42 | + opc = neg ? SETNBCR : SETBCR; | ||
43 | + } | ||
44 | + tcg_out32(s, opc | RT(arg0) | bi); | ||
45 | + return; | ||
46 | + } | ||
47 | + | ||
48 | /* Handle common and trivial cases before handling anything else. */ | ||
49 | if (arg2 == 0) { | ||
50 | switch (cond) { | ||
51 | -- | ||
52 | 2.34.1 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Trivial, as aarch64 has an instruction for this: CSETM. | ||
2 | 1 | ||
3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | --- | ||
6 | tcg/aarch64/tcg-target.h | 4 ++-- | ||
7 | tcg/aarch64/tcg-target.c.inc | 12 ++++++++++++ | ||
8 | 2 files changed, 14 insertions(+), 2 deletions(-) | ||
9 | |||
10 | diff --git a/tcg/aarch64/tcg-target.h b/tcg/aarch64/tcg-target.h | ||
11 | index XXXXXXX..XXXXXXX 100644 | ||
12 | --- a/tcg/aarch64/tcg-target.h | ||
13 | +++ b/tcg/aarch64/tcg-target.h | ||
14 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
15 | #define TCG_TARGET_HAS_sextract_i32 1 | ||
16 | #define TCG_TARGET_HAS_extract2_i32 1 | ||
17 | #define TCG_TARGET_HAS_movcond_i32 1 | ||
18 | -#define TCG_TARGET_HAS_negsetcond_i32 0 | ||
19 | +#define TCG_TARGET_HAS_negsetcond_i32 1 | ||
20 | #define TCG_TARGET_HAS_add2_i32 1 | ||
21 | #define TCG_TARGET_HAS_sub2_i32 1 | ||
22 | #define TCG_TARGET_HAS_mulu2_i32 0 | ||
23 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
24 | #define TCG_TARGET_HAS_sextract_i64 1 | ||
25 | #define TCG_TARGET_HAS_extract2_i64 1 | ||
26 | #define TCG_TARGET_HAS_movcond_i64 1 | ||
27 | -#define TCG_TARGET_HAS_negsetcond_i64 0 | ||
28 | +#define TCG_TARGET_HAS_negsetcond_i64 1 | ||
29 | #define TCG_TARGET_HAS_add2_i64 1 | ||
30 | #define TCG_TARGET_HAS_sub2_i64 1 | ||
31 | #define TCG_TARGET_HAS_mulu2_i64 0 | ||
32 | diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc | ||
33 | index XXXXXXX..XXXXXXX 100644 | ||
34 | --- a/tcg/aarch64/tcg-target.c.inc | ||
35 | +++ b/tcg/aarch64/tcg-target.c.inc | ||
36 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, | ||
37 | TCG_REG_XZR, tcg_invert_cond(args[3])); | ||
38 | break; | ||
39 | |||
40 | + case INDEX_op_negsetcond_i32: | ||
41 | + a2 = (int32_t)a2; | ||
42 | + /* FALLTHRU */ | ||
43 | + case INDEX_op_negsetcond_i64: | ||
44 | + tcg_out_cmp(s, ext, a1, a2, c2); | ||
45 | + /* Use CSETM alias of CSINV Wd, WZR, WZR, invert(cond). */ | ||
46 | + tcg_out_insn(s, 3506, CSINV, ext, a0, TCG_REG_XZR, | ||
47 | + TCG_REG_XZR, tcg_invert_cond(args[3])); | ||
48 | + break; | ||
49 | + | ||
50 | case INDEX_op_movcond_i32: | ||
51 | a2 = (int32_t)a2; | ||
52 | /* FALLTHRU */ | ||
53 | @@ -XXX,XX +XXX,XX @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) | ||
54 | case INDEX_op_sub_i64: | ||
55 | case INDEX_op_setcond_i32: | ||
56 | case INDEX_op_setcond_i64: | ||
57 | + case INDEX_op_negsetcond_i32: | ||
58 | + case INDEX_op_negsetcond_i64: | ||
59 | return C_O1_I2(r, r, rA); | ||
60 | |||
61 | case INDEX_op_mul_i32: | ||
62 | -- | ||
63 | 2.34.1 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Trivial, as we simply need to load a different constant | ||
2 | in the conditional move. | ||
3 | 1 | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | --- | ||
7 | tcg/arm/tcg-target.h | 2 +- | ||
8 | tcg/arm/tcg-target.c.inc | 9 +++++++++ | ||
9 | 2 files changed, 10 insertions(+), 1 deletion(-) | ||
10 | |||
11 | diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/tcg/arm/tcg-target.h | ||
14 | +++ b/tcg/arm/tcg-target.h | ||
15 | @@ -XXX,XX +XXX,XX @@ extern bool use_neon_instructions; | ||
16 | #define TCG_TARGET_HAS_sextract_i32 use_armv7_instructions | ||
17 | #define TCG_TARGET_HAS_extract2_i32 1 | ||
18 | #define TCG_TARGET_HAS_movcond_i32 1 | ||
19 | -#define TCG_TARGET_HAS_negsetcond_i32 0 | ||
20 | +#define TCG_TARGET_HAS_negsetcond_i32 1 | ||
21 | #define TCG_TARGET_HAS_mulu2_i32 1 | ||
22 | #define TCG_TARGET_HAS_muls2_i32 1 | ||
23 | #define TCG_TARGET_HAS_muluh_i32 0 | ||
24 | diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc | ||
25 | index XXXXXXX..XXXXXXX 100644 | ||
26 | --- a/tcg/arm/tcg-target.c.inc | ||
27 | +++ b/tcg/arm/tcg-target.c.inc | ||
28 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, | ||
29 | tcg_out_dat_imm(s, tcg_cond_to_arm_cond[tcg_invert_cond(args[3])], | ||
30 | ARITH_MOV, args[0], 0, 0); | ||
31 | break; | ||
32 | + case INDEX_op_negsetcond_i32: | ||
33 | + tcg_out_dat_rIN(s, COND_AL, ARITH_CMP, ARITH_CMN, 0, | ||
34 | + args[1], args[2], const_args[2]); | ||
35 | + tcg_out_dat_imm(s, tcg_cond_to_arm_cond[args[3]], | ||
36 | + ARITH_MVN, args[0], 0, 0); | ||
37 | + tcg_out_dat_imm(s, tcg_cond_to_arm_cond[tcg_invert_cond(args[3])], | ||
38 | + ARITH_MOV, args[0], 0, 0); | ||
39 | + break; | ||
40 | |||
41 | case INDEX_op_brcond2_i32: | ||
42 | c = tcg_out_cmp2(s, args, const_args); | ||
43 | @@ -XXX,XX +XXX,XX @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) | ||
44 | case INDEX_op_add_i32: | ||
45 | case INDEX_op_sub_i32: | ||
46 | case INDEX_op_setcond_i32: | ||
47 | + case INDEX_op_negsetcond_i32: | ||
48 | return C_O1_I2(r, r, rIN); | ||
49 | |||
50 | case INDEX_op_and_i32: | ||
51 | -- | ||
52 | 2.34.1 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> | ||
2 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
3 | --- | ||
4 | tcg/riscv/tcg-target.h | 4 ++-- | ||
5 | tcg/riscv/tcg-target.c.inc | 45 ++++++++++++++++++++++++++++++++++++++ | ||
6 | 2 files changed, 47 insertions(+), 2 deletions(-) | ||
7 | 1 | ||
8 | diff --git a/tcg/riscv/tcg-target.h b/tcg/riscv/tcg-target.h | ||
9 | index XXXXXXX..XXXXXXX 100644 | ||
10 | --- a/tcg/riscv/tcg-target.h | ||
11 | +++ b/tcg/riscv/tcg-target.h | ||
12 | @@ -XXX,XX +XXX,XX @@ extern bool have_zbb; | ||
13 | |||
14 | /* optional instructions */ | ||
15 | #define TCG_TARGET_HAS_movcond_i32 1 | ||
16 | -#define TCG_TARGET_HAS_negsetcond_i32 0 | ||
17 | +#define TCG_TARGET_HAS_negsetcond_i32 1 | ||
18 | #define TCG_TARGET_HAS_div_i32 1 | ||
19 | #define TCG_TARGET_HAS_rem_i32 1 | ||
20 | #define TCG_TARGET_HAS_div2_i32 0 | ||
21 | @@ -XXX,XX +XXX,XX @@ extern bool have_zbb; | ||
22 | #define TCG_TARGET_HAS_qemu_st8_i32 0 | ||
23 | |||
24 | #define TCG_TARGET_HAS_movcond_i64 1 | ||
25 | -#define TCG_TARGET_HAS_negsetcond_i64 0 | ||
26 | +#define TCG_TARGET_HAS_negsetcond_i64 1 | ||
27 | #define TCG_TARGET_HAS_div_i64 1 | ||
28 | #define TCG_TARGET_HAS_rem_i64 1 | ||
29 | #define TCG_TARGET_HAS_div2_i64 0 | ||
30 | diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc | ||
31 | index XXXXXXX..XXXXXXX 100644 | ||
32 | --- a/tcg/riscv/tcg-target.c.inc | ||
33 | +++ b/tcg/riscv/tcg-target.c.inc | ||
34 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_setcond(TCGContext *s, TCGCond cond, TCGReg ret, | ||
35 | } | ||
36 | } | ||
37 | |||
38 | +static void tcg_out_negsetcond(TCGContext *s, TCGCond cond, TCGReg ret, | ||
39 | + TCGReg arg1, tcg_target_long arg2, bool c2) | ||
40 | +{ | ||
41 | + int tmpflags; | ||
42 | + TCGReg tmp; | ||
43 | + | ||
44 | + /* For LT/GE comparison against 0, replicate the sign bit. */ | ||
45 | + if (c2 && arg2 == 0) { | ||
46 | + switch (cond) { | ||
47 | + case TCG_COND_GE: | ||
48 | + tcg_out_opc_imm(s, OPC_XORI, ret, arg1, -1); | ||
49 | + arg1 = ret; | ||
50 | + /* fall through */ | ||
51 | + case TCG_COND_LT: | ||
52 | + tcg_out_opc_imm(s, OPC_SRAI, ret, arg1, TCG_TARGET_REG_BITS - 1); | ||
53 | + return; | ||
54 | + default: | ||
55 | + break; | ||
56 | + } | ||
57 | + } | ||
58 | + | ||
59 | + tmpflags = tcg_out_setcond_int(s, cond, ret, arg1, arg2, c2); | ||
60 | + tmp = tmpflags & ~SETCOND_FLAGS; | ||
61 | + | ||
62 | + /* If intermediate result is zero/non-zero: test != 0. */ | ||
63 | + if (tmpflags & SETCOND_NEZ) { | ||
64 | + tcg_out_opc_reg(s, OPC_SLTU, ret, TCG_REG_ZERO, tmp); | ||
65 | + tmp = ret; | ||
66 | + } | ||
67 | + | ||
68 | + /* Produce the 0/-1 result. */ | ||
69 | + if (tmpflags & SETCOND_INV) { | ||
70 | + tcg_out_opc_imm(s, OPC_ADDI, ret, tmp, -1); | ||
71 | + } else { | ||
72 | + tcg_out_opc_reg(s, OPC_SUB, ret, TCG_REG_ZERO, tmp); | ||
73 | + } | ||
74 | +} | ||
75 | + | ||
76 | static void tcg_out_movcond_zicond(TCGContext *s, TCGReg ret, TCGReg test_ne, | ||
77 | int val1, bool c_val1, | ||
78 | int val2, bool c_val2) | ||
79 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, | ||
80 | tcg_out_setcond(s, args[3], a0, a1, a2, c2); | ||
81 | break; | ||
82 | |||
83 | + case INDEX_op_negsetcond_i32: | ||
84 | + case INDEX_op_negsetcond_i64: | ||
85 | + tcg_out_negsetcond(s, args[3], a0, a1, a2, c2); | ||
86 | + break; | ||
87 | + | ||
88 | case INDEX_op_movcond_i32: | ||
89 | case INDEX_op_movcond_i64: | ||
90 | tcg_out_movcond(s, args[5], a0, a1, a2, c2, | ||
91 | @@ -XXX,XX +XXX,XX @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) | ||
92 | case INDEX_op_xor_i64: | ||
93 | case INDEX_op_setcond_i32: | ||
94 | case INDEX_op_setcond_i64: | ||
95 | + case INDEX_op_negsetcond_i32: | ||
96 | + case INDEX_op_negsetcond_i64: | ||
97 | return C_O1_I2(r, r, rI); | ||
98 | |||
99 | case INDEX_op_andc_i32: | ||
100 | -- | ||
101 | 2.34.1 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
2 | --- | ||
3 | tcg/s390x/tcg-target.h | 4 +- | ||
4 | tcg/s390x/tcg-target.c.inc | 78 +++++++++++++++++++++++++------------- | ||
5 | 2 files changed, 54 insertions(+), 28 deletions(-) | ||
6 | 1 | ||
7 | diff --git a/tcg/s390x/tcg-target.h b/tcg/s390x/tcg-target.h | ||
8 | index XXXXXXX..XXXXXXX 100644 | ||
9 | --- a/tcg/s390x/tcg-target.h | ||
10 | +++ b/tcg/s390x/tcg-target.h | ||
11 | @@ -XXX,XX +XXX,XX @@ extern uint64_t s390_facilities[3]; | ||
12 | #define TCG_TARGET_HAS_sextract_i32 0 | ||
13 | #define TCG_TARGET_HAS_extract2_i32 0 | ||
14 | #define TCG_TARGET_HAS_movcond_i32 1 | ||
15 | -#define TCG_TARGET_HAS_negsetcond_i32 0 | ||
16 | +#define TCG_TARGET_HAS_negsetcond_i32 1 | ||
17 | #define TCG_TARGET_HAS_add2_i32 1 | ||
18 | #define TCG_TARGET_HAS_sub2_i32 1 | ||
19 | #define TCG_TARGET_HAS_mulu2_i32 0 | ||
20 | @@ -XXX,XX +XXX,XX @@ extern uint64_t s390_facilities[3]; | ||
21 | #define TCG_TARGET_HAS_sextract_i64 0 | ||
22 | #define TCG_TARGET_HAS_extract2_i64 0 | ||
23 | #define TCG_TARGET_HAS_movcond_i64 1 | ||
24 | -#define TCG_TARGET_HAS_negsetcond_i64 0 | ||
25 | +#define TCG_TARGET_HAS_negsetcond_i64 1 | ||
26 | #define TCG_TARGET_HAS_add2_i64 1 | ||
27 | #define TCG_TARGET_HAS_sub2_i64 1 | ||
28 | #define TCG_TARGET_HAS_mulu2_i64 1 | ||
29 | diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc | ||
30 | index XXXXXXX..XXXXXXX 100644 | ||
31 | --- a/tcg/s390x/tcg-target.c.inc | ||
32 | +++ b/tcg/s390x/tcg-target.c.inc | ||
33 | @@ -XXX,XX +XXX,XX @@ static int tgen_cmp(TCGContext *s, TCGType type, TCGCond c, TCGReg r1, | ||
34 | } | ||
35 | |||
36 | static void tgen_setcond(TCGContext *s, TCGType type, TCGCond cond, | ||
37 | - TCGReg dest, TCGReg c1, TCGArg c2, int c2const) | ||
38 | + TCGReg dest, TCGReg c1, TCGArg c2, | ||
39 | + bool c2const, bool neg) | ||
40 | { | ||
41 | int cc; | ||
42 | |||
43 | @@ -XXX,XX +XXX,XX @@ static void tgen_setcond(TCGContext *s, TCGType type, TCGCond cond, | ||
44 | /* Emit: d = 0, d = (cc ? 1 : d). */ | ||
45 | cc = tgen_cmp(s, type, cond, c1, c2, c2const, false); | ||
46 | tcg_out_movi(s, TCG_TYPE_I64, dest, 0); | ||
47 | - tcg_out_insn(s, RIEg, LOCGHI, dest, 1, cc); | ||
48 | + tcg_out_insn(s, RIEg, LOCGHI, dest, neg ? -1 : 1, cc); | ||
49 | return; | ||
50 | } | ||
51 | |||
52 | - restart: | ||
53 | + switch (cond) { | ||
54 | + case TCG_COND_GEU: | ||
55 | + case TCG_COND_LTU: | ||
56 | + case TCG_COND_LT: | ||
57 | + case TCG_COND_GE: | ||
58 | + /* Swap operands so that we can use LEU/GTU/GT/LE. */ | ||
59 | + if (!c2const) { | ||
60 | + TCGReg t = c1; | ||
61 | + c1 = c2; | ||
62 | + c2 = t; | ||
63 | + cond = tcg_swap_cond(cond); | ||
64 | + } | ||
65 | + break; | ||
66 | + default: | ||
67 | + break; | ||
68 | + } | ||
69 | + | ||
70 | switch (cond) { | ||
71 | case TCG_COND_NE: | ||
72 | /* X != 0 is X > 0. */ | ||
73 | @@ -XXX,XX +XXX,XX @@ static void tgen_setcond(TCGContext *s, TCGType type, TCGCond cond, | ||
74 | |||
75 | case TCG_COND_GTU: | ||
76 | case TCG_COND_GT: | ||
77 | - /* The result of a compare has CC=2 for GT and CC=3 unused. | ||
78 | - ADD LOGICAL WITH CARRY considers (CC & 2) the carry bit. */ | ||
79 | + /* | ||
80 | + * The result of a compare has CC=2 for GT and CC=3 unused. | ||
81 | + * ADD LOGICAL WITH CARRY considers (CC & 2) the carry bit. | ||
82 | + */ | ||
83 | tgen_cmp(s, type, cond, c1, c2, c2const, true); | ||
84 | tcg_out_movi(s, type, dest, 0); | ||
85 | tcg_out_insn(s, RRE, ALCGR, dest, dest); | ||
86 | + if (neg) { | ||
87 | + if (type == TCG_TYPE_I32) { | ||
88 | + tcg_out_insn(s, RR, LCR, dest, dest); | ||
89 | + } else { | ||
90 | + tcg_out_insn(s, RRE, LCGR, dest, dest); | ||
91 | + } | ||
92 | + } | ||
93 | return; | ||
94 | |||
95 | case TCG_COND_EQ: | ||
96 | @@ -XXX,XX +XXX,XX @@ static void tgen_setcond(TCGContext *s, TCGType type, TCGCond cond, | ||
97 | |||
98 | case TCG_COND_LEU: | ||
99 | case TCG_COND_LE: | ||
100 | - /* As above, but we're looking for borrow, or !carry. | ||
101 | - The second insn computes d - d - borrow, or -1 for true | ||
102 | - and 0 for false. So we must mask to 1 bit afterward. */ | ||
103 | + /* | ||
104 | + * As above, but we're looking for borrow, or !carry. | ||
105 | + * The second insn computes d - d - borrow, or -1 for true | ||
106 | + * and 0 for false. So we must mask to 1 bit afterward. | ||
107 | + */ | ||
108 | tgen_cmp(s, type, cond, c1, c2, c2const, true); | ||
109 | tcg_out_insn(s, RRE, SLBGR, dest, dest); | ||
110 | - tgen_andi(s, type, dest, 1); | ||
111 | - return; | ||
112 | - | ||
113 | - case TCG_COND_GEU: | ||
114 | - case TCG_COND_LTU: | ||
115 | - case TCG_COND_LT: | ||
116 | - case TCG_COND_GE: | ||
117 | - /* Swap operands so that we can use LEU/GTU/GT/LE. */ | ||
118 | - if (!c2const) { | ||
119 | - TCGReg t = c1; | ||
120 | - c1 = c2; | ||
121 | - c2 = t; | ||
122 | - cond = tcg_swap_cond(cond); | ||
123 | - goto restart; | ||
124 | + if (!neg) { | ||
125 | + tgen_andi(s, type, dest, 1); | ||
126 | } | ||
127 | - break; | ||
128 | + return; | ||
129 | |||
130 | default: | ||
131 | g_assert_not_reached(); | ||
132 | @@ -XXX,XX +XXX,XX @@ static void tgen_setcond(TCGContext *s, TCGType type, TCGCond cond, | ||
133 | cc = tgen_cmp(s, type, cond, c1, c2, c2const, false); | ||
134 | /* Emit: d = 0, t = 1, d = (cc ? t : d). */ | ||
135 | tcg_out_movi(s, TCG_TYPE_I64, dest, 0); | ||
136 | - tcg_out_movi(s, TCG_TYPE_I64, TCG_TMP0, 1); | ||
137 | + tcg_out_movi(s, TCG_TYPE_I64, TCG_TMP0, neg ? -1 : 1); | ||
138 | tcg_out_insn(s, RRFc, LOCGR, dest, TCG_TMP0, cc); | ||
139 | } | ||
140 | |||
141 | @@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, | ||
142 | break; | ||
143 | case INDEX_op_setcond_i32: | ||
144 | tgen_setcond(s, TCG_TYPE_I32, args[3], args[0], args[1], | ||
145 | - args[2], const_args[2]); | ||
146 | + args[2], const_args[2], false); | ||
147 | + break; | ||
148 | + case INDEX_op_negsetcond_i32: | ||
149 | + tgen_setcond(s, TCG_TYPE_I32, args[3], args[0], args[1], | ||
150 | + args[2], const_args[2], true); | ||
151 | break; | ||
152 | case INDEX_op_movcond_i32: | ||
153 | tgen_movcond(s, TCG_TYPE_I32, args[5], args[0], args[1], | ||
154 | @@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, | ||
155 | break; | ||
156 | case INDEX_op_setcond_i64: | ||
157 | tgen_setcond(s, TCG_TYPE_I64, args[3], args[0], args[1], | ||
158 | - args[2], const_args[2]); | ||
159 | + args[2], const_args[2], false); | ||
160 | + break; | ||
161 | + case INDEX_op_negsetcond_i64: | ||
162 | + tgen_setcond(s, TCG_TYPE_I64, args[3], args[0], args[1], | ||
163 | + args[2], const_args[2], true); | ||
164 | break; | ||
165 | case INDEX_op_movcond_i64: | ||
166 | tgen_movcond(s, TCG_TYPE_I64, args[5], args[0], args[1], | ||
167 | @@ -XXX,XX +XXX,XX @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) | ||
168 | case INDEX_op_rotr_i32: | ||
169 | case INDEX_op_rotr_i64: | ||
170 | case INDEX_op_setcond_i32: | ||
171 | + case INDEX_op_negsetcond_i32: | ||
172 | return C_O1_I2(r, r, ri); | ||
173 | case INDEX_op_setcond_i64: | ||
174 | + case INDEX_op_negsetcond_i64: | ||
175 | return C_O1_I2(r, r, rA); | ||
176 | |||
177 | case INDEX_op_clz_i64: | ||
178 | -- | ||
179 | 2.34.1 | 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 | tcg/sparc64/tcg-target.h | 4 ++-- | ||
5 | tcg/sparc64/tcg-target.c.inc | 40 +++++++++++++++++++++++++++--------- | ||
6 | 2 files changed, 32 insertions(+), 12 deletions(-) | ||
7 | 1 | ||
8 | diff --git a/tcg/sparc64/tcg-target.h b/tcg/sparc64/tcg-target.h | ||
9 | index XXXXXXX..XXXXXXX 100644 | ||
10 | --- a/tcg/sparc64/tcg-target.h | ||
11 | +++ b/tcg/sparc64/tcg-target.h | ||
12 | @@ -XXX,XX +XXX,XX @@ extern bool use_vis3_instructions; | ||
13 | #define TCG_TARGET_HAS_sextract_i32 0 | ||
14 | #define TCG_TARGET_HAS_extract2_i32 0 | ||
15 | #define TCG_TARGET_HAS_movcond_i32 1 | ||
16 | -#define TCG_TARGET_HAS_negsetcond_i32 0 | ||
17 | +#define TCG_TARGET_HAS_negsetcond_i32 1 | ||
18 | #define TCG_TARGET_HAS_add2_i32 1 | ||
19 | #define TCG_TARGET_HAS_sub2_i32 1 | ||
20 | #define TCG_TARGET_HAS_mulu2_i32 1 | ||
21 | @@ -XXX,XX +XXX,XX @@ extern bool use_vis3_instructions; | ||
22 | #define TCG_TARGET_HAS_sextract_i64 0 | ||
23 | #define TCG_TARGET_HAS_extract2_i64 0 | ||
24 | #define TCG_TARGET_HAS_movcond_i64 1 | ||
25 | -#define TCG_TARGET_HAS_negsetcond_i64 0 | ||
26 | +#define TCG_TARGET_HAS_negsetcond_i64 1 | ||
27 | #define TCG_TARGET_HAS_add2_i64 1 | ||
28 | #define TCG_TARGET_HAS_sub2_i64 1 | ||
29 | #define TCG_TARGET_HAS_mulu2_i64 0 | ||
30 | diff --git a/tcg/sparc64/tcg-target.c.inc b/tcg/sparc64/tcg-target.c.inc | ||
31 | index XXXXXXX..XXXXXXX 100644 | ||
32 | --- a/tcg/sparc64/tcg-target.c.inc | ||
33 | +++ b/tcg/sparc64/tcg-target.c.inc | ||
34 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_movcond_i64(TCGContext *s, TCGCond cond, TCGReg ret, | ||
35 | } | ||
36 | |||
37 | static void tcg_out_setcond_i32(TCGContext *s, TCGCond cond, TCGReg ret, | ||
38 | - TCGReg c1, int32_t c2, int c2const) | ||
39 | + TCGReg c1, int32_t c2, int c2const, bool neg) | ||
40 | { | ||
41 | /* For 32-bit comparisons, we can play games with ADDC/SUBC. */ | ||
42 | switch (cond) { | ||
43 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_setcond_i32(TCGContext *s, TCGCond cond, TCGReg ret, | ||
44 | default: | ||
45 | tcg_out_cmp(s, c1, c2, c2const); | ||
46 | tcg_out_movi_s13(s, ret, 0); | ||
47 | - tcg_out_movcc(s, cond, MOVCC_ICC, ret, 1, 1); | ||
48 | + tcg_out_movcc(s, cond, MOVCC_ICC, ret, neg ? -1 : 1, 1); | ||
49 | return; | ||
50 | } | ||
51 | |||
52 | tcg_out_cmp(s, c1, c2, c2const); | ||
53 | if (cond == TCG_COND_LTU) { | ||
54 | - tcg_out_arithi(s, ret, TCG_REG_G0, 0, ARITH_ADDC); | ||
55 | + if (neg) { | ||
56 | + /* 0 - 0 - C = -C = (C ? -1 : 0) */ | ||
57 | + tcg_out_arithi(s, ret, TCG_REG_G0, 0, ARITH_SUBC); | ||
58 | + } else { | ||
59 | + /* 0 + 0 + C = C = (C ? 1 : 0) */ | ||
60 | + tcg_out_arithi(s, ret, TCG_REG_G0, 0, ARITH_ADDC); | ||
61 | + } | ||
62 | } else { | ||
63 | - tcg_out_arithi(s, ret, TCG_REG_G0, -1, ARITH_SUBC); | ||
64 | + if (neg) { | ||
65 | + /* 0 + -1 + C = C - 1 = (C ? 0 : -1) */ | ||
66 | + tcg_out_arithi(s, ret, TCG_REG_G0, -1, ARITH_ADDC); | ||
67 | + } else { | ||
68 | + /* 0 - -1 - C = 1 - C = (C ? 0 : 1) */ | ||
69 | + tcg_out_arithi(s, ret, TCG_REG_G0, -1, ARITH_SUBC); | ||
70 | + } | ||
71 | } | ||
72 | } | ||
73 | |||
74 | static void tcg_out_setcond_i64(TCGContext *s, TCGCond cond, TCGReg ret, | ||
75 | - TCGReg c1, int32_t c2, int c2const) | ||
76 | + TCGReg c1, int32_t c2, int c2const, bool neg) | ||
77 | { | ||
78 | - if (use_vis3_instructions) { | ||
79 | + if (use_vis3_instructions && !neg) { | ||
80 | switch (cond) { | ||
81 | case TCG_COND_NE: | ||
82 | if (c2 != 0) { | ||
83 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_setcond_i64(TCGContext *s, TCGCond cond, TCGReg ret, | ||
84 | if the input does not overlap the output. */ | ||
85 | if (c2 == 0 && !is_unsigned_cond(cond) && c1 != ret) { | ||
86 | tcg_out_movi_s13(s, ret, 0); | ||
87 | - tcg_out_movr(s, cond, ret, c1, 1, 1); | ||
88 | + tcg_out_movr(s, cond, ret, c1, neg ? -1 : 1, 1); | ||
89 | } else { | ||
90 | tcg_out_cmp(s, c1, c2, c2const); | ||
91 | tcg_out_movi_s13(s, ret, 0); | ||
92 | - tcg_out_movcc(s, cond, MOVCC_XCC, ret, 1, 1); | ||
93 | + tcg_out_movcc(s, cond, MOVCC_XCC, ret, neg ? -1 : 1, 1); | ||
94 | } | ||
95 | } | ||
96 | |||
97 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, | ||
98 | tcg_out_brcond_i32(s, a2, a0, a1, const_args[1], arg_label(args[3])); | ||
99 | break; | ||
100 | case INDEX_op_setcond_i32: | ||
101 | - tcg_out_setcond_i32(s, args[3], a0, a1, a2, c2); | ||
102 | + tcg_out_setcond_i32(s, args[3], a0, a1, a2, c2, false); | ||
103 | + break; | ||
104 | + case INDEX_op_negsetcond_i32: | ||
105 | + tcg_out_setcond_i32(s, args[3], a0, a1, a2, c2, true); | ||
106 | break; | ||
107 | case INDEX_op_movcond_i32: | ||
108 | tcg_out_movcond_i32(s, args[5], a0, a1, a2, c2, args[3], const_args[3]); | ||
109 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, | ||
110 | tcg_out_brcond_i64(s, a2, a0, a1, const_args[1], arg_label(args[3])); | ||
111 | break; | ||
112 | case INDEX_op_setcond_i64: | ||
113 | - tcg_out_setcond_i64(s, args[3], a0, a1, a2, c2); | ||
114 | + tcg_out_setcond_i64(s, args[3], a0, a1, a2, c2, false); | ||
115 | + break; | ||
116 | + case INDEX_op_negsetcond_i64: | ||
117 | + tcg_out_setcond_i64(s, args[3], a0, a1, a2, c2, true); | ||
118 | break; | ||
119 | case INDEX_op_movcond_i64: | ||
120 | tcg_out_movcond_i64(s, args[5], a0, a1, a2, c2, args[3], const_args[3]); | ||
121 | @@ -XXX,XX +XXX,XX @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) | ||
122 | case INDEX_op_sar_i64: | ||
123 | case INDEX_op_setcond_i32: | ||
124 | case INDEX_op_setcond_i64: | ||
125 | + case INDEX_op_negsetcond_i32: | ||
126 | + case INDEX_op_negsetcond_i64: | ||
127 | return C_O1_I2(r, rZ, rJ); | ||
128 | |||
129 | case INDEX_op_brcond_i32: | ||
130 | -- | ||
131 | 2.34.1 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Pass a rexw parameter instead of duplicating the functions. | ||
2 | 1 | ||
3 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | --- | ||
7 | tcg/i386/tcg-target.c.inc | 110 +++++++++++++++++--------------------- | ||
8 | 1 file changed, 49 insertions(+), 61 deletions(-) | ||
9 | |||
10 | diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc | ||
11 | index XXXXXXX..XXXXXXX 100644 | ||
12 | --- a/tcg/i386/tcg-target.c.inc | ||
13 | +++ b/tcg/i386/tcg-target.c.inc | ||
14 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_cmp(TCGContext *s, TCGArg arg1, TCGArg arg2, | ||
15 | } | ||
16 | } | ||
17 | |||
18 | -static void tcg_out_brcond32(TCGContext *s, TCGCond cond, | ||
19 | - TCGArg arg1, TCGArg arg2, int const_arg2, | ||
20 | - TCGLabel *label, int small) | ||
21 | +static void tcg_out_brcond(TCGContext *s, int rexw, TCGCond cond, | ||
22 | + TCGArg arg1, TCGArg arg2, int const_arg2, | ||
23 | + TCGLabel *label, bool small) | ||
24 | { | ||
25 | - tcg_out_cmp(s, arg1, arg2, const_arg2, 0); | ||
26 | + tcg_out_cmp(s, arg1, arg2, const_arg2, rexw); | ||
27 | tcg_out_jxx(s, tcg_cond_to_jcc[cond], label, small); | ||
28 | } | ||
29 | |||
30 | -#if TCG_TARGET_REG_BITS == 64 | ||
31 | -static void tcg_out_brcond64(TCGContext *s, TCGCond cond, | ||
32 | - TCGArg arg1, TCGArg arg2, int const_arg2, | ||
33 | - TCGLabel *label, int small) | ||
34 | -{ | ||
35 | - tcg_out_cmp(s, arg1, arg2, const_arg2, P_REXW); | ||
36 | - tcg_out_jxx(s, tcg_cond_to_jcc[cond], label, small); | ||
37 | -} | ||
38 | -#else | ||
39 | -/* XXX: we implement it at the target level to avoid having to | ||
40 | - handle cross basic blocks temporaries */ | ||
41 | +#if TCG_TARGET_REG_BITS == 32 | ||
42 | static void tcg_out_brcond2(TCGContext *s, const TCGArg *args, | ||
43 | - const int *const_args, int small) | ||
44 | + const int *const_args, bool small) | ||
45 | { | ||
46 | TCGLabel *label_next = gen_new_label(); | ||
47 | TCGLabel *label_this = arg_label(args[5]); | ||
48 | |||
49 | switch(args[4]) { | ||
50 | case TCG_COND_EQ: | ||
51 | - tcg_out_brcond32(s, TCG_COND_NE, args[0], args[2], const_args[2], | ||
52 | - label_next, 1); | ||
53 | - tcg_out_brcond32(s, TCG_COND_EQ, args[1], args[3], const_args[3], | ||
54 | - label_this, small); | ||
55 | + tcg_out_brcond(s, 0, TCG_COND_NE, args[0], args[2], const_args[2], | ||
56 | + label_next, 1); | ||
57 | + tcg_out_brcond(s, 0, TCG_COND_EQ, args[1], args[3], const_args[3], | ||
58 | + label_this, small); | ||
59 | break; | ||
60 | case TCG_COND_NE: | ||
61 | - tcg_out_brcond32(s, TCG_COND_NE, args[0], args[2], const_args[2], | ||
62 | - label_this, small); | ||
63 | - tcg_out_brcond32(s, TCG_COND_NE, args[1], args[3], const_args[3], | ||
64 | - label_this, small); | ||
65 | + tcg_out_brcond(s, 0, TCG_COND_NE, args[0], args[2], const_args[2], | ||
66 | + label_this, small); | ||
67 | + tcg_out_brcond(s, 0, TCG_COND_NE, args[1], args[3], const_args[3], | ||
68 | + label_this, small); | ||
69 | break; | ||
70 | case TCG_COND_LT: | ||
71 | - tcg_out_brcond32(s, TCG_COND_LT, args[1], args[3], const_args[3], | ||
72 | - label_this, small); | ||
73 | + tcg_out_brcond(s, 0, TCG_COND_LT, args[1], args[3], const_args[3], | ||
74 | + label_this, small); | ||
75 | tcg_out_jxx(s, JCC_JNE, label_next, 1); | ||
76 | - tcg_out_brcond32(s, TCG_COND_LTU, args[0], args[2], const_args[2], | ||
77 | - label_this, small); | ||
78 | + tcg_out_brcond(s, 0, TCG_COND_LTU, args[0], args[2], const_args[2], | ||
79 | + label_this, small); | ||
80 | break; | ||
81 | case TCG_COND_LE: | ||
82 | - tcg_out_brcond32(s, TCG_COND_LT, args[1], args[3], const_args[3], | ||
83 | - label_this, small); | ||
84 | + tcg_out_brcond(s, 0, TCG_COND_LT, args[1], args[3], const_args[3], | ||
85 | + label_this, small); | ||
86 | tcg_out_jxx(s, JCC_JNE, label_next, 1); | ||
87 | - tcg_out_brcond32(s, TCG_COND_LEU, args[0], args[2], const_args[2], | ||
88 | - label_this, small); | ||
89 | + tcg_out_brcond(s, 0, TCG_COND_LEU, args[0], args[2], const_args[2], | ||
90 | + label_this, small); | ||
91 | break; | ||
92 | case TCG_COND_GT: | ||
93 | - tcg_out_brcond32(s, TCG_COND_GT, args[1], args[3], const_args[3], | ||
94 | - label_this, small); | ||
95 | + tcg_out_brcond(s, 0, TCG_COND_GT, args[1], args[3], const_args[3], | ||
96 | + label_this, small); | ||
97 | tcg_out_jxx(s, JCC_JNE, label_next, 1); | ||
98 | - tcg_out_brcond32(s, TCG_COND_GTU, args[0], args[2], const_args[2], | ||
99 | - label_this, small); | ||
100 | + tcg_out_brcond(s, 0, TCG_COND_GTU, args[0], args[2], const_args[2], | ||
101 | + label_this, small); | ||
102 | break; | ||
103 | case TCG_COND_GE: | ||
104 | - tcg_out_brcond32(s, TCG_COND_GT, args[1], args[3], const_args[3], | ||
105 | - label_this, small); | ||
106 | + tcg_out_brcond(s, 0, TCG_COND_GT, args[1], args[3], const_args[3], | ||
107 | + label_this, small); | ||
108 | tcg_out_jxx(s, JCC_JNE, label_next, 1); | ||
109 | - tcg_out_brcond32(s, TCG_COND_GEU, args[0], args[2], const_args[2], | ||
110 | - label_this, small); | ||
111 | + tcg_out_brcond(s, 0, TCG_COND_GEU, args[0], args[2], const_args[2], | ||
112 | + label_this, small); | ||
113 | break; | ||
114 | case TCG_COND_LTU: | ||
115 | - tcg_out_brcond32(s, TCG_COND_LTU, args[1], args[3], const_args[3], | ||
116 | - label_this, small); | ||
117 | + tcg_out_brcond(s, 0, TCG_COND_LTU, args[1], args[3], const_args[3], | ||
118 | + label_this, small); | ||
119 | tcg_out_jxx(s, JCC_JNE, label_next, 1); | ||
120 | - tcg_out_brcond32(s, TCG_COND_LTU, args[0], args[2], const_args[2], | ||
121 | - label_this, small); | ||
122 | + tcg_out_brcond(s, 0, TCG_COND_LTU, args[0], args[2], const_args[2], | ||
123 | + label_this, small); | ||
124 | break; | ||
125 | case TCG_COND_LEU: | ||
126 | - tcg_out_brcond32(s, TCG_COND_LTU, args[1], args[3], const_args[3], | ||
127 | - label_this, small); | ||
128 | + tcg_out_brcond(s, 0, TCG_COND_LTU, args[1], args[3], const_args[3], | ||
129 | + label_this, small); | ||
130 | tcg_out_jxx(s, JCC_JNE, label_next, 1); | ||
131 | - tcg_out_brcond32(s, TCG_COND_LEU, args[0], args[2], const_args[2], | ||
132 | - label_this, small); | ||
133 | + tcg_out_brcond(s, 0, TCG_COND_LEU, args[0], args[2], const_args[2], | ||
134 | + label_this, small); | ||
135 | break; | ||
136 | case TCG_COND_GTU: | ||
137 | - tcg_out_brcond32(s, TCG_COND_GTU, args[1], args[3], const_args[3], | ||
138 | - label_this, small); | ||
139 | + tcg_out_brcond(s, 0, TCG_COND_GTU, args[1], args[3], const_args[3], | ||
140 | + label_this, small); | ||
141 | tcg_out_jxx(s, JCC_JNE, label_next, 1); | ||
142 | - tcg_out_brcond32(s, TCG_COND_GTU, args[0], args[2], const_args[2], | ||
143 | - label_this, small); | ||
144 | + tcg_out_brcond(s, 0, TCG_COND_GTU, args[0], args[2], const_args[2], | ||
145 | + label_this, small); | ||
146 | break; | ||
147 | case TCG_COND_GEU: | ||
148 | - tcg_out_brcond32(s, TCG_COND_GTU, args[1], args[3], const_args[3], | ||
149 | - label_this, small); | ||
150 | + tcg_out_brcond(s, 0, TCG_COND_GTU, args[1], args[3], const_args[3], | ||
151 | + label_this, small); | ||
152 | tcg_out_jxx(s, JCC_JNE, label_next, 1); | ||
153 | - tcg_out_brcond32(s, TCG_COND_GEU, args[0], args[2], const_args[2], | ||
154 | - label_this, small); | ||
155 | + tcg_out_brcond(s, 0, TCG_COND_GEU, args[0], args[2], const_args[2], | ||
156 | + label_this, small); | ||
157 | break; | ||
158 | default: | ||
159 | g_assert_not_reached(); | ||
160 | @@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, | ||
161 | tcg_out_modrm(s, OPC_POPCNT + rexw, a0, a1); | ||
162 | break; | ||
163 | |||
164 | - case INDEX_op_brcond_i32: | ||
165 | - tcg_out_brcond32(s, a2, a0, a1, const_args[1], arg_label(args[3]), 0); | ||
166 | + OP_32_64(brcond): | ||
167 | + tcg_out_brcond(s, rexw, a2, a0, a1, const_args[1], | ||
168 | + arg_label(args[3]), 0); | ||
169 | break; | ||
170 | case INDEX_op_setcond_i32: | ||
171 | tcg_out_setcond32(s, args[3], a0, a1, a2, const_a2); | ||
172 | @@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, | ||
173 | } | ||
174 | break; | ||
175 | |||
176 | - case INDEX_op_brcond_i64: | ||
177 | - tcg_out_brcond64(s, a2, a0, a1, const_args[1], arg_label(args[3]), 0); | ||
178 | - break; | ||
179 | case INDEX_op_setcond_i64: | ||
180 | tcg_out_setcond64(s, args[3], a0, a1, a2, const_a2); | ||
181 | break; | ||
182 | -- | ||
183 | 2.34.1 | ||
184 | |||
185 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Pass a rexw parameter instead of duplicating the functions. | ||
2 | 1 | ||
3 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | --- | ||
7 | tcg/i386/tcg-target.c.inc | 24 +++++++----------------- | ||
8 | 1 file changed, 7 insertions(+), 17 deletions(-) | ||
9 | |||
10 | diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc | ||
11 | index XXXXXXX..XXXXXXX 100644 | ||
12 | --- a/tcg/i386/tcg-target.c.inc | ||
13 | +++ b/tcg/i386/tcg-target.c.inc | ||
14 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_brcond2(TCGContext *s, const TCGArg *args, | ||
15 | } | ||
16 | #endif | ||
17 | |||
18 | -static void tcg_out_setcond32(TCGContext *s, TCGCond cond, TCGArg dest, | ||
19 | - TCGArg arg1, TCGArg arg2, int const_arg2) | ||
20 | +static void tcg_out_setcond(TCGContext *s, int rexw, TCGCond cond, | ||
21 | + TCGArg dest, TCGArg arg1, TCGArg arg2, | ||
22 | + int const_arg2) | ||
23 | { | ||
24 | - tcg_out_cmp(s, arg1, arg2, const_arg2, 0); | ||
25 | + tcg_out_cmp(s, arg1, arg2, const_arg2, rexw); | ||
26 | tcg_out_modrm(s, OPC_SETCC | tcg_cond_to_jcc[cond], 0, dest); | ||
27 | tcg_out_ext8u(s, dest, dest); | ||
28 | } | ||
29 | |||
30 | -#if TCG_TARGET_REG_BITS == 64 | ||
31 | -static void tcg_out_setcond64(TCGContext *s, TCGCond cond, TCGArg dest, | ||
32 | - TCGArg arg1, TCGArg arg2, int const_arg2) | ||
33 | -{ | ||
34 | - tcg_out_cmp(s, arg1, arg2, const_arg2, P_REXW); | ||
35 | - tcg_out_modrm(s, OPC_SETCC | tcg_cond_to_jcc[cond], 0, dest); | ||
36 | - tcg_out_ext8u(s, dest, dest); | ||
37 | -} | ||
38 | -#else | ||
39 | +#if TCG_TARGET_REG_BITS == 32 | ||
40 | static void tcg_out_setcond2(TCGContext *s, const TCGArg *args, | ||
41 | const int *const_args) | ||
42 | { | ||
43 | @@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, | ||
44 | tcg_out_brcond(s, rexw, a2, a0, a1, const_args[1], | ||
45 | arg_label(args[3]), 0); | ||
46 | break; | ||
47 | - case INDEX_op_setcond_i32: | ||
48 | - tcg_out_setcond32(s, args[3], a0, a1, a2, const_a2); | ||
49 | + OP_32_64(setcond): | ||
50 | + tcg_out_setcond(s, rexw, args[3], a0, a1, a2, const_a2); | ||
51 | break; | ||
52 | case INDEX_op_movcond_i32: | ||
53 | tcg_out_movcond32(s, args[5], a0, a1, a2, const_a2, args[3]); | ||
54 | @@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, | ||
55 | } | ||
56 | break; | ||
57 | |||
58 | - case INDEX_op_setcond_i64: | ||
59 | - tcg_out_setcond64(s, args[3], a0, a1, a2, const_a2); | ||
60 | - break; | ||
61 | case INDEX_op_movcond_i64: | ||
62 | tcg_out_movcond64(s, args[5], a0, a1, a2, const_a2, args[3]); | ||
63 | break; | ||
64 | -- | ||
65 | 2.34.1 | ||
66 | |||
67 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Pass a rexw parameter instead of duplicating the functions. | ||
2 | 1 | ||
3 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | --- | ||
7 | tcg/i386/tcg-target.c.inc | 28 +++++++--------------------- | ||
8 | 1 file changed, 7 insertions(+), 21 deletions(-) | ||
9 | |||
10 | diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc | ||
11 | index XXXXXXX..XXXXXXX 100644 | ||
12 | --- a/tcg/i386/tcg-target.c.inc | ||
13 | +++ b/tcg/i386/tcg-target.c.inc | ||
14 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_cmov(TCGContext *s, TCGCond cond, int rexw, | ||
15 | } | ||
16 | } | ||
17 | |||
18 | -static void tcg_out_movcond32(TCGContext *s, TCGCond cond, TCGReg dest, | ||
19 | - TCGReg c1, TCGArg c2, int const_c2, | ||
20 | - TCGReg v1) | ||
21 | +static void tcg_out_movcond(TCGContext *s, int rexw, TCGCond cond, | ||
22 | + TCGReg dest, TCGReg c1, TCGArg c2, int const_c2, | ||
23 | + TCGReg v1) | ||
24 | { | ||
25 | - tcg_out_cmp(s, c1, c2, const_c2, 0); | ||
26 | - tcg_out_cmov(s, cond, 0, dest, v1); | ||
27 | + tcg_out_cmp(s, c1, c2, const_c2, rexw); | ||
28 | + tcg_out_cmov(s, cond, rexw, dest, v1); | ||
29 | } | ||
30 | |||
31 | -#if TCG_TARGET_REG_BITS == 64 | ||
32 | -static void tcg_out_movcond64(TCGContext *s, TCGCond cond, TCGReg dest, | ||
33 | - TCGReg c1, TCGArg c2, int const_c2, | ||
34 | - TCGReg v1) | ||
35 | -{ | ||
36 | - tcg_out_cmp(s, c1, c2, const_c2, P_REXW); | ||
37 | - tcg_out_cmov(s, cond, P_REXW, dest, v1); | ||
38 | -} | ||
39 | -#endif | ||
40 | - | ||
41 | static void tcg_out_ctz(TCGContext *s, int rexw, TCGReg dest, TCGReg arg1, | ||
42 | TCGArg arg2, bool const_a2) | ||
43 | { | ||
44 | @@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, | ||
45 | OP_32_64(setcond): | ||
46 | tcg_out_setcond(s, rexw, args[3], a0, a1, a2, const_a2); | ||
47 | break; | ||
48 | - case INDEX_op_movcond_i32: | ||
49 | - tcg_out_movcond32(s, args[5], a0, a1, a2, const_a2, args[3]); | ||
50 | + OP_32_64(movcond): | ||
51 | + tcg_out_movcond(s, rexw, args[5], a0, a1, a2, const_a2, args[3]); | ||
52 | break; | ||
53 | |||
54 | OP_32_64(bswap16): | ||
55 | @@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, | ||
56 | } | ||
57 | break; | ||
58 | |||
59 | - case INDEX_op_movcond_i64: | ||
60 | - tcg_out_movcond64(s, args[5], a0, a1, a2, const_a2, args[3]); | ||
61 | - break; | ||
62 | - | ||
63 | case INDEX_op_bswap64_i64: | ||
64 | tcg_out_bswap64(s, a0); | ||
65 | break; | ||
66 | -- | ||
67 | 2.34.1 | ||
68 | |||
69 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Use the carry bit to optimize some forms of setcond. | ||
2 | 1 | ||
3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | --- | ||
6 | tcg/i386/tcg-target.c.inc | 50 +++++++++++++++++++++++++++++++++++++++ | ||
7 | 1 file changed, 50 insertions(+) | ||
8 | |||
9 | diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc | ||
10 | index XXXXXXX..XXXXXXX 100644 | ||
11 | --- a/tcg/i386/tcg-target.c.inc | ||
12 | +++ b/tcg/i386/tcg-target.c.inc | ||
13 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_setcond(TCGContext *s, int rexw, TCGCond cond, | ||
14 | TCGArg dest, TCGArg arg1, TCGArg arg2, | ||
15 | int const_arg2) | ||
16 | { | ||
17 | + bool inv = false; | ||
18 | + | ||
19 | + switch (cond) { | ||
20 | + case TCG_COND_NE: | ||
21 | + inv = true; | ||
22 | + /* fall through */ | ||
23 | + case TCG_COND_EQ: | ||
24 | + /* If arg2 is 0, convert to LTU/GEU vs 1. */ | ||
25 | + if (const_arg2 && arg2 == 0) { | ||
26 | + arg2 = 1; | ||
27 | + goto do_ltu; | ||
28 | + } | ||
29 | + break; | ||
30 | + | ||
31 | + case TCG_COND_LEU: | ||
32 | + inv = true; | ||
33 | + /* fall through */ | ||
34 | + case TCG_COND_GTU: | ||
35 | + /* If arg2 is a register, swap for LTU/GEU. */ | ||
36 | + if (!const_arg2) { | ||
37 | + TCGReg t = arg1; | ||
38 | + arg1 = arg2; | ||
39 | + arg2 = t; | ||
40 | + goto do_ltu; | ||
41 | + } | ||
42 | + break; | ||
43 | + | ||
44 | + case TCG_COND_GEU: | ||
45 | + inv = true; | ||
46 | + /* fall through */ | ||
47 | + case TCG_COND_LTU: | ||
48 | + do_ltu: | ||
49 | + /* | ||
50 | + * Relying on the carry bit, use SBB to produce -1 if LTU, 0 if GEU. | ||
51 | + * We can then use NEG or INC to produce the desired result. | ||
52 | + * This is always smaller than the SETCC expansion. | ||
53 | + */ | ||
54 | + tcg_out_cmp(s, arg1, arg2, const_arg2, rexw); | ||
55 | + tgen_arithr(s, ARITH_SBB, dest, dest); /* T:-1 F:0 */ | ||
56 | + if (inv) { | ||
57 | + tgen_arithi(s, ARITH_ADD, dest, 1, 0); /* T:0 F:1 */ | ||
58 | + } else { | ||
59 | + tcg_out_modrm(s, OPC_GRP3_Ev, EXT3_NEG, dest); /* T:1 F:0 */ | ||
60 | + } | ||
61 | + return; | ||
62 | + | ||
63 | + default: | ||
64 | + break; | ||
65 | + } | ||
66 | + | ||
67 | tcg_out_cmp(s, arg1, arg2, const_arg2, rexw); | ||
68 | tcg_out_modrm(s, OPC_SETCC | tcg_cond_to_jcc[cond], 0, dest); | ||
69 | tcg_out_ext8u(s, dest, dest); | ||
70 | -- | ||
71 | 2.34.1 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Using XOR first is both smaller and more efficient, | ||
2 | though cannot be applied if it clobbers an input. | ||
3 | 1 | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | --- | ||
7 | tcg/i386/tcg-target.c.inc | 17 ++++++++++++++++- | ||
8 | 1 file changed, 16 insertions(+), 1 deletion(-) | ||
9 | |||
10 | diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc | ||
11 | index XXXXXXX..XXXXXXX 100644 | ||
12 | --- a/tcg/i386/tcg-target.c.inc | ||
13 | +++ b/tcg/i386/tcg-target.c.inc | ||
14 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_setcond(TCGContext *s, int rexw, TCGCond cond, | ||
15 | int const_arg2) | ||
16 | { | ||
17 | bool inv = false; | ||
18 | + bool cleared; | ||
19 | |||
20 | switch (cond) { | ||
21 | case TCG_COND_NE: | ||
22 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_setcond(TCGContext *s, int rexw, TCGCond cond, | ||
23 | break; | ||
24 | } | ||
25 | |||
26 | + /* | ||
27 | + * If dest does not overlap the inputs, clearing it first is preferred. | ||
28 | + * The XOR breaks any false dependency for the low-byte write to dest, | ||
29 | + * and is also one byte smaller than MOVZBL. | ||
30 | + */ | ||
31 | + cleared = false; | ||
32 | + if (dest != arg1 && (const_arg2 || dest != arg2)) { | ||
33 | + tgen_arithr(s, ARITH_XOR, dest, dest); | ||
34 | + cleared = true; | ||
35 | + } | ||
36 | + | ||
37 | tcg_out_cmp(s, arg1, arg2, const_arg2, rexw); | ||
38 | tcg_out_modrm(s, OPC_SETCC | tcg_cond_to_jcc[cond], 0, dest); | ||
39 | - tcg_out_ext8u(s, dest, dest); | ||
40 | + | ||
41 | + if (!cleared) { | ||
42 | + tcg_out_ext8u(s, dest, dest); | ||
43 | + } | ||
44 | } | ||
45 | |||
46 | #if TCG_TARGET_REG_BITS == 32 | ||
47 | -- | ||
48 | 2.34.1 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | For LT/GE vs zero, shift down the sign bit. | ||
2 | 1 | ||
3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | --- | ||
6 | tcg/i386/tcg-target.c.inc | 15 +++++++++++++++ | ||
7 | 1 file changed, 15 insertions(+) | ||
8 | |||
9 | diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc | ||
10 | index XXXXXXX..XXXXXXX 100644 | ||
11 | --- a/tcg/i386/tcg-target.c.inc | ||
12 | +++ b/tcg/i386/tcg-target.c.inc | ||
13 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_setcond(TCGContext *s, int rexw, TCGCond cond, | ||
14 | } | ||
15 | return; | ||
16 | |||
17 | + case TCG_COND_GE: | ||
18 | + inv = true; | ||
19 | + /* fall through */ | ||
20 | + case TCG_COND_LT: | ||
21 | + /* If arg2 is 0, extract the sign bit. */ | ||
22 | + if (const_arg2 && arg2 == 0) { | ||
23 | + tcg_out_mov(s, rexw ? TCG_TYPE_I64 : TCG_TYPE_I32, dest, arg1); | ||
24 | + if (inv) { | ||
25 | + tcg_out_modrm(s, OPC_GRP3_Ev + rexw, EXT3_NOT, dest); | ||
26 | + } | ||
27 | + tcg_out_shifti(s, SHIFT_SHR + rexw, dest, rexw ? 63 : 31); | ||
28 | + return; | ||
29 | + } | ||
30 | + break; | ||
31 | + | ||
32 | default: | ||
33 | break; | ||
34 | } | ||
35 | -- | ||
36 | 2.34.1 | 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 | tcg/i386/tcg-target.h | 4 ++-- | ||
5 | tcg/i386/tcg-target.c.inc | 32 ++++++++++++++++++++++++-------- | ||
6 | 2 files changed, 26 insertions(+), 10 deletions(-) | ||
7 | 1 | ||
8 | diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h | ||
9 | index XXXXXXX..XXXXXXX 100644 | ||
10 | --- a/tcg/i386/tcg-target.h | ||
11 | +++ b/tcg/i386/tcg-target.h | ||
12 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
13 | #define TCG_TARGET_HAS_sextract_i32 1 | ||
14 | #define TCG_TARGET_HAS_extract2_i32 1 | ||
15 | #define TCG_TARGET_HAS_movcond_i32 1 | ||
16 | -#define TCG_TARGET_HAS_negsetcond_i32 0 | ||
17 | +#define TCG_TARGET_HAS_negsetcond_i32 1 | ||
18 | #define TCG_TARGET_HAS_add2_i32 1 | ||
19 | #define TCG_TARGET_HAS_sub2_i32 1 | ||
20 | #define TCG_TARGET_HAS_mulu2_i32 1 | ||
21 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
22 | #define TCG_TARGET_HAS_sextract_i64 0 | ||
23 | #define TCG_TARGET_HAS_extract2_i64 1 | ||
24 | #define TCG_TARGET_HAS_movcond_i64 1 | ||
25 | -#define TCG_TARGET_HAS_negsetcond_i64 0 | ||
26 | +#define TCG_TARGET_HAS_negsetcond_i64 1 | ||
27 | #define TCG_TARGET_HAS_add2_i64 1 | ||
28 | #define TCG_TARGET_HAS_sub2_i64 1 | ||
29 | #define TCG_TARGET_HAS_mulu2_i64 1 | ||
30 | diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc | ||
31 | index XXXXXXX..XXXXXXX 100644 | ||
32 | --- a/tcg/i386/tcg-target.c.inc | ||
33 | +++ b/tcg/i386/tcg-target.c.inc | ||
34 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_brcond2(TCGContext *s, const TCGArg *args, | ||
35 | |||
36 | static void tcg_out_setcond(TCGContext *s, int rexw, TCGCond cond, | ||
37 | TCGArg dest, TCGArg arg1, TCGArg arg2, | ||
38 | - int const_arg2) | ||
39 | + int const_arg2, bool neg) | ||
40 | { | ||
41 | bool inv = false; | ||
42 | bool cleared; | ||
43 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_setcond(TCGContext *s, int rexw, TCGCond cond, | ||
44 | * This is always smaller than the SETCC expansion. | ||
45 | */ | ||
46 | tcg_out_cmp(s, arg1, arg2, const_arg2, rexw); | ||
47 | - tgen_arithr(s, ARITH_SBB, dest, dest); /* T:-1 F:0 */ | ||
48 | - if (inv) { | ||
49 | - tgen_arithi(s, ARITH_ADD, dest, 1, 0); /* T:0 F:1 */ | ||
50 | - } else { | ||
51 | - tcg_out_modrm(s, OPC_GRP3_Ev, EXT3_NEG, dest); /* T:1 F:0 */ | ||
52 | + | ||
53 | + /* X - X - C = -C = (C ? -1 : 0) */ | ||
54 | + tgen_arithr(s, ARITH_SBB + (neg ? rexw : 0), dest, dest); | ||
55 | + if (inv && neg) { | ||
56 | + /* ~(C ? -1 : 0) = (C ? 0 : -1) */ | ||
57 | + tcg_out_modrm(s, OPC_GRP3_Ev + rexw, EXT3_NOT, dest); | ||
58 | + } else if (inv) { | ||
59 | + /* (C ? -1 : 0) + 1 = (C ? 0 : 1) */ | ||
60 | + tgen_arithi(s, ARITH_ADD, dest, 1, 0); | ||
61 | + } else if (!neg) { | ||
62 | + /* -(C ? -1 : 0) = (C ? 1 : 0) */ | ||
63 | + tcg_out_modrm(s, OPC_GRP3_Ev, EXT3_NEG, dest); | ||
64 | } | ||
65 | return; | ||
66 | |||
67 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_setcond(TCGContext *s, int rexw, TCGCond cond, | ||
68 | if (inv) { | ||
69 | tcg_out_modrm(s, OPC_GRP3_Ev + rexw, EXT3_NOT, dest); | ||
70 | } | ||
71 | - tcg_out_shifti(s, SHIFT_SHR + rexw, dest, rexw ? 63 : 31); | ||
72 | + tcg_out_shifti(s, (neg ? SHIFT_SAR : SHIFT_SHR) + rexw, | ||
73 | + dest, rexw ? 63 : 31); | ||
74 | return; | ||
75 | } | ||
76 | break; | ||
77 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_setcond(TCGContext *s, int rexw, TCGCond cond, | ||
78 | if (!cleared) { | ||
79 | tcg_out_ext8u(s, dest, dest); | ||
80 | } | ||
81 | + if (neg) { | ||
82 | + tcg_out_modrm(s, OPC_GRP3_Ev + rexw, EXT3_NEG, dest); | ||
83 | + } | ||
84 | } | ||
85 | |||
86 | #if TCG_TARGET_REG_BITS == 32 | ||
87 | @@ -XXX,XX +XXX,XX @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, | ||
88 | arg_label(args[3]), 0); | ||
89 | break; | ||
90 | OP_32_64(setcond): | ||
91 | - tcg_out_setcond(s, rexw, args[3], a0, a1, a2, const_a2); | ||
92 | + tcg_out_setcond(s, rexw, args[3], a0, a1, a2, const_a2, false); | ||
93 | + break; | ||
94 | + OP_32_64(negsetcond): | ||
95 | + tcg_out_setcond(s, rexw, args[3], a0, a1, a2, const_a2, true); | ||
96 | break; | ||
97 | OP_32_64(movcond): | ||
98 | tcg_out_movcond(s, rexw, args[5], a0, a1, a2, const_a2, args[3]); | ||
99 | @@ -XXX,XX +XXX,XX @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) | ||
100 | |||
101 | case INDEX_op_setcond_i32: | ||
102 | case INDEX_op_setcond_i64: | ||
103 | + case INDEX_op_negsetcond_i32: | ||
104 | + case INDEX_op_negsetcond_i64: | ||
105 | return C_O1_I2(q, r, re); | ||
106 | |||
107 | case INDEX_op_movcond_i32: | ||
108 | -- | ||
109 | 2.34.1 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
2 | 1 | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
4 | Message-Id: <20230823145542.79633-2-philmd@linaro.org> | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | --- | ||
7 | tcg/tcg-op.c | 27 +++++++++++++++++++-------- | ||
8 | 1 file changed, 19 insertions(+), 8 deletions(-) | ||
9 | |||
10 | diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c | ||
11 | index XXXXXXX..XXXXXXX 100644 | ||
12 | --- a/tcg/tcg-op.c | ||
13 | +++ b/tcg/tcg-op.c | ||
14 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_ext16u_i32(TCGv_i32 ret, TCGv_i32 arg) | ||
15 | } | ||
16 | } | ||
17 | |||
18 | +/* | ||
19 | + * bswap16_i32: 16-bit byte swap on the low bits of a 32-bit value. | ||
20 | + * | ||
21 | + * Byte pattern: xxab -> yyba | ||
22 | + * | ||
23 | + * With TCG_BSWAP_IZ, x == zero, else undefined. | ||
24 | + * With TCG_BSWAP_OZ, y == zero, with TCG_BSWAP_OS y == sign, else undefined. | ||
25 | + */ | ||
26 | void tcg_gen_bswap16_i32(TCGv_i32 ret, TCGv_i32 arg, int flags) | ||
27 | { | ||
28 | /* Only one extension flag may be present. */ | ||
29 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_bswap16_i32(TCGv_i32 ret, TCGv_i32 arg, int flags) | ||
30 | TCGv_i32 t0 = tcg_temp_ebb_new_i32(); | ||
31 | TCGv_i32 t1 = tcg_temp_ebb_new_i32(); | ||
32 | |||
33 | - tcg_gen_shri_i32(t0, arg, 8); | ||
34 | + /* arg = ..ab (IZ) xxab (!IZ) */ | ||
35 | + tcg_gen_shri_i32(t0, arg, 8); /* t0 = ...a (IZ) .xxa (!IZ) */ | ||
36 | if (!(flags & TCG_BSWAP_IZ)) { | ||
37 | - tcg_gen_ext8u_i32(t0, t0); | ||
38 | + tcg_gen_ext8u_i32(t0, t0); /* t0 = ...a */ | ||
39 | } | ||
40 | |||
41 | if (flags & TCG_BSWAP_OS) { | ||
42 | - tcg_gen_shli_i32(t1, arg, 24); | ||
43 | - tcg_gen_sari_i32(t1, t1, 16); | ||
44 | + tcg_gen_shli_i32(t1, arg, 24); /* t1 = b... */ | ||
45 | + tcg_gen_sari_i32(t1, t1, 16); /* t1 = ssb. */ | ||
46 | } else if (flags & TCG_BSWAP_OZ) { | ||
47 | - tcg_gen_ext8u_i32(t1, arg); | ||
48 | - tcg_gen_shli_i32(t1, t1, 8); | ||
49 | + tcg_gen_ext8u_i32(t1, arg); /* t1 = ...b */ | ||
50 | + tcg_gen_shli_i32(t1, t1, 8); /* t1 = ..b. */ | ||
51 | } else { | ||
52 | - tcg_gen_shli_i32(t1, arg, 8); | ||
53 | + tcg_gen_shli_i32(t1, arg, 8); /* t1 = xab. */ | ||
54 | } | ||
55 | |||
56 | - tcg_gen_or_i32(ret, t0, t1); | ||
57 | + tcg_gen_or_i32(ret, t0, t1); /* ret = ..ba (OZ) */ | ||
58 | + /* = ssba (OS) */ | ||
59 | + /* = xaba (no flag) */ | ||
60 | tcg_temp_free_i32(t0); | ||
61 | tcg_temp_free_i32(t1); | ||
62 | } | ||
63 | -- | ||
64 | 2.34.1 | ||
65 | |||
66 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
2 | 1 | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
4 | Message-Id: <20230823145542.79633-3-philmd@linaro.org> | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | --- | ||
7 | tcg/tcg-op.c | 27 +++++++++++++++++++-------- | ||
8 | 1 file changed, 19 insertions(+), 8 deletions(-) | ||
9 | |||
10 | diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c | ||
11 | index XXXXXXX..XXXXXXX 100644 | ||
12 | --- a/tcg/tcg-op.c | ||
13 | +++ b/tcg/tcg-op.c | ||
14 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_ext32u_i64(TCGv_i64 ret, TCGv_i64 arg) | ||
15 | } | ||
16 | } | ||
17 | |||
18 | +/* | ||
19 | + * bswap16_i64: 16-bit byte swap on the low bits of a 64-bit value. | ||
20 | + * | ||
21 | + * Byte pattern: xxxxxxxxab -> yyyyyyyyba | ||
22 | + * | ||
23 | + * With TCG_BSWAP_IZ, x == zero, else undefined. | ||
24 | + * With TCG_BSWAP_OZ, y == zero, with TCG_BSWAP_OS y == sign, else undefined. | ||
25 | + */ | ||
26 | void tcg_gen_bswap16_i64(TCGv_i64 ret, TCGv_i64 arg, int flags) | ||
27 | { | ||
28 | /* Only one extension flag may be present. */ | ||
29 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_bswap16_i64(TCGv_i64 ret, TCGv_i64 arg, int flags) | ||
30 | TCGv_i64 t0 = tcg_temp_ebb_new_i64(); | ||
31 | TCGv_i64 t1 = tcg_temp_ebb_new_i64(); | ||
32 | |||
33 | - tcg_gen_shri_i64(t0, arg, 8); | ||
34 | + /* arg = ......ab or xxxxxxab */ | ||
35 | + tcg_gen_shri_i64(t0, arg, 8); /* t0 = .......a or .xxxxxxa */ | ||
36 | if (!(flags & TCG_BSWAP_IZ)) { | ||
37 | - tcg_gen_ext8u_i64(t0, t0); | ||
38 | + tcg_gen_ext8u_i64(t0, t0); /* t0 = .......a */ | ||
39 | } | ||
40 | |||
41 | if (flags & TCG_BSWAP_OS) { | ||
42 | - tcg_gen_shli_i64(t1, arg, 56); | ||
43 | - tcg_gen_sari_i64(t1, t1, 48); | ||
44 | + tcg_gen_shli_i64(t1, arg, 56); /* t1 = b....... */ | ||
45 | + tcg_gen_sari_i64(t1, t1, 48); /* t1 = ssssssb. */ | ||
46 | } else if (flags & TCG_BSWAP_OZ) { | ||
47 | - tcg_gen_ext8u_i64(t1, arg); | ||
48 | - tcg_gen_shli_i64(t1, t1, 8); | ||
49 | + tcg_gen_ext8u_i64(t1, arg); /* t1 = .......b */ | ||
50 | + tcg_gen_shli_i64(t1, t1, 8); /* t1 = ......b. */ | ||
51 | } else { | ||
52 | - tcg_gen_shli_i64(t1, arg, 8); | ||
53 | + tcg_gen_shli_i64(t1, arg, 8); /* t1 = xxxxxab. */ | ||
54 | } | ||
55 | |||
56 | - tcg_gen_or_i64(ret, t0, t1); | ||
57 | + tcg_gen_or_i64(ret, t0, t1); /* ret = ......ba (OZ) */ | ||
58 | + /* ssssssba (OS) */ | ||
59 | + /* xxxxxaba (no flag) */ | ||
60 | tcg_temp_free_i64(t0); | ||
61 | tcg_temp_free_i64(t1); | ||
62 | } | ||
63 | -- | ||
64 | 2.34.1 | ||
65 | |||
66 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
2 | 1 | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
4 | Message-Id: <20230823145542.79633-4-philmd@linaro.org> | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | --- | ||
7 | tcg/tcg-op.c | 5 +++++ | ||
8 | 1 file changed, 5 insertions(+) | ||
9 | |||
10 | diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c | ||
11 | index XXXXXXX..XXXXXXX 100644 | ||
12 | --- a/tcg/tcg-op.c | ||
13 | +++ b/tcg/tcg-op.c | ||
14 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_bswap16_i32(TCGv_i32 ret, TCGv_i32 arg, int flags) | ||
15 | } | ||
16 | } | ||
17 | |||
18 | +/* | ||
19 | + * bswap32_i32: 32-bit byte swap on a 32-bit value. | ||
20 | + * | ||
21 | + * Byte pattern: abcd -> dcba | ||
22 | + */ | ||
23 | void tcg_gen_bswap32_i32(TCGv_i32 ret, TCGv_i32 arg) | ||
24 | { | ||
25 | if (TCG_TARGET_HAS_bswap32_i32) { | ||
26 | -- | ||
27 | 2.34.1 | ||
28 | |||
29 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
2 | 1 | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
4 | Message-Id: <20230823145542.79633-5-philmd@linaro.org> | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | --- | ||
7 | tcg/tcg-op.c | 11 ++++++++++- | ||
8 | 1 file changed, 10 insertions(+), 1 deletion(-) | ||
9 | |||
10 | diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c | ||
11 | index XXXXXXX..XXXXXXX 100644 | ||
12 | --- a/tcg/tcg-op.c | ||
13 | +++ b/tcg/tcg-op.c | ||
14 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_bswap16_i64(TCGv_i64 ret, TCGv_i64 arg, int flags) | ||
15 | } | ||
16 | } | ||
17 | |||
18 | +/* | ||
19 | + * bswap32_i64: 32-bit byte swap on the low bits of a 64-bit value. | ||
20 | + * | ||
21 | + * Byte pattern: xxxxabcd -> yyyydcba | ||
22 | + * | ||
23 | + * With TCG_BSWAP_IZ, x == zero, else undefined. | ||
24 | + * With TCG_BSWAP_OZ, y == zero, with TCG_BSWAP_OS y == sign, else undefined. | ||
25 | + */ | ||
26 | void tcg_gen_bswap32_i64(TCGv_i64 ret, TCGv_i64 arg, int flags) | ||
27 | { | ||
28 | /* Only one extension flag may be present. */ | ||
29 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_bswap32_i64(TCGv_i64 ret, TCGv_i64 arg, int flags) | ||
30 | } else { | ||
31 | tcg_gen_shri_i64(t1, t1, 32); /* t1 = ....dc.. */ | ||
32 | } | ||
33 | - tcg_gen_or_i64(ret, t0, t1); /* ret = ssssdcba */ | ||
34 | + tcg_gen_or_i64(ret, t0, t1); /* ret = ssssdcba (OS) */ | ||
35 | + /* ....dcba (else) */ | ||
36 | |||
37 | tcg_temp_free_i64(t0); | ||
38 | tcg_temp_free_i64(t1); | ||
39 | -- | ||
40 | 2.34.1 | ||
41 | |||
42 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
2 | 1 | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | Message-Id: <20230823145542.79633-6-philmd@linaro.org> | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | --- | ||
8 | tcg/tcg-op.c | 5 +++++ | ||
9 | 1 file changed, 5 insertions(+) | ||
10 | |||
11 | diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/tcg/tcg-op.c | ||
14 | +++ b/tcg/tcg-op.c | ||
15 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_bswap32_i64(TCGv_i64 ret, TCGv_i64 arg, int flags) | ||
16 | } | ||
17 | } | ||
18 | |||
19 | +/* | ||
20 | + * bswap64_i64: 64-bit byte swap on a 64-bit value. | ||
21 | + * | ||
22 | + * Byte pattern: abcdefgh -> hgfedcba | ||
23 | + */ | ||
24 | void tcg_gen_bswap64_i64(TCGv_i64 ret, TCGv_i64 arg) | ||
25 | { | ||
26 | if (TCG_TARGET_REG_BITS == 32) { | ||
27 | -- | ||
28 | 2.34.1 | ||
29 | |||
30 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
2 | 1 | ||
3 | Document hswap_i32() and hswap_i64(), added in commit | ||
4 | 46be8425ff ("tcg: Implement tcg_gen_{h,w}swap_{i32,i64}"). | ||
5 | |||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
8 | Message-Id: <20230823145542.79633-7-philmd@linaro.org> | ||
9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | --- | ||
11 | tcg/tcg-op.c | 25 ++++++++++++++++++------- | ||
12 | 1 file changed, 18 insertions(+), 7 deletions(-) | ||
13 | |||
14 | diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/tcg/tcg-op.c | ||
17 | +++ b/tcg/tcg-op.c | ||
18 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_bswap32_i32(TCGv_i32 ret, TCGv_i32 arg) | ||
19 | } | ||
20 | } | ||
21 | |||
22 | +/* | ||
23 | + * hswap_i32: Swap 16-bit halfwords within a 32-bit value. | ||
24 | + * | ||
25 | + * Byte pattern: abcd -> cdab | ||
26 | + */ | ||
27 | void tcg_gen_hswap_i32(TCGv_i32 ret, TCGv_i32 arg) | ||
28 | { | ||
29 | /* Swapping 2 16-bit elements is a rotate. */ | ||
30 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_bswap64_i64(TCGv_i64 ret, TCGv_i64 arg) | ||
31 | } | ||
32 | } | ||
33 | |||
34 | +/* | ||
35 | + * hswap_i64: Swap 16-bit halfwords within a 64-bit value. | ||
36 | + * See also include/qemu/bitops.h, hswap64. | ||
37 | + * | ||
38 | + * Byte pattern: abcdefgh -> ghefcdab | ||
39 | + */ | ||
40 | void tcg_gen_hswap_i64(TCGv_i64 ret, TCGv_i64 arg) | ||
41 | { | ||
42 | uint64_t m = 0x0000ffff0000ffffull; | ||
43 | TCGv_i64 t0 = tcg_temp_ebb_new_i64(); | ||
44 | TCGv_i64 t1 = tcg_temp_ebb_new_i64(); | ||
45 | |||
46 | - /* See include/qemu/bitops.h, hswap64. */ | ||
47 | - tcg_gen_rotli_i64(t1, arg, 32); | ||
48 | - tcg_gen_andi_i64(t0, t1, m); | ||
49 | - tcg_gen_shli_i64(t0, t0, 16); | ||
50 | - tcg_gen_shri_i64(t1, t1, 16); | ||
51 | - tcg_gen_andi_i64(t1, t1, m); | ||
52 | - tcg_gen_or_i64(ret, t0, t1); | ||
53 | + /* arg = abcdefgh */ | ||
54 | + tcg_gen_rotli_i64(t1, arg, 32); /* t1 = efghabcd */ | ||
55 | + tcg_gen_andi_i64(t0, t1, m); /* t0 = ..gh..cd */ | ||
56 | + tcg_gen_shli_i64(t0, t0, 16); /* t0 = gh..cd.. */ | ||
57 | + tcg_gen_shri_i64(t1, t1, 16); /* t1 = ..efghab */ | ||
58 | + tcg_gen_andi_i64(t1, t1, m); /* t1 = ..ef..ab */ | ||
59 | + tcg_gen_or_i64(ret, t0, t1); /* ret = ghefcdab */ | ||
60 | |||
61 | tcg_temp_free_i64(t0); | ||
62 | tcg_temp_free_i64(t1); | ||
63 | -- | ||
64 | 2.34.1 | ||
65 | |||
66 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
2 | 1 | ||
3 | Document wswap_i64(), added in commit 46be8425ff | ||
4 | ("tcg: Implement tcg_gen_{h,w}swap_{i32,i64}"). | ||
5 | |||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
8 | Message-Id: <20230823145542.79633-8-philmd@linaro.org> | ||
9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | --- | ||
11 | tcg/tcg-op.c | 5 +++++ | ||
12 | 1 file changed, 5 insertions(+) | ||
13 | |||
14 | diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/tcg/tcg-op.c | ||
17 | +++ b/tcg/tcg-op.c | ||
18 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_hswap_i64(TCGv_i64 ret, TCGv_i64 arg) | ||
19 | tcg_temp_free_i64(t1); | ||
20 | } | ||
21 | |||
22 | +/* | ||
23 | + * wswap_i64: Swap 32-bit words within a 64-bit value. | ||
24 | + * | ||
25 | + * Byte pattern: abcdefgh -> efghabcd | ||
26 | + */ | ||
27 | void tcg_gen_wswap_i64(TCGv_i64 ret, TCGv_i64 arg) | ||
28 | { | ||
29 | /* Swapping 2 32-bit elements is a rotate. */ | ||
30 | -- | ||
31 | 2.34.1 | ||
32 | |||
33 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
2 | 1 | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
4 | Message-Id: <20230823145542.79633-9-philmd@linaro.org> | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | --- | ||
7 | target/cris/translate.c | 20 +++++++++++--------- | ||
8 | 1 file changed, 11 insertions(+), 9 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 inline void t_gen_swapw(TCGv d, TCGv s) | ||
15 | tcg_gen_or_tl(d, d, t); | ||
16 | } | ||
17 | |||
18 | -/* Reverse the within each byte. | ||
19 | - T0 = (((T0 << 7) & 0x80808080) | | ||
20 | - ((T0 << 5) & 0x40404040) | | ||
21 | - ((T0 << 3) & 0x20202020) | | ||
22 | - ((T0 << 1) & 0x10101010) | | ||
23 | - ((T0 >> 1) & 0x08080808) | | ||
24 | - ((T0 >> 3) & 0x04040404) | | ||
25 | - ((T0 >> 5) & 0x02020202) | | ||
26 | - ((T0 >> 7) & 0x01010101)); | ||
27 | +/* | ||
28 | + * Reverse the bits within each byte. | ||
29 | + * | ||
30 | + * T0 = ((T0 << 7) & 0x80808080) | ||
31 | + * | ((T0 << 5) & 0x40404040) | ||
32 | + * | ((T0 << 3) & 0x20202020) | ||
33 | + * | ((T0 << 1) & 0x10101010) | ||
34 | + * | ((T0 >> 1) & 0x08080808) | ||
35 | + * | ((T0 >> 3) & 0x04040404) | ||
36 | + * | ((T0 >> 5) & 0x02020202) | ||
37 | + * | ((T0 >> 7) & 0x01010101); | ||
38 | */ | ||
39 | static void t_gen_swapr(TCGv d, TCGv s) | ||
40 | { | ||
41 | -- | ||
42 | 2.34.1 | ||
43 | |||
44 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | ||
2 | 1 | ||
3 | This unintentionally causes the mov_vec, ld_vec and st_vec operations | ||
4 | to appear on the same line. | ||
5 | |||
6 | Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
8 | Message-Id: <20230823141740.35974-1-mark.cave-ayland@ilande.co.uk> | ||
9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | --- | ||
11 | docs/devel/tcg-ops.rst | 2 ++ | ||
12 | 1 file changed, 2 insertions(+) | ||
13 | |||
14 | diff --git a/docs/devel/tcg-ops.rst b/docs/devel/tcg-ops.rst | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/docs/devel/tcg-ops.rst | ||
17 | +++ b/docs/devel/tcg-ops.rst | ||
18 | @@ -XXX,XX +XXX,XX @@ E.g. VECL = 1 -> 64 << 1 -> v128, and VECE = 2 -> 1 << 2 -> i32. | ||
19 | .. list-table:: | ||
20 | |||
21 | * - mov_vec *v0*, *v1* | ||
22 | + | ||
23 | ld_vec *v0*, *t1* | ||
24 | + | ||
25 | st_vec *v0*, *t1* | ||
26 | |||
27 | - | Move, load and store. | ||
28 | -- | ||
29 | 2.34.1 | ||
30 | |||
31 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Michael Tokarev <mjt@tls.msk.ru> | ||
2 | 1 | ||
3 | Acked-by: Alex Bennée <alex.bennee@linaro.org> | ||
4 | Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> | ||
5 | Message-Id: <20230823065335.1919380-4-mjt@tls.msk.ru> | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | --- | ||
8 | tcg/aarch64/tcg-target.c.inc | 2 +- | ||
9 | tcg/arm/tcg-target.c.inc | 10 ++++++---- | ||
10 | tcg/riscv/tcg-target.c.inc | 4 ++-- | ||
11 | 3 files changed, 9 insertions(+), 7 deletions(-) | ||
12 | |||
13 | diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/tcg/aarch64/tcg-target.c.inc | ||
16 | +++ b/tcg/aarch64/tcg-target.c.inc | ||
17 | @@ -XXX,XX +XXX,XX @@ static void tcg_target_qemu_prologue(TCGContext *s) | ||
18 | #if !defined(CONFIG_SOFTMMU) | ||
19 | /* | ||
20 | * Note that XZR cannot be encoded in the address base register slot, | ||
21 | - * as that actaully encodes SP. Depending on the guest, we may need | ||
22 | + * as that actually encodes SP. Depending on the guest, we may need | ||
23 | * to zero-extend the guest address via the address index register slot, | ||
24 | * therefore we need to load even a zero guest base into a register. | ||
25 | */ | ||
26 | diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc | ||
27 | index XXXXXXX..XXXXXXX 100644 | ||
28 | --- a/tcg/arm/tcg-target.c.inc | ||
29 | +++ b/tcg/arm/tcg-target.c.inc | ||
30 | @@ -XXX,XX +XXX,XX @@ static TCGCond tcg_out_cmp2(TCGContext *s, const TCGArg *args, | ||
31 | case TCG_COND_LEU: | ||
32 | case TCG_COND_GTU: | ||
33 | case TCG_COND_GEU: | ||
34 | - /* We perform a conditional comparision. If the high half is | ||
35 | - equal, then overwrite the flags with the comparison of the | ||
36 | - low half. The resulting flags cover the whole. */ | ||
37 | + /* | ||
38 | + * We perform a conditional comparison. If the high half is | ||
39 | + * equal, then overwrite the flags with the comparison of the | ||
40 | + * low half. The resulting flags cover the whole. | ||
41 | + */ | ||
42 | tcg_out_dat_rI(s, COND_AL, ARITH_CMP, 0, ah, bh, const_bh); | ||
43 | tcg_out_dat_rI(s, COND_EQ, ARITH_CMP, 0, al, bl, const_bl); | ||
44 | return cond; | ||
45 | @@ -XXX,XX +XXX,XX @@ static TCGCond tcg_out_cmp2(TCGContext *s, const TCGArg *args, | ||
46 | |||
47 | /* | ||
48 | * Note that TCGReg references Q-registers. | ||
49 | - * Q-regno = 2 * D-regno, so shift left by 1 whlie inserting. | ||
50 | + * Q-regno = 2 * D-regno, so shift left by 1 while inserting. | ||
51 | */ | ||
52 | static uint32_t encode_vd(TCGReg rd) | ||
53 | { | ||
54 | diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc | ||
55 | index XXXXXXX..XXXXXXX 100644 | ||
56 | --- a/tcg/riscv/tcg-target.c.inc | ||
57 | +++ b/tcg/riscv/tcg-target.c.inc | ||
58 | @@ -XXX,XX +XXX,XX @@ static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = { | ||
59 | |||
60 | static const int tcg_target_reg_alloc_order[] = { | ||
61 | /* Call saved registers */ | ||
62 | - /* TCG_REG_S0 reservered for TCG_AREG0 */ | ||
63 | + /* TCG_REG_S0 reserved for TCG_AREG0 */ | ||
64 | TCG_REG_S1, | ||
65 | TCG_REG_S2, | ||
66 | TCG_REG_S3, | ||
67 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
68 | /* Zba: Bit manipulation extension, address generation */ | ||
69 | OPC_ADD_UW = 0x0800003b, | ||
70 | |||
71 | - /* Zbb: Bit manipulation extension, basic bit manipulaton */ | ||
72 | + /* Zbb: Bit manipulation extension, basic bit manipulation */ | ||
73 | OPC_ANDN = 0x40007033, | ||
74 | OPC_CLZ = 0x60001013, | ||
75 | OPC_CLZW = 0x6000101b, | ||
76 | -- | ||
77 | 2.34.1 | ||
78 | |||
79 | diff view generated by jsdifflib |