1 | The following changes since commit 5a67d7735d4162630769ef495cf813244fc850df: | 1 | This is mostly RTH's tcg_constant refactoring work, plus a few |
---|---|---|---|
2 | other things. | ||
2 | 3 | ||
3 | Merge remote-tracking branch 'remotes/berrange-gitlab/tags/tls-deps-pull-request' into staging (2021-07-02 08:22:39 +0100) | 4 | thanks |
5 | -- PMM | ||
6 | |||
7 | The following changes since commit cf6f26d6f9b2015ee12b4604b79359e76784163a: | ||
8 | |||
9 | Merge tag 'kraxel-20220427-pull-request' of git://git.kraxel.org/qemu into staging (2022-04-27 10:49:28 -0700) | ||
4 | 10 | ||
5 | are available in the Git repository at: | 11 | are available in the Git repository at: |
6 | 12 | ||
7 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20210702 | 13 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20220428 |
8 | 14 | ||
9 | for you to fetch changes up to 04ea4d3cfd0a21b248ece8eb7a9436a3d9898dd8: | 15 | for you to fetch changes up to f8e7163d9e6740b5cef02bf73a17a59d0bef8bdb: |
10 | 16 | ||
11 | target/arm: Implement MVE shifts by register (2021-07-02 11:48:38 +0100) | 17 | hw/arm/smmuv3: Advertise support for SMMUv3.2-BBML2 (2022-04-28 13:59:23 +0100) |
12 | 18 | ||
13 | ---------------------------------------------------------------- | 19 | ---------------------------------------------------------------- |
14 | target-arm queue: | 20 | target-arm queue: |
15 | * more MVE instructions | 21 | * refactor to use tcg_constant where appropriate |
16 | * hw/gpio/gpio_pwr: use shutdown function for reboot | 22 | * Advertise support for FEAT_TTL and FEAT_BBM level 2 |
17 | * target/arm: Check NaN mode before silencing NaN | 23 | * smmuv3: Cache event fault record |
18 | * tests: Boot and halt a Linux guest on the Raspberry Pi 2 machine | 24 | * smmuv3: Add space in guest error message |
19 | * hw/arm: Add basic power management to raspi. | 25 | * smmuv3: Advertise support for SMMUv3.2-BBML2 |
20 | * docs/system/arm: Add quanta-gbs-bmc, quanta-q7l1-bmc | ||
21 | 26 | ||
22 | ---------------------------------------------------------------- | 27 | ---------------------------------------------------------------- |
23 | Joe Komlodi (1): | 28 | Damien Hedde (1): |
24 | target/arm: Check NaN mode before silencing NaN | 29 | target/arm: Disable cryptographic instructions when neon is disabled |
25 | 30 | ||
26 | Maxim Uvarov (1): | 31 | Jean-Philippe Brucker (2): |
27 | hw/gpio/gpio_pwr: use shutdown function for reboot | 32 | hw/arm/smmuv3: Cache event fault record |
33 | hw/arm/smmuv3: Add space in guest error message | ||
28 | 34 | ||
29 | Nolan Leake (1): | 35 | Peter Maydell (3): |
30 | hw/arm: Add basic power management to raspi. | 36 | target/arm: Advertise support for FEAT_TTL |
37 | target/arm: Advertise support for FEAT_BBM level 2 | ||
38 | hw/arm/smmuv3: Advertise support for SMMUv3.2-BBML2 | ||
31 | 39 | ||
32 | Patrick Venture (2): | 40 | Richard Henderson (48): |
33 | docs/system/arm: Add quanta-q7l1-bmc reference | 41 | target/arm: Use tcg_constant in gen_probe_access |
34 | docs/system/arm: Add quanta-gbs-bmc reference | 42 | target/arm: Use tcg_constant in gen_mte_check* |
43 | target/arm: Use tcg_constant in gen_exception* | ||
44 | target/arm: Use tcg_constant in gen_adc_CC | ||
45 | target/arm: Use tcg_constant in handle_msr_i | ||
46 | target/arm: Use tcg_constant in handle_sys | ||
47 | target/arm: Use tcg_constant in disas_exc | ||
48 | target/arm: Use tcg_constant in gen_compare_and_swap_pair | ||
49 | target/arm: Use tcg_constant in disas_ld_lit | ||
50 | target/arm: Use tcg_constant in disas_ldst_* | ||
51 | target/arm: Use tcg_constant in disas_add_sum_imm* | ||
52 | target/arm: Use tcg_constant in disas_movw_imm | ||
53 | target/arm: Use tcg_constant in shift_reg_imm | ||
54 | target/arm: Use tcg_constant in disas_cond_select | ||
55 | target/arm: Use tcg_constant in handle_{rev16,crc32} | ||
56 | target/arm: Use tcg_constant in disas_data_proc_2src | ||
57 | target/arm: Use tcg_constant in disas_fp* | ||
58 | target/arm: Use tcg_constant in simd shift expanders | ||
59 | target/arm: Use tcg_constant in simd fp/int conversion | ||
60 | target/arm: Use tcg_constant in 2misc expanders | ||
61 | target/arm: Use tcg_constant in balance of translate-a64.c | ||
62 | target/arm: Use tcg_constant for aa32 exceptions | ||
63 | target/arm: Use tcg_constant for disas_iwmmxt_insn | ||
64 | target/arm: Use tcg_constant for gen_{msr,mrs} | ||
65 | target/arm: Use tcg_constant for vector shift expanders | ||
66 | target/arm: Use tcg_constant for do_coproc_insn | ||
67 | target/arm: Use tcg_constant for gen_srs | ||
68 | target/arm: Use tcg_constant for op_s_{rri,rxi}_rot | ||
69 | target/arm: Use tcg_constant for MOVW, UMAAL, CRC32 | ||
70 | target/arm: Use tcg_constant for v7m MRS, MSR | ||
71 | target/arm: Use tcg_constant for TT, SAT, SMMLA | ||
72 | target/arm: Use tcg_constant in LDM, STM | ||
73 | target/arm: Use tcg_constant in CLRM, DLS, WLS, LE | ||
74 | target/arm: Use tcg_constant in trans_CPS_v7m | ||
75 | target/arm: Use tcg_constant in trans_CSEL | ||
76 | target/arm: Use tcg_constant for trans_INDEX_* | ||
77 | target/arm: Use tcg_constant in SINCDEC, INCDEC | ||
78 | target/arm: Use tcg_constant in FCPY, CPY | ||
79 | target/arm: Use tcg_constant in {incr, wrap}_last_active | ||
80 | target/arm: Use tcg_constant in do_clast_scalar | ||
81 | target/arm: Use tcg_constant in WHILE | ||
82 | target/arm: Use tcg_constant in LD1, ST1 | ||
83 | target/arm: Use tcg_constant in SUBR | ||
84 | target/arm: Use tcg_constant in do_zzi_{sat, ool}, do_fp_imm | ||
85 | target/arm: Use tcg_constant for predicate descriptors | ||
86 | target/arm: Use tcg_constant for do_brk{2,3} | ||
87 | target/arm: Use tcg_constant for vector descriptor | ||
88 | target/arm: Use field names for accessing DBGWCRn | ||
35 | 89 | ||
36 | Peter Maydell (18): | 90 | docs/system/arm/emulation.rst | 2 + |
37 | target/arm: Fix MVE widening/narrowing VLDR/VSTR offset calculation | 91 | hw/arm/smmuv3-internal.h | 2 +- |
38 | target/arm: Fix bugs in MVE VRMLALDAVH, VRMLSLDAVH | 92 | include/hw/arm/smmu-common.h | 1 + |
39 | target/arm: Make asimd_imm_const() public | 93 | target/arm/internals.h | 12 ++ |
40 | target/arm: Use asimd_imm_const for A64 decode | 94 | hw/arm/smmuv3.c | 17 +-- |
41 | target/arm: Use dup_const() instead of bitfield_replicate() | 95 | target/arm/cpu.c | 9 ++ |
42 | target/arm: Implement MVE logical immediate insns | 96 | target/arm/cpu64.c | 2 + |
43 | target/arm: Implement MVE vector shift left by immediate insns | 97 | target/arm/debug_helper.c | 10 +- |
44 | target/arm: Implement MVE vector shift right by immediate insns | 98 | target/arm/helper.c | 8 +- |
45 | target/arm: Implement MVE VSHLL | 99 | target/arm/kvm64.c | 14 +- |
46 | target/arm: Implement MVE VSRI, VSLI | 100 | target/arm/translate-a64.c | 301 +++++++++++++----------------------------- |
47 | target/arm: Implement MVE VSHRN, VRSHRN | 101 | target/arm/translate-sve.c | 202 ++++++++++------------------ |
48 | target/arm: Implement MVE saturating narrowing shifts | 102 | target/arm/translate.c | 244 ++++++++++++---------------------- |
49 | target/arm: Implement MVE VSHLC | 103 | 13 files changed, 293 insertions(+), 531 deletions(-) |
50 | target/arm: Implement MVE VADDLV | ||
51 | target/arm: Implement MVE long shifts by immediate | ||
52 | target/arm: Implement MVE long shifts by register | ||
53 | target/arm: Implement MVE shifts by immediate | ||
54 | target/arm: Implement MVE shifts by register | ||
55 | |||
56 | Philippe Mathieu-Daudé (1): | ||
57 | tests: Boot and halt a Linux guest on the Raspberry Pi 2 machine | ||
58 | |||
59 | docs/system/arm/aspeed.rst | 1 + | ||
60 | docs/system/arm/nuvoton.rst | 5 +- | ||
61 | include/hw/arm/bcm2835_peripherals.h | 3 +- | ||
62 | include/hw/misc/bcm2835_powermgt.h | 29 ++ | ||
63 | target/arm/helper-mve.h | 108 +++++++ | ||
64 | target/arm/translate.h | 41 +++ | ||
65 | target/arm/mve.decode | 177 ++++++++++- | ||
66 | target/arm/t32.decode | 71 ++++- | ||
67 | hw/arm/bcm2835_peripherals.c | 13 +- | ||
68 | hw/gpio/gpio_pwr.c | 2 +- | ||
69 | hw/misc/bcm2835_powermgt.c | 160 ++++++++++ | ||
70 | target/arm/helper-a64.c | 12 +- | ||
71 | target/arm/mve_helper.c | 524 +++++++++++++++++++++++++++++++-- | ||
72 | target/arm/translate-a64.c | 86 +----- | ||
73 | target/arm/translate-mve.c | 261 +++++++++++++++- | ||
74 | target/arm/translate-neon.c | 81 ----- | ||
75 | target/arm/translate.c | 327 +++++++++++++++++++- | ||
76 | target/arm/vfp_helper.c | 24 +- | ||
77 | hw/misc/meson.build | 1 + | ||
78 | tests/acceptance/boot_linux_console.py | 43 +++ | ||
79 | 20 files changed, 1760 insertions(+), 209 deletions(-) | ||
80 | create mode 100644 include/hw/misc/bcm2835_powermgt.h | ||
81 | create mode 100644 hw/misc/bcm2835_powermgt.c | ||
82 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-2-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-a64.c | 12 ++++-------- | ||
9 | 1 file changed, 4 insertions(+), 8 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-a64.c | ||
14 | +++ b/target/arm/translate-a64.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static void gen_address_with_allocation_tag0(TCGv_i64 dst, TCGv_i64 src) | ||
16 | static void gen_probe_access(DisasContext *s, TCGv_i64 ptr, | ||
17 | MMUAccessType acc, int log2_size) | ||
18 | { | ||
19 | - TCGv_i32 t_acc = tcg_const_i32(acc); | ||
20 | - TCGv_i32 t_idx = tcg_const_i32(get_mem_index(s)); | ||
21 | - TCGv_i32 t_size = tcg_const_i32(1 << log2_size); | ||
22 | - | ||
23 | - gen_helper_probe_access(cpu_env, ptr, t_acc, t_idx, t_size); | ||
24 | - tcg_temp_free_i32(t_acc); | ||
25 | - tcg_temp_free_i32(t_idx); | ||
26 | - tcg_temp_free_i32(t_size); | ||
27 | + gen_helper_probe_access(cpu_env, ptr, | ||
28 | + tcg_constant_i32(acc), | ||
29 | + tcg_constant_i32(get_mem_index(s)), | ||
30 | + tcg_constant_i32(1 << log2_size)); | ||
31 | } | ||
32 | |||
33 | /* | ||
34 | -- | ||
35 | 2.25.1 | diff view generated by jsdifflib |
1 | Use dup_const() instead of bitfield_replicate() in | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | disas_simd_mod_imm(). | ||
3 | 2 | ||
4 | (We can't replace the other use of bitfield_replicate() in this file, | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
5 | in logic_imm_decode_wmask(), because that location needs to handle 2 | 4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
6 | and 4 bit elements, which dup_const() cannot.) | 5 | Message-id: 20220426163043.100432-3-richard.henderson@linaro.org |
7 | |||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Message-id: 20210628135835.6690-6-peter.maydell@linaro.org | ||
11 | --- | 7 | --- |
12 | target/arm/translate-a64.c | 2 +- | 8 | target/arm/translate-a64.c | 10 ++-------- |
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | 9 | 1 file changed, 2 insertions(+), 8 deletions(-) |
14 | 10 | ||
15 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 11 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
16 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/translate-a64.c | 13 | --- a/target/arm/translate-a64.c |
18 | +++ b/target/arm/translate-a64.c | 14 | +++ b/target/arm/translate-a64.c |
19 | @@ -XXX,XX +XXX,XX @@ static void disas_simd_mod_imm(DisasContext *s, uint32_t insn) | 15 | @@ -XXX,XX +XXX,XX @@ static TCGv_i64 gen_mte_check1_mmuidx(DisasContext *s, TCGv_i64 addr, |
20 | /* FMOV (vector, immediate) - half-precision */ | 16 | int core_idx) |
21 | imm = vfp_expand_imm(MO_16, abcdefgh); | 17 | { |
22 | /* now duplicate across the lanes */ | 18 | if (tag_checked && s->mte_active[is_unpriv]) { |
23 | - imm = bitfield_replicate(imm, 16); | 19 | - TCGv_i32 tcg_desc; |
24 | + imm = dup_const(MO_16, imm); | 20 | TCGv_i64 ret; |
25 | } else { | 21 | int desc = 0; |
26 | imm = asimd_imm_const(abcdefgh, cmode, is_neg); | 22 | |
23 | @@ -XXX,XX +XXX,XX @@ static TCGv_i64 gen_mte_check1_mmuidx(DisasContext *s, TCGv_i64 addr, | ||
24 | desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); | ||
25 | desc = FIELD_DP32(desc, MTEDESC, WRITE, is_write); | ||
26 | desc = FIELD_DP32(desc, MTEDESC, SIZEM1, (1 << log2_size) - 1); | ||
27 | - tcg_desc = tcg_const_i32(desc); | ||
28 | |||
29 | ret = new_tmp_a64(s); | ||
30 | - gen_helper_mte_check(ret, cpu_env, tcg_desc, addr); | ||
31 | - tcg_temp_free_i32(tcg_desc); | ||
32 | + gen_helper_mte_check(ret, cpu_env, tcg_constant_i32(desc), addr); | ||
33 | |||
34 | return ret; | ||
35 | } | ||
36 | @@ -XXX,XX +XXX,XX @@ TCGv_i64 gen_mte_checkN(DisasContext *s, TCGv_i64 addr, bool is_write, | ||
37 | bool tag_checked, int size) | ||
38 | { | ||
39 | if (tag_checked && s->mte_active[0]) { | ||
40 | - TCGv_i32 tcg_desc; | ||
41 | TCGv_i64 ret; | ||
42 | int desc = 0; | ||
43 | |||
44 | @@ -XXX,XX +XXX,XX @@ TCGv_i64 gen_mte_checkN(DisasContext *s, TCGv_i64 addr, bool is_write, | ||
45 | desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); | ||
46 | desc = FIELD_DP32(desc, MTEDESC, WRITE, is_write); | ||
47 | desc = FIELD_DP32(desc, MTEDESC, SIZEM1, size - 1); | ||
48 | - tcg_desc = tcg_const_i32(desc); | ||
49 | |||
50 | ret = new_tmp_a64(s); | ||
51 | - gen_helper_mte_check(ret, cpu_env, tcg_desc, addr); | ||
52 | - tcg_temp_free_i32(tcg_desc); | ||
53 | + gen_helper_mte_check(ret, cpu_env, tcg_constant_i32(desc), addr); | ||
54 | |||
55 | return ret; | ||
27 | } | 56 | } |
28 | -- | 57 | -- |
29 | 2.20.1 | 58 | 2.25.1 |
30 | |||
31 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-4-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-a64.c | 11 ++--------- | ||
9 | 1 file changed, 2 insertions(+), 9 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-a64.c | ||
14 | +++ b/target/arm/translate-a64.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static void gen_rebuild_hflags(DisasContext *s) | ||
16 | |||
17 | static void gen_exception_internal(int excp) | ||
18 | { | ||
19 | - TCGv_i32 tcg_excp = tcg_const_i32(excp); | ||
20 | - | ||
21 | assert(excp_is_internal(excp)); | ||
22 | - gen_helper_exception_internal(cpu_env, tcg_excp); | ||
23 | - tcg_temp_free_i32(tcg_excp); | ||
24 | + gen_helper_exception_internal(cpu_env, tcg_constant_i32(excp)); | ||
25 | } | ||
26 | |||
27 | static void gen_exception_internal_insn(DisasContext *s, uint64_t pc, int excp) | ||
28 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_internal_insn(DisasContext *s, uint64_t pc, int excp) | ||
29 | |||
30 | static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syndrome) | ||
31 | { | ||
32 | - TCGv_i32 tcg_syn; | ||
33 | - | ||
34 | gen_a64_set_pc_im(s->pc_curr); | ||
35 | - tcg_syn = tcg_const_i32(syndrome); | ||
36 | - gen_helper_exception_bkpt_insn(cpu_env, tcg_syn); | ||
37 | - tcg_temp_free_i32(tcg_syn); | ||
38 | + gen_helper_exception_bkpt_insn(cpu_env, tcg_constant_i32(syndrome)); | ||
39 | s->base.is_jmp = DISAS_NORETURN; | ||
40 | } | ||
41 | |||
42 | -- | ||
43 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Note that tmp was doing double-duty as zero | ||
4 | and then later as a temporary in its own right. | ||
5 | Split the use of 0 to a new variable 'zero'. | ||
6 | |||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Message-id: 20220426163043.100432-5-richard.henderson@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | target/arm/translate-a64.c | 26 +++++++++++++------------- | ||
13 | 1 file changed, 13 insertions(+), 13 deletions(-) | ||
14 | |||
15 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/target/arm/translate-a64.c | ||
18 | +++ b/target/arm/translate-a64.c | ||
19 | @@ -XXX,XX +XXX,XX @@ static void gen_adc(int sf, TCGv_i64 dest, TCGv_i64 t0, TCGv_i64 t1) | ||
20 | static void gen_adc_CC(int sf, TCGv_i64 dest, TCGv_i64 t0, TCGv_i64 t1) | ||
21 | { | ||
22 | if (sf) { | ||
23 | - TCGv_i64 result, cf_64, vf_64, tmp; | ||
24 | - result = tcg_temp_new_i64(); | ||
25 | - cf_64 = tcg_temp_new_i64(); | ||
26 | - vf_64 = tcg_temp_new_i64(); | ||
27 | - tmp = tcg_const_i64(0); | ||
28 | + TCGv_i64 result = tcg_temp_new_i64(); | ||
29 | + TCGv_i64 cf_64 = tcg_temp_new_i64(); | ||
30 | + TCGv_i64 vf_64 = tcg_temp_new_i64(); | ||
31 | + TCGv_i64 tmp = tcg_temp_new_i64(); | ||
32 | + TCGv_i64 zero = tcg_constant_i64(0); | ||
33 | |||
34 | tcg_gen_extu_i32_i64(cf_64, cpu_CF); | ||
35 | - tcg_gen_add2_i64(result, cf_64, t0, tmp, cf_64, tmp); | ||
36 | - tcg_gen_add2_i64(result, cf_64, result, cf_64, t1, tmp); | ||
37 | + tcg_gen_add2_i64(result, cf_64, t0, zero, cf_64, zero); | ||
38 | + tcg_gen_add2_i64(result, cf_64, result, cf_64, t1, zero); | ||
39 | tcg_gen_extrl_i64_i32(cpu_CF, cf_64); | ||
40 | gen_set_NZ64(result); | ||
41 | |||
42 | @@ -XXX,XX +XXX,XX @@ static void gen_adc_CC(int sf, TCGv_i64 dest, TCGv_i64 t0, TCGv_i64 t1) | ||
43 | tcg_temp_free_i64(cf_64); | ||
44 | tcg_temp_free_i64(result); | ||
45 | } else { | ||
46 | - TCGv_i32 t0_32, t1_32, tmp; | ||
47 | - t0_32 = tcg_temp_new_i32(); | ||
48 | - t1_32 = tcg_temp_new_i32(); | ||
49 | - tmp = tcg_const_i32(0); | ||
50 | + TCGv_i32 t0_32 = tcg_temp_new_i32(); | ||
51 | + TCGv_i32 t1_32 = tcg_temp_new_i32(); | ||
52 | + TCGv_i32 tmp = tcg_temp_new_i32(); | ||
53 | + TCGv_i32 zero = tcg_constant_i32(0); | ||
54 | |||
55 | tcg_gen_extrl_i64_i32(t0_32, t0); | ||
56 | tcg_gen_extrl_i64_i32(t1_32, t1); | ||
57 | - tcg_gen_add2_i32(cpu_NF, cpu_CF, t0_32, tmp, cpu_CF, tmp); | ||
58 | - tcg_gen_add2_i32(cpu_NF, cpu_CF, cpu_NF, cpu_CF, t1_32, tmp); | ||
59 | + tcg_gen_add2_i32(cpu_NF, cpu_CF, t0_32, zero, cpu_CF, zero); | ||
60 | + tcg_gen_add2_i32(cpu_NF, cpu_CF, cpu_NF, cpu_CF, t1_32, zero); | ||
61 | |||
62 | tcg_gen_mov_i32(cpu_ZF, cpu_NF); | ||
63 | tcg_gen_xor_i32(cpu_VF, cpu_NF, t0_32); | ||
64 | -- | ||
65 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-6-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-a64.c | 13 +++---------- | ||
9 | 1 file changed, 3 insertions(+), 10 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-a64.c | ||
14 | +++ b/target/arm/translate-a64.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static void gen_axflag(void) | ||
16 | static void handle_msr_i(DisasContext *s, uint32_t insn, | ||
17 | unsigned int op1, unsigned int op2, unsigned int crm) | ||
18 | { | ||
19 | - TCGv_i32 t1; | ||
20 | int op = op1 << 3 | op2; | ||
21 | |||
22 | /* End the TB by default, chaining is ok. */ | ||
23 | @@ -XXX,XX +XXX,XX @@ static void handle_msr_i(DisasContext *s, uint32_t insn, | ||
24 | if (s->current_el == 0) { | ||
25 | goto do_unallocated; | ||
26 | } | ||
27 | - t1 = tcg_const_i32(crm & PSTATE_SP); | ||
28 | - gen_helper_msr_i_spsel(cpu_env, t1); | ||
29 | - tcg_temp_free_i32(t1); | ||
30 | + gen_helper_msr_i_spsel(cpu_env, tcg_constant_i32(crm & PSTATE_SP)); | ||
31 | break; | ||
32 | |||
33 | case 0x19: /* SSBS */ | ||
34 | @@ -XXX,XX +XXX,XX @@ static void handle_msr_i(DisasContext *s, uint32_t insn, | ||
35 | break; | ||
36 | |||
37 | case 0x1e: /* DAIFSet */ | ||
38 | - t1 = tcg_const_i32(crm); | ||
39 | - gen_helper_msr_i_daifset(cpu_env, t1); | ||
40 | - tcg_temp_free_i32(t1); | ||
41 | + gen_helper_msr_i_daifset(cpu_env, tcg_constant_i32(crm)); | ||
42 | break; | ||
43 | |||
44 | case 0x1f: /* DAIFClear */ | ||
45 | - t1 = tcg_const_i32(crm); | ||
46 | - gen_helper_msr_i_daifclear(cpu_env, t1); | ||
47 | - tcg_temp_free_i32(t1); | ||
48 | + gen_helper_msr_i_daifclear(cpu_env, tcg_constant_i32(crm)); | ||
49 | /* For DAIFClear, exit the cpu loop to re-evaluate pending IRQs. */ | ||
50 | s->base.is_jmp = DISAS_UPDATE_EXIT; | ||
51 | break; | ||
52 | -- | ||
53 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-7-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-a64.c | 31 +++++++++---------------------- | ||
9 | 1 file changed, 9 insertions(+), 22 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-a64.c | ||
14 | +++ b/target/arm/translate-a64.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread, | ||
16 | /* Emit code to perform further access permissions checks at | ||
17 | * runtime; this may result in an exception. | ||
18 | */ | ||
19 | - TCGv_ptr tmpptr; | ||
20 | - TCGv_i32 tcg_syn, tcg_isread; | ||
21 | uint32_t syndrome; | ||
22 | |||
23 | - gen_a64_set_pc_im(s->pc_curr); | ||
24 | - tmpptr = tcg_const_ptr(ri); | ||
25 | syndrome = syn_aa64_sysregtrap(op0, op1, op2, crn, crm, rt, isread); | ||
26 | - tcg_syn = tcg_const_i32(syndrome); | ||
27 | - tcg_isread = tcg_const_i32(isread); | ||
28 | - gen_helper_access_check_cp_reg(cpu_env, tmpptr, tcg_syn, tcg_isread); | ||
29 | - tcg_temp_free_ptr(tmpptr); | ||
30 | - tcg_temp_free_i32(tcg_syn); | ||
31 | - tcg_temp_free_i32(tcg_isread); | ||
32 | + gen_a64_set_pc_im(s->pc_curr); | ||
33 | + gen_helper_access_check_cp_reg(cpu_env, | ||
34 | + tcg_constant_ptr(ri), | ||
35 | + tcg_constant_i32(syndrome), | ||
36 | + tcg_constant_i32(isread)); | ||
37 | } else if (ri->type & ARM_CP_RAISES_EXC) { | ||
38 | /* | ||
39 | * The readfn or writefn might raise an exception; | ||
40 | @@ -XXX,XX +XXX,XX @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread, | ||
41 | case ARM_CP_DC_ZVA: | ||
42 | /* Writes clear the aligned block of memory which rt points into. */ | ||
43 | if (s->mte_active[0]) { | ||
44 | - TCGv_i32 t_desc; | ||
45 | int desc = 0; | ||
46 | |||
47 | desc = FIELD_DP32(desc, MTEDESC, MIDX, get_mem_index(s)); | ||
48 | desc = FIELD_DP32(desc, MTEDESC, TBI, s->tbid); | ||
49 | desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); | ||
50 | - t_desc = tcg_const_i32(desc); | ||
51 | |||
52 | tcg_rt = new_tmp_a64(s); | ||
53 | - gen_helper_mte_check_zva(tcg_rt, cpu_env, t_desc, cpu_reg(s, rt)); | ||
54 | - tcg_temp_free_i32(t_desc); | ||
55 | + gen_helper_mte_check_zva(tcg_rt, cpu_env, | ||
56 | + tcg_constant_i32(desc), cpu_reg(s, rt)); | ||
57 | } else { | ||
58 | tcg_rt = clean_data_tbi(s, cpu_reg(s, rt)); | ||
59 | } | ||
60 | @@ -XXX,XX +XXX,XX @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread, | ||
61 | if (ri->type & ARM_CP_CONST) { | ||
62 | tcg_gen_movi_i64(tcg_rt, ri->resetvalue); | ||
63 | } else if (ri->readfn) { | ||
64 | - TCGv_ptr tmpptr; | ||
65 | - tmpptr = tcg_const_ptr(ri); | ||
66 | - gen_helper_get_cp_reg64(tcg_rt, cpu_env, tmpptr); | ||
67 | - tcg_temp_free_ptr(tmpptr); | ||
68 | + gen_helper_get_cp_reg64(tcg_rt, cpu_env, tcg_constant_ptr(ri)); | ||
69 | } else { | ||
70 | tcg_gen_ld_i64(tcg_rt, cpu_env, ri->fieldoffset); | ||
71 | } | ||
72 | @@ -XXX,XX +XXX,XX @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread, | ||
73 | /* If not forbidden by access permissions, treat as WI */ | ||
74 | return; | ||
75 | } else if (ri->writefn) { | ||
76 | - TCGv_ptr tmpptr; | ||
77 | - tmpptr = tcg_const_ptr(ri); | ||
78 | - gen_helper_set_cp_reg64(cpu_env, tmpptr, tcg_rt); | ||
79 | - tcg_temp_free_ptr(tmpptr); | ||
80 | + gen_helper_set_cp_reg64(cpu_env, tcg_constant_ptr(ri), tcg_rt); | ||
81 | } else { | ||
82 | tcg_gen_st_i64(tcg_rt, cpu_env, ri->fieldoffset); | ||
83 | } | ||
84 | -- | ||
85 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-8-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-a64.c | 5 +---- | ||
9 | 1 file changed, 1 insertion(+), 4 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-a64.c | ||
14 | +++ b/target/arm/translate-a64.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static void disas_exc(DisasContext *s, uint32_t insn) | ||
16 | int opc = extract32(insn, 21, 3); | ||
17 | int op2_ll = extract32(insn, 0, 5); | ||
18 | int imm16 = extract32(insn, 5, 16); | ||
19 | - TCGv_i32 tmp; | ||
20 | |||
21 | switch (opc) { | ||
22 | case 0: | ||
23 | @@ -XXX,XX +XXX,XX @@ static void disas_exc(DisasContext *s, uint32_t insn) | ||
24 | break; | ||
25 | } | ||
26 | gen_a64_set_pc_im(s->pc_curr); | ||
27 | - tmp = tcg_const_i32(syn_aa64_smc(imm16)); | ||
28 | - gen_helper_pre_smc(cpu_env, tmp); | ||
29 | - tcg_temp_free_i32(tmp); | ||
30 | + gen_helper_pre_smc(cpu_env, tcg_constant_i32(syn_aa64_smc(imm16))); | ||
31 | gen_ss_advance(s); | ||
32 | gen_exception_insn(s, s->base.pc_next, EXCP_SMC, | ||
33 | syn_aa64_smc(imm16), 3); | ||
34 | -- | ||
35 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-9-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-a64.c | 6 ++---- | ||
9 | 1 file changed, 2 insertions(+), 4 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-a64.c | ||
14 | +++ b/target/arm/translate-a64.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static void gen_compare_and_swap_pair(DisasContext *s, int rs, int rt, | ||
16 | tcg_temp_free_i64(cmp); | ||
17 | } else if (tb_cflags(s->base.tb) & CF_PARALLEL) { | ||
18 | if (HAVE_CMPXCHG128) { | ||
19 | - TCGv_i32 tcg_rs = tcg_const_i32(rs); | ||
20 | + TCGv_i32 tcg_rs = tcg_constant_i32(rs); | ||
21 | if (s->be_data == MO_LE) { | ||
22 | gen_helper_casp_le_parallel(cpu_env, tcg_rs, | ||
23 | clean_addr, t1, t2); | ||
24 | @@ -XXX,XX +XXX,XX @@ static void gen_compare_and_swap_pair(DisasContext *s, int rs, int rt, | ||
25 | gen_helper_casp_be_parallel(cpu_env, tcg_rs, | ||
26 | clean_addr, t1, t2); | ||
27 | } | ||
28 | - tcg_temp_free_i32(tcg_rs); | ||
29 | } else { | ||
30 | gen_helper_exit_atomic(cpu_env); | ||
31 | s->base.is_jmp = DISAS_NORETURN; | ||
32 | @@ -XXX,XX +XXX,XX @@ static void gen_compare_and_swap_pair(DisasContext *s, int rs, int rt, | ||
33 | TCGv_i64 a2 = tcg_temp_new_i64(); | ||
34 | TCGv_i64 c1 = tcg_temp_new_i64(); | ||
35 | TCGv_i64 c2 = tcg_temp_new_i64(); | ||
36 | - TCGv_i64 zero = tcg_const_i64(0); | ||
37 | + TCGv_i64 zero = tcg_constant_i64(0); | ||
38 | |||
39 | /* Load the two words, in memory order. */ | ||
40 | tcg_gen_qemu_ld_i64(d1, clean_addr, memidx, | ||
41 | @@ -XXX,XX +XXX,XX @@ static void gen_compare_and_swap_pair(DisasContext *s, int rs, int rt, | ||
42 | tcg_temp_free_i64(a2); | ||
43 | tcg_temp_free_i64(c1); | ||
44 | tcg_temp_free_i64(c2); | ||
45 | - tcg_temp_free_i64(zero); | ||
46 | |||
47 | /* Write back the data from memory to Rs. */ | ||
48 | tcg_gen_mov_i64(s1, d1); | ||
49 | -- | ||
50 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-10-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-a64.c | 3 +-- | ||
9 | 1 file changed, 1 insertion(+), 2 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-a64.c | ||
14 | +++ b/target/arm/translate-a64.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static void disas_ld_lit(DisasContext *s, uint32_t insn) | ||
16 | |||
17 | tcg_rt = cpu_reg(s, rt); | ||
18 | |||
19 | - clean_addr = tcg_const_i64(s->pc_curr + imm); | ||
20 | + clean_addr = tcg_constant_i64(s->pc_curr + imm); | ||
21 | if (is_vector) { | ||
22 | do_fp_ld(s, rt, clean_addr, size); | ||
23 | } else { | ||
24 | @@ -XXX,XX +XXX,XX @@ static void disas_ld_lit(DisasContext *s, uint32_t insn) | ||
25 | do_gpr_ld(s, tcg_rt, clean_addr, size + is_signed * MO_SIGN, | ||
26 | false, true, rt, iss_sf, false); | ||
27 | } | ||
28 | - tcg_temp_free_i64(clean_addr); | ||
29 | } | ||
30 | |||
31 | /* | ||
32 | -- | ||
33 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-11-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-a64.c | 9 +++------ | ||
9 | 1 file changed, 3 insertions(+), 6 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-a64.c | ||
14 | +++ b/target/arm/translate-a64.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_multiple_struct(DisasContext *s, uint32_t insn) | ||
16 | mop = endian | size | align; | ||
17 | |||
18 | elements = (is_q ? 16 : 8) >> size; | ||
19 | - tcg_ebytes = tcg_const_i64(1 << size); | ||
20 | + tcg_ebytes = tcg_constant_i64(1 << size); | ||
21 | for (r = 0; r < rpt; r++) { | ||
22 | int e; | ||
23 | for (e = 0; e < elements; e++) { | ||
24 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_multiple_struct(DisasContext *s, uint32_t insn) | ||
25 | } | ||
26 | } | ||
27 | } | ||
28 | - tcg_temp_free_i64(tcg_ebytes); | ||
29 | |||
30 | if (!is_store) { | ||
31 | /* For non-quad operations, setting a slice of the low | ||
32 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_single_struct(DisasContext *s, uint32_t insn) | ||
33 | total); | ||
34 | mop = finalize_memop(s, scale); | ||
35 | |||
36 | - tcg_ebytes = tcg_const_i64(1 << scale); | ||
37 | + tcg_ebytes = tcg_constant_i64(1 << scale); | ||
38 | for (xs = 0; xs < selem; xs++) { | ||
39 | if (replicate) { | ||
40 | /* Load and replicate to all elements */ | ||
41 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_single_struct(DisasContext *s, uint32_t insn) | ||
42 | tcg_gen_add_i64(clean_addr, clean_addr, tcg_ebytes); | ||
43 | rt = (rt + 1) % 32; | ||
44 | } | ||
45 | - tcg_temp_free_i64(tcg_ebytes); | ||
46 | |||
47 | if (is_postidx) { | ||
48 | if (rm == 31) { | ||
49 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_tag(DisasContext *s, uint32_t insn) | ||
50 | |||
51 | if (is_zero) { | ||
52 | TCGv_i64 clean_addr = clean_data_tbi(s, addr); | ||
53 | - TCGv_i64 tcg_zero = tcg_const_i64(0); | ||
54 | + TCGv_i64 tcg_zero = tcg_constant_i64(0); | ||
55 | int mem_index = get_mem_index(s); | ||
56 | int i, n = (1 + is_pair) << LOG2_TAG_GRANULE; | ||
57 | |||
58 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_tag(DisasContext *s, uint32_t insn) | ||
59 | tcg_gen_addi_i64(clean_addr, clean_addr, 8); | ||
60 | tcg_gen_qemu_st_i64(tcg_zero, clean_addr, mem_index, MO_UQ); | ||
61 | } | ||
62 | - tcg_temp_free_i64(tcg_zero); | ||
63 | } | ||
64 | |||
65 | if (index != 0) { | ||
66 | -- | ||
67 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-12-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-a64.c | 12 ++++-------- | ||
9 | 1 file changed, 4 insertions(+), 8 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-a64.c | ||
14 | +++ b/target/arm/translate-a64.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static void disas_add_sub_imm(DisasContext *s, uint32_t insn) | ||
16 | tcg_gen_addi_i64(tcg_result, tcg_rn, imm); | ||
17 | } | ||
18 | } else { | ||
19 | - TCGv_i64 tcg_imm = tcg_const_i64(imm); | ||
20 | + TCGv_i64 tcg_imm = tcg_constant_i64(imm); | ||
21 | if (sub_op) { | ||
22 | gen_sub_CC(is_64bit, tcg_result, tcg_rn, tcg_imm); | ||
23 | } else { | ||
24 | gen_add_CC(is_64bit, tcg_result, tcg_rn, tcg_imm); | ||
25 | } | ||
26 | - tcg_temp_free_i64(tcg_imm); | ||
27 | } | ||
28 | |||
29 | if (is_64bit) { | ||
30 | @@ -XXX,XX +XXX,XX @@ static void disas_add_sub_imm_with_tags(DisasContext *s, uint32_t insn) | ||
31 | tcg_rd = cpu_reg_sp(s, rd); | ||
32 | |||
33 | if (s->ata) { | ||
34 | - TCGv_i32 offset = tcg_const_i32(imm); | ||
35 | - TCGv_i32 tag_offset = tcg_const_i32(uimm4); | ||
36 | - | ||
37 | - gen_helper_addsubg(tcg_rd, cpu_env, tcg_rn, offset, tag_offset); | ||
38 | - tcg_temp_free_i32(tag_offset); | ||
39 | - tcg_temp_free_i32(offset); | ||
40 | + gen_helper_addsubg(tcg_rd, cpu_env, tcg_rn, | ||
41 | + tcg_constant_i32(imm), | ||
42 | + tcg_constant_i32(uimm4)); | ||
43 | } else { | ||
44 | tcg_gen_addi_i64(tcg_rd, tcg_rn, imm); | ||
45 | gen_address_with_allocation_tag0(tcg_rd, tcg_rd); | ||
46 | -- | ||
47 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-13-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-a64.c | 5 +---- | ||
9 | 1 file changed, 1 insertion(+), 4 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-a64.c | ||
14 | +++ b/target/arm/translate-a64.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static void disas_movw_imm(DisasContext *s, uint32_t insn) | ||
16 | int opc = extract32(insn, 29, 2); | ||
17 | int pos = extract32(insn, 21, 2) << 4; | ||
18 | TCGv_i64 tcg_rd = cpu_reg(s, rd); | ||
19 | - TCGv_i64 tcg_imm; | ||
20 | |||
21 | if (!sf && (pos >= 32)) { | ||
22 | unallocated_encoding(s); | ||
23 | @@ -XXX,XX +XXX,XX @@ static void disas_movw_imm(DisasContext *s, uint32_t insn) | ||
24 | tcg_gen_movi_i64(tcg_rd, imm); | ||
25 | break; | ||
26 | case 3: /* MOVK */ | ||
27 | - tcg_imm = tcg_const_i64(imm); | ||
28 | - tcg_gen_deposit_i64(tcg_rd, tcg_rd, tcg_imm, pos, 16); | ||
29 | - tcg_temp_free_i64(tcg_imm); | ||
30 | + tcg_gen_deposit_i64(tcg_rd, tcg_rd, tcg_constant_i64(imm), pos, 16); | ||
31 | if (!sf) { | ||
32 | tcg_gen_ext32u_i64(tcg_rd, tcg_rd); | ||
33 | } | ||
34 | -- | ||
35 | 2.25.1 | diff view generated by jsdifflib |
1 | From: Maxim Uvarov <maxim.uvarov@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | qemu has 2 type of functions: shutdown and reboot. Shutdown | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
4 | function has to be used for machine shutdown. Otherwise we cause | ||
5 | a reset with a bogus "cause" value, when we intended a shutdown. | ||
6 | |||
7 | Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Message-id: 20210625111842.3790-3-maxim.uvarov@linaro.org | 5 | Message-id: 20220426163043.100432-14-richard.henderson@linaro.org |
10 | [PMM: tweaked commit message] | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 7 | --- |
13 | hw/gpio/gpio_pwr.c | 2 +- | 8 | target/arm/translate-a64.c | 6 +----- |
14 | 1 file changed, 1 insertion(+), 1 deletion(-) | 9 | 1 file changed, 1 insertion(+), 5 deletions(-) |
15 | 10 | ||
16 | diff --git a/hw/gpio/gpio_pwr.c b/hw/gpio/gpio_pwr.c | 11 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
17 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/hw/gpio/gpio_pwr.c | 13 | --- a/target/arm/translate-a64.c |
19 | +++ b/hw/gpio/gpio_pwr.c | 14 | +++ b/target/arm/translate-a64.c |
20 | @@ -XXX,XX +XXX,XX @@ static void gpio_pwr_reset(void *opaque, int n, int level) | 15 | @@ -XXX,XX +XXX,XX @@ static void shift_reg_imm(TCGv_i64 dst, TCGv_i64 src, int sf, |
21 | static void gpio_pwr_shutdown(void *opaque, int n, int level) | 16 | if (shift_i == 0) { |
22 | { | 17 | tcg_gen_mov_i64(dst, src); |
23 | if (level) { | 18 | } else { |
24 | - qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN); | 19 | - TCGv_i64 shift_const; |
25 | + qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN); | 20 | - |
21 | - shift_const = tcg_const_i64(shift_i); | ||
22 | - shift_reg(dst, src, sf, shift_type, shift_const); | ||
23 | - tcg_temp_free_i64(shift_const); | ||
24 | + shift_reg(dst, src, sf, shift_type, tcg_constant_i64(shift_i)); | ||
26 | } | 25 | } |
27 | } | 26 | } |
28 | 27 | ||
29 | -- | 28 | -- |
30 | 2.20.1 | 29 | 2.25.1 |
31 | |||
32 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-15-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-a64.c | 3 +-- | ||
9 | 1 file changed, 1 insertion(+), 2 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-a64.c | ||
14 | +++ b/target/arm/translate-a64.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static void disas_cond_select(DisasContext *s, uint32_t insn) | ||
16 | tcg_rd = cpu_reg(s, rd); | ||
17 | |||
18 | a64_test_cc(&c, cond); | ||
19 | - zero = tcg_const_i64(0); | ||
20 | + zero = tcg_constant_i64(0); | ||
21 | |||
22 | if (rn == 31 && rm == 31 && (else_inc ^ else_inv)) { | ||
23 | /* CSET & CSETM. */ | ||
24 | @@ -XXX,XX +XXX,XX @@ static void disas_cond_select(DisasContext *s, uint32_t insn) | ||
25 | tcg_gen_movcond_i64(c.cond, tcg_rd, c.value, zero, t_true, t_false); | ||
26 | } | ||
27 | |||
28 | - tcg_temp_free_i64(zero); | ||
29 | a64_free_cc(&c); | ||
30 | |||
31 | if (!sf) { | ||
32 | -- | ||
33 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-16-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-a64.c | 7 ++----- | ||
9 | 1 file changed, 2 insertions(+), 5 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-a64.c | ||
14 | +++ b/target/arm/translate-a64.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static void handle_rev16(DisasContext *s, unsigned int sf, | ||
16 | TCGv_i64 tcg_rd = cpu_reg(s, rd); | ||
17 | TCGv_i64 tcg_tmp = tcg_temp_new_i64(); | ||
18 | TCGv_i64 tcg_rn = read_cpu_reg(s, rn, sf); | ||
19 | - TCGv_i64 mask = tcg_const_i64(sf ? 0x00ff00ff00ff00ffull : 0x00ff00ff); | ||
20 | + TCGv_i64 mask = tcg_constant_i64(sf ? 0x00ff00ff00ff00ffull : 0x00ff00ff); | ||
21 | |||
22 | tcg_gen_shri_i64(tcg_tmp, tcg_rn, 8); | ||
23 | tcg_gen_and_i64(tcg_rd, tcg_rn, mask); | ||
24 | @@ -XXX,XX +XXX,XX @@ static void handle_rev16(DisasContext *s, unsigned int sf, | ||
25 | tcg_gen_shli_i64(tcg_rd, tcg_rd, 8); | ||
26 | tcg_gen_or_i64(tcg_rd, tcg_rd, tcg_tmp); | ||
27 | |||
28 | - tcg_temp_free_i64(mask); | ||
29 | tcg_temp_free_i64(tcg_tmp); | ||
30 | } | ||
31 | |||
32 | @@ -XXX,XX +XXX,XX @@ static void handle_crc32(DisasContext *s, | ||
33 | } | ||
34 | |||
35 | tcg_acc = cpu_reg(s, rn); | ||
36 | - tcg_bytes = tcg_const_i32(1 << sz); | ||
37 | + tcg_bytes = tcg_constant_i32(1 << sz); | ||
38 | |||
39 | if (crc32c) { | ||
40 | gen_helper_crc32c_64(cpu_reg(s, rd), tcg_acc, tcg_val, tcg_bytes); | ||
41 | } else { | ||
42 | gen_helper_crc32_64(cpu_reg(s, rd), tcg_acc, tcg_val, tcg_bytes); | ||
43 | } | ||
44 | - | ||
45 | - tcg_temp_free_i32(tcg_bytes); | ||
46 | } | ||
47 | |||
48 | /* Data-processing (2 source) | ||
49 | -- | ||
50 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Existing temp usage treats t1 as both zero and as a | ||
4 | temporary. Rearrange to only require one temporary, | ||
5 | so remove t1 and rename t2. | ||
6 | |||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Message-id: 20220426163043.100432-17-richard.henderson@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | target/arm/translate-a64.c | 12 +++++------- | ||
13 | 1 file changed, 5 insertions(+), 7 deletions(-) | ||
14 | |||
15 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/target/arm/translate-a64.c | ||
18 | +++ b/target/arm/translate-a64.c | ||
19 | @@ -XXX,XX +XXX,XX @@ static void disas_data_proc_2src(DisasContext *s, uint32_t insn) | ||
20 | if (sf == 0 || !dc_isar_feature(aa64_mte_insn_reg, s)) { | ||
21 | goto do_unallocated; | ||
22 | } else { | ||
23 | - TCGv_i64 t1 = tcg_const_i64(1); | ||
24 | - TCGv_i64 t2 = tcg_temp_new_i64(); | ||
25 | + TCGv_i64 t = tcg_temp_new_i64(); | ||
26 | |||
27 | - tcg_gen_extract_i64(t2, cpu_reg_sp(s, rn), 56, 4); | ||
28 | - tcg_gen_shl_i64(t1, t1, t2); | ||
29 | - tcg_gen_or_i64(cpu_reg(s, rd), cpu_reg(s, rm), t1); | ||
30 | + tcg_gen_extract_i64(t, cpu_reg_sp(s, rn), 56, 4); | ||
31 | + tcg_gen_shl_i64(t, tcg_constant_i64(1), t); | ||
32 | + tcg_gen_or_i64(cpu_reg(s, rd), cpu_reg(s, rm), t); | ||
33 | |||
34 | - tcg_temp_free_i64(t1); | ||
35 | - tcg_temp_free_i64(t2); | ||
36 | + tcg_temp_free_i64(t); | ||
37 | } | ||
38 | break; | ||
39 | case 8: /* LSLV */ | ||
40 | -- | ||
41 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-18-richard.henderson@linaro.org | ||
6 | [PMM: Restore incorrectly removed free of t_false in disas_fp_csel()] | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | --- | ||
9 | target/arm/translate-a64.c | 23 +++++++---------------- | ||
10 | 1 file changed, 7 insertions(+), 16 deletions(-) | ||
11 | |||
12 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
13 | index XXXXXXX..XXXXXXX 100644 | ||
14 | --- a/target/arm/translate-a64.c | ||
15 | +++ b/target/arm/translate-a64.c | ||
16 | @@ -XXX,XX +XXX,XX @@ static void handle_fp_compare(DisasContext *s, int size, | ||
17 | |||
18 | tcg_vn = read_fp_dreg(s, rn); | ||
19 | if (cmp_with_zero) { | ||
20 | - tcg_vm = tcg_const_i64(0); | ||
21 | + tcg_vm = tcg_constant_i64(0); | ||
22 | } else { | ||
23 | tcg_vm = read_fp_dreg(s, rm); | ||
24 | } | ||
25 | @@ -XXX,XX +XXX,XX @@ static void disas_fp_compare(DisasContext *s, uint32_t insn) | ||
26 | static void disas_fp_ccomp(DisasContext *s, uint32_t insn) | ||
27 | { | ||
28 | unsigned int mos, type, rm, cond, rn, op, nzcv; | ||
29 | - TCGv_i64 tcg_flags; | ||
30 | TCGLabel *label_continue = NULL; | ||
31 | int size; | ||
32 | |||
33 | @@ -XXX,XX +XXX,XX @@ static void disas_fp_ccomp(DisasContext *s, uint32_t insn) | ||
34 | label_continue = gen_new_label(); | ||
35 | arm_gen_test_cc(cond, label_match); | ||
36 | /* nomatch: */ | ||
37 | - tcg_flags = tcg_const_i64(nzcv << 28); | ||
38 | - gen_set_nzcv(tcg_flags); | ||
39 | - tcg_temp_free_i64(tcg_flags); | ||
40 | + gen_set_nzcv(tcg_constant_i64(nzcv << 28)); | ||
41 | tcg_gen_br(label_continue); | ||
42 | gen_set_label(label_match); | ||
43 | } | ||
44 | @@ -XXX,XX +XXX,XX @@ static void disas_fp_ccomp(DisasContext *s, uint32_t insn) | ||
45 | static void disas_fp_csel(DisasContext *s, uint32_t insn) | ||
46 | { | ||
47 | unsigned int mos, type, rm, cond, rn, rd; | ||
48 | - TCGv_i64 t_true, t_false, t_zero; | ||
49 | + TCGv_i64 t_true, t_false; | ||
50 | DisasCompare64 c; | ||
51 | MemOp sz; | ||
52 | |||
53 | @@ -XXX,XX +XXX,XX @@ static void disas_fp_csel(DisasContext *s, uint32_t insn) | ||
54 | read_vec_element(s, t_false, rm, 0, sz); | ||
55 | |||
56 | a64_test_cc(&c, cond); | ||
57 | - t_zero = tcg_const_i64(0); | ||
58 | - tcg_gen_movcond_i64(c.cond, t_true, c.value, t_zero, t_true, t_false); | ||
59 | - tcg_temp_free_i64(t_zero); | ||
60 | + tcg_gen_movcond_i64(c.cond, t_true, c.value, tcg_constant_i64(0), | ||
61 | + t_true, t_false); | ||
62 | tcg_temp_free_i64(t_false); | ||
63 | a64_free_cc(&c); | ||
64 | |||
65 | @@ -XXX,XX +XXX,XX @@ static void disas_fp_imm(DisasContext *s, uint32_t insn) | ||
66 | int type = extract32(insn, 22, 2); | ||
67 | int mos = extract32(insn, 29, 3); | ||
68 | uint64_t imm; | ||
69 | - TCGv_i64 tcg_res; | ||
70 | MemOp sz; | ||
71 | |||
72 | if (mos || imm5) { | ||
73 | @@ -XXX,XX +XXX,XX @@ static void disas_fp_imm(DisasContext *s, uint32_t insn) | ||
74 | } | ||
75 | |||
76 | imm = vfp_expand_imm(sz, imm8); | ||
77 | - | ||
78 | - tcg_res = tcg_const_i64(imm); | ||
79 | - write_fp_dreg(s, rd, tcg_res); | ||
80 | - tcg_temp_free_i64(tcg_res); | ||
81 | + write_fp_dreg(s, rd, tcg_constant_i64(imm)); | ||
82 | } | ||
83 | |||
84 | /* Handle floating point <=> fixed point conversions. Note that we can | ||
85 | @@ -XXX,XX +XXX,XX @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode, | ||
86 | |||
87 | tcg_fpstatus = fpstatus_ptr(type == 3 ? FPST_FPCR_F16 : FPST_FPCR); | ||
88 | |||
89 | - tcg_shift = tcg_const_i32(64 - scale); | ||
90 | + tcg_shift = tcg_constant_i32(64 - scale); | ||
91 | |||
92 | if (itof) { | ||
93 | TCGv_i64 tcg_int = cpu_reg(s, rn); | ||
94 | @@ -XXX,XX +XXX,XX @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode, | ||
95 | } | ||
96 | |||
97 | tcg_temp_free_ptr(tcg_fpstatus); | ||
98 | - tcg_temp_free_i32(tcg_shift); | ||
99 | } | ||
100 | |||
101 | /* Floating point <-> fixed point conversions | ||
102 | -- | ||
103 | 2.25.1 | diff view generated by jsdifflib |
1 | The A64 AdvSIMD modified-immediate grouping uses almost the same | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | constant encoding that A32 Neon does; reuse asimd_imm_const() (to | ||
3 | which we add the AArch64-specific case for cmode 15 op 1) instead of | ||
4 | reimplementing it all. | ||
5 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-19-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20210628135835.6690-5-peter.maydell@linaro.org | ||
9 | --- | 7 | --- |
10 | target/arm/translate.h | 3 +- | 8 | target/arm/translate-a64.c | 21 +++++---------------- |
11 | target/arm/translate-a64.c | 86 ++++---------------------------------- | 9 | 1 file changed, 5 insertions(+), 16 deletions(-) |
12 | target/arm/translate.c | 17 +++++++- | ||
13 | 3 files changed, 24 insertions(+), 82 deletions(-) | ||
14 | 10 | ||
15 | diff --git a/target/arm/translate.h b/target/arm/translate.h | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/target/arm/translate.h | ||
18 | +++ b/target/arm/translate.h | ||
19 | @@ -XXX,XX +XXX,XX @@ static inline MemOp finalize_memop(DisasContext *s, MemOp opc) | ||
20 | * VMVN and VBIC (when cmode < 14 && op == 1). | ||
21 | * | ||
22 | * The combination cmode == 15 op == 1 is a reserved encoding for AArch32; | ||
23 | - * callers must catch this. | ||
24 | + * callers must catch this; we return the 64-bit constant value defined | ||
25 | + * for AArch64. | ||
26 | * | ||
27 | * cmode = 2,3,4,5,6,7,10,11,12,13 imm=0 was UNPREDICTABLE in v7A but | ||
28 | * is either not unpredictable or merely CONSTRAINED UNPREDICTABLE in v8A; | ||
29 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 11 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
30 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
31 | --- a/target/arm/translate-a64.c | 13 | --- a/target/arm/translate-a64.c |
32 | +++ b/target/arm/translate-a64.c | 14 | +++ b/target/arm/translate-a64.c |
33 | @@ -XXX,XX +XXX,XX @@ static void disas_simd_mod_imm(DisasContext *s, uint32_t insn) | 15 | @@ -XXX,XX +XXX,XX @@ static void handle_shri_with_rndacc(TCGv_i64 tcg_res, TCGv_i64 tcg_src, |
34 | { | 16 | /* Deal with the rounding step */ |
35 | int rd = extract32(insn, 0, 5); | 17 | if (round) { |
36 | int cmode = extract32(insn, 12, 4); | 18 | if (extended_result) { |
37 | - int cmode_3_1 = extract32(cmode, 1, 3); | 19 | - TCGv_i64 tcg_zero = tcg_const_i64(0); |
38 | - int cmode_0 = extract32(cmode, 0, 1); | 20 | + TCGv_i64 tcg_zero = tcg_constant_i64(0); |
39 | int o2 = extract32(insn, 11, 1); | 21 | if (!is_u) { |
40 | uint64_t abcdefgh = extract32(insn, 5, 5) | (extract32(insn, 16, 3) << 5); | 22 | /* take care of sign extending tcg_res */ |
41 | bool is_neg = extract32(insn, 29, 1); | 23 | tcg_gen_sari_i64(tcg_src_hi, tcg_src, 63); |
42 | @@ -XXX,XX +XXX,XX @@ static void disas_simd_mod_imm(DisasContext *s, uint32_t insn) | 24 | @@ -XXX,XX +XXX,XX @@ static void handle_shri_with_rndacc(TCGv_i64 tcg_res, TCGv_i64 tcg_src, |
43 | return; | 25 | tcg_src, tcg_zero, |
26 | tcg_rnd, tcg_zero); | ||
27 | } | ||
28 | - tcg_temp_free_i64(tcg_zero); | ||
29 | } else { | ||
30 | tcg_gen_add_i64(tcg_src, tcg_src, tcg_rnd); | ||
31 | } | ||
32 | @@ -XXX,XX +XXX,XX @@ static void handle_scalar_simd_shri(DisasContext *s, | ||
44 | } | 33 | } |
45 | 34 | ||
46 | - /* See AdvSIMDExpandImm() in ARM ARM */ | 35 | if (round) { |
47 | - switch (cmode_3_1) { | 36 | - uint64_t round_const = 1ULL << (shift - 1); |
48 | - case 0: /* Replicate(Zeros(24):imm8, 2) */ | 37 | - tcg_round = tcg_const_i64(round_const); |
49 | - case 1: /* Replicate(Zeros(16):imm8:Zeros(8), 2) */ | 38 | + tcg_round = tcg_constant_i64(1ULL << (shift - 1)); |
50 | - case 2: /* Replicate(Zeros(8):imm8:Zeros(16), 2) */ | 39 | } else { |
51 | - case 3: /* Replicate(imm8:Zeros(24), 2) */ | 40 | tcg_round = NULL; |
52 | - { | 41 | } |
53 | - int shift = cmode_3_1 * 8; | 42 | @@ -XXX,XX +XXX,XX @@ static void handle_scalar_simd_shri(DisasContext *s, |
54 | - imm = bitfield_replicate(abcdefgh << shift, 32); | 43 | |
55 | - break; | 44 | tcg_temp_free_i64(tcg_rn); |
45 | tcg_temp_free_i64(tcg_rd); | ||
46 | - if (round) { | ||
47 | - tcg_temp_free_i64(tcg_round); | ||
56 | - } | 48 | - } |
57 | - case 4: /* Replicate(Zeros(8):imm8, 4) */ | 49 | } |
58 | - case 5: /* Replicate(imm8:Zeros(8), 4) */ | 50 | |
59 | - { | 51 | /* SHL/SLI - Scalar shift left */ |
60 | - int shift = (cmode_3_1 & 0x1) * 8; | 52 | @@ -XXX,XX +XXX,XX @@ static void handle_vec_simd_sqshrn(DisasContext *s, bool is_scalar, bool is_q, |
61 | - imm = bitfield_replicate(abcdefgh << shift, 16); | 53 | tcg_final = tcg_const_i64(0); |
62 | - break; | 54 | |
55 | if (round) { | ||
56 | - uint64_t round_const = 1ULL << (shift - 1); | ||
57 | - tcg_round = tcg_const_i64(round_const); | ||
58 | + tcg_round = tcg_constant_i64(1ULL << (shift - 1)); | ||
59 | } else { | ||
60 | tcg_round = NULL; | ||
61 | } | ||
62 | @@ -XXX,XX +XXX,XX @@ static void handle_vec_simd_sqshrn(DisasContext *s, bool is_scalar, bool is_q, | ||
63 | write_vec_element(s, tcg_final, rd, 1, MO_64); | ||
64 | } | ||
65 | |||
66 | - if (round) { | ||
67 | - tcg_temp_free_i64(tcg_round); | ||
63 | - } | 68 | - } |
64 | - case 6: | 69 | tcg_temp_free_i64(tcg_rn); |
65 | - if (cmode_0) { | 70 | tcg_temp_free_i64(tcg_rd); |
66 | - /* Replicate(Zeros(8):imm8:Ones(16), 2) */ | 71 | tcg_temp_free_i32(tcg_rd_narrowed); |
67 | - imm = (abcdefgh << 16) | 0xffff; | 72 | @@ -XXX,XX +XXX,XX @@ static void handle_simd_qshl(DisasContext *s, bool scalar, bool is_q, |
68 | - } else { | ||
69 | - /* Replicate(Zeros(16):imm8:Ones(8), 2) */ | ||
70 | - imm = (abcdefgh << 8) | 0xff; | ||
71 | - } | ||
72 | - imm = bitfield_replicate(imm, 32); | ||
73 | - break; | ||
74 | - case 7: | ||
75 | - if (!cmode_0 && !is_neg) { | ||
76 | - imm = bitfield_replicate(abcdefgh, 8); | ||
77 | - } else if (!cmode_0 && is_neg) { | ||
78 | - int i; | ||
79 | - imm = 0; | ||
80 | - for (i = 0; i < 8; i++) { | ||
81 | - if ((abcdefgh) & (1 << i)) { | ||
82 | - imm |= 0xffULL << (i * 8); | ||
83 | - } | ||
84 | - } | ||
85 | - } else if (cmode_0) { | ||
86 | - if (is_neg) { | ||
87 | - imm = (abcdefgh & 0x3f) << 48; | ||
88 | - if (abcdefgh & 0x80) { | ||
89 | - imm |= 0x8000000000000000ULL; | ||
90 | - } | ||
91 | - if (abcdefgh & 0x40) { | ||
92 | - imm |= 0x3fc0000000000000ULL; | ||
93 | - } else { | ||
94 | - imm |= 0x4000000000000000ULL; | ||
95 | - } | ||
96 | - } else { | ||
97 | - if (o2) { | ||
98 | - /* FMOV (vector, immediate) - half-precision */ | ||
99 | - imm = vfp_expand_imm(MO_16, abcdefgh); | ||
100 | - /* now duplicate across the lanes */ | ||
101 | - imm = bitfield_replicate(imm, 16); | ||
102 | - } else { | ||
103 | - imm = (abcdefgh & 0x3f) << 19; | ||
104 | - if (abcdefgh & 0x80) { | ||
105 | - imm |= 0x80000000; | ||
106 | - } | ||
107 | - if (abcdefgh & 0x40) { | ||
108 | - imm |= 0x3e000000; | ||
109 | - } else { | ||
110 | - imm |= 0x40000000; | ||
111 | - } | ||
112 | - imm |= (imm << 32); | ||
113 | - } | ||
114 | - } | ||
115 | - } | ||
116 | - break; | ||
117 | - default: | ||
118 | - g_assert_not_reached(); | ||
119 | - } | ||
120 | - | ||
121 | - if (cmode_3_1 != 7 && is_neg) { | ||
122 | - imm = ~imm; | ||
123 | + if (cmode == 15 && o2 && !is_neg) { | ||
124 | + /* FMOV (vector, immediate) - half-precision */ | ||
125 | + imm = vfp_expand_imm(MO_16, abcdefgh); | ||
126 | + /* now duplicate across the lanes */ | ||
127 | + imm = bitfield_replicate(imm, 16); | ||
128 | + } else { | ||
129 | + imm = asimd_imm_const(abcdefgh, cmode, is_neg); | ||
130 | } | 73 | } |
131 | 74 | ||
132 | if (!((cmode & 0x9) == 0x1 || (cmode & 0xd) == 0x9)) { | 75 | if (size == 3) { |
133 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 76 | - TCGv_i64 tcg_shift = tcg_const_i64(shift); |
134 | index XXXXXXX..XXXXXXX 100644 | 77 | + TCGv_i64 tcg_shift = tcg_constant_i64(shift); |
135 | --- a/target/arm/translate.c | 78 | static NeonGenTwo64OpEnvFn * const fns[2][2] = { |
136 | +++ b/target/arm/translate.c | 79 | { gen_helper_neon_qshl_s64, gen_helper_neon_qshlu_s64 }, |
137 | @@ -XXX,XX +XXX,XX @@ uint64_t asimd_imm_const(uint32_t imm, int cmode, int op) | 80 | { NULL, gen_helper_neon_qshl_u64 }, |
138 | case 14: | 81 | @@ -XXX,XX +XXX,XX @@ static void handle_simd_qshl(DisasContext *s, bool scalar, bool is_q, |
139 | if (op) { | 82 | |
140 | /* | 83 | tcg_temp_free_i64(tcg_op); |
141 | - * This is the only case where the top and bottom 32 bits | 84 | } |
142 | - * of the encoded constant differ. | 85 | - tcg_temp_free_i64(tcg_shift); |
143 | + * This and cmode == 15 op == 1 are the only cases where | 86 | clear_vec_high(s, is_q, rd); |
144 | + * the top and bottom 32 bits of the encoded constant differ. | 87 | } else { |
145 | */ | 88 | - TCGv_i32 tcg_shift = tcg_const_i32(shift); |
146 | uint64_t imm64 = 0; | 89 | + TCGv_i32 tcg_shift = tcg_constant_i32(shift); |
147 | int n; | 90 | static NeonGenTwoOpEnvFn * const fns[2][2][3] = { |
148 | @@ -XXX,XX +XXX,XX @@ uint64_t asimd_imm_const(uint32_t imm, int cmode, int op) | 91 | { |
149 | imm |= (imm << 8) | (imm << 16) | (imm << 24); | 92 | { gen_helper_neon_qshl_s8, |
150 | break; | 93 | @@ -XXX,XX +XXX,XX @@ static void handle_simd_qshl(DisasContext *s, bool scalar, bool is_q, |
151 | case 15: | 94 | |
152 | + if (op) { | 95 | tcg_temp_free_i32(tcg_op); |
153 | + /* Reserved encoding for AArch32; valid for AArch64 */ | 96 | } |
154 | + uint64_t imm64 = (uint64_t)(imm & 0x3f) << 48; | 97 | - tcg_temp_free_i32(tcg_shift); |
155 | + if (imm & 0x80) { | 98 | |
156 | + imm64 |= 0x8000000000000000ULL; | 99 | if (!scalar) { |
157 | + } | 100 | clear_vec_high(s, is_q, rd); |
158 | + if (imm & 0x40) { | ||
159 | + imm64 |= 0x3fc0000000000000ULL; | ||
160 | + } else { | ||
161 | + imm64 |= 0x4000000000000000ULL; | ||
162 | + } | ||
163 | + return imm64; | ||
164 | + } | ||
165 | imm = ((imm & 0x80) << 24) | ((imm & 0x3f) << 19) | ||
166 | | ((imm & 0x40) ? (0x1f << 25) : (1 << 30)); | ||
167 | break; | ||
168 | -- | 101 | -- |
169 | 2.20.1 | 102 | 2.25.1 |
170 | |||
171 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-20-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-a64.c | 26 ++++++-------------------- | ||
9 | 1 file changed, 6 insertions(+), 20 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-a64.c | ||
14 | +++ b/target/arm/translate-a64.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static void handle_simd_intfp_conv(DisasContext *s, int rd, int rn, | ||
16 | int pass; | ||
17 | |||
18 | if (fracbits || size == MO_64) { | ||
19 | - tcg_shift = tcg_const_i32(fracbits); | ||
20 | + tcg_shift = tcg_constant_i32(fracbits); | ||
21 | } | ||
22 | |||
23 | if (size == MO_64) { | ||
24 | @@ -XXX,XX +XXX,XX @@ static void handle_simd_intfp_conv(DisasContext *s, int rd, int rn, | ||
25 | } | ||
26 | |||
27 | tcg_temp_free_ptr(tcg_fpst); | ||
28 | - if (tcg_shift) { | ||
29 | - tcg_temp_free_i32(tcg_shift); | ||
30 | - } | ||
31 | |||
32 | clear_vec_high(s, elements << size == 16, rd); | ||
33 | } | ||
34 | @@ -XXX,XX +XXX,XX @@ static void handle_simd_shift_fpint_conv(DisasContext *s, bool is_scalar, | ||
35 | tcg_fpstatus = fpstatus_ptr(size == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); | ||
36 | gen_helper_set_rmode(tcg_rmode, tcg_rmode, tcg_fpstatus); | ||
37 | fracbits = (16 << size) - immhb; | ||
38 | - tcg_shift = tcg_const_i32(fracbits); | ||
39 | + tcg_shift = tcg_constant_i32(fracbits); | ||
40 | |||
41 | if (size == MO_64) { | ||
42 | int maxpass = is_scalar ? 1 : 2; | ||
43 | @@ -XXX,XX +XXX,XX @@ static void handle_simd_shift_fpint_conv(DisasContext *s, bool is_scalar, | ||
44 | } | ||
45 | } | ||
46 | |||
47 | - tcg_temp_free_i32(tcg_shift); | ||
48 | gen_helper_set_rmode(tcg_rmode, tcg_rmode, tcg_fpstatus); | ||
49 | tcg_temp_free_ptr(tcg_fpstatus); | ||
50 | tcg_temp_free_i32(tcg_rmode); | ||
51 | @@ -XXX,XX +XXX,XX @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u, | ||
52 | case 0x1c: /* FCVTAS */ | ||
53 | case 0x3a: /* FCVTPS */ | ||
54 | case 0x3b: /* FCVTZS */ | ||
55 | - { | ||
56 | - TCGv_i32 tcg_shift = tcg_const_i32(0); | ||
57 | - gen_helper_vfp_tosqd(tcg_rd, tcg_rn, tcg_shift, tcg_fpstatus); | ||
58 | - tcg_temp_free_i32(tcg_shift); | ||
59 | + gen_helper_vfp_tosqd(tcg_rd, tcg_rn, tcg_constant_i32(0), tcg_fpstatus); | ||
60 | break; | ||
61 | - } | ||
62 | case 0x5a: /* FCVTNU */ | ||
63 | case 0x5b: /* FCVTMU */ | ||
64 | case 0x5c: /* FCVTAU */ | ||
65 | case 0x7a: /* FCVTPU */ | ||
66 | case 0x7b: /* FCVTZU */ | ||
67 | - { | ||
68 | - TCGv_i32 tcg_shift = tcg_const_i32(0); | ||
69 | - gen_helper_vfp_touqd(tcg_rd, tcg_rn, tcg_shift, tcg_fpstatus); | ||
70 | - tcg_temp_free_i32(tcg_shift); | ||
71 | + gen_helper_vfp_touqd(tcg_rd, tcg_rn, tcg_constant_i32(0), tcg_fpstatus); | ||
72 | break; | ||
73 | - } | ||
74 | case 0x18: /* FRINTN */ | ||
75 | case 0x19: /* FRINTM */ | ||
76 | case 0x38: /* FRINTP */ | ||
77 | @@ -XXX,XX +XXX,XX @@ static void handle_2misc_fcmp_zero(DisasContext *s, int opcode, | ||
78 | |||
79 | if (is_double) { | ||
80 | TCGv_i64 tcg_op = tcg_temp_new_i64(); | ||
81 | - TCGv_i64 tcg_zero = tcg_const_i64(0); | ||
82 | + TCGv_i64 tcg_zero = tcg_constant_i64(0); | ||
83 | TCGv_i64 tcg_res = tcg_temp_new_i64(); | ||
84 | NeonGenTwoDoubleOpFn *genfn; | ||
85 | bool swap = false; | ||
86 | @@ -XXX,XX +XXX,XX @@ static void handle_2misc_fcmp_zero(DisasContext *s, int opcode, | ||
87 | write_vec_element(s, tcg_res, rd, pass, MO_64); | ||
88 | } | ||
89 | tcg_temp_free_i64(tcg_res); | ||
90 | - tcg_temp_free_i64(tcg_zero); | ||
91 | tcg_temp_free_i64(tcg_op); | ||
92 | |||
93 | clear_vec_high(s, !is_scalar, rd); | ||
94 | } else { | ||
95 | TCGv_i32 tcg_op = tcg_temp_new_i32(); | ||
96 | - TCGv_i32 tcg_zero = tcg_const_i32(0); | ||
97 | + TCGv_i32 tcg_zero = tcg_constant_i32(0); | ||
98 | TCGv_i32 tcg_res = tcg_temp_new_i32(); | ||
99 | NeonGenTwoSingleOpFn *genfn; | ||
100 | bool swap = false; | ||
101 | @@ -XXX,XX +XXX,XX @@ static void handle_2misc_fcmp_zero(DisasContext *s, int opcode, | ||
102 | } | ||
103 | } | ||
104 | tcg_temp_free_i32(tcg_res); | ||
105 | - tcg_temp_free_i32(tcg_zero); | ||
106 | tcg_temp_free_i32(tcg_op); | ||
107 | if (!is_scalar) { | ||
108 | clear_vec_high(s, is_q, rd); | ||
109 | -- | ||
110 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-21-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-a64.c | 40 ++++++++++---------------------------- | ||
9 | 1 file changed, 10 insertions(+), 30 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-a64.c | ||
14 | +++ b/target/arm/translate-a64.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static void handle_2misc_narrow(DisasContext *s, bool scalar, | ||
16 | int passes = scalar ? 1 : 2; | ||
17 | |||
18 | if (scalar) { | ||
19 | - tcg_res[1] = tcg_const_i32(0); | ||
20 | + tcg_res[1] = tcg_constant_i32(0); | ||
21 | } | ||
22 | |||
23 | for (pass = 0; pass < passes; pass++) { | ||
24 | @@ -XXX,XX +XXX,XX @@ static void handle_2misc_satacc(DisasContext *s, bool is_scalar, bool is_u, | ||
25 | } | ||
26 | |||
27 | if (is_scalar) { | ||
28 | - TCGv_i64 tcg_zero = tcg_const_i64(0); | ||
29 | - write_vec_element(s, tcg_zero, rd, 0, MO_64); | ||
30 | - tcg_temp_free_i64(tcg_zero); | ||
31 | + write_vec_element(s, tcg_constant_i64(0), rd, 0, MO_64); | ||
32 | } | ||
33 | write_vec_element_i32(s, tcg_rd, rd, pass, MO_32); | ||
34 | } | ||
35 | @@ -XXX,XX +XXX,XX @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) | ||
36 | case 0x1c: /* FCVTAS */ | ||
37 | case 0x3a: /* FCVTPS */ | ||
38 | case 0x3b: /* FCVTZS */ | ||
39 | - { | ||
40 | - TCGv_i32 tcg_shift = tcg_const_i32(0); | ||
41 | - gen_helper_vfp_tosls(tcg_rd, tcg_rn, tcg_shift, tcg_fpstatus); | ||
42 | - tcg_temp_free_i32(tcg_shift); | ||
43 | + gen_helper_vfp_tosls(tcg_rd, tcg_rn, tcg_constant_i32(0), | ||
44 | + tcg_fpstatus); | ||
45 | break; | ||
46 | - } | ||
47 | case 0x5a: /* FCVTNU */ | ||
48 | case 0x5b: /* FCVTMU */ | ||
49 | case 0x5c: /* FCVTAU */ | ||
50 | case 0x7a: /* FCVTPU */ | ||
51 | case 0x7b: /* FCVTZU */ | ||
52 | - { | ||
53 | - TCGv_i32 tcg_shift = tcg_const_i32(0); | ||
54 | - gen_helper_vfp_touls(tcg_rd, tcg_rn, tcg_shift, tcg_fpstatus); | ||
55 | - tcg_temp_free_i32(tcg_shift); | ||
56 | + gen_helper_vfp_touls(tcg_rd, tcg_rn, tcg_constant_i32(0), | ||
57 | + tcg_fpstatus); | ||
58 | break; | ||
59 | - } | ||
60 | default: | ||
61 | g_assert_not_reached(); | ||
62 | } | ||
63 | @@ -XXX,XX +XXX,XX @@ static void handle_vec_simd_shrn(DisasContext *s, bool is_q, | ||
64 | read_vec_element(s, tcg_final, rd, is_q ? 1 : 0, MO_64); | ||
65 | |||
66 | if (round) { | ||
67 | - uint64_t round_const = 1ULL << (shift - 1); | ||
68 | - tcg_round = tcg_const_i64(round_const); | ||
69 | + tcg_round = tcg_constant_i64(1ULL << (shift - 1)); | ||
70 | } else { | ||
71 | tcg_round = NULL; | ||
72 | } | ||
73 | @@ -XXX,XX +XXX,XX @@ static void handle_vec_simd_shrn(DisasContext *s, bool is_q, | ||
74 | } else { | ||
75 | write_vec_element(s, tcg_final, rd, 1, MO_64); | ||
76 | } | ||
77 | - if (round) { | ||
78 | - tcg_temp_free_i64(tcg_round); | ||
79 | - } | ||
80 | tcg_temp_free_i64(tcg_rn); | ||
81 | tcg_temp_free_i64(tcg_rd); | ||
82 | tcg_temp_free_i64(tcg_final); | ||
83 | @@ -XXX,XX +XXX,XX @@ static void handle_2misc_pairwise(DisasContext *s, int opcode, bool u, | ||
84 | } | ||
85 | } | ||
86 | if (!is_q) { | ||
87 | - tcg_res[1] = tcg_const_i64(0); | ||
88 | + tcg_res[1] = tcg_constant_i64(0); | ||
89 | } | ||
90 | for (pass = 0; pass < 2; pass++) { | ||
91 | write_vec_element(s, tcg_res[pass], rd, pass, MO_64); | ||
92 | @@ -XXX,XX +XXX,XX @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) | ||
93 | case 0x1c: /* FCVTAS */ | ||
94 | case 0x3a: /* FCVTPS */ | ||
95 | case 0x3b: /* FCVTZS */ | ||
96 | - { | ||
97 | - TCGv_i32 tcg_shift = tcg_const_i32(0); | ||
98 | gen_helper_vfp_tosls(tcg_res, tcg_op, | ||
99 | - tcg_shift, tcg_fpstatus); | ||
100 | - tcg_temp_free_i32(tcg_shift); | ||
101 | + tcg_constant_i32(0), tcg_fpstatus); | ||
102 | break; | ||
103 | - } | ||
104 | case 0x5a: /* FCVTNU */ | ||
105 | case 0x5b: /* FCVTMU */ | ||
106 | case 0x5c: /* FCVTAU */ | ||
107 | case 0x7a: /* FCVTPU */ | ||
108 | case 0x7b: /* FCVTZU */ | ||
109 | - { | ||
110 | - TCGv_i32 tcg_shift = tcg_const_i32(0); | ||
111 | gen_helper_vfp_touls(tcg_res, tcg_op, | ||
112 | - tcg_shift, tcg_fpstatus); | ||
113 | - tcg_temp_free_i32(tcg_shift); | ||
114 | + tcg_constant_i32(0), tcg_fpstatus); | ||
115 | break; | ||
116 | - } | ||
117 | case 0x18: /* FRINTN */ | ||
118 | case 0x19: /* FRINTM */ | ||
119 | case 0x38: /* FRINTP */ | ||
120 | -- | ||
121 | 2.25.1 | diff view generated by jsdifflib |
1 | Implement the MVE saturating shift-right-and-narrow insns | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | VQSHRN, VQSHRUN, VQRSHRN and VQRSHRUN. | ||
3 | 2 | ||
4 | do_srshr() is borrowed from sve_helper.c. | 3 | Finish conversion of the file to tcg_constant_*. |
5 | 4 | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Message-id: 20220426163043.100432-22-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20210628135835.6690-13-peter.maydell@linaro.org | ||
9 | --- | 9 | --- |
10 | target/arm/helper-mve.h | 30 +++++++++++ | 10 | target/arm/translate-a64.c | 20 ++++++++------------ |
11 | target/arm/mve.decode | 28 ++++++++++ | 11 | 1 file changed, 8 insertions(+), 12 deletions(-) |
12 | target/arm/mve_helper.c | 104 +++++++++++++++++++++++++++++++++++++ | ||
13 | target/arm/translate-mve.c | 12 +++++ | ||
14 | 4 files changed, 174 insertions(+) | ||
15 | 12 | ||
16 | diff --git a/target/arm/helper-mve.h b/target/arm/helper-mve.h | 13 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
17 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/helper-mve.h | 15 | --- a/target/arm/translate-a64.c |
19 | +++ b/target/arm/helper-mve.h | 16 | +++ b/target/arm/translate-a64.c |
20 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_4(mve_vrshrnbb, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 17 | @@ -XXX,XX +XXX,XX @@ static void disas_simd_indexed(DisasContext *s, uint32_t insn) |
21 | DEF_HELPER_FLAGS_4(mve_vrshrnbh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 18 | } |
22 | DEF_HELPER_FLAGS_4(mve_vrshrntb, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 19 | |
23 | DEF_HELPER_FLAGS_4(mve_vrshrnth, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 20 | if (is_scalar) { |
24 | + | 21 | - tcg_res[1] = tcg_const_i64(0); |
25 | +DEF_HELPER_FLAGS_4(mve_vqshrnb_sb, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 22 | + tcg_res[1] = tcg_constant_i64(0); |
26 | +DEF_HELPER_FLAGS_4(mve_vqshrnb_sh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 23 | } |
27 | +DEF_HELPER_FLAGS_4(mve_vqshrnt_sb, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 24 | |
28 | +DEF_HELPER_FLAGS_4(mve_vqshrnt_sh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 25 | for (pass = 0; pass < 2; pass++) { |
29 | + | 26 | @@ -XXX,XX +XXX,XX @@ static void disas_crypto_four_reg(DisasContext *s, uint32_t insn) |
30 | +DEF_HELPER_FLAGS_4(mve_vqshrnb_ub, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 27 | tcg_op2 = tcg_temp_new_i32(); |
31 | +DEF_HELPER_FLAGS_4(mve_vqshrnb_uh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 28 | tcg_op3 = tcg_temp_new_i32(); |
32 | +DEF_HELPER_FLAGS_4(mve_vqshrnt_ub, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 29 | tcg_res = tcg_temp_new_i32(); |
33 | +DEF_HELPER_FLAGS_4(mve_vqshrnt_uh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 30 | - tcg_zero = tcg_const_i32(0); |
34 | + | 31 | + tcg_zero = tcg_constant_i32(0); |
35 | +DEF_HELPER_FLAGS_4(mve_vqshrunbb, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 32 | |
36 | +DEF_HELPER_FLAGS_4(mve_vqshrunbh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 33 | read_vec_element_i32(s, tcg_op1, rn, 3, MO_32); |
37 | +DEF_HELPER_FLAGS_4(mve_vqshruntb, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 34 | read_vec_element_i32(s, tcg_op2, rm, 3, MO_32); |
38 | +DEF_HELPER_FLAGS_4(mve_vqshrunth, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 35 | @@ -XXX,XX +XXX,XX @@ static void disas_crypto_four_reg(DisasContext *s, uint32_t insn) |
39 | + | 36 | tcg_temp_free_i32(tcg_op2); |
40 | +DEF_HELPER_FLAGS_4(mve_vqrshrnb_sb, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 37 | tcg_temp_free_i32(tcg_op3); |
41 | +DEF_HELPER_FLAGS_4(mve_vqrshrnb_sh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 38 | tcg_temp_free_i32(tcg_res); |
42 | +DEF_HELPER_FLAGS_4(mve_vqrshrnt_sb, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 39 | - tcg_temp_free_i32(tcg_zero); |
43 | +DEF_HELPER_FLAGS_4(mve_vqrshrnt_sh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | ||
44 | + | ||
45 | +DEF_HELPER_FLAGS_4(mve_vqrshrnb_ub, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | ||
46 | +DEF_HELPER_FLAGS_4(mve_vqrshrnb_uh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | ||
47 | +DEF_HELPER_FLAGS_4(mve_vqrshrnt_ub, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | ||
48 | +DEF_HELPER_FLAGS_4(mve_vqrshrnt_uh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | ||
49 | + | ||
50 | +DEF_HELPER_FLAGS_4(mve_vqrshrunbb, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | ||
51 | +DEF_HELPER_FLAGS_4(mve_vqrshrunbh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | ||
52 | +DEF_HELPER_FLAGS_4(mve_vqrshruntb, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | ||
53 | +DEF_HELPER_FLAGS_4(mve_vqrshrunth, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | ||
54 | diff --git a/target/arm/mve.decode b/target/arm/mve.decode | ||
55 | index XXXXXXX..XXXXXXX 100644 | ||
56 | --- a/target/arm/mve.decode | ||
57 | +++ b/target/arm/mve.decode | ||
58 | @@ -XXX,XX +XXX,XX @@ VRSHRNB 111 1 1110 1 . ... ... ... 0 1111 1 1 . 0 ... 1 @2_shr_b | ||
59 | VRSHRNB 111 1 1110 1 . ... ... ... 0 1111 1 1 . 0 ... 1 @2_shr_h | ||
60 | VRSHRNT 111 1 1110 1 . ... ... ... 1 1111 1 1 . 0 ... 1 @2_shr_b | ||
61 | VRSHRNT 111 1 1110 1 . ... ... ... 1 1111 1 1 . 0 ... 1 @2_shr_h | ||
62 | + | ||
63 | +VQSHRNB_S 111 0 1110 1 . ... ... ... 0 1111 0 1 . 0 ... 0 @2_shr_b | ||
64 | +VQSHRNB_S 111 0 1110 1 . ... ... ... 0 1111 0 1 . 0 ... 0 @2_shr_h | ||
65 | +VQSHRNT_S 111 0 1110 1 . ... ... ... 1 1111 0 1 . 0 ... 0 @2_shr_b | ||
66 | +VQSHRNT_S 111 0 1110 1 . ... ... ... 1 1111 0 1 . 0 ... 0 @2_shr_h | ||
67 | +VQSHRNB_U 111 1 1110 1 . ... ... ... 0 1111 0 1 . 0 ... 0 @2_shr_b | ||
68 | +VQSHRNB_U 111 1 1110 1 . ... ... ... 0 1111 0 1 . 0 ... 0 @2_shr_h | ||
69 | +VQSHRNT_U 111 1 1110 1 . ... ... ... 1 1111 0 1 . 0 ... 0 @2_shr_b | ||
70 | +VQSHRNT_U 111 1 1110 1 . ... ... ... 1 1111 0 1 . 0 ... 0 @2_shr_h | ||
71 | + | ||
72 | +VQSHRUNB 111 0 1110 1 . ... ... ... 0 1111 1 1 . 0 ... 0 @2_shr_b | ||
73 | +VQSHRUNB 111 0 1110 1 . ... ... ... 0 1111 1 1 . 0 ... 0 @2_shr_h | ||
74 | +VQSHRUNT 111 0 1110 1 . ... ... ... 1 1111 1 1 . 0 ... 0 @2_shr_b | ||
75 | +VQSHRUNT 111 0 1110 1 . ... ... ... 1 1111 1 1 . 0 ... 0 @2_shr_h | ||
76 | + | ||
77 | +VQRSHRNB_S 111 0 1110 1 . ... ... ... 0 1111 0 1 . 0 ... 1 @2_shr_b | ||
78 | +VQRSHRNB_S 111 0 1110 1 . ... ... ... 0 1111 0 1 . 0 ... 1 @2_shr_h | ||
79 | +VQRSHRNT_S 111 0 1110 1 . ... ... ... 1 1111 0 1 . 0 ... 1 @2_shr_b | ||
80 | +VQRSHRNT_S 111 0 1110 1 . ... ... ... 1 1111 0 1 . 0 ... 1 @2_shr_h | ||
81 | +VQRSHRNB_U 111 1 1110 1 . ... ... ... 0 1111 0 1 . 0 ... 1 @2_shr_b | ||
82 | +VQRSHRNB_U 111 1 1110 1 . ... ... ... 0 1111 0 1 . 0 ... 1 @2_shr_h | ||
83 | +VQRSHRNT_U 111 1 1110 1 . ... ... ... 1 1111 0 1 . 0 ... 1 @2_shr_b | ||
84 | +VQRSHRNT_U 111 1 1110 1 . ... ... ... 1 1111 0 1 . 0 ... 1 @2_shr_h | ||
85 | + | ||
86 | +VQRSHRUNB 111 1 1110 1 . ... ... ... 0 1111 1 1 . 0 ... 0 @2_shr_b | ||
87 | +VQRSHRUNB 111 1 1110 1 . ... ... ... 0 1111 1 1 . 0 ... 0 @2_shr_h | ||
88 | +VQRSHRUNT 111 1 1110 1 . ... ... ... 1 1111 1 1 . 0 ... 0 @2_shr_b | ||
89 | +VQRSHRUNT 111 1 1110 1 . ... ... ... 1 1111 1 1 . 0 ... 0 @2_shr_h | ||
90 | diff --git a/target/arm/mve_helper.c b/target/arm/mve_helper.c | ||
91 | index XXXXXXX..XXXXXXX 100644 | ||
92 | --- a/target/arm/mve_helper.c | ||
93 | +++ b/target/arm/mve_helper.c | ||
94 | @@ -XXX,XX +XXX,XX @@ static inline uint64_t do_urshr(uint64_t x, unsigned sh) | ||
95 | } | 40 | } |
96 | } | 41 | } |
97 | 42 | ||
98 | +static inline int64_t do_srshr(int64_t x, unsigned sh) | 43 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) |
99 | +{ | 44 | gen_helper_yield(cpu_env); |
100 | + if (likely(sh < 64)) { | 45 | break; |
101 | + return (x >> sh) + ((x >> (sh - 1)) & 1); | 46 | case DISAS_WFI: |
102 | + } else { | 47 | - { |
103 | + /* Rounding the sign bit always produces 0. */ | 48 | - /* This is a special case because we don't want to just halt the CPU |
104 | + return 0; | 49 | - * if trying to debug across a WFI. |
105 | + } | 50 | + /* |
106 | +} | 51 | + * This is a special case because we don't want to just halt |
107 | + | 52 | + * the CPU if trying to debug across a WFI. |
108 | DO_VSHRN_ALL(vshrn, DO_SHR) | 53 | */ |
109 | DO_VSHRN_ALL(vrshrn, do_urshr) | 54 | - TCGv_i32 tmp = tcg_const_i32(4); |
110 | + | 55 | - |
111 | +static inline int32_t do_sat_bhs(int64_t val, int64_t min, int64_t max, | 56 | gen_a64_set_pc_im(dc->base.pc_next); |
112 | + bool *satp) | 57 | - gen_helper_wfi(cpu_env, tmp); |
113 | +{ | 58 | - tcg_temp_free_i32(tmp); |
114 | + if (val > max) { | 59 | - /* The helper doesn't necessarily throw an exception, but we |
115 | + *satp = true; | 60 | + gen_helper_wfi(cpu_env, tcg_constant_i32(4)); |
116 | + return max; | 61 | + /* |
117 | + } else if (val < min) { | 62 | + * The helper doesn't necessarily throw an exception, but we |
118 | + *satp = true; | 63 | * must go back to the main loop to check for interrupts anyway. |
119 | + return min; | 64 | */ |
120 | + } else { | 65 | tcg_gen_exit_tb(NULL, 0); |
121 | + return val; | 66 | break; |
122 | + } | 67 | } |
123 | +} | 68 | - } |
124 | + | 69 | } |
125 | +/* Saturating narrowing right shifts */ | 70 | } |
126 | +#define DO_VSHRN_SAT(OP, TOP, ESIZE, TYPE, LESIZE, LTYPE, FN) \ | 71 | |
127 | + void HELPER(glue(mve_, OP))(CPUARMState *env, void *vd, \ | ||
128 | + void *vm, uint32_t shift) \ | ||
129 | + { \ | ||
130 | + LTYPE *m = vm; \ | ||
131 | + TYPE *d = vd; \ | ||
132 | + uint16_t mask = mve_element_mask(env); \ | ||
133 | + bool qc = false; \ | ||
134 | + unsigned le; \ | ||
135 | + for (le = 0; le < 16 / LESIZE; le++, mask >>= LESIZE) { \ | ||
136 | + bool sat = false; \ | ||
137 | + TYPE r = FN(m[H##LESIZE(le)], shift, &sat); \ | ||
138 | + mergemask(&d[H##ESIZE(le * 2 + TOP)], r, mask); \ | ||
139 | + qc |= sat && (mask & 1 << (TOP * ESIZE)); \ | ||
140 | + } \ | ||
141 | + if (qc) { \ | ||
142 | + env->vfp.qc[0] = qc; \ | ||
143 | + } \ | ||
144 | + mve_advance_vpt(env); \ | ||
145 | + } | ||
146 | + | ||
147 | +#define DO_VSHRN_SAT_UB(BOP, TOP, FN) \ | ||
148 | + DO_VSHRN_SAT(BOP, false, 1, uint8_t, 2, uint16_t, FN) \ | ||
149 | + DO_VSHRN_SAT(TOP, true, 1, uint8_t, 2, uint16_t, FN) | ||
150 | + | ||
151 | +#define DO_VSHRN_SAT_UH(BOP, TOP, FN) \ | ||
152 | + DO_VSHRN_SAT(BOP, false, 2, uint16_t, 4, uint32_t, FN) \ | ||
153 | + DO_VSHRN_SAT(TOP, true, 2, uint16_t, 4, uint32_t, FN) | ||
154 | + | ||
155 | +#define DO_VSHRN_SAT_SB(BOP, TOP, FN) \ | ||
156 | + DO_VSHRN_SAT(BOP, false, 1, int8_t, 2, int16_t, FN) \ | ||
157 | + DO_VSHRN_SAT(TOP, true, 1, int8_t, 2, int16_t, FN) | ||
158 | + | ||
159 | +#define DO_VSHRN_SAT_SH(BOP, TOP, FN) \ | ||
160 | + DO_VSHRN_SAT(BOP, false, 2, int16_t, 4, int32_t, FN) \ | ||
161 | + DO_VSHRN_SAT(TOP, true, 2, int16_t, 4, int32_t, FN) | ||
162 | + | ||
163 | +#define DO_SHRN_SB(N, M, SATP) \ | ||
164 | + do_sat_bhs((int64_t)(N) >> (M), INT8_MIN, INT8_MAX, SATP) | ||
165 | +#define DO_SHRN_UB(N, M, SATP) \ | ||
166 | + do_sat_bhs((uint64_t)(N) >> (M), 0, UINT8_MAX, SATP) | ||
167 | +#define DO_SHRUN_B(N, M, SATP) \ | ||
168 | + do_sat_bhs((int64_t)(N) >> (M), 0, UINT8_MAX, SATP) | ||
169 | + | ||
170 | +#define DO_SHRN_SH(N, M, SATP) \ | ||
171 | + do_sat_bhs((int64_t)(N) >> (M), INT16_MIN, INT16_MAX, SATP) | ||
172 | +#define DO_SHRN_UH(N, M, SATP) \ | ||
173 | + do_sat_bhs((uint64_t)(N) >> (M), 0, UINT16_MAX, SATP) | ||
174 | +#define DO_SHRUN_H(N, M, SATP) \ | ||
175 | + do_sat_bhs((int64_t)(N) >> (M), 0, UINT16_MAX, SATP) | ||
176 | + | ||
177 | +#define DO_RSHRN_SB(N, M, SATP) \ | ||
178 | + do_sat_bhs(do_srshr(N, M), INT8_MIN, INT8_MAX, SATP) | ||
179 | +#define DO_RSHRN_UB(N, M, SATP) \ | ||
180 | + do_sat_bhs(do_urshr(N, M), 0, UINT8_MAX, SATP) | ||
181 | +#define DO_RSHRUN_B(N, M, SATP) \ | ||
182 | + do_sat_bhs(do_srshr(N, M), 0, UINT8_MAX, SATP) | ||
183 | + | ||
184 | +#define DO_RSHRN_SH(N, M, SATP) \ | ||
185 | + do_sat_bhs(do_srshr(N, M), INT16_MIN, INT16_MAX, SATP) | ||
186 | +#define DO_RSHRN_UH(N, M, SATP) \ | ||
187 | + do_sat_bhs(do_urshr(N, M), 0, UINT16_MAX, SATP) | ||
188 | +#define DO_RSHRUN_H(N, M, SATP) \ | ||
189 | + do_sat_bhs(do_srshr(N, M), 0, UINT16_MAX, SATP) | ||
190 | + | ||
191 | +DO_VSHRN_SAT_SB(vqshrnb_sb, vqshrnt_sb, DO_SHRN_SB) | ||
192 | +DO_VSHRN_SAT_SH(vqshrnb_sh, vqshrnt_sh, DO_SHRN_SH) | ||
193 | +DO_VSHRN_SAT_UB(vqshrnb_ub, vqshrnt_ub, DO_SHRN_UB) | ||
194 | +DO_VSHRN_SAT_UH(vqshrnb_uh, vqshrnt_uh, DO_SHRN_UH) | ||
195 | +DO_VSHRN_SAT_SB(vqshrunbb, vqshruntb, DO_SHRUN_B) | ||
196 | +DO_VSHRN_SAT_SH(vqshrunbh, vqshrunth, DO_SHRUN_H) | ||
197 | + | ||
198 | +DO_VSHRN_SAT_SB(vqrshrnb_sb, vqrshrnt_sb, DO_RSHRN_SB) | ||
199 | +DO_VSHRN_SAT_SH(vqrshrnb_sh, vqrshrnt_sh, DO_RSHRN_SH) | ||
200 | +DO_VSHRN_SAT_UB(vqrshrnb_ub, vqrshrnt_ub, DO_RSHRN_UB) | ||
201 | +DO_VSHRN_SAT_UH(vqrshrnb_uh, vqrshrnt_uh, DO_RSHRN_UH) | ||
202 | +DO_VSHRN_SAT_SB(vqrshrunbb, vqrshruntb, DO_RSHRUN_B) | ||
203 | +DO_VSHRN_SAT_SH(vqrshrunbh, vqrshrunth, DO_RSHRUN_H) | ||
204 | diff --git a/target/arm/translate-mve.c b/target/arm/translate-mve.c | ||
205 | index XXXXXXX..XXXXXXX 100644 | ||
206 | --- a/target/arm/translate-mve.c | ||
207 | +++ b/target/arm/translate-mve.c | ||
208 | @@ -XXX,XX +XXX,XX @@ DO_2SHIFT_N(VSHRNB, vshrnb) | ||
209 | DO_2SHIFT_N(VSHRNT, vshrnt) | ||
210 | DO_2SHIFT_N(VRSHRNB, vrshrnb) | ||
211 | DO_2SHIFT_N(VRSHRNT, vrshrnt) | ||
212 | +DO_2SHIFT_N(VQSHRNB_S, vqshrnb_s) | ||
213 | +DO_2SHIFT_N(VQSHRNT_S, vqshrnt_s) | ||
214 | +DO_2SHIFT_N(VQSHRNB_U, vqshrnb_u) | ||
215 | +DO_2SHIFT_N(VQSHRNT_U, vqshrnt_u) | ||
216 | +DO_2SHIFT_N(VQSHRUNB, vqshrunb) | ||
217 | +DO_2SHIFT_N(VQSHRUNT, vqshrunt) | ||
218 | +DO_2SHIFT_N(VQRSHRNB_S, vqrshrnb_s) | ||
219 | +DO_2SHIFT_N(VQRSHRNT_S, vqrshrnt_s) | ||
220 | +DO_2SHIFT_N(VQRSHRNB_U, vqrshrnb_u) | ||
221 | +DO_2SHIFT_N(VQRSHRNT_U, vqrshrnt_u) | ||
222 | +DO_2SHIFT_N(VQRSHRUNB, vqrshrunb) | ||
223 | +DO_2SHIFT_N(VQRSHRUNT, vqrshrunt) | ||
224 | -- | 72 | -- |
225 | 2.20.1 | 73 | 2.25.1 |
226 | |||
227 | diff view generated by jsdifflib |
1 | Implement the MVE shifts by register, which perform | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | shifts on a single general-purpose register. | ||
3 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-23-richard.henderson@linaro.org | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20210628135835.6690-19-peter.maydell@linaro.org | ||
7 | --- | 7 | --- |
8 | target/arm/helper-mve.h | 2 ++ | 8 | target/arm/translate.c | 32 +++++++------------------------- |
9 | target/arm/translate.h | 1 + | 9 | 1 file changed, 7 insertions(+), 25 deletions(-) |
10 | target/arm/t32.decode | 18 ++++++++++++++---- | ||
11 | target/arm/mve_helper.c | 10 ++++++++++ | ||
12 | target/arm/translate.c | 30 ++++++++++++++++++++++++++++++ | ||
13 | 5 files changed, 57 insertions(+), 4 deletions(-) | ||
14 | 10 | ||
15 | diff --git a/target/arm/helper-mve.h b/target/arm/helper-mve.h | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/target/arm/helper-mve.h | ||
18 | +++ b/target/arm/helper-mve.h | ||
19 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_3(mve_uqrshll48, TCG_CALL_NO_RWG, i64, env, i64, i32) | ||
20 | |||
21 | DEF_HELPER_FLAGS_3(mve_uqshl, TCG_CALL_NO_RWG, i32, env, i32, i32) | ||
22 | DEF_HELPER_FLAGS_3(mve_sqshl, TCG_CALL_NO_RWG, i32, env, i32, i32) | ||
23 | +DEF_HELPER_FLAGS_3(mve_uqrshl, TCG_CALL_NO_RWG, i32, env, i32, i32) | ||
24 | +DEF_HELPER_FLAGS_3(mve_sqrshr, TCG_CALL_NO_RWG, i32, env, i32, i32) | ||
25 | diff --git a/target/arm/translate.h b/target/arm/translate.h | ||
26 | index XXXXXXX..XXXXXXX 100644 | ||
27 | --- a/target/arm/translate.h | ||
28 | +++ b/target/arm/translate.h | ||
29 | @@ -XXX,XX +XXX,XX @@ typedef void AtomicThreeOpFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGArg, MemOp); | ||
30 | typedef void WideShiftImmFn(TCGv_i64, TCGv_i64, int64_t shift); | ||
31 | typedef void WideShiftFn(TCGv_i64, TCGv_ptr, TCGv_i64, TCGv_i32); | ||
32 | typedef void ShiftImmFn(TCGv_i32, TCGv_i32, int32_t shift); | ||
33 | +typedef void ShiftFn(TCGv_i32, TCGv_ptr, TCGv_i32, TCGv_i32); | ||
34 | |||
35 | /** | ||
36 | * arm_tbflags_from_tb: | ||
37 | diff --git a/target/arm/t32.decode b/target/arm/t32.decode | ||
38 | index XXXXXXX..XXXXXXX 100644 | ||
39 | --- a/target/arm/t32.decode | ||
40 | +++ b/target/arm/t32.decode | ||
41 | @@ -XXX,XX +XXX,XX @@ | ||
42 | &mve_shl_ri rdalo rdahi shim | ||
43 | &mve_shl_rr rdalo rdahi rm | ||
44 | &mve_sh_ri rda shim | ||
45 | +&mve_sh_rr rda rm | ||
46 | |||
47 | # rdahi: bits [3:1] from insn, bit 0 is 1 | ||
48 | # rdalo: bits [3:1] from insn, bit 0 is 0 | ||
49 | @@ -XXX,XX +XXX,XX @@ | ||
50 | &mve_shl_rr rdalo=%rdalo_17 rdahi=%rdahi_9 | ||
51 | @mve_sh_ri ....... .... . rda:4 . ... ... . .. .. .... \ | ||
52 | &mve_sh_ri shim=%imm5_12_6 | ||
53 | +@mve_sh_rr ....... .... . rda:4 rm:4 .... .... .... &mve_sh_rr | ||
54 | |||
55 | { | ||
56 | TST_xrri 1110101 0000 1 .... 0 ... 1111 .... .... @S_xrr_shi | ||
57 | @@ -XXX,XX +XXX,XX @@ BIC_rrri 1110101 0001 . .... 0 ... .... .... .... @s_rrr_shi | ||
58 | SQSHLL_ri 1110101 0010 1 ... 1 0 ... ... 1 .. 11 1111 @mve_shl_ri | ||
59 | } | ||
60 | |||
61 | - LSLL_rr 1110101 0010 1 ... 0 .... ... 1 0000 1101 @mve_shl_rr | ||
62 | - ASRL_rr 1110101 0010 1 ... 0 .... ... 1 0010 1101 @mve_shl_rr | ||
63 | - UQRSHLL64_rr 1110101 0010 1 ... 1 .... ... 1 0000 1101 @mve_shl_rr | ||
64 | - SQRSHRL64_rr 1110101 0010 1 ... 1 .... ... 1 0010 1101 @mve_shl_rr | ||
65 | + { | ||
66 | + UQRSHL_rr 1110101 0010 1 .... .... 1111 0000 1101 @mve_sh_rr | ||
67 | + LSLL_rr 1110101 0010 1 ... 0 .... ... 1 0000 1101 @mve_shl_rr | ||
68 | + UQRSHLL64_rr 1110101 0010 1 ... 1 .... ... 1 0000 1101 @mve_shl_rr | ||
69 | + } | ||
70 | + | ||
71 | + { | ||
72 | + SQRSHR_rr 1110101 0010 1 .... .... 1111 0010 1101 @mve_sh_rr | ||
73 | + ASRL_rr 1110101 0010 1 ... 0 .... ... 1 0010 1101 @mve_shl_rr | ||
74 | + SQRSHRL64_rr 1110101 0010 1 ... 1 .... ... 1 0010 1101 @mve_shl_rr | ||
75 | + } | ||
76 | + | ||
77 | UQRSHLL48_rr 1110101 0010 1 ... 1 .... ... 1 1000 1101 @mve_shl_rr | ||
78 | SQRSHRL48_rr 1110101 0010 1 ... 1 .... ... 1 1010 1101 @mve_shl_rr | ||
79 | ] | ||
80 | diff --git a/target/arm/mve_helper.c b/target/arm/mve_helper.c | ||
81 | index XXXXXXX..XXXXXXX 100644 | ||
82 | --- a/target/arm/mve_helper.c | ||
83 | +++ b/target/arm/mve_helper.c | ||
84 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(mve_sqshl)(CPUARMState *env, uint32_t n, uint32_t shift) | ||
85 | { | ||
86 | return do_sqrshl_bhs(n, (int8_t)shift, 32, false, &env->QF); | ||
87 | } | ||
88 | + | ||
89 | +uint32_t HELPER(mve_uqrshl)(CPUARMState *env, uint32_t n, uint32_t shift) | ||
90 | +{ | ||
91 | + return do_uqrshl_bhs(n, (int8_t)shift, 32, true, &env->QF); | ||
92 | +} | ||
93 | + | ||
94 | +uint32_t HELPER(mve_sqrshr)(CPUARMState *env, uint32_t n, uint32_t shift) | ||
95 | +{ | ||
96 | + return do_sqrshl_bhs(n, -(int8_t)shift, 32, true, &env->QF); | ||
97 | +} | ||
98 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 11 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
99 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
100 | --- a/target/arm/translate.c | 13 | --- a/target/arm/translate.c |
101 | +++ b/target/arm/translate.c | 14 | +++ b/target/arm/translate.c |
102 | @@ -XXX,XX +XXX,XX @@ static bool trans_UQSHL_ri(DisasContext *s, arg_mve_sh_ri *a) | 15 | @@ -XXX,XX +XXX,XX @@ static void store_sp_checked(DisasContext *s, TCGv_i32 var) |
103 | return do_mve_sh_ri(s, a, gen_mve_uqshl); | 16 | |
17 | void gen_set_cpsr(TCGv_i32 var, uint32_t mask) | ||
18 | { | ||
19 | - TCGv_i32 tmp_mask = tcg_const_i32(mask); | ||
20 | - gen_helper_cpsr_write(cpu_env, var, tmp_mask); | ||
21 | - tcg_temp_free_i32(tmp_mask); | ||
22 | + gen_helper_cpsr_write(cpu_env, var, tcg_constant_i32(mask)); | ||
104 | } | 23 | } |
105 | 24 | ||
106 | +static bool do_mve_sh_rr(DisasContext *s, arg_mve_sh_rr *a, ShiftFn *fn) | 25 | static void gen_rebuild_hflags(DisasContext *s, bool new_el) |
107 | +{ | 26 | @@ -XXX,XX +XXX,XX @@ static void gen_rebuild_hflags(DisasContext *s, bool new_el) |
108 | + if (!arm_dc_feature(s, ARM_FEATURE_V8_1M)) { | 27 | |
109 | + /* Decode falls through to ORR/MOV UNPREDICTABLE handling */ | 28 | static void gen_exception_internal(int excp) |
110 | + return false; | 29 | { |
111 | + } | 30 | - TCGv_i32 tcg_excp = tcg_const_i32(excp); |
112 | + if (!dc_isar_feature(aa32_mve, s) || | 31 | - |
113 | + !arm_dc_feature(s, ARM_FEATURE_M_MAIN) || | 32 | assert(excp_is_internal(excp)); |
114 | + a->rda == 13 || a->rda == 15 || a->rm == 13 || a->rm == 15 || | 33 | - gen_helper_exception_internal(cpu_env, tcg_excp); |
115 | + a->rm == a->rda) { | 34 | - tcg_temp_free_i32(tcg_excp); |
116 | + /* These rda/rm cases are UNPREDICTABLE; we choose to UNDEF */ | 35 | + gen_helper_exception_internal(cpu_env, tcg_constant_i32(excp)); |
117 | + unallocated_encoding(s); | 36 | } |
118 | + return true; | 37 | |
119 | + } | 38 | static void gen_singlestep_exception(DisasContext *s) |
120 | + | 39 | @@ -XXX,XX +XXX,XX @@ static inline void gen_smc(DisasContext *s) |
121 | + /* The helper takes care of the sign-extension of the low 8 bits of Rm */ | 40 | /* As with HVC, we may take an exception either before or after |
122 | + fn(cpu_R[a->rda], cpu_env, cpu_R[a->rda], cpu_R[a->rm]); | 41 | * the insn executes. |
123 | + return true; | 42 | */ |
124 | +} | 43 | - TCGv_i32 tmp; |
125 | + | 44 | - |
126 | +static bool trans_SQRSHR_rr(DisasContext *s, arg_mve_sh_rr *a) | 45 | gen_set_pc_im(s, s->pc_curr); |
127 | +{ | 46 | - tmp = tcg_const_i32(syn_aa32_smc()); |
128 | + return do_mve_sh_rr(s, a, gen_helper_mve_sqrshr); | 47 | - gen_helper_pre_smc(cpu_env, tmp); |
129 | +} | 48 | - tcg_temp_free_i32(tmp); |
130 | + | 49 | + gen_helper_pre_smc(cpu_env, tcg_constant_i32(syn_aa32_smc())); |
131 | +static bool trans_UQRSHL_rr(DisasContext *s, arg_mve_sh_rr *a) | 50 | gen_set_pc_im(s, s->base.pc_next); |
132 | +{ | 51 | s->base.is_jmp = DISAS_SMC; |
133 | + return do_mve_sh_rr(s, a, gen_helper_mve_uqrshl); | 52 | } |
134 | +} | 53 | @@ -XXX,XX +XXX,XX @@ void gen_exception_insn(DisasContext *s, uint64_t pc, int excp, |
135 | + | 54 | |
136 | /* | 55 | static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syn) |
137 | * Multiply and multiply accumulate | 56 | { |
138 | */ | 57 | - TCGv_i32 tcg_syn; |
58 | - | ||
59 | gen_set_condexec(s); | ||
60 | gen_set_pc_im(s, s->pc_curr); | ||
61 | - tcg_syn = tcg_const_i32(syn); | ||
62 | - gen_helper_exception_bkpt_insn(cpu_env, tcg_syn); | ||
63 | - tcg_temp_free_i32(tcg_syn); | ||
64 | + gen_helper_exception_bkpt_insn(cpu_env, tcg_constant_i32(syn)); | ||
65 | s->base.is_jmp = DISAS_NORETURN; | ||
66 | } | ||
67 | |||
68 | @@ -XXX,XX +XXX,XX @@ void unallocated_encoding(DisasContext *s) | ||
69 | static void gen_exception_el(DisasContext *s, int excp, uint32_t syn, | ||
70 | TCGv_i32 tcg_el) | ||
71 | { | ||
72 | - TCGv_i32 tcg_excp; | ||
73 | - TCGv_i32 tcg_syn; | ||
74 | - | ||
75 | gen_set_condexec(s); | ||
76 | gen_set_pc_im(s, s->pc_curr); | ||
77 | - tcg_excp = tcg_const_i32(excp); | ||
78 | - tcg_syn = tcg_const_i32(syn); | ||
79 | - gen_helper_exception_with_syndrome(cpu_env, tcg_excp, tcg_syn, tcg_el); | ||
80 | - tcg_temp_free_i32(tcg_syn); | ||
81 | - tcg_temp_free_i32(tcg_excp); | ||
82 | + gen_helper_exception_with_syndrome(cpu_env, | ||
83 | + tcg_constant_i32(excp), | ||
84 | + tcg_constant_i32(syn), tcg_el); | ||
85 | s->base.is_jmp = DISAS_NORETURN; | ||
86 | } | ||
87 | |||
139 | -- | 88 | -- |
140 | 2.20.1 | 89 | 2.25.1 |
141 | |||
142 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-24-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate.c | 25 ++++++++++--------------- | ||
9 | 1 file changed, 10 insertions(+), 15 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate.c | ||
14 | +++ b/target/arm/translate.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn) | ||
16 | gen_op_iwmmxt_movq_M0_wRn(wrd); | ||
17 | switch ((insn >> 6) & 3) { | ||
18 | case 0: | ||
19 | - tmp2 = tcg_const_i32(0xff); | ||
20 | - tmp3 = tcg_const_i32((insn & 7) << 3); | ||
21 | + tmp2 = tcg_constant_i32(0xff); | ||
22 | + tmp3 = tcg_constant_i32((insn & 7) << 3); | ||
23 | break; | ||
24 | case 1: | ||
25 | - tmp2 = tcg_const_i32(0xffff); | ||
26 | - tmp3 = tcg_const_i32((insn & 3) << 4); | ||
27 | + tmp2 = tcg_constant_i32(0xffff); | ||
28 | + tmp3 = tcg_constant_i32((insn & 3) << 4); | ||
29 | break; | ||
30 | case 2: | ||
31 | - tmp2 = tcg_const_i32(0xffffffff); | ||
32 | - tmp3 = tcg_const_i32((insn & 1) << 5); | ||
33 | + tmp2 = tcg_constant_i32(0xffffffff); | ||
34 | + tmp3 = tcg_constant_i32((insn & 1) << 5); | ||
35 | break; | ||
36 | default: | ||
37 | - tmp2 = NULL; | ||
38 | - tmp3 = NULL; | ||
39 | + g_assert_not_reached(); | ||
40 | } | ||
41 | gen_helper_iwmmxt_insr(cpu_M0, cpu_M0, tmp, tmp2, tmp3); | ||
42 | - tcg_temp_free_i32(tmp3); | ||
43 | - tcg_temp_free_i32(tmp2); | ||
44 | tcg_temp_free_i32(tmp); | ||
45 | gen_op_iwmmxt_movq_wRn_M0(wrd); | ||
46 | gen_op_iwmmxt_set_mup(); | ||
47 | @@ -XXX,XX +XXX,XX @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn) | ||
48 | rd0 = (insn >> 16) & 0xf; | ||
49 | rd1 = (insn >> 0) & 0xf; | ||
50 | gen_op_iwmmxt_movq_M0_wRn(rd0); | ||
51 | - tmp = tcg_const_i32((insn >> 20) & 3); | ||
52 | iwmmxt_load_reg(cpu_V1, rd1); | ||
53 | - gen_helper_iwmmxt_align(cpu_M0, cpu_M0, cpu_V1, tmp); | ||
54 | - tcg_temp_free_i32(tmp); | ||
55 | + gen_helper_iwmmxt_align(cpu_M0, cpu_M0, cpu_V1, | ||
56 | + tcg_constant_i32((insn >> 20) & 3)); | ||
57 | gen_op_iwmmxt_movq_wRn_M0(wrd); | ||
58 | gen_op_iwmmxt_set_mup(); | ||
59 | break; | ||
60 | @@ -XXX,XX +XXX,XX @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn) | ||
61 | wrd = (insn >> 12) & 0xf; | ||
62 | rd0 = (insn >> 16) & 0xf; | ||
63 | gen_op_iwmmxt_movq_M0_wRn(rd0); | ||
64 | - tmp = tcg_const_i32(((insn >> 16) & 0xf0) | (insn & 0x0f)); | ||
65 | + tmp = tcg_constant_i32(((insn >> 16) & 0xf0) | (insn & 0x0f)); | ||
66 | gen_helper_iwmmxt_shufh(cpu_M0, cpu_env, cpu_M0, tmp); | ||
67 | - tcg_temp_free_i32(tmp); | ||
68 | gen_op_iwmmxt_movq_wRn_M0(wrd); | ||
69 | gen_op_iwmmxt_set_mup(); | ||
70 | gen_op_iwmmxt_set_cup(); | ||
71 | -- | ||
72 | 2.25.1 | diff view generated by jsdifflib |
1 | The function asimd_imm_const() in translate-neon.c is an | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | implementation of the pseudocode AdvSIMDExpandImm(), which we will | ||
3 | also want for MVE. Move the implementation to translate.c, with a | ||
4 | prototype in translate.h. | ||
5 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-25-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20210628135835.6690-4-peter.maydell@linaro.org | ||
9 | --- | 7 | --- |
10 | target/arm/translate.h | 16 ++++++++++ | 8 | target/arm/translate.c | 22 +++++++++------------- |
11 | target/arm/translate-neon.c | 63 ------------------------------------- | 9 | 1 file changed, 9 insertions(+), 13 deletions(-) |
12 | target/arm/translate.c | 57 +++++++++++++++++++++++++++++++++ | ||
13 | 3 files changed, 73 insertions(+), 63 deletions(-) | ||
14 | 10 | ||
15 | diff --git a/target/arm/translate.h b/target/arm/translate.h | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/target/arm/translate.h | ||
18 | +++ b/target/arm/translate.h | ||
19 | @@ -XXX,XX +XXX,XX @@ static inline MemOp finalize_memop(DisasContext *s, MemOp opc) | ||
20 | return opc | s->be_data; | ||
21 | } | ||
22 | |||
23 | +/** | ||
24 | + * asimd_imm_const: Expand an encoded SIMD constant value | ||
25 | + * | ||
26 | + * Expand a SIMD constant value. This is essentially the pseudocode | ||
27 | + * AdvSIMDExpandImm, except that we also perform the boolean NOT needed for | ||
28 | + * VMVN and VBIC (when cmode < 14 && op == 1). | ||
29 | + * | ||
30 | + * The combination cmode == 15 op == 1 is a reserved encoding for AArch32; | ||
31 | + * callers must catch this. | ||
32 | + * | ||
33 | + * cmode = 2,3,4,5,6,7,10,11,12,13 imm=0 was UNPREDICTABLE in v7A but | ||
34 | + * is either not unpredictable or merely CONSTRAINED UNPREDICTABLE in v8A; | ||
35 | + * we produce an immediate constant value of 0 in these cases. | ||
36 | + */ | ||
37 | +uint64_t asimd_imm_const(uint32_t imm, int cmode, int op); | ||
38 | + | ||
39 | #endif /* TARGET_ARM_TRANSLATE_H */ | ||
40 | diff --git a/target/arm/translate-neon.c b/target/arm/translate-neon.c | ||
41 | index XXXXXXX..XXXXXXX 100644 | ||
42 | --- a/target/arm/translate-neon.c | ||
43 | +++ b/target/arm/translate-neon.c | ||
44 | @@ -XXX,XX +XXX,XX @@ DO_FP_2SH(VCVT_UH, gen_helper_gvec_vcvt_uh) | ||
45 | DO_FP_2SH(VCVT_HS, gen_helper_gvec_vcvt_hs) | ||
46 | DO_FP_2SH(VCVT_HU, gen_helper_gvec_vcvt_hu) | ||
47 | |||
48 | -static uint64_t asimd_imm_const(uint32_t imm, int cmode, int op) | ||
49 | -{ | ||
50 | - /* | ||
51 | - * Expand the encoded constant. | ||
52 | - * Note that cmode = 2,3,4,5,6,7,10,11,12,13 imm=0 is UNPREDICTABLE. | ||
53 | - * We choose to not special-case this and will behave as if a | ||
54 | - * valid constant encoding of 0 had been given. | ||
55 | - * cmode = 15 op = 1 must UNDEF; we assume decode has handled that. | ||
56 | - */ | ||
57 | - switch (cmode) { | ||
58 | - case 0: case 1: | ||
59 | - /* no-op */ | ||
60 | - break; | ||
61 | - case 2: case 3: | ||
62 | - imm <<= 8; | ||
63 | - break; | ||
64 | - case 4: case 5: | ||
65 | - imm <<= 16; | ||
66 | - break; | ||
67 | - case 6: case 7: | ||
68 | - imm <<= 24; | ||
69 | - break; | ||
70 | - case 8: case 9: | ||
71 | - imm |= imm << 16; | ||
72 | - break; | ||
73 | - case 10: case 11: | ||
74 | - imm = (imm << 8) | (imm << 24); | ||
75 | - break; | ||
76 | - case 12: | ||
77 | - imm = (imm << 8) | 0xff; | ||
78 | - break; | ||
79 | - case 13: | ||
80 | - imm = (imm << 16) | 0xffff; | ||
81 | - break; | ||
82 | - case 14: | ||
83 | - if (op) { | ||
84 | - /* | ||
85 | - * This is the only case where the top and bottom 32 bits | ||
86 | - * of the encoded constant differ. | ||
87 | - */ | ||
88 | - uint64_t imm64 = 0; | ||
89 | - int n; | ||
90 | - | ||
91 | - for (n = 0; n < 8; n++) { | ||
92 | - if (imm & (1 << n)) { | ||
93 | - imm64 |= (0xffULL << (n * 8)); | ||
94 | - } | ||
95 | - } | ||
96 | - return imm64; | ||
97 | - } | ||
98 | - imm |= (imm << 8) | (imm << 16) | (imm << 24); | ||
99 | - break; | ||
100 | - case 15: | ||
101 | - imm = ((imm & 0x80) << 24) | ((imm & 0x3f) << 19) | ||
102 | - | ((imm & 0x40) ? (0x1f << 25) : (1 << 30)); | ||
103 | - break; | ||
104 | - } | ||
105 | - if (op) { | ||
106 | - imm = ~imm; | ||
107 | - } | ||
108 | - return dup_const(MO_32, imm); | ||
109 | -} | ||
110 | - | ||
111 | static bool do_1reg_imm(DisasContext *s, arg_1reg_imm *a, | ||
112 | GVecGen2iFn *fn) | ||
113 | { | ||
114 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 11 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
115 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
116 | --- a/target/arm/translate.c | 13 | --- a/target/arm/translate.c |
117 | +++ b/target/arm/translate.c | 14 | +++ b/target/arm/translate.c |
118 | @@ -XXX,XX +XXX,XX @@ void arm_translate_init(void) | 15 | @@ -XXX,XX +XXX,XX @@ static bool msr_banked_access_decode(DisasContext *s, int r, int sysm, int rn, |
119 | a64_translate_init(); | 16 | tcg_gen_sextract_i32(tcg_el, tcg_el, ctz32(SCR_EEL2), 1); |
17 | tcg_gen_addi_i32(tcg_el, tcg_el, 3); | ||
18 | } else { | ||
19 | - tcg_el = tcg_const_i32(3); | ||
20 | + tcg_el = tcg_constant_i32(3); | ||
21 | } | ||
22 | |||
23 | gen_exception_el(s, EXCP_UDEF, syn_uncategorized(), tcg_el); | ||
24 | @@ -XXX,XX +XXX,XX @@ undef: | ||
25 | |||
26 | static void gen_msr_banked(DisasContext *s, int r, int sysm, int rn) | ||
27 | { | ||
28 | - TCGv_i32 tcg_reg, tcg_tgtmode, tcg_regno; | ||
29 | + TCGv_i32 tcg_reg; | ||
30 | int tgtmode = 0, regno = 0; | ||
31 | |||
32 | if (!msr_banked_access_decode(s, r, sysm, rn, &tgtmode, ®no)) { | ||
33 | @@ -XXX,XX +XXX,XX @@ static void gen_msr_banked(DisasContext *s, int r, int sysm, int rn) | ||
34 | gen_set_condexec(s); | ||
35 | gen_set_pc_im(s, s->pc_curr); | ||
36 | tcg_reg = load_reg(s, rn); | ||
37 | - tcg_tgtmode = tcg_const_i32(tgtmode); | ||
38 | - tcg_regno = tcg_const_i32(regno); | ||
39 | - gen_helper_msr_banked(cpu_env, tcg_reg, tcg_tgtmode, tcg_regno); | ||
40 | - tcg_temp_free_i32(tcg_tgtmode); | ||
41 | - tcg_temp_free_i32(tcg_regno); | ||
42 | + gen_helper_msr_banked(cpu_env, tcg_reg, | ||
43 | + tcg_constant_i32(tgtmode), | ||
44 | + tcg_constant_i32(regno)); | ||
45 | tcg_temp_free_i32(tcg_reg); | ||
46 | s->base.is_jmp = DISAS_UPDATE_EXIT; | ||
120 | } | 47 | } |
121 | 48 | ||
122 | +uint64_t asimd_imm_const(uint32_t imm, int cmode, int op) | 49 | static void gen_mrs_banked(DisasContext *s, int r, int sysm, int rn) |
123 | +{ | ||
124 | + /* Expand the encoded constant as per AdvSIMDExpandImm pseudocode */ | ||
125 | + switch (cmode) { | ||
126 | + case 0: case 1: | ||
127 | + /* no-op */ | ||
128 | + break; | ||
129 | + case 2: case 3: | ||
130 | + imm <<= 8; | ||
131 | + break; | ||
132 | + case 4: case 5: | ||
133 | + imm <<= 16; | ||
134 | + break; | ||
135 | + case 6: case 7: | ||
136 | + imm <<= 24; | ||
137 | + break; | ||
138 | + case 8: case 9: | ||
139 | + imm |= imm << 16; | ||
140 | + break; | ||
141 | + case 10: case 11: | ||
142 | + imm = (imm << 8) | (imm << 24); | ||
143 | + break; | ||
144 | + case 12: | ||
145 | + imm = (imm << 8) | 0xff; | ||
146 | + break; | ||
147 | + case 13: | ||
148 | + imm = (imm << 16) | 0xffff; | ||
149 | + break; | ||
150 | + case 14: | ||
151 | + if (op) { | ||
152 | + /* | ||
153 | + * This is the only case where the top and bottom 32 bits | ||
154 | + * of the encoded constant differ. | ||
155 | + */ | ||
156 | + uint64_t imm64 = 0; | ||
157 | + int n; | ||
158 | + | ||
159 | + for (n = 0; n < 8; n++) { | ||
160 | + if (imm & (1 << n)) { | ||
161 | + imm64 |= (0xffULL << (n * 8)); | ||
162 | + } | ||
163 | + } | ||
164 | + return imm64; | ||
165 | + } | ||
166 | + imm |= (imm << 8) | (imm << 16) | (imm << 24); | ||
167 | + break; | ||
168 | + case 15: | ||
169 | + imm = ((imm & 0x80) << 24) | ((imm & 0x3f) << 19) | ||
170 | + | ((imm & 0x40) ? (0x1f << 25) : (1 << 30)); | ||
171 | + break; | ||
172 | + } | ||
173 | + if (op) { | ||
174 | + imm = ~imm; | ||
175 | + } | ||
176 | + return dup_const(MO_32, imm); | ||
177 | +} | ||
178 | + | ||
179 | /* Generate a label used for skipping this instruction */ | ||
180 | void arm_gen_condlabel(DisasContext *s) | ||
181 | { | 50 | { |
51 | - TCGv_i32 tcg_reg, tcg_tgtmode, tcg_regno; | ||
52 | + TCGv_i32 tcg_reg; | ||
53 | int tgtmode = 0, regno = 0; | ||
54 | |||
55 | if (!msr_banked_access_decode(s, r, sysm, rn, &tgtmode, ®no)) { | ||
56 | @@ -XXX,XX +XXX,XX @@ static void gen_mrs_banked(DisasContext *s, int r, int sysm, int rn) | ||
57 | gen_set_condexec(s); | ||
58 | gen_set_pc_im(s, s->pc_curr); | ||
59 | tcg_reg = tcg_temp_new_i32(); | ||
60 | - tcg_tgtmode = tcg_const_i32(tgtmode); | ||
61 | - tcg_regno = tcg_const_i32(regno); | ||
62 | - gen_helper_mrs_banked(tcg_reg, cpu_env, tcg_tgtmode, tcg_regno); | ||
63 | - tcg_temp_free_i32(tcg_tgtmode); | ||
64 | - tcg_temp_free_i32(tcg_regno); | ||
65 | + gen_helper_mrs_banked(tcg_reg, cpu_env, | ||
66 | + tcg_constant_i32(tgtmode), | ||
67 | + tcg_constant_i32(regno)); | ||
68 | store_reg(s, rn, tcg_reg); | ||
69 | s->base.is_jmp = DISAS_UPDATE_EXIT; | ||
70 | } | ||
182 | -- | 71 | -- |
183 | 2.20.1 | 72 | 2.25.1 |
184 | |||
185 | diff view generated by jsdifflib |
1 | Implement the MVE shifts by immediate, which perform shifts | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | on a single general-purpose register. | ||
3 | 2 | ||
4 | These patterns overlap with the long-shift-by-immediates, | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
5 | so we have to rearrange the grouping a little here. | 4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Message-id: 20220426163043.100432-26-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate.c | 27 +++++++++------------------ | ||
9 | 1 file changed, 9 insertions(+), 18 deletions(-) | ||
6 | 10 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20210628135835.6690-18-peter.maydell@linaro.org | ||
10 | --- | ||
11 | target/arm/helper-mve.h | 3 ++ | ||
12 | target/arm/translate.h | 1 + | ||
13 | target/arm/t32.decode | 31 ++++++++++++++----- | ||
14 | target/arm/mve_helper.c | 10 ++++++ | ||
15 | target/arm/translate.c | 68 +++++++++++++++++++++++++++++++++++++++-- | ||
16 | 5 files changed, 104 insertions(+), 9 deletions(-) | ||
17 | |||
18 | diff --git a/target/arm/helper-mve.h b/target/arm/helper-mve.h | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/target/arm/helper-mve.h | ||
21 | +++ b/target/arm/helper-mve.h | ||
22 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_3(mve_sqrshrl, TCG_CALL_NO_RWG, i64, env, i64, i32) | ||
23 | DEF_HELPER_FLAGS_3(mve_uqrshll, TCG_CALL_NO_RWG, i64, env, i64, i32) | ||
24 | DEF_HELPER_FLAGS_3(mve_sqrshrl48, TCG_CALL_NO_RWG, i64, env, i64, i32) | ||
25 | DEF_HELPER_FLAGS_3(mve_uqrshll48, TCG_CALL_NO_RWG, i64, env, i64, i32) | ||
26 | + | ||
27 | +DEF_HELPER_FLAGS_3(mve_uqshl, TCG_CALL_NO_RWG, i32, env, i32, i32) | ||
28 | +DEF_HELPER_FLAGS_3(mve_sqshl, TCG_CALL_NO_RWG, i32, env, i32, i32) | ||
29 | diff --git a/target/arm/translate.h b/target/arm/translate.h | ||
30 | index XXXXXXX..XXXXXXX 100644 | ||
31 | --- a/target/arm/translate.h | ||
32 | +++ b/target/arm/translate.h | ||
33 | @@ -XXX,XX +XXX,XX @@ typedef void CryptoThreeOpFn(TCGv_ptr, TCGv_ptr, TCGv_ptr); | ||
34 | typedef void AtomicThreeOpFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGArg, MemOp); | ||
35 | typedef void WideShiftImmFn(TCGv_i64, TCGv_i64, int64_t shift); | ||
36 | typedef void WideShiftFn(TCGv_i64, TCGv_ptr, TCGv_i64, TCGv_i32); | ||
37 | +typedef void ShiftImmFn(TCGv_i32, TCGv_i32, int32_t shift); | ||
38 | |||
39 | /** | ||
40 | * arm_tbflags_from_tb: | ||
41 | diff --git a/target/arm/t32.decode b/target/arm/t32.decode | ||
42 | index XXXXXXX..XXXXXXX 100644 | ||
43 | --- a/target/arm/t32.decode | ||
44 | +++ b/target/arm/t32.decode | ||
45 | @@ -XXX,XX +XXX,XX @@ | ||
46 | |||
47 | &mve_shl_ri rdalo rdahi shim | ||
48 | &mve_shl_rr rdalo rdahi rm | ||
49 | +&mve_sh_ri rda shim | ||
50 | |||
51 | # rdahi: bits [3:1] from insn, bit 0 is 1 | ||
52 | # rdalo: bits [3:1] from insn, bit 0 is 0 | ||
53 | @@ -XXX,XX +XXX,XX @@ | ||
54 | &mve_shl_ri shim=%imm5_12_6 rdalo=%rdalo_17 rdahi=%rdahi_9 | ||
55 | @mve_shl_rr ....... .... . ... . rm:4 ... . .. .. .... \ | ||
56 | &mve_shl_rr rdalo=%rdalo_17 rdahi=%rdahi_9 | ||
57 | +@mve_sh_ri ....... .... . rda:4 . ... ... . .. .. .... \ | ||
58 | + &mve_sh_ri shim=%imm5_12_6 | ||
59 | |||
60 | { | ||
61 | TST_xrri 1110101 0000 1 .... 0 ... 1111 .... .... @S_xrr_shi | ||
62 | @@ -XXX,XX +XXX,XX @@ BIC_rrri 1110101 0001 . .... 0 ... .... .... .... @s_rrr_shi | ||
63 | # the rest fall through (where ORR_rrri and MOV_rxri will end up | ||
64 | # handling them as r13 and r15 accesses with the same semantics as A32). | ||
65 | [ | ||
66 | - LSLL_ri 1110101 0010 1 ... 0 0 ... ... 1 .. 00 1111 @mve_shl_ri | ||
67 | - LSRL_ri 1110101 0010 1 ... 0 0 ... ... 1 .. 01 1111 @mve_shl_ri | ||
68 | - ASRL_ri 1110101 0010 1 ... 0 0 ... ... 1 .. 10 1111 @mve_shl_ri | ||
69 | + { | ||
70 | + UQSHL_ri 1110101 0010 1 .... 0 ... 1111 .. 00 1111 @mve_sh_ri | ||
71 | + LSLL_ri 1110101 0010 1 ... 0 0 ... ... 1 .. 00 1111 @mve_shl_ri | ||
72 | + UQSHLL_ri 1110101 0010 1 ... 1 0 ... ... 1 .. 00 1111 @mve_shl_ri | ||
73 | + } | ||
74 | |||
75 | - UQSHLL_ri 1110101 0010 1 ... 1 0 ... ... 1 .. 00 1111 @mve_shl_ri | ||
76 | - URSHRL_ri 1110101 0010 1 ... 1 0 ... ... 1 .. 01 1111 @mve_shl_ri | ||
77 | - SRSHRL_ri 1110101 0010 1 ... 1 0 ... ... 1 .. 10 1111 @mve_shl_ri | ||
78 | - SQSHLL_ri 1110101 0010 1 ... 1 0 ... ... 1 .. 11 1111 @mve_shl_ri | ||
79 | + { | ||
80 | + URSHR_ri 1110101 0010 1 .... 0 ... 1111 .. 01 1111 @mve_sh_ri | ||
81 | + LSRL_ri 1110101 0010 1 ... 0 0 ... ... 1 .. 01 1111 @mve_shl_ri | ||
82 | + URSHRL_ri 1110101 0010 1 ... 1 0 ... ... 1 .. 01 1111 @mve_shl_ri | ||
83 | + } | ||
84 | + | ||
85 | + { | ||
86 | + SRSHR_ri 1110101 0010 1 .... 0 ... 1111 .. 10 1111 @mve_sh_ri | ||
87 | + ASRL_ri 1110101 0010 1 ... 0 0 ... ... 1 .. 10 1111 @mve_shl_ri | ||
88 | + SRSHRL_ri 1110101 0010 1 ... 1 0 ... ... 1 .. 10 1111 @mve_shl_ri | ||
89 | + } | ||
90 | + | ||
91 | + { | ||
92 | + SQSHL_ri 1110101 0010 1 .... 0 ... 1111 .. 11 1111 @mve_sh_ri | ||
93 | + SQSHLL_ri 1110101 0010 1 ... 1 0 ... ... 1 .. 11 1111 @mve_shl_ri | ||
94 | + } | ||
95 | |||
96 | LSLL_rr 1110101 0010 1 ... 0 .... ... 1 0000 1101 @mve_shl_rr | ||
97 | ASRL_rr 1110101 0010 1 ... 0 .... ... 1 0010 1101 @mve_shl_rr | ||
98 | diff --git a/target/arm/mve_helper.c b/target/arm/mve_helper.c | ||
99 | index XXXXXXX..XXXXXXX 100644 | ||
100 | --- a/target/arm/mve_helper.c | ||
101 | +++ b/target/arm/mve_helper.c | ||
102 | @@ -XXX,XX +XXX,XX @@ uint64_t HELPER(mve_uqrshll48)(CPUARMState *env, uint64_t n, uint32_t shift) | ||
103 | { | ||
104 | return do_uqrshl48_d(n, (int8_t)shift, true, &env->QF); | ||
105 | } | ||
106 | + | ||
107 | +uint32_t HELPER(mve_uqshl)(CPUARMState *env, uint32_t n, uint32_t shift) | ||
108 | +{ | ||
109 | + return do_uqrshl_bhs(n, (int8_t)shift, 32, false, &env->QF); | ||
110 | +} | ||
111 | + | ||
112 | +uint32_t HELPER(mve_sqshl)(CPUARMState *env, uint32_t n, uint32_t shift) | ||
113 | +{ | ||
114 | + return do_sqrshl_bhs(n, (int8_t)shift, 32, false, &env->QF); | ||
115 | +} | ||
116 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 11 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
117 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
118 | --- a/target/arm/translate.c | 13 | --- a/target/arm/translate.c |
119 | +++ b/target/arm/translate.c | 14 | +++ b/target/arm/translate.c |
120 | @@ -XXX,XX +XXX,XX @@ static void gen_srshr16_i64(TCGv_i64 d, TCGv_i64 a, int64_t sh) | 15 | @@ -XXX,XX +XXX,XX @@ void gen_gvec_sqrdmlsh_qc(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, |
121 | 16 | } \ | |
122 | static void gen_srshr32_i32(TCGv_i32 d, TCGv_i32 a, int32_t sh) | 17 | static void gen_##NAME##0_vec(unsigned vece, TCGv_vec d, TCGv_vec a) \ |
123 | { | 18 | { \ |
124 | - TCGv_i32 t = tcg_temp_new_i32(); | 19 | - TCGv_vec zero = tcg_const_zeros_vec_matching(d); \ |
125 | + TCGv_i32 t; | 20 | + TCGv_vec zero = tcg_constant_vec_matching(d, vece, 0); \ |
126 | 21 | tcg_gen_cmp_vec(COND, vece, d, a, zero); \ | |
127 | + /* Handle shift by the input size for the benefit of trans_SRSHR_ri */ | 22 | - tcg_temp_free_vec(zero); \ |
128 | + if (sh == 32) { | 23 | } \ |
129 | + tcg_gen_movi_i32(d, 0); | 24 | void gen_gvec_##NAME##0(unsigned vece, uint32_t d, uint32_t m, \ |
130 | + return; | 25 | uint32_t opr_sz, uint32_t max_sz) \ |
131 | + } | 26 | @@ -XXX,XX +XXX,XX @@ void gen_ushl_i32(TCGv_i32 dst, TCGv_i32 src, TCGv_i32 shift) |
132 | + t = tcg_temp_new_i32(); | 27 | TCGv_i32 rval = tcg_temp_new_i32(); |
133 | tcg_gen_extract_i32(t, a, sh - 1, 1); | 28 | TCGv_i32 lsh = tcg_temp_new_i32(); |
134 | tcg_gen_sari_i32(d, a, sh); | 29 | TCGv_i32 rsh = tcg_temp_new_i32(); |
135 | tcg_gen_add_i32(d, d, t); | 30 | - TCGv_i32 zero = tcg_const_i32(0); |
136 | @@ -XXX,XX +XXX,XX @@ static void gen_urshr16_i64(TCGv_i64 d, TCGv_i64 a, int64_t sh) | 31 | - TCGv_i32 max = tcg_const_i32(32); |
137 | 32 | + TCGv_i32 zero = tcg_constant_i32(0); | |
138 | static void gen_urshr32_i32(TCGv_i32 d, TCGv_i32 a, int32_t sh) | 33 | + TCGv_i32 max = tcg_constant_i32(32); |
139 | { | 34 | |
140 | - TCGv_i32 t = tcg_temp_new_i32(); | 35 | /* |
141 | + TCGv_i32 t; | 36 | * Rely on the TCG guarantee that out of range shifts produce |
142 | 37 | @@ -XXX,XX +XXX,XX @@ void gen_ushl_i32(TCGv_i32 dst, TCGv_i32 src, TCGv_i32 shift) | |
143 | + /* Handle shift by the input size for the benefit of trans_URSHR_ri */ | 38 | tcg_temp_free_i32(rval); |
144 | + if (sh == 32) { | 39 | tcg_temp_free_i32(lsh); |
145 | + tcg_gen_extract_i32(d, a, sh - 1, 1); | 40 | tcg_temp_free_i32(rsh); |
146 | + return; | 41 | - tcg_temp_free_i32(zero); |
147 | + } | 42 | - tcg_temp_free_i32(max); |
148 | + t = tcg_temp_new_i32(); | ||
149 | tcg_gen_extract_i32(t, a, sh - 1, 1); | ||
150 | tcg_gen_shri_i32(d, a, sh); | ||
151 | tcg_gen_add_i32(d, d, t); | ||
152 | @@ -XXX,XX +XXX,XX @@ static bool trans_SQRSHRL48_rr(DisasContext *s, arg_mve_shl_rr *a) | ||
153 | return do_mve_shl_rr(s, a, gen_helper_mve_sqrshrl48); | ||
154 | } | 43 | } |
155 | 44 | ||
156 | +static bool do_mve_sh_ri(DisasContext *s, arg_mve_sh_ri *a, ShiftImmFn *fn) | 45 | void gen_ushl_i64(TCGv_i64 dst, TCGv_i64 src, TCGv_i64 shift) |
157 | +{ | 46 | @@ -XXX,XX +XXX,XX @@ void gen_ushl_i64(TCGv_i64 dst, TCGv_i64 src, TCGv_i64 shift) |
158 | + if (!arm_dc_feature(s, ARM_FEATURE_V8_1M)) { | 47 | TCGv_i64 rval = tcg_temp_new_i64(); |
159 | + /* Decode falls through to ORR/MOV UNPREDICTABLE handling */ | 48 | TCGv_i64 lsh = tcg_temp_new_i64(); |
160 | + return false; | 49 | TCGv_i64 rsh = tcg_temp_new_i64(); |
161 | + } | 50 | - TCGv_i64 zero = tcg_const_i64(0); |
162 | + if (!dc_isar_feature(aa32_mve, s) || | 51 | - TCGv_i64 max = tcg_const_i64(64); |
163 | + !arm_dc_feature(s, ARM_FEATURE_M_MAIN) || | 52 | + TCGv_i64 zero = tcg_constant_i64(0); |
164 | + a->rda == 13 || a->rda == 15) { | 53 | + TCGv_i64 max = tcg_constant_i64(64); |
165 | + /* These rda cases are UNPREDICTABLE; we choose to UNDEF */ | 54 | |
166 | + unallocated_encoding(s); | 55 | /* |
167 | + return true; | 56 | * Rely on the TCG guarantee that out of range shifts produce |
168 | + } | 57 | @@ -XXX,XX +XXX,XX @@ void gen_ushl_i64(TCGv_i64 dst, TCGv_i64 src, TCGv_i64 shift) |
169 | + | 58 | tcg_temp_free_i64(rval); |
170 | + if (a->shim == 0) { | 59 | tcg_temp_free_i64(lsh); |
171 | + a->shim = 32; | 60 | tcg_temp_free_i64(rsh); |
172 | + } | 61 | - tcg_temp_free_i64(zero); |
173 | + fn(cpu_R[a->rda], cpu_R[a->rda], a->shim); | 62 | - tcg_temp_free_i64(max); |
174 | + | 63 | } |
175 | + return true; | 64 | |
176 | +} | 65 | static void gen_ushl_vec(unsigned vece, TCGv_vec dst, |
177 | + | 66 | @@ -XXX,XX +XXX,XX @@ void gen_sshl_i32(TCGv_i32 dst, TCGv_i32 src, TCGv_i32 shift) |
178 | +static bool trans_URSHR_ri(DisasContext *s, arg_mve_sh_ri *a) | 67 | TCGv_i32 rval = tcg_temp_new_i32(); |
179 | +{ | 68 | TCGv_i32 lsh = tcg_temp_new_i32(); |
180 | + return do_mve_sh_ri(s, a, gen_urshr32_i32); | 69 | TCGv_i32 rsh = tcg_temp_new_i32(); |
181 | +} | 70 | - TCGv_i32 zero = tcg_const_i32(0); |
182 | + | 71 | - TCGv_i32 max = tcg_const_i32(31); |
183 | +static bool trans_SRSHR_ri(DisasContext *s, arg_mve_sh_ri *a) | 72 | + TCGv_i32 zero = tcg_constant_i32(0); |
184 | +{ | 73 | + TCGv_i32 max = tcg_constant_i32(31); |
185 | + return do_mve_sh_ri(s, a, gen_srshr32_i32); | 74 | |
186 | +} | 75 | /* |
187 | + | 76 | * Rely on the TCG guarantee that out of range shifts produce |
188 | +static void gen_mve_sqshl(TCGv_i32 r, TCGv_i32 n, int32_t shift) | 77 | @@ -XXX,XX +XXX,XX @@ void gen_sshl_i32(TCGv_i32 dst, TCGv_i32 src, TCGv_i32 shift) |
189 | +{ | 78 | tcg_temp_free_i32(rval); |
190 | + gen_helper_mve_sqshl(r, cpu_env, n, tcg_constant_i32(shift)); | 79 | tcg_temp_free_i32(lsh); |
191 | +} | 80 | tcg_temp_free_i32(rsh); |
192 | + | 81 | - tcg_temp_free_i32(zero); |
193 | +static bool trans_SQSHL_ri(DisasContext *s, arg_mve_sh_ri *a) | 82 | - tcg_temp_free_i32(max); |
194 | +{ | 83 | } |
195 | + return do_mve_sh_ri(s, a, gen_mve_sqshl); | 84 | |
196 | +} | 85 | void gen_sshl_i64(TCGv_i64 dst, TCGv_i64 src, TCGv_i64 shift) |
197 | + | 86 | @@ -XXX,XX +XXX,XX @@ void gen_sshl_i64(TCGv_i64 dst, TCGv_i64 src, TCGv_i64 shift) |
198 | +static void gen_mve_uqshl(TCGv_i32 r, TCGv_i32 n, int32_t shift) | 87 | TCGv_i64 rval = tcg_temp_new_i64(); |
199 | +{ | 88 | TCGv_i64 lsh = tcg_temp_new_i64(); |
200 | + gen_helper_mve_uqshl(r, cpu_env, n, tcg_constant_i32(shift)); | 89 | TCGv_i64 rsh = tcg_temp_new_i64(); |
201 | +} | 90 | - TCGv_i64 zero = tcg_const_i64(0); |
202 | + | 91 | - TCGv_i64 max = tcg_const_i64(63); |
203 | +static bool trans_UQSHL_ri(DisasContext *s, arg_mve_sh_ri *a) | 92 | + TCGv_i64 zero = tcg_constant_i64(0); |
204 | +{ | 93 | + TCGv_i64 max = tcg_constant_i64(63); |
205 | + return do_mve_sh_ri(s, a, gen_mve_uqshl); | 94 | |
206 | +} | 95 | /* |
207 | + | 96 | * Rely on the TCG guarantee that out of range shifts produce |
208 | /* | 97 | @@ -XXX,XX +XXX,XX @@ void gen_sshl_i64(TCGv_i64 dst, TCGv_i64 src, TCGv_i64 shift) |
209 | * Multiply and multiply accumulate | 98 | tcg_temp_free_i64(rval); |
210 | */ | 99 | tcg_temp_free_i64(lsh); |
100 | tcg_temp_free_i64(rsh); | ||
101 | - tcg_temp_free_i64(zero); | ||
102 | - tcg_temp_free_i64(max); | ||
103 | } | ||
104 | |||
105 | static void gen_sshl_vec(unsigned vece, TCGv_vec dst, | ||
211 | -- | 106 | -- |
212 | 2.20.1 | 107 | 2.25.1 |
213 | |||
214 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-27-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate.c | 43 +++++++++++++----------------------------- | ||
9 | 1 file changed, 13 insertions(+), 30 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate.c | ||
14 | +++ b/target/arm/translate.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, | ||
16 | * Note that on XScale all cp0..c13 registers do an access check | ||
17 | * call in order to handle c15_cpar. | ||
18 | */ | ||
19 | - TCGv_ptr tmpptr; | ||
20 | - TCGv_i32 tcg_syn, tcg_isread; | ||
21 | uint32_t syndrome; | ||
22 | |||
23 | /* Note that since we are an implementation which takes an | ||
24 | @@ -XXX,XX +XXX,XX @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, | ||
25 | |||
26 | gen_set_condexec(s); | ||
27 | gen_set_pc_im(s, s->pc_curr); | ||
28 | - tmpptr = tcg_const_ptr(ri); | ||
29 | - tcg_syn = tcg_const_i32(syndrome); | ||
30 | - tcg_isread = tcg_const_i32(isread); | ||
31 | - gen_helper_access_check_cp_reg(cpu_env, tmpptr, tcg_syn, | ||
32 | - tcg_isread); | ||
33 | - tcg_temp_free_ptr(tmpptr); | ||
34 | - tcg_temp_free_i32(tcg_syn); | ||
35 | - tcg_temp_free_i32(tcg_isread); | ||
36 | + gen_helper_access_check_cp_reg(cpu_env, | ||
37 | + tcg_constant_ptr(ri), | ||
38 | + tcg_constant_i32(syndrome), | ||
39 | + tcg_constant_i32(isread)); | ||
40 | } else if (ri->type & ARM_CP_RAISES_EXC) { | ||
41 | /* | ||
42 | * The readfn or writefn might raise an exception; | ||
43 | @@ -XXX,XX +XXX,XX @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, | ||
44 | TCGv_i64 tmp64; | ||
45 | TCGv_i32 tmp; | ||
46 | if (ri->type & ARM_CP_CONST) { | ||
47 | - tmp64 = tcg_const_i64(ri->resetvalue); | ||
48 | + tmp64 = tcg_constant_i64(ri->resetvalue); | ||
49 | } else if (ri->readfn) { | ||
50 | - TCGv_ptr tmpptr; | ||
51 | tmp64 = tcg_temp_new_i64(); | ||
52 | - tmpptr = tcg_const_ptr(ri); | ||
53 | - gen_helper_get_cp_reg64(tmp64, cpu_env, tmpptr); | ||
54 | - tcg_temp_free_ptr(tmpptr); | ||
55 | + gen_helper_get_cp_reg64(tmp64, cpu_env, | ||
56 | + tcg_constant_ptr(ri)); | ||
57 | } else { | ||
58 | tmp64 = tcg_temp_new_i64(); | ||
59 | tcg_gen_ld_i64(tmp64, cpu_env, ri->fieldoffset); | ||
60 | @@ -XXX,XX +XXX,XX @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, | ||
61 | } else { | ||
62 | TCGv_i32 tmp; | ||
63 | if (ri->type & ARM_CP_CONST) { | ||
64 | - tmp = tcg_const_i32(ri->resetvalue); | ||
65 | + tmp = tcg_constant_i32(ri->resetvalue); | ||
66 | } else if (ri->readfn) { | ||
67 | - TCGv_ptr tmpptr; | ||
68 | tmp = tcg_temp_new_i32(); | ||
69 | - tmpptr = tcg_const_ptr(ri); | ||
70 | - gen_helper_get_cp_reg(tmp, cpu_env, tmpptr); | ||
71 | - tcg_temp_free_ptr(tmpptr); | ||
72 | + gen_helper_get_cp_reg(tmp, cpu_env, tcg_constant_ptr(ri)); | ||
73 | } else { | ||
74 | tmp = load_cpu_offset(ri->fieldoffset); | ||
75 | } | ||
76 | @@ -XXX,XX +XXX,XX @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, | ||
77 | tcg_temp_free_i32(tmplo); | ||
78 | tcg_temp_free_i32(tmphi); | ||
79 | if (ri->writefn) { | ||
80 | - TCGv_ptr tmpptr = tcg_const_ptr(ri); | ||
81 | - gen_helper_set_cp_reg64(cpu_env, tmpptr, tmp64); | ||
82 | - tcg_temp_free_ptr(tmpptr); | ||
83 | + gen_helper_set_cp_reg64(cpu_env, tcg_constant_ptr(ri), | ||
84 | + tmp64); | ||
85 | } else { | ||
86 | tcg_gen_st_i64(tmp64, cpu_env, ri->fieldoffset); | ||
87 | } | ||
88 | tcg_temp_free_i64(tmp64); | ||
89 | } else { | ||
90 | + TCGv_i32 tmp = load_reg(s, rt); | ||
91 | if (ri->writefn) { | ||
92 | - TCGv_i32 tmp; | ||
93 | - TCGv_ptr tmpptr; | ||
94 | - tmp = load_reg(s, rt); | ||
95 | - tmpptr = tcg_const_ptr(ri); | ||
96 | - gen_helper_set_cp_reg(cpu_env, tmpptr, tmp); | ||
97 | - tcg_temp_free_ptr(tmpptr); | ||
98 | + gen_helper_set_cp_reg(cpu_env, tcg_constant_ptr(ri), tmp); | ||
99 | tcg_temp_free_i32(tmp); | ||
100 | } else { | ||
101 | - TCGv_i32 tmp = load_reg(s, rt); | ||
102 | store_cpu_offset(tmp, ri->fieldoffset, 4); | ||
103 | } | ||
104 | } | ||
105 | -- | ||
106 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-28-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate.c | 8 ++------ | ||
9 | 1 file changed, 2 insertions(+), 6 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate.c | ||
14 | +++ b/target/arm/translate.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static void gen_srs(DisasContext *s, | ||
16 | } | ||
17 | |||
18 | addr = tcg_temp_new_i32(); | ||
19 | - tmp = tcg_const_i32(mode); | ||
20 | /* get_r13_banked() will raise an exception if called from System mode */ | ||
21 | gen_set_condexec(s); | ||
22 | gen_set_pc_im(s, s->pc_curr); | ||
23 | - gen_helper_get_r13_banked(addr, cpu_env, tmp); | ||
24 | - tcg_temp_free_i32(tmp); | ||
25 | + gen_helper_get_r13_banked(addr, cpu_env, tcg_constant_i32(mode)); | ||
26 | switch (amode) { | ||
27 | case 0: /* DA */ | ||
28 | offset = -4; | ||
29 | @@ -XXX,XX +XXX,XX @@ static void gen_srs(DisasContext *s, | ||
30 | abort(); | ||
31 | } | ||
32 | tcg_gen_addi_i32(addr, addr, offset); | ||
33 | - tmp = tcg_const_i32(mode); | ||
34 | - gen_helper_set_r13_banked(cpu_env, tmp, addr); | ||
35 | - tcg_temp_free_i32(tmp); | ||
36 | + gen_helper_set_r13_banked(cpu_env, tcg_constant_i32(mode), addr); | ||
37 | } | ||
38 | tcg_temp_free_i32(addr); | ||
39 | s->base.is_jmp = DISAS_UPDATE_EXIT; | ||
40 | -- | ||
41 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-29-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate.c | 11 +++++------ | ||
9 | 1 file changed, 5 insertions(+), 6 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate.c | ||
14 | +++ b/target/arm/translate.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool op_s_rri_rot(DisasContext *s, arg_s_rri_rot *a, | ||
16 | void (*gen)(TCGv_i32, TCGv_i32, TCGv_i32), | ||
17 | int logic_cc, StoreRegKind kind) | ||
18 | { | ||
19 | - TCGv_i32 tmp1, tmp2; | ||
20 | + TCGv_i32 tmp1; | ||
21 | uint32_t imm; | ||
22 | |||
23 | imm = ror32(a->imm, a->rot); | ||
24 | if (logic_cc && a->rot) { | ||
25 | tcg_gen_movi_i32(cpu_CF, imm >> 31); | ||
26 | } | ||
27 | - tmp2 = tcg_const_i32(imm); | ||
28 | tmp1 = load_reg(s, a->rn); | ||
29 | |||
30 | - gen(tmp1, tmp1, tmp2); | ||
31 | - tcg_temp_free_i32(tmp2); | ||
32 | + gen(tmp1, tmp1, tcg_constant_i32(imm)); | ||
33 | |||
34 | if (logic_cc) { | ||
35 | gen_logic_CC(tmp1); | ||
36 | @@ -XXX,XX +XXX,XX @@ static bool op_s_rxi_rot(DisasContext *s, arg_s_rri_rot *a, | ||
37 | if (logic_cc && a->rot) { | ||
38 | tcg_gen_movi_i32(cpu_CF, imm >> 31); | ||
39 | } | ||
40 | - tmp = tcg_const_i32(imm); | ||
41 | |||
42 | - gen(tmp, tmp); | ||
43 | + tmp = tcg_temp_new_i32(); | ||
44 | + gen(tmp, tcg_constant_i32(imm)); | ||
45 | + | ||
46 | if (logic_cc) { | ||
47 | gen_logic_CC(tmp); | ||
48 | } | ||
49 | -- | ||
50 | 2.25.1 | diff view generated by jsdifflib |
1 | The MVE extension to v8.1M includes some new shift instructions which | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | sit entirely within the non-coprocessor part of the encoding space | ||
3 | and which operate only on general-purpose registers. They take up | ||
4 | the space which was previously UNPREDICTABLE MOVS and ORRS encodings | ||
5 | with Rm == 13 or 15. | ||
6 | 2 | ||
7 | Implement the long shifts by immediate, which perform shifts on a | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | pair of general-purpose registers treated as a 64-bit quantity, with | 4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | an immediate shift count between 1 and 32. | 5 | Message-id: 20220426163043.100432-30-richard.henderson@linaro.org |
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate.c | 11 +++-------- | ||
9 | 1 file changed, 3 insertions(+), 8 deletions(-) | ||
10 | 10 | ||
11 | Awkwardly, because the MOVS and ORRS trans functions do not UNDEF for | ||
12 | the Rm==13,15 case, we need to explicitly emit code to UNDEF for the | ||
13 | cases where v8.1M now requires that. (Trying to change MOVS and ORRS | ||
14 | is too difficult, because the functions that generate the code are | ||
15 | shared between a dozen different kinds of arithmetic or logical | ||
16 | instruction for all A32, T16 and T32 encodings, and for some insns | ||
17 | and some encodings Rm==13,15 are valid.) | ||
18 | |||
19 | We make the helper functions we need for UQSHLL and SQSHLL take | ||
20 | a 32-bit value which the helper casts to int8_t because we'll need | ||
21 | these helpers also for the shift-by-register insns, where the shift | ||
22 | count might be < 0 or > 32. | ||
23 | |||
24 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
25 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
26 | Message-id: 20210628135835.6690-16-peter.maydell@linaro.org | ||
27 | --- | ||
28 | target/arm/helper-mve.h | 3 ++ | ||
29 | target/arm/translate.h | 1 + | ||
30 | target/arm/t32.decode | 28 +++++++++++++ | ||
31 | target/arm/mve_helper.c | 10 +++++ | ||
32 | target/arm/translate.c | 90 +++++++++++++++++++++++++++++++++++++++++ | ||
33 | 5 files changed, 132 insertions(+) | ||
34 | |||
35 | diff --git a/target/arm/helper-mve.h b/target/arm/helper-mve.h | ||
36 | index XXXXXXX..XXXXXXX 100644 | ||
37 | --- a/target/arm/helper-mve.h | ||
38 | +++ b/target/arm/helper-mve.h | ||
39 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_4(mve_vqrshruntb, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | ||
40 | DEF_HELPER_FLAGS_4(mve_vqrshrunth, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | ||
41 | |||
42 | DEF_HELPER_FLAGS_4(mve_vshlc, TCG_CALL_NO_WG, i32, env, ptr, i32, i32) | ||
43 | + | ||
44 | +DEF_HELPER_FLAGS_3(mve_sqshll, TCG_CALL_NO_RWG, i64, env, i64, i32) | ||
45 | +DEF_HELPER_FLAGS_3(mve_uqshll, TCG_CALL_NO_RWG, i64, env, i64, i32) | ||
46 | diff --git a/target/arm/translate.h b/target/arm/translate.h | ||
47 | index XXXXXXX..XXXXXXX 100644 | ||
48 | --- a/target/arm/translate.h | ||
49 | +++ b/target/arm/translate.h | ||
50 | @@ -XXX,XX +XXX,XX @@ typedef void CryptoTwoOpFn(TCGv_ptr, TCGv_ptr); | ||
51 | typedef void CryptoThreeOpIntFn(TCGv_ptr, TCGv_ptr, TCGv_i32); | ||
52 | typedef void CryptoThreeOpFn(TCGv_ptr, TCGv_ptr, TCGv_ptr); | ||
53 | typedef void AtomicThreeOpFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGArg, MemOp); | ||
54 | +typedef void WideShiftImmFn(TCGv_i64, TCGv_i64, int64_t shift); | ||
55 | |||
56 | /** | ||
57 | * arm_tbflags_from_tb: | ||
58 | diff --git a/target/arm/t32.decode b/target/arm/t32.decode | ||
59 | index XXXXXXX..XXXXXXX 100644 | ||
60 | --- a/target/arm/t32.decode | ||
61 | +++ b/target/arm/t32.decode | ||
62 | @@ -XXX,XX +XXX,XX @@ | ||
63 | &mcr !extern cp opc1 crn crm opc2 rt | ||
64 | &mcrr !extern cp opc1 crm rt rt2 | ||
65 | |||
66 | +&mve_shl_ri rdalo rdahi shim | ||
67 | + | ||
68 | +# rdahi: bits [3:1] from insn, bit 0 is 1 | ||
69 | +# rdalo: bits [3:1] from insn, bit 0 is 0 | ||
70 | +%rdahi_9 9:3 !function=times_2_plus_1 | ||
71 | +%rdalo_17 17:3 !function=times_2 | ||
72 | + | ||
73 | # Data-processing (register) | ||
74 | |||
75 | %imm5_12_6 12:3 6:2 | ||
76 | @@ -XXX,XX +XXX,XX @@ | ||
77 | @S_xrr_shi ....... .... . rn:4 .... .... .. shty:2 rm:4 \ | ||
78 | &s_rrr_shi shim=%imm5_12_6 s=1 rd=0 | ||
79 | |||
80 | +@mve_shl_ri ....... .... . ... . . ... ... . .. .. .... \ | ||
81 | + &mve_shl_ri shim=%imm5_12_6 rdalo=%rdalo_17 rdahi=%rdahi_9 | ||
82 | + | ||
83 | { | ||
84 | TST_xrri 1110101 0000 1 .... 0 ... 1111 .... .... @S_xrr_shi | ||
85 | AND_rrri 1110101 0000 . .... 0 ... .... .... .... @s_rrr_shi | ||
86 | } | ||
87 | BIC_rrri 1110101 0001 . .... 0 ... .... .... .... @s_rrr_shi | ||
88 | { | ||
89 | + # The v8.1M MVE shift insns overlap in encoding with MOVS/ORRS | ||
90 | + # and are distinguished by having Rm==13 or 15. Those are UNPREDICTABLE | ||
91 | + # cases for MOVS/ORRS. We decode the MVE cases first, ensuring that | ||
92 | + # they explicitly call unallocated_encoding() for cases that must UNDEF | ||
93 | + # (eg "using a new shift insn on a v8.1M CPU without MVE"), and letting | ||
94 | + # the rest fall through (where ORR_rrri and MOV_rxri will end up | ||
95 | + # handling them as r13 and r15 accesses with the same semantics as A32). | ||
96 | + [ | ||
97 | + LSLL_ri 1110101 0010 1 ... 0 0 ... ... 1 .. 00 1111 @mve_shl_ri | ||
98 | + LSRL_ri 1110101 0010 1 ... 0 0 ... ... 1 .. 01 1111 @mve_shl_ri | ||
99 | + ASRL_ri 1110101 0010 1 ... 0 0 ... ... 1 .. 10 1111 @mve_shl_ri | ||
100 | + | ||
101 | + UQSHLL_ri 1110101 0010 1 ... 1 0 ... ... 1 .. 00 1111 @mve_shl_ri | ||
102 | + URSHRL_ri 1110101 0010 1 ... 1 0 ... ... 1 .. 01 1111 @mve_shl_ri | ||
103 | + SRSHRL_ri 1110101 0010 1 ... 1 0 ... ... 1 .. 10 1111 @mve_shl_ri | ||
104 | + SQSHLL_ri 1110101 0010 1 ... 1 0 ... ... 1 .. 11 1111 @mve_shl_ri | ||
105 | + ] | ||
106 | + | ||
107 | MOV_rxri 1110101 0010 . 1111 0 ... .... .... .... @s_rxr_shi | ||
108 | ORR_rrri 1110101 0010 . .... 0 ... .... .... .... @s_rrr_shi | ||
109 | } | ||
110 | diff --git a/target/arm/mve_helper.c b/target/arm/mve_helper.c | ||
111 | index XXXXXXX..XXXXXXX 100644 | ||
112 | --- a/target/arm/mve_helper.c | ||
113 | +++ b/target/arm/mve_helper.c | ||
114 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(mve_vshlc)(CPUARMState *env, void *vd, uint32_t rdm, | ||
115 | mve_advance_vpt(env); | ||
116 | return rdm; | ||
117 | } | ||
118 | + | ||
119 | +uint64_t HELPER(mve_sqshll)(CPUARMState *env, uint64_t n, uint32_t shift) | ||
120 | +{ | ||
121 | + return do_sqrshl_d(n, (int8_t)shift, false, &env->QF); | ||
122 | +} | ||
123 | + | ||
124 | +uint64_t HELPER(mve_uqshll)(CPUARMState *env, uint64_t n, uint32_t shift) | ||
125 | +{ | ||
126 | + return do_uqrshl_d(n, (int8_t)shift, false, &env->QF); | ||
127 | +} | ||
128 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 11 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
129 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
130 | --- a/target/arm/translate.c | 13 | --- a/target/arm/translate.c |
131 | +++ b/target/arm/translate.c | 14 | +++ b/target/arm/translate.c |
132 | @@ -XXX,XX +XXX,XX @@ static bool trans_MOVT(DisasContext *s, arg_MOVW *a) | 15 | @@ -XXX,XX +XXX,XX @@ static bool trans_ADR(DisasContext *s, arg_ri *a) |
16 | |||
17 | static bool trans_MOVW(DisasContext *s, arg_MOVW *a) | ||
18 | { | ||
19 | - TCGv_i32 tmp; | ||
20 | - | ||
21 | if (!ENABLE_ARCH_6T2) { | ||
22 | return false; | ||
23 | } | ||
24 | |||
25 | - tmp = tcg_const_i32(a->imm); | ||
26 | - store_reg(s, a->rd, tmp); | ||
27 | + store_reg(s, a->rd, tcg_constant_i32(a->imm)); | ||
133 | return true; | 28 | return true; |
134 | } | 29 | } |
135 | 30 | ||
136 | +/* | 31 | @@ -XXX,XX +XXX,XX @@ static bool trans_UMAAL(DisasContext *s, arg_UMAAL *a) |
137 | + * v8.1M MVE wide-shifts | 32 | t0 = load_reg(s, a->rm); |
138 | + */ | 33 | t1 = load_reg(s, a->rn); |
139 | +static bool do_mve_shl_ri(DisasContext *s, arg_mve_shl_ri *a, | 34 | tcg_gen_mulu2_i32(t0, t1, t0, t1); |
140 | + WideShiftImmFn *fn) | 35 | - zero = tcg_const_i32(0); |
141 | +{ | 36 | + zero = tcg_constant_i32(0); |
142 | + TCGv_i64 rda; | 37 | t2 = load_reg(s, a->ra); |
143 | + TCGv_i32 rdalo, rdahi; | 38 | tcg_gen_add2_i32(t0, t1, t0, t1, t2, zero); |
144 | + | 39 | tcg_temp_free_i32(t2); |
145 | + if (!arm_dc_feature(s, ARM_FEATURE_V8_1M)) { | 40 | t2 = load_reg(s, a->rd); |
146 | + /* Decode falls through to ORR/MOV UNPREDICTABLE handling */ | 41 | tcg_gen_add2_i32(t0, t1, t0, t1, t2, zero); |
147 | + return false; | 42 | tcg_temp_free_i32(t2); |
148 | + } | 43 | - tcg_temp_free_i32(zero); |
149 | + if (a->rdahi == 15) { | 44 | store_reg(s, a->ra, t0); |
150 | + /* These are a different encoding (SQSHL/SRSHR/UQSHL/URSHR) */ | 45 | store_reg(s, a->rd, t1); |
151 | + return false; | 46 | return true; |
152 | + } | 47 | @@ -XXX,XX +XXX,XX @@ static bool op_crc32(DisasContext *s, arg_rrr *a, bool c, MemOp sz) |
153 | + if (!dc_isar_feature(aa32_mve, s) || | 48 | default: |
154 | + !arm_dc_feature(s, ARM_FEATURE_M_MAIN) || | 49 | g_assert_not_reached(); |
155 | + a->rdahi == 13) { | 50 | } |
156 | + /* RdaHi == 13 is UNPREDICTABLE; we choose to UNDEF */ | 51 | - t3 = tcg_const_i32(1 << sz); |
157 | + unallocated_encoding(s); | 52 | + t3 = tcg_constant_i32(1 << sz); |
158 | + return true; | 53 | if (c) { |
159 | + } | 54 | gen_helper_crc32c(t1, t1, t2, t3); |
160 | + | 55 | } else { |
161 | + if (a->shim == 0) { | 56 | gen_helper_crc32(t1, t1, t2, t3); |
162 | + a->shim = 32; | 57 | } |
163 | + } | 58 | tcg_temp_free_i32(t2); |
164 | + | 59 | - tcg_temp_free_i32(t3); |
165 | + rda = tcg_temp_new_i64(); | 60 | store_reg(s, a->rd, t1); |
166 | + rdalo = load_reg(s, a->rdalo); | 61 | return true; |
167 | + rdahi = load_reg(s, a->rdahi); | 62 | } |
168 | + tcg_gen_concat_i32_i64(rda, rdalo, rdahi); | ||
169 | + | ||
170 | + fn(rda, rda, a->shim); | ||
171 | + | ||
172 | + tcg_gen_extrl_i64_i32(rdalo, rda); | ||
173 | + tcg_gen_extrh_i64_i32(rdahi, rda); | ||
174 | + store_reg(s, a->rdalo, rdalo); | ||
175 | + store_reg(s, a->rdahi, rdahi); | ||
176 | + tcg_temp_free_i64(rda); | ||
177 | + | ||
178 | + return true; | ||
179 | +} | ||
180 | + | ||
181 | +static bool trans_ASRL_ri(DisasContext *s, arg_mve_shl_ri *a) | ||
182 | +{ | ||
183 | + return do_mve_shl_ri(s, a, tcg_gen_sari_i64); | ||
184 | +} | ||
185 | + | ||
186 | +static bool trans_LSLL_ri(DisasContext *s, arg_mve_shl_ri *a) | ||
187 | +{ | ||
188 | + return do_mve_shl_ri(s, a, tcg_gen_shli_i64); | ||
189 | +} | ||
190 | + | ||
191 | +static bool trans_LSRL_ri(DisasContext *s, arg_mve_shl_ri *a) | ||
192 | +{ | ||
193 | + return do_mve_shl_ri(s, a, tcg_gen_shri_i64); | ||
194 | +} | ||
195 | + | ||
196 | +static void gen_mve_sqshll(TCGv_i64 r, TCGv_i64 n, int64_t shift) | ||
197 | +{ | ||
198 | + gen_helper_mve_sqshll(r, cpu_env, n, tcg_constant_i32(shift)); | ||
199 | +} | ||
200 | + | ||
201 | +static bool trans_SQSHLL_ri(DisasContext *s, arg_mve_shl_ri *a) | ||
202 | +{ | ||
203 | + return do_mve_shl_ri(s, a, gen_mve_sqshll); | ||
204 | +} | ||
205 | + | ||
206 | +static void gen_mve_uqshll(TCGv_i64 r, TCGv_i64 n, int64_t shift) | ||
207 | +{ | ||
208 | + gen_helper_mve_uqshll(r, cpu_env, n, tcg_constant_i32(shift)); | ||
209 | +} | ||
210 | + | ||
211 | +static bool trans_UQSHLL_ri(DisasContext *s, arg_mve_shl_ri *a) | ||
212 | +{ | ||
213 | + return do_mve_shl_ri(s, a, gen_mve_uqshll); | ||
214 | +} | ||
215 | + | ||
216 | +static bool trans_SRSHRL_ri(DisasContext *s, arg_mve_shl_ri *a) | ||
217 | +{ | ||
218 | + return do_mve_shl_ri(s, a, gen_srshr64_i64); | ||
219 | +} | ||
220 | + | ||
221 | +static bool trans_URSHRL_ri(DisasContext *s, arg_mve_shl_ri *a) | ||
222 | +{ | ||
223 | + return do_mve_shl_ri(s, a, gen_urshr64_i64); | ||
224 | +} | ||
225 | + | ||
226 | /* | ||
227 | * Multiply and multiply accumulate | ||
228 | */ | ||
229 | -- | 63 | -- |
230 | 2.20.1 | 64 | 2.25.1 |
231 | |||
232 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-31-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate.c | 7 +++---- | ||
9 | 1 file changed, 3 insertions(+), 4 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate.c | ||
14 | +++ b/target/arm/translate.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool trans_MRS_v7m(DisasContext *s, arg_MRS_v7m *a) | ||
16 | if (!arm_dc_feature(s, ARM_FEATURE_M)) { | ||
17 | return false; | ||
18 | } | ||
19 | - tmp = tcg_const_i32(a->sysm); | ||
20 | - gen_helper_v7m_mrs(tmp, cpu_env, tmp); | ||
21 | + tmp = tcg_temp_new_i32(); | ||
22 | + gen_helper_v7m_mrs(tmp, cpu_env, tcg_constant_i32(a->sysm)); | ||
23 | store_reg(s, a->rd, tmp); | ||
24 | return true; | ||
25 | } | ||
26 | @@ -XXX,XX +XXX,XX @@ static bool trans_MSR_v7m(DisasContext *s, arg_MSR_v7m *a) | ||
27 | if (!arm_dc_feature(s, ARM_FEATURE_M)) { | ||
28 | return false; | ||
29 | } | ||
30 | - addr = tcg_const_i32((a->mask << 10) | a->sysm); | ||
31 | + addr = tcg_constant_i32((a->mask << 10) | a->sysm); | ||
32 | reg = load_reg(s, a->rn); | ||
33 | gen_helper_v7m_msr(cpu_env, addr, reg); | ||
34 | - tcg_temp_free_i32(addr); | ||
35 | tcg_temp_free_i32(reg); | ||
36 | /* If we wrote to CONTROL, the EL might have changed */ | ||
37 | gen_rebuild_hflags(s, true); | ||
38 | -- | ||
39 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-32-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate.c | 14 +++++--------- | ||
9 | 1 file changed, 5 insertions(+), 9 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate.c | ||
14 | +++ b/target/arm/translate.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool trans_TT(DisasContext *s, arg_TT *a) | ||
16 | } | ||
17 | |||
18 | addr = load_reg(s, a->rn); | ||
19 | - tmp = tcg_const_i32((a->A << 1) | a->T); | ||
20 | - gen_helper_v7m_tt(tmp, cpu_env, addr, tmp); | ||
21 | + tmp = tcg_temp_new_i32(); | ||
22 | + gen_helper_v7m_tt(tmp, cpu_env, addr, tcg_constant_i32((a->A << 1) | a->T)); | ||
23 | tcg_temp_free_i32(addr); | ||
24 | store_reg(s, a->rd, tmp); | ||
25 | return true; | ||
26 | @@ -XXX,XX +XXX,XX @@ static bool trans_PKH(DisasContext *s, arg_PKH *a) | ||
27 | static bool op_sat(DisasContext *s, arg_sat *a, | ||
28 | void (*gen)(TCGv_i32, TCGv_env, TCGv_i32, TCGv_i32)) | ||
29 | { | ||
30 | - TCGv_i32 tmp, satimm; | ||
31 | + TCGv_i32 tmp; | ||
32 | int shift = a->imm; | ||
33 | |||
34 | if (!ENABLE_ARCH_6) { | ||
35 | @@ -XXX,XX +XXX,XX @@ static bool op_sat(DisasContext *s, arg_sat *a, | ||
36 | tcg_gen_shli_i32(tmp, tmp, shift); | ||
37 | } | ||
38 | |||
39 | - satimm = tcg_const_i32(a->satimm); | ||
40 | - gen(tmp, cpu_env, tmp, satimm); | ||
41 | - tcg_temp_free_i32(satimm); | ||
42 | + gen(tmp, cpu_env, tmp, tcg_constant_i32(a->satimm)); | ||
43 | |||
44 | store_reg(s, a->rd, tmp); | ||
45 | return true; | ||
46 | @@ -XXX,XX +XXX,XX @@ static bool op_smmla(DisasContext *s, arg_rrrr *a, bool round, bool sub) | ||
47 | * a non-zero multiplicand lowpart, and the correct result | ||
48 | * lowpart for rounding. | ||
49 | */ | ||
50 | - TCGv_i32 zero = tcg_const_i32(0); | ||
51 | - tcg_gen_sub2_i32(t2, t1, zero, t3, t2, t1); | ||
52 | - tcg_temp_free_i32(zero); | ||
53 | + tcg_gen_sub2_i32(t2, t1, tcg_constant_i32(0), t3, t2, t1); | ||
54 | } else { | ||
55 | tcg_gen_add_i32(t1, t1, t3); | ||
56 | } | ||
57 | -- | ||
58 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-33-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate.c | 12 ++++-------- | ||
9 | 1 file changed, 4 insertions(+), 8 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate.c | ||
14 | +++ b/target/arm/translate.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool op_stm(DisasContext *s, arg_ldst_block *a, int min_n) | ||
16 | { | ||
17 | int i, j, n, list, mem_idx; | ||
18 | bool user = a->u; | ||
19 | - TCGv_i32 addr, tmp, tmp2; | ||
20 | + TCGv_i32 addr, tmp; | ||
21 | |||
22 | if (user) { | ||
23 | /* STM (user) */ | ||
24 | @@ -XXX,XX +XXX,XX @@ static bool op_stm(DisasContext *s, arg_ldst_block *a, int min_n) | ||
25 | |||
26 | if (user && i != 15) { | ||
27 | tmp = tcg_temp_new_i32(); | ||
28 | - tmp2 = tcg_const_i32(i); | ||
29 | - gen_helper_get_user_reg(tmp, cpu_env, tmp2); | ||
30 | - tcg_temp_free_i32(tmp2); | ||
31 | + gen_helper_get_user_reg(tmp, cpu_env, tcg_constant_i32(i)); | ||
32 | } else { | ||
33 | tmp = load_reg(s, i); | ||
34 | } | ||
35 | @@ -XXX,XX +XXX,XX @@ static bool do_ldm(DisasContext *s, arg_ldst_block *a, int min_n) | ||
36 | bool loaded_base; | ||
37 | bool user = a->u; | ||
38 | bool exc_return = false; | ||
39 | - TCGv_i32 addr, tmp, tmp2, loaded_var; | ||
40 | + TCGv_i32 addr, tmp, loaded_var; | ||
41 | |||
42 | if (user) { | ||
43 | /* LDM (user), LDM (exception return) */ | ||
44 | @@ -XXX,XX +XXX,XX @@ static bool do_ldm(DisasContext *s, arg_ldst_block *a, int min_n) | ||
45 | tmp = tcg_temp_new_i32(); | ||
46 | gen_aa32_ld_i32(s, tmp, addr, mem_idx, MO_UL | MO_ALIGN); | ||
47 | if (user) { | ||
48 | - tmp2 = tcg_const_i32(i); | ||
49 | - gen_helper_set_user_reg(cpu_env, tmp2, tmp); | ||
50 | - tcg_temp_free_i32(tmp2); | ||
51 | + gen_helper_set_user_reg(cpu_env, tcg_constant_i32(i), tmp); | ||
52 | tcg_temp_free_i32(tmp); | ||
53 | } else if (i == a->rn) { | ||
54 | loaded_var = tmp; | ||
55 | -- | ||
56 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-34-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate.c | 16 +++++----------- | ||
9 | 1 file changed, 5 insertions(+), 11 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate.c | ||
14 | +++ b/target/arm/translate.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool trans_CLRM(DisasContext *s, arg_CLRM *a) | ||
16 | |||
17 | s->eci_handled = true; | ||
18 | |||
19 | - zero = tcg_const_i32(0); | ||
20 | + zero = tcg_constant_i32(0); | ||
21 | for (i = 0; i < 15; i++) { | ||
22 | if (extract32(a->list, i, 1)) { | ||
23 | /* Clear R[i] */ | ||
24 | @@ -XXX,XX +XXX,XX @@ static bool trans_CLRM(DisasContext *s, arg_CLRM *a) | ||
25 | * Clear APSR (by calling the MSR helper with the same argument | ||
26 | * as for "MSR APSR_nzcvqg, Rn": mask = 0b1100, SYSM=0) | ||
27 | */ | ||
28 | - TCGv_i32 maskreg = tcg_const_i32(0xc << 8); | ||
29 | - gen_helper_v7m_msr(cpu_env, maskreg, zero); | ||
30 | - tcg_temp_free_i32(maskreg); | ||
31 | + gen_helper_v7m_msr(cpu_env, tcg_constant_i32(0xc00), zero); | ||
32 | } | ||
33 | - tcg_temp_free_i32(zero); | ||
34 | clear_eci_state(s); | ||
35 | return true; | ||
36 | } | ||
37 | @@ -XXX,XX +XXX,XX @@ static bool trans_DLS(DisasContext *s, arg_DLS *a) | ||
38 | store_reg(s, 14, tmp); | ||
39 | if (a->size != 4) { | ||
40 | /* DLSTP: set FPSCR.LTPSIZE */ | ||
41 | - tmp = tcg_const_i32(a->size); | ||
42 | - store_cpu_field(tmp, v7m.ltpsize); | ||
43 | + store_cpu_field(tcg_constant_i32(a->size), v7m.ltpsize); | ||
44 | s->base.is_jmp = DISAS_UPDATE_NOCHAIN; | ||
45 | } | ||
46 | return true; | ||
47 | @@ -XXX,XX +XXX,XX @@ static bool trans_WLS(DisasContext *s, arg_WLS *a) | ||
48 | */ | ||
49 | bool ok = vfp_access_check(s); | ||
50 | assert(ok); | ||
51 | - tmp = tcg_const_i32(a->size); | ||
52 | - store_cpu_field(tmp, v7m.ltpsize); | ||
53 | + store_cpu_field(tcg_constant_i32(a->size), v7m.ltpsize); | ||
54 | /* | ||
55 | * LTPSIZE updated, but MVE_NO_PRED will always be the same thing (0) | ||
56 | * when we take this upcoming exit from this TB, so gen_jmp_tb() is OK. | ||
57 | @@ -XXX,XX +XXX,XX @@ static bool trans_LE(DisasContext *s, arg_LE *a) | ||
58 | gen_set_label(loopend); | ||
59 | if (a->tp) { | ||
60 | /* Exits from tail-pred loops must reset LTPSIZE to 4 */ | ||
61 | - tmp = tcg_const_i32(4); | ||
62 | - store_cpu_field(tmp, v7m.ltpsize); | ||
63 | + store_cpu_field(tcg_constant_i32(4), v7m.ltpsize); | ||
64 | } | ||
65 | /* End TB, continuing to following insn */ | ||
66 | gen_jmp_tb(s, s->base.pc_next, 1); | ||
67 | -- | ||
68 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-35-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate.c | 9 +++------ | ||
9 | 1 file changed, 3 insertions(+), 6 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate.c | ||
14 | +++ b/target/arm/translate.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool trans_CPS_v7m(DisasContext *s, arg_CPS_v7m *a) | ||
16 | return true; | ||
17 | } | ||
18 | |||
19 | - tmp = tcg_const_i32(a->im); | ||
20 | + tmp = tcg_constant_i32(a->im); | ||
21 | /* FAULTMASK */ | ||
22 | if (a->F) { | ||
23 | - addr = tcg_const_i32(19); | ||
24 | + addr = tcg_constant_i32(19); | ||
25 | gen_helper_v7m_msr(cpu_env, addr, tmp); | ||
26 | - tcg_temp_free_i32(addr); | ||
27 | } | ||
28 | /* PRIMASK */ | ||
29 | if (a->I) { | ||
30 | - addr = tcg_const_i32(16); | ||
31 | + addr = tcg_constant_i32(16); | ||
32 | gen_helper_v7m_msr(cpu_env, addr, tmp); | ||
33 | - tcg_temp_free_i32(addr); | ||
34 | } | ||
35 | gen_rebuild_hflags(s, false); | ||
36 | - tcg_temp_free_i32(tmp); | ||
37 | gen_lookup_tb(s); | ||
38 | return true; | ||
39 | } | ||
40 | -- | ||
41 | 2.25.1 | diff view generated by jsdifflib |
1 | Implement the MVE long shifts by register, which perform shifts on a | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | pair of general-purpose registers treated as a 64-bit quantity, with | ||
3 | the shift count in another general-purpose register, which might be | ||
4 | either positive or negative. | ||
5 | 2 | ||
6 | Like the long-shifts-by-immediate, these encodings sit in the space | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | that was previously the UNPREDICTABLE MOVS/ORRS with Rm==13,15. | 4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Because LSLL_rr and ASRL_rr overlap with both MOV_rxri/ORR_rrri and | 5 | Message-id: 20220426163043.100432-36-richard.henderson@linaro.org |
9 | also with CSEL (as one of the previously-UNPREDICTABLE Rm==13 cases), | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | we have to move the CSEL pattern into the same decodetree group. | 7 | --- |
8 | target/arm/translate.c | 7 +++---- | ||
9 | 1 file changed, 3 insertions(+), 4 deletions(-) | ||
11 | 10 | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
14 | Message-id: 20210628135835.6690-17-peter.maydell@linaro.org | ||
15 | --- | ||
16 | target/arm/helper-mve.h | 6 +++ | ||
17 | target/arm/translate.h | 1 + | ||
18 | target/arm/t32.decode | 16 +++++-- | ||
19 | target/arm/mve_helper.c | 93 +++++++++++++++++++++++++++++++++++++++++ | ||
20 | target/arm/translate.c | 69 ++++++++++++++++++++++++++++++ | ||
21 | 5 files changed, 182 insertions(+), 3 deletions(-) | ||
22 | |||
23 | diff --git a/target/arm/helper-mve.h b/target/arm/helper-mve.h | ||
24 | index XXXXXXX..XXXXXXX 100644 | ||
25 | --- a/target/arm/helper-mve.h | ||
26 | +++ b/target/arm/helper-mve.h | ||
27 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_4(mve_vqrshrunth, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | ||
28 | |||
29 | DEF_HELPER_FLAGS_4(mve_vshlc, TCG_CALL_NO_WG, i32, env, ptr, i32, i32) | ||
30 | |||
31 | +DEF_HELPER_FLAGS_3(mve_sshrl, TCG_CALL_NO_RWG, i64, env, i64, i32) | ||
32 | +DEF_HELPER_FLAGS_3(mve_ushll, TCG_CALL_NO_RWG, i64, env, i64, i32) | ||
33 | DEF_HELPER_FLAGS_3(mve_sqshll, TCG_CALL_NO_RWG, i64, env, i64, i32) | ||
34 | DEF_HELPER_FLAGS_3(mve_uqshll, TCG_CALL_NO_RWG, i64, env, i64, i32) | ||
35 | +DEF_HELPER_FLAGS_3(mve_sqrshrl, TCG_CALL_NO_RWG, i64, env, i64, i32) | ||
36 | +DEF_HELPER_FLAGS_3(mve_uqrshll, TCG_CALL_NO_RWG, i64, env, i64, i32) | ||
37 | +DEF_HELPER_FLAGS_3(mve_sqrshrl48, TCG_CALL_NO_RWG, i64, env, i64, i32) | ||
38 | +DEF_HELPER_FLAGS_3(mve_uqrshll48, TCG_CALL_NO_RWG, i64, env, i64, i32) | ||
39 | diff --git a/target/arm/translate.h b/target/arm/translate.h | ||
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/target/arm/translate.h | ||
42 | +++ b/target/arm/translate.h | ||
43 | @@ -XXX,XX +XXX,XX @@ typedef void CryptoThreeOpIntFn(TCGv_ptr, TCGv_ptr, TCGv_i32); | ||
44 | typedef void CryptoThreeOpFn(TCGv_ptr, TCGv_ptr, TCGv_ptr); | ||
45 | typedef void AtomicThreeOpFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGArg, MemOp); | ||
46 | typedef void WideShiftImmFn(TCGv_i64, TCGv_i64, int64_t shift); | ||
47 | +typedef void WideShiftFn(TCGv_i64, TCGv_ptr, TCGv_i64, TCGv_i32); | ||
48 | |||
49 | /** | ||
50 | * arm_tbflags_from_tb: | ||
51 | diff --git a/target/arm/t32.decode b/target/arm/t32.decode | ||
52 | index XXXXXXX..XXXXXXX 100644 | ||
53 | --- a/target/arm/t32.decode | ||
54 | +++ b/target/arm/t32.decode | ||
55 | @@ -XXX,XX +XXX,XX @@ | ||
56 | &mcrr !extern cp opc1 crm rt rt2 | ||
57 | |||
58 | &mve_shl_ri rdalo rdahi shim | ||
59 | +&mve_shl_rr rdalo rdahi rm | ||
60 | |||
61 | # rdahi: bits [3:1] from insn, bit 0 is 1 | ||
62 | # rdalo: bits [3:1] from insn, bit 0 is 0 | ||
63 | @@ -XXX,XX +XXX,XX @@ | ||
64 | |||
65 | @mve_shl_ri ....... .... . ... . . ... ... . .. .. .... \ | ||
66 | &mve_shl_ri shim=%imm5_12_6 rdalo=%rdalo_17 rdahi=%rdahi_9 | ||
67 | +@mve_shl_rr ....... .... . ... . rm:4 ... . .. .. .... \ | ||
68 | + &mve_shl_rr rdalo=%rdalo_17 rdahi=%rdahi_9 | ||
69 | |||
70 | { | ||
71 | TST_xrri 1110101 0000 1 .... 0 ... 1111 .... .... @S_xrr_shi | ||
72 | @@ -XXX,XX +XXX,XX @@ BIC_rrri 1110101 0001 . .... 0 ... .... .... .... @s_rrr_shi | ||
73 | URSHRL_ri 1110101 0010 1 ... 1 0 ... ... 1 .. 01 1111 @mve_shl_ri | ||
74 | SRSHRL_ri 1110101 0010 1 ... 1 0 ... ... 1 .. 10 1111 @mve_shl_ri | ||
75 | SQSHLL_ri 1110101 0010 1 ... 1 0 ... ... 1 .. 11 1111 @mve_shl_ri | ||
76 | + | ||
77 | + LSLL_rr 1110101 0010 1 ... 0 .... ... 1 0000 1101 @mve_shl_rr | ||
78 | + ASRL_rr 1110101 0010 1 ... 0 .... ... 1 0010 1101 @mve_shl_rr | ||
79 | + UQRSHLL64_rr 1110101 0010 1 ... 1 .... ... 1 0000 1101 @mve_shl_rr | ||
80 | + SQRSHRL64_rr 1110101 0010 1 ... 1 .... ... 1 0010 1101 @mve_shl_rr | ||
81 | + UQRSHLL48_rr 1110101 0010 1 ... 1 .... ... 1 1000 1101 @mve_shl_rr | ||
82 | + SQRSHRL48_rr 1110101 0010 1 ... 1 .... ... 1 1010 1101 @mve_shl_rr | ||
83 | ] | ||
84 | |||
85 | MOV_rxri 1110101 0010 . 1111 0 ... .... .... .... @s_rxr_shi | ||
86 | ORR_rrri 1110101 0010 . .... 0 ... .... .... .... @s_rrr_shi | ||
87 | + | ||
88 | + # v8.1M CSEL and friends | ||
89 | + CSEL 1110101 0010 1 rn:4 10 op:2 rd:4 fcond:4 rm:4 | ||
90 | } | ||
91 | { | ||
92 | MVN_rxri 1110101 0011 . 1111 0 ... .... .... .... @s_rxr_shi | ||
93 | @@ -XXX,XX +XXX,XX @@ SBC_rrri 1110101 1011 . .... 0 ... .... .... .... @s_rrr_shi | ||
94 | } | ||
95 | RSB_rrri 1110101 1110 . .... 0 ... .... .... .... @s_rrr_shi | ||
96 | |||
97 | -# v8.1M CSEL and friends | ||
98 | -CSEL 1110101 0010 1 rn:4 10 op:2 rd:4 fcond:4 rm:4 | ||
99 | - | ||
100 | # Data-processing (register-shifted register) | ||
101 | |||
102 | MOV_rxrr 1111 1010 0 shty:2 s:1 rm:4 1111 rd:4 0000 rs:4 \ | ||
103 | diff --git a/target/arm/mve_helper.c b/target/arm/mve_helper.c | ||
104 | index XXXXXXX..XXXXXXX 100644 | ||
105 | --- a/target/arm/mve_helper.c | ||
106 | +++ b/target/arm/mve_helper.c | ||
107 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(mve_vshlc)(CPUARMState *env, void *vd, uint32_t rdm, | ||
108 | return rdm; | ||
109 | } | ||
110 | |||
111 | +uint64_t HELPER(mve_sshrl)(CPUARMState *env, uint64_t n, uint32_t shift) | ||
112 | +{ | ||
113 | + return do_sqrshl_d(n, -(int8_t)shift, false, NULL); | ||
114 | +} | ||
115 | + | ||
116 | +uint64_t HELPER(mve_ushll)(CPUARMState *env, uint64_t n, uint32_t shift) | ||
117 | +{ | ||
118 | + return do_uqrshl_d(n, (int8_t)shift, false, NULL); | ||
119 | +} | ||
120 | + | ||
121 | uint64_t HELPER(mve_sqshll)(CPUARMState *env, uint64_t n, uint32_t shift) | ||
122 | { | ||
123 | return do_sqrshl_d(n, (int8_t)shift, false, &env->QF); | ||
124 | @@ -XXX,XX +XXX,XX @@ uint64_t HELPER(mve_uqshll)(CPUARMState *env, uint64_t n, uint32_t shift) | ||
125 | { | ||
126 | return do_uqrshl_d(n, (int8_t)shift, false, &env->QF); | ||
127 | } | ||
128 | + | ||
129 | +uint64_t HELPER(mve_sqrshrl)(CPUARMState *env, uint64_t n, uint32_t shift) | ||
130 | +{ | ||
131 | + return do_sqrshl_d(n, -(int8_t)shift, true, &env->QF); | ||
132 | +} | ||
133 | + | ||
134 | +uint64_t HELPER(mve_uqrshll)(CPUARMState *env, uint64_t n, uint32_t shift) | ||
135 | +{ | ||
136 | + return do_uqrshl_d(n, (int8_t)shift, true, &env->QF); | ||
137 | +} | ||
138 | + | ||
139 | +/* Operate on 64-bit values, but saturate at 48 bits */ | ||
140 | +static inline int64_t do_sqrshl48_d(int64_t src, int64_t shift, | ||
141 | + bool round, uint32_t *sat) | ||
142 | +{ | ||
143 | + if (shift <= -48) { | ||
144 | + /* Rounding the sign bit always produces 0. */ | ||
145 | + if (round) { | ||
146 | + return 0; | ||
147 | + } | ||
148 | + return src >> 63; | ||
149 | + } else if (shift < 0) { | ||
150 | + if (round) { | ||
151 | + src >>= -shift - 1; | ||
152 | + return (src >> 1) + (src & 1); | ||
153 | + } | ||
154 | + return src >> -shift; | ||
155 | + } else if (shift < 48) { | ||
156 | + int64_t val = src << shift; | ||
157 | + int64_t extval = sextract64(val, 0, 48); | ||
158 | + if (!sat || val == extval) { | ||
159 | + return extval; | ||
160 | + } | ||
161 | + } else if (!sat || src == 0) { | ||
162 | + return 0; | ||
163 | + } | ||
164 | + | ||
165 | + *sat = 1; | ||
166 | + return (1ULL << 47) - (src >= 0); | ||
167 | +} | ||
168 | + | ||
169 | +/* Operate on 64-bit values, but saturate at 48 bits */ | ||
170 | +static inline uint64_t do_uqrshl48_d(uint64_t src, int64_t shift, | ||
171 | + bool round, uint32_t *sat) | ||
172 | +{ | ||
173 | + uint64_t val, extval; | ||
174 | + | ||
175 | + if (shift <= -(48 + round)) { | ||
176 | + return 0; | ||
177 | + } else if (shift < 0) { | ||
178 | + if (round) { | ||
179 | + val = src >> (-shift - 1); | ||
180 | + val = (val >> 1) + (val & 1); | ||
181 | + } else { | ||
182 | + val = src >> -shift; | ||
183 | + } | ||
184 | + extval = extract64(val, 0, 48); | ||
185 | + if (!sat || val == extval) { | ||
186 | + return extval; | ||
187 | + } | ||
188 | + } else if (shift < 48) { | ||
189 | + uint64_t val = src << shift; | ||
190 | + uint64_t extval = extract64(val, 0, 48); | ||
191 | + if (!sat || val == extval) { | ||
192 | + return extval; | ||
193 | + } | ||
194 | + } else if (!sat || src == 0) { | ||
195 | + return 0; | ||
196 | + } | ||
197 | + | ||
198 | + *sat = 1; | ||
199 | + return MAKE_64BIT_MASK(0, 48); | ||
200 | +} | ||
201 | + | ||
202 | +uint64_t HELPER(mve_sqrshrl48)(CPUARMState *env, uint64_t n, uint32_t shift) | ||
203 | +{ | ||
204 | + return do_sqrshl48_d(n, -(int8_t)shift, true, &env->QF); | ||
205 | +} | ||
206 | + | ||
207 | +uint64_t HELPER(mve_uqrshll48)(CPUARMState *env, uint64_t n, uint32_t shift) | ||
208 | +{ | ||
209 | + return do_uqrshl48_d(n, (int8_t)shift, true, &env->QF); | ||
210 | +} | ||
211 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 11 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
212 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
213 | --- a/target/arm/translate.c | 13 | --- a/target/arm/translate.c |
214 | +++ b/target/arm/translate.c | 14 | +++ b/target/arm/translate.c |
215 | @@ -XXX,XX +XXX,XX @@ static bool trans_URSHRL_ri(DisasContext *s, arg_mve_shl_ri *a) | 15 | @@ -XXX,XX +XXX,XX @@ static bool trans_CSEL(DisasContext *s, arg_CSEL *a) |
216 | return do_mve_shl_ri(s, a, gen_urshr64_i64); | 16 | } |
217 | } | 17 | |
218 | 18 | /* In this insn input reg fields of 0b1111 mean "zero", not "PC" */ | |
219 | +static bool do_mve_shl_rr(DisasContext *s, arg_mve_shl_rr *a, WideShiftFn *fn) | 19 | + zero = tcg_constant_i32(0); |
220 | +{ | 20 | if (a->rn == 15) { |
221 | + TCGv_i64 rda; | 21 | - rn = tcg_const_i32(0); |
222 | + TCGv_i32 rdalo, rdahi; | 22 | + rn = zero; |
223 | + | 23 | } else { |
224 | + if (!arm_dc_feature(s, ARM_FEATURE_V8_1M)) { | 24 | rn = load_reg(s, a->rn); |
225 | + /* Decode falls through to ORR/MOV UNPREDICTABLE handling */ | 25 | } |
226 | + return false; | 26 | if (a->rm == 15) { |
227 | + } | 27 | - rm = tcg_const_i32(0); |
228 | + if (a->rdahi == 15) { | 28 | + rm = zero; |
229 | + /* These are a different encoding (SQSHL/SRSHR/UQSHL/URSHR) */ | 29 | } else { |
230 | + return false; | 30 | rm = load_reg(s, a->rm); |
231 | + } | 31 | } |
232 | + if (!dc_isar_feature(aa32_mve, s) || | 32 | @@ -XXX,XX +XXX,XX @@ static bool trans_CSEL(DisasContext *s, arg_CSEL *a) |
233 | + !arm_dc_feature(s, ARM_FEATURE_M_MAIN) || | 33 | } |
234 | + a->rdahi == 13 || a->rm == 13 || a->rm == 15 || | 34 | |
235 | + a->rm == a->rdahi || a->rm == a->rdalo) { | 35 | arm_test_cc(&c, a->fcond); |
236 | + /* These rdahi/rdalo/rm cases are UNPREDICTABLE; we choose to UNDEF */ | 36 | - zero = tcg_const_i32(0); |
237 | + unallocated_encoding(s); | 37 | tcg_gen_movcond_i32(c.cond, rn, c.value, zero, rn, rm); |
238 | + return true; | 38 | arm_free_cc(&c); |
239 | + } | 39 | - tcg_temp_free_i32(zero); |
240 | + | 40 | |
241 | + rda = tcg_temp_new_i64(); | 41 | store_reg(s, a->rd, rn); |
242 | + rdalo = load_reg(s, a->rdalo); | 42 | tcg_temp_free_i32(rm); |
243 | + rdahi = load_reg(s, a->rdahi); | ||
244 | + tcg_gen_concat_i32_i64(rda, rdalo, rdahi); | ||
245 | + | ||
246 | + /* The helper takes care of the sign-extension of the low 8 bits of Rm */ | ||
247 | + fn(rda, cpu_env, rda, cpu_R[a->rm]); | ||
248 | + | ||
249 | + tcg_gen_extrl_i64_i32(rdalo, rda); | ||
250 | + tcg_gen_extrh_i64_i32(rdahi, rda); | ||
251 | + store_reg(s, a->rdalo, rdalo); | ||
252 | + store_reg(s, a->rdahi, rdahi); | ||
253 | + tcg_temp_free_i64(rda); | ||
254 | + | ||
255 | + return true; | ||
256 | +} | ||
257 | + | ||
258 | +static bool trans_LSLL_rr(DisasContext *s, arg_mve_shl_rr *a) | ||
259 | +{ | ||
260 | + return do_mve_shl_rr(s, a, gen_helper_mve_ushll); | ||
261 | +} | ||
262 | + | ||
263 | +static bool trans_ASRL_rr(DisasContext *s, arg_mve_shl_rr *a) | ||
264 | +{ | ||
265 | + return do_mve_shl_rr(s, a, gen_helper_mve_sshrl); | ||
266 | +} | ||
267 | + | ||
268 | +static bool trans_UQRSHLL64_rr(DisasContext *s, arg_mve_shl_rr *a) | ||
269 | +{ | ||
270 | + return do_mve_shl_rr(s, a, gen_helper_mve_uqrshll); | ||
271 | +} | ||
272 | + | ||
273 | +static bool trans_SQRSHRL64_rr(DisasContext *s, arg_mve_shl_rr *a) | ||
274 | +{ | ||
275 | + return do_mve_shl_rr(s, a, gen_helper_mve_sqrshrl); | ||
276 | +} | ||
277 | + | ||
278 | +static bool trans_UQRSHLL48_rr(DisasContext *s, arg_mve_shl_rr *a) | ||
279 | +{ | ||
280 | + return do_mve_shl_rr(s, a, gen_helper_mve_uqrshll48); | ||
281 | +} | ||
282 | + | ||
283 | +static bool trans_SQRSHRL48_rr(DisasContext *s, arg_mve_shl_rr *a) | ||
284 | +{ | ||
285 | + return do_mve_shl_rr(s, a, gen_helper_mve_sqrshrl48); | ||
286 | +} | ||
287 | + | ||
288 | /* | ||
289 | * Multiply and multiply accumulate | ||
290 | */ | ||
291 | -- | 43 | -- |
292 | 2.20.1 | 44 | 2.25.1 |
293 | |||
294 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-37-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 12 ++++-------- | ||
9 | 1 file changed, 4 insertions(+), 8 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-sve.c | ||
14 | +++ b/target/arm/translate-sve.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static void do_index(DisasContext *s, int esz, int rd, | ||
16 | static bool trans_INDEX_ii(DisasContext *s, arg_INDEX_ii *a) | ||
17 | { | ||
18 | if (sve_access_check(s)) { | ||
19 | - TCGv_i64 start = tcg_const_i64(a->imm1); | ||
20 | - TCGv_i64 incr = tcg_const_i64(a->imm2); | ||
21 | + TCGv_i64 start = tcg_constant_i64(a->imm1); | ||
22 | + TCGv_i64 incr = tcg_constant_i64(a->imm2); | ||
23 | do_index(s, a->esz, a->rd, start, incr); | ||
24 | - tcg_temp_free_i64(start); | ||
25 | - tcg_temp_free_i64(incr); | ||
26 | } | ||
27 | return true; | ||
28 | } | ||
29 | @@ -XXX,XX +XXX,XX @@ static bool trans_INDEX_ii(DisasContext *s, arg_INDEX_ii *a) | ||
30 | static bool trans_INDEX_ir(DisasContext *s, arg_INDEX_ir *a) | ||
31 | { | ||
32 | if (sve_access_check(s)) { | ||
33 | - TCGv_i64 start = tcg_const_i64(a->imm); | ||
34 | + TCGv_i64 start = tcg_constant_i64(a->imm); | ||
35 | TCGv_i64 incr = cpu_reg(s, a->rm); | ||
36 | do_index(s, a->esz, a->rd, start, incr); | ||
37 | - tcg_temp_free_i64(start); | ||
38 | } | ||
39 | return true; | ||
40 | } | ||
41 | @@ -XXX,XX +XXX,XX @@ static bool trans_INDEX_ri(DisasContext *s, arg_INDEX_ri *a) | ||
42 | { | ||
43 | if (sve_access_check(s)) { | ||
44 | TCGv_i64 start = cpu_reg(s, a->rn); | ||
45 | - TCGv_i64 incr = tcg_const_i64(a->imm); | ||
46 | + TCGv_i64 incr = tcg_constant_i64(a->imm); | ||
47 | do_index(s, a->esz, a->rd, start, incr); | ||
48 | - tcg_temp_free_i64(incr); | ||
49 | } | ||
50 | return true; | ||
51 | } | ||
52 | -- | ||
53 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-38-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 18 ++++++------------ | ||
9 | 1 file changed, 6 insertions(+), 12 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-sve.c | ||
14 | +++ b/target/arm/translate-sve.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool trans_SINCDEC_r_32(DisasContext *s, arg_incdec_cnt *a) | ||
16 | tcg_gen_ext32s_i64(reg, reg); | ||
17 | } | ||
18 | } else { | ||
19 | - TCGv_i64 t = tcg_const_i64(inc); | ||
20 | - do_sat_addsub_32(reg, t, a->u, a->d); | ||
21 | - tcg_temp_free_i64(t); | ||
22 | + do_sat_addsub_32(reg, tcg_constant_i64(inc), a->u, a->d); | ||
23 | } | ||
24 | return true; | ||
25 | } | ||
26 | @@ -XXX,XX +XXX,XX @@ static bool trans_SINCDEC_r_64(DisasContext *s, arg_incdec_cnt *a) | ||
27 | TCGv_i64 reg = cpu_reg(s, a->rd); | ||
28 | |||
29 | if (inc != 0) { | ||
30 | - TCGv_i64 t = tcg_const_i64(inc); | ||
31 | - do_sat_addsub_64(reg, t, a->u, a->d); | ||
32 | - tcg_temp_free_i64(t); | ||
33 | + do_sat_addsub_64(reg, tcg_constant_i64(inc), a->u, a->d); | ||
34 | } | ||
35 | return true; | ||
36 | } | ||
37 | @@ -XXX,XX +XXX,XX @@ static bool trans_INCDEC_v(DisasContext *s, arg_incdec2_cnt *a) | ||
38 | |||
39 | if (inc != 0) { | ||
40 | if (sve_access_check(s)) { | ||
41 | - TCGv_i64 t = tcg_const_i64(a->d ? -inc : inc); | ||
42 | tcg_gen_gvec_adds(a->esz, vec_full_reg_offset(s, a->rd), | ||
43 | vec_full_reg_offset(s, a->rn), | ||
44 | - t, fullsz, fullsz); | ||
45 | - tcg_temp_free_i64(t); | ||
46 | + tcg_constant_i64(a->d ? -inc : inc), | ||
47 | + fullsz, fullsz); | ||
48 | } | ||
49 | } else { | ||
50 | do_mov_z(s, a->rd, a->rn); | ||
51 | @@ -XXX,XX +XXX,XX @@ static bool trans_SINCDEC_v(DisasContext *s, arg_incdec2_cnt *a) | ||
52 | |||
53 | if (inc != 0) { | ||
54 | if (sve_access_check(s)) { | ||
55 | - TCGv_i64 t = tcg_const_i64(inc); | ||
56 | - do_sat_addsub_vec(s, a->esz, a->rd, a->rn, t, a->u, a->d); | ||
57 | - tcg_temp_free_i64(t); | ||
58 | + do_sat_addsub_vec(s, a->esz, a->rd, a->rn, | ||
59 | + tcg_constant_i64(inc), a->u, a->d); | ||
60 | } | ||
61 | } else { | ||
62 | do_mov_z(s, a->rd, a->rn); | ||
63 | -- | ||
64 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-39-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 13 ++++--------- | ||
9 | 1 file changed, 4 insertions(+), 9 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-sve.c | ||
14 | +++ b/target/arm/translate-sve.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool trans_FCPY(DisasContext *s, arg_FCPY *a) | ||
16 | if (sve_access_check(s)) { | ||
17 | /* Decode the VFP immediate. */ | ||
18 | uint64_t imm = vfp_expand_imm(a->esz, a->imm); | ||
19 | - TCGv_i64 t_imm = tcg_const_i64(imm); | ||
20 | - do_cpy_m(s, a->esz, a->rd, a->rn, a->pg, t_imm); | ||
21 | - tcg_temp_free_i64(t_imm); | ||
22 | + do_cpy_m(s, a->esz, a->rd, a->rn, a->pg, tcg_constant_i64(imm)); | ||
23 | } | ||
24 | return true; | ||
25 | } | ||
26 | @@ -XXX,XX +XXX,XX @@ static bool trans_CPY_m_i(DisasContext *s, arg_rpri_esz *a) | ||
27 | return false; | ||
28 | } | ||
29 | if (sve_access_check(s)) { | ||
30 | - TCGv_i64 t_imm = tcg_const_i64(a->imm); | ||
31 | - do_cpy_m(s, a->esz, a->rd, a->rn, a->pg, t_imm); | ||
32 | - tcg_temp_free_i64(t_imm); | ||
33 | + do_cpy_m(s, a->esz, a->rd, a->rn, a->pg, tcg_constant_i64(a->imm)); | ||
34 | } | ||
35 | return true; | ||
36 | } | ||
37 | @@ -XXX,XX +XXX,XX @@ static bool trans_CPY_z_i(DisasContext *s, arg_CPY_z_i *a) | ||
38 | } | ||
39 | if (sve_access_check(s)) { | ||
40 | unsigned vsz = vec_full_reg_size(s); | ||
41 | - TCGv_i64 t_imm = tcg_const_i64(a->imm); | ||
42 | tcg_gen_gvec_2i_ool(vec_full_reg_offset(s, a->rd), | ||
43 | pred_full_reg_offset(s, a->pg), | ||
44 | - t_imm, vsz, vsz, 0, fns[a->esz]); | ||
45 | - tcg_temp_free_i64(t_imm); | ||
46 | + tcg_constant_i64(a->imm), | ||
47 | + vsz, vsz, 0, fns[a->esz]); | ||
48 | } | ||
49 | return true; | ||
50 | } | ||
51 | -- | ||
52 | 2.25.1 | diff view generated by jsdifflib |
1 | In do_ldst(), the calculation of the offset needs to be based on the | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | size of the memory access, not the size of the elements in the | ||
3 | vector. This meant we were getting it wrong for the widening and | ||
4 | narrowing variants of the various VLDR and VSTR insns. | ||
5 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-40-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20210628135835.6690-2-peter.maydell@linaro.org | ||
9 | --- | 7 | --- |
10 | target/arm/translate-mve.c | 17 +++++++++-------- | 8 | target/arm/translate-sve.c | 12 ++++-------- |
11 | 1 file changed, 9 insertions(+), 8 deletions(-) | 9 | 1 file changed, 4 insertions(+), 8 deletions(-) |
12 | 10 | ||
13 | diff --git a/target/arm/translate-mve.c b/target/arm/translate-mve.c | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
14 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/translate-mve.c | 13 | --- a/target/arm/translate-sve.c |
16 | +++ b/target/arm/translate-mve.c | 14 | +++ b/target/arm/translate-sve.c |
17 | @@ -XXX,XX +XXX,XX @@ static bool mve_skip_first_beat(DisasContext *s) | 15 | @@ -XXX,XX +XXX,XX @@ static void incr_last_active(DisasContext *s, TCGv_i32 last, int esz) |
16 | if (is_power_of_2(vsz)) { | ||
17 | tcg_gen_andi_i32(last, last, vsz - 1); | ||
18 | } else { | ||
19 | - TCGv_i32 max = tcg_const_i32(vsz); | ||
20 | - TCGv_i32 zero = tcg_const_i32(0); | ||
21 | + TCGv_i32 max = tcg_constant_i32(vsz); | ||
22 | + TCGv_i32 zero = tcg_constant_i32(0); | ||
23 | tcg_gen_movcond_i32(TCG_COND_GEU, last, last, max, zero, last); | ||
24 | - tcg_temp_free_i32(max); | ||
25 | - tcg_temp_free_i32(zero); | ||
18 | } | 26 | } |
19 | } | 27 | } |
20 | 28 | ||
21 | -static bool do_ldst(DisasContext *s, arg_VLDR_VSTR *a, MVEGenLdStFn *fn) | 29 | @@ -XXX,XX +XXX,XX @@ static void wrap_last_active(DisasContext *s, TCGv_i32 last, int esz) |
22 | +static bool do_ldst(DisasContext *s, arg_VLDR_VSTR *a, MVEGenLdStFn *fn, | 30 | if (is_power_of_2(vsz)) { |
23 | + unsigned msize) | 31 | tcg_gen_andi_i32(last, last, vsz - 1); |
24 | { | 32 | } else { |
25 | TCGv_i32 addr; | 33 | - TCGv_i32 max = tcg_const_i32(vsz - (1 << esz)); |
26 | uint32_t offset; | 34 | - TCGv_i32 zero = tcg_const_i32(0); |
27 | @@ -XXX,XX +XXX,XX @@ static bool do_ldst(DisasContext *s, arg_VLDR_VSTR *a, MVEGenLdStFn *fn) | 35 | + TCGv_i32 max = tcg_constant_i32(vsz - (1 << esz)); |
28 | return true; | 36 | + TCGv_i32 zero = tcg_constant_i32(0); |
37 | tcg_gen_movcond_i32(TCG_COND_LT, last, last, zero, max, last); | ||
38 | - tcg_temp_free_i32(max); | ||
39 | - tcg_temp_free_i32(zero); | ||
29 | } | 40 | } |
30 | |||
31 | - offset = a->imm << a->size; | ||
32 | + offset = a->imm << msize; | ||
33 | if (!a->a) { | ||
34 | offset = -offset; | ||
35 | } | ||
36 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDR_VSTR(DisasContext *s, arg_VLDR_VSTR *a) | ||
37 | { gen_helper_mve_vstrw, gen_helper_mve_vldrw }, | ||
38 | { NULL, NULL } | ||
39 | }; | ||
40 | - return do_ldst(s, a, ldstfns[a->size][a->l]); | ||
41 | + return do_ldst(s, a, ldstfns[a->size][a->l], a->size); | ||
42 | } | 41 | } |
43 | 42 | ||
44 | -#define DO_VLDST_WIDE_NARROW(OP, SLD, ULD, ST) \ | ||
45 | +#define DO_VLDST_WIDE_NARROW(OP, SLD, ULD, ST, MSIZE) \ | ||
46 | static bool trans_##OP(DisasContext *s, arg_VLDR_VSTR *a) \ | ||
47 | { \ | ||
48 | static MVEGenLdStFn * const ldstfns[2][2] = { \ | ||
49 | { gen_helper_mve_##ST, gen_helper_mve_##SLD }, \ | ||
50 | { NULL, gen_helper_mve_##ULD }, \ | ||
51 | }; \ | ||
52 | - return do_ldst(s, a, ldstfns[a->u][a->l]); \ | ||
53 | + return do_ldst(s, a, ldstfns[a->u][a->l], MSIZE); \ | ||
54 | } | ||
55 | |||
56 | -DO_VLDST_WIDE_NARROW(VLDSTB_H, vldrb_sh, vldrb_uh, vstrb_h) | ||
57 | -DO_VLDST_WIDE_NARROW(VLDSTB_W, vldrb_sw, vldrb_uw, vstrb_w) | ||
58 | -DO_VLDST_WIDE_NARROW(VLDSTH_W, vldrh_sw, vldrh_uw, vstrh_w) | ||
59 | +DO_VLDST_WIDE_NARROW(VLDSTB_H, vldrb_sh, vldrb_uh, vstrb_h, MO_8) | ||
60 | +DO_VLDST_WIDE_NARROW(VLDSTB_W, vldrb_sw, vldrb_uw, vstrb_w, MO_8) | ||
61 | +DO_VLDST_WIDE_NARROW(VLDSTH_W, vldrh_sw, vldrh_uw, vstrh_w, MO_16) | ||
62 | |||
63 | static bool trans_VDUP(DisasContext *s, arg_VDUP *a) | ||
64 | { | ||
65 | -- | 43 | -- |
66 | 2.20.1 | 44 | 2.25.1 |
67 | |||
68 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-41-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 7 +++---- | ||
9 | 1 file changed, 3 insertions(+), 4 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate-sve.c | ||
14 | +++ b/target/arm/translate-sve.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static void do_clast_scalar(DisasContext *s, int esz, int pg, int rm, | ||
16 | bool before, TCGv_i64 reg_val) | ||
17 | { | ||
18 | TCGv_i32 last = tcg_temp_new_i32(); | ||
19 | - TCGv_i64 ele, cmp, zero; | ||
20 | + TCGv_i64 ele, cmp; | ||
21 | |||
22 | find_last_active(s, last, esz, pg); | ||
23 | |||
24 | @@ -XXX,XX +XXX,XX @@ static void do_clast_scalar(DisasContext *s, int esz, int pg, int rm, | ||
25 | ele = load_last_active(s, last, rm, esz); | ||
26 | tcg_temp_free_i32(last); | ||
27 | |||
28 | - zero = tcg_const_i64(0); | ||
29 | - tcg_gen_movcond_i64(TCG_COND_GE, reg_val, cmp, zero, ele, reg_val); | ||
30 | + tcg_gen_movcond_i64(TCG_COND_GE, reg_val, cmp, tcg_constant_i64(0), | ||
31 | + ele, reg_val); | ||
32 | |||
33 | - tcg_temp_free_i64(zero); | ||
34 | tcg_temp_free_i64(cmp); | ||
35 | tcg_temp_free_i64(ele); | ||
36 | } | ||
37 | -- | ||
38 | 2.25.1 | diff view generated by jsdifflib |
1 | Implement the MVE vector shift right by immediate insns VSHRI and | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | VRSHRI. As with Neon, we implement these by using helper functions | ||
3 | which perform left shifts but allow negative shift counts to indicate | ||
4 | right shifts. | ||
5 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-42-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20210628135835.6690-9-peter.maydell@linaro.org | ||
9 | --- | 7 | --- |
10 | target/arm/helper-mve.h | 12 ++++++++++++ | 8 | target/arm/translate-sve.c | 20 +++++++------------- |
11 | target/arm/translate.h | 20 ++++++++++++++++++++ | 9 | 1 file changed, 7 insertions(+), 13 deletions(-) |
12 | target/arm/mve.decode | 28 ++++++++++++++++++++++++++++ | ||
13 | target/arm/mve_helper.c | 7 +++++++ | ||
14 | target/arm/translate-mve.c | 5 +++++ | ||
15 | target/arm/translate-neon.c | 18 ------------------ | ||
16 | 6 files changed, 72 insertions(+), 18 deletions(-) | ||
17 | 10 | ||
18 | diff --git a/target/arm/helper-mve.h b/target/arm/helper-mve.h | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
19 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/target/arm/helper-mve.h | 13 | --- a/target/arm/translate-sve.c |
21 | +++ b/target/arm/helper-mve.h | 14 | +++ b/target/arm/translate-sve.c |
22 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_3(mve_vmovi, TCG_CALL_NO_WG, void, env, ptr, i64) | 15 | @@ -XXX,XX +XXX,XX @@ static bool trans_CTERM(DisasContext *s, arg_CTERM *a) |
23 | DEF_HELPER_FLAGS_3(mve_vandi, TCG_CALL_NO_WG, void, env, ptr, i64) | 16 | static bool trans_WHILE(DisasContext *s, arg_WHILE *a) |
24 | DEF_HELPER_FLAGS_3(mve_vorri, TCG_CALL_NO_WG, void, env, ptr, i64) | 17 | { |
25 | 18 | TCGv_i64 op0, op1, t0, t1, tmax; | |
26 | +DEF_HELPER_FLAGS_4(mve_vshli_sb, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 19 | - TCGv_i32 t2, t3; |
27 | +DEF_HELPER_FLAGS_4(mve_vshli_sh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 20 | + TCGv_i32 t2; |
28 | +DEF_HELPER_FLAGS_4(mve_vshli_sw, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 21 | TCGv_ptr ptr; |
29 | + | 22 | unsigned vsz = vec_full_reg_size(s); |
30 | DEF_HELPER_FLAGS_4(mve_vshli_ub, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 23 | unsigned desc = 0; |
31 | DEF_HELPER_FLAGS_4(mve_vshli_uh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 24 | @@ -XXX,XX +XXX,XX @@ static bool trans_WHILE(DisasContext *s, arg_WHILE *a) |
32 | DEF_HELPER_FLAGS_4(mve_vshli_uw, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 25 | } |
33 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_4(mve_vqshli_uw, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 26 | } |
34 | DEF_HELPER_FLAGS_4(mve_vqshlui_sb, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 27 | |
35 | DEF_HELPER_FLAGS_4(mve_vqshlui_sh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 28 | - tmax = tcg_const_i64(vsz >> a->esz); |
36 | DEF_HELPER_FLAGS_4(mve_vqshlui_sw, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 29 | + tmax = tcg_constant_i64(vsz >> a->esz); |
37 | + | 30 | if (eq) { |
38 | +DEF_HELPER_FLAGS_4(mve_vrshli_sb, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 31 | /* Equality means one more iteration. */ |
39 | +DEF_HELPER_FLAGS_4(mve_vrshli_sh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 32 | tcg_gen_addi_i64(t0, t0, 1); |
40 | +DEF_HELPER_FLAGS_4(mve_vrshli_sw, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 33 | @@ -XXX,XX +XXX,XX @@ static bool trans_WHILE(DisasContext *s, arg_WHILE *a) |
41 | + | 34 | |
42 | +DEF_HELPER_FLAGS_4(mve_vrshli_ub, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 35 | /* Bound to the maximum. */ |
43 | +DEF_HELPER_FLAGS_4(mve_vrshli_uh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 36 | tcg_gen_umin_i64(t0, t0, tmax); |
44 | +DEF_HELPER_FLAGS_4(mve_vrshli_uw, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 37 | - tcg_temp_free_i64(tmax); |
45 | diff --git a/target/arm/translate.h b/target/arm/translate.h | 38 | |
46 | index XXXXXXX..XXXXXXX 100644 | 39 | /* Set the count to zero if the condition is false. */ |
47 | --- a/target/arm/translate.h | 40 | tcg_gen_movi_i64(t1, 0); |
48 | +++ b/target/arm/translate.h | 41 | @@ -XXX,XX +XXX,XX @@ static bool trans_WHILE(DisasContext *s, arg_WHILE *a) |
49 | @@ -XXX,XX +XXX,XX @@ static inline int times_2_plus_1(DisasContext *s, int x) | 42 | |
50 | return x * 2 + 1; | 43 | desc = FIELD_DP32(desc, PREDDESC, OPRSZ, vsz / 8); |
44 | desc = FIELD_DP32(desc, PREDDESC, ESZ, a->esz); | ||
45 | - t3 = tcg_const_i32(desc); | ||
46 | |||
47 | ptr = tcg_temp_new_ptr(); | ||
48 | tcg_gen_addi_ptr(ptr, cpu_env, pred_full_reg_offset(s, a->rd)); | ||
49 | |||
50 | if (a->lt) { | ||
51 | - gen_helper_sve_whilel(t2, ptr, t2, t3); | ||
52 | + gen_helper_sve_whilel(t2, ptr, t2, tcg_constant_i32(desc)); | ||
53 | } else { | ||
54 | - gen_helper_sve_whileg(t2, ptr, t2, t3); | ||
55 | + gen_helper_sve_whileg(t2, ptr, t2, tcg_constant_i32(desc)); | ||
56 | } | ||
57 | do_pred_flags(t2); | ||
58 | |||
59 | tcg_temp_free_ptr(ptr); | ||
60 | tcg_temp_free_i32(t2); | ||
61 | - tcg_temp_free_i32(t3); | ||
62 | return true; | ||
51 | } | 63 | } |
52 | 64 | ||
53 | +static inline int rsub_64(DisasContext *s, int x) | 65 | static bool trans_WHILE_ptr(DisasContext *s, arg_WHILE_ptr *a) |
54 | +{ | ||
55 | + return 64 - x; | ||
56 | +} | ||
57 | + | ||
58 | +static inline int rsub_32(DisasContext *s, int x) | ||
59 | +{ | ||
60 | + return 32 - x; | ||
61 | +} | ||
62 | + | ||
63 | +static inline int rsub_16(DisasContext *s, int x) | ||
64 | +{ | ||
65 | + return 16 - x; | ||
66 | +} | ||
67 | + | ||
68 | +static inline int rsub_8(DisasContext *s, int x) | ||
69 | +{ | ||
70 | + return 8 - x; | ||
71 | +} | ||
72 | + | ||
73 | static inline int arm_dc_feature(DisasContext *dc, int feature) | ||
74 | { | 66 | { |
75 | return (dc->features & (1ULL << feature)) != 0; | 67 | TCGv_i64 op0, op1, diff, t1, tmax; |
76 | diff --git a/target/arm/mve.decode b/target/arm/mve.decode | 68 | - TCGv_i32 t2, t3; |
77 | index XXXXXXX..XXXXXXX 100644 | 69 | + TCGv_i32 t2; |
78 | --- a/target/arm/mve.decode | 70 | TCGv_ptr ptr; |
79 | +++ b/target/arm/mve.decode | 71 | unsigned vsz = vec_full_reg_size(s); |
80 | @@ -XXX,XX +XXX,XX @@ | 72 | unsigned desc = 0; |
81 | @2_shl_h .... .... .. 01 shift:4 .... .... .... .... &2shift qd=%qd qm=%qm size=1 | 73 | @@ -XXX,XX +XXX,XX @@ static bool trans_WHILE_ptr(DisasContext *s, arg_WHILE_ptr *a) |
82 | @2_shl_w .... .... .. 1 shift:5 .... .... .... .... &2shift qd=%qd qm=%qm size=2 | 74 | op0 = read_cpu_reg(s, a->rn, 1); |
83 | 75 | op1 = read_cpu_reg(s, a->rm, 1); | |
84 | +# Right shifts are encoded as N - shift, where N is the element size in bits. | 76 | |
85 | +%rshift_i5 16:5 !function=rsub_32 | 77 | - tmax = tcg_const_i64(vsz); |
86 | +%rshift_i4 16:4 !function=rsub_16 | 78 | + tmax = tcg_constant_i64(vsz); |
87 | +%rshift_i3 16:3 !function=rsub_8 | 79 | diff = tcg_temp_new_i64(); |
88 | + | 80 | |
89 | +@2_shr_b .... .... .. 001 ... .... .... .... .... &2shift qd=%qd qm=%qm \ | 81 | if (a->rw) { |
90 | + size=0 shift=%rshift_i3 | 82 | @@ -XXX,XX +XXX,XX @@ static bool trans_WHILE_ptr(DisasContext *s, arg_WHILE_ptr *a) |
91 | +@2_shr_h .... .... .. 01 .... .... .... .... .... &2shift qd=%qd qm=%qm \ | 83 | |
92 | + size=1 shift=%rshift_i4 | 84 | /* Bound to the maximum. */ |
93 | +@2_shr_w .... .... .. 1 ..... .... .... .... .... &2shift qd=%qd qm=%qm \ | 85 | tcg_gen_umin_i64(diff, diff, tmax); |
94 | + size=2 shift=%rshift_i5 | 86 | - tcg_temp_free_i64(tmax); |
95 | + | 87 | |
96 | # Vector loads and stores | 88 | /* Since we're bounded, pass as a 32-bit type. */ |
97 | 89 | t2 = tcg_temp_new_i32(); | |
98 | # Widening loads and narrowing stores: | 90 | @@ -XXX,XX +XXX,XX @@ static bool trans_WHILE_ptr(DisasContext *s, arg_WHILE_ptr *a) |
99 | @@ -XXX,XX +XXX,XX @@ VQSHLI_U 111 1 1111 1 . ... ... ... 0 0111 0 1 . 1 ... 0 @2_shl_w | 91 | |
100 | VQSHLUI 111 1 1111 1 . ... ... ... 0 0110 0 1 . 1 ... 0 @2_shl_b | 92 | desc = FIELD_DP32(desc, PREDDESC, OPRSZ, vsz / 8); |
101 | VQSHLUI 111 1 1111 1 . ... ... ... 0 0110 0 1 . 1 ... 0 @2_shl_h | 93 | desc = FIELD_DP32(desc, PREDDESC, ESZ, a->esz); |
102 | VQSHLUI 111 1 1111 1 . ... ... ... 0 0110 0 1 . 1 ... 0 @2_shl_w | 94 | - t3 = tcg_const_i32(desc); |
103 | + | 95 | |
104 | +VSHRI_S 111 0 1111 1 . ... ... ... 0 0000 0 1 . 1 ... 0 @2_shr_b | 96 | ptr = tcg_temp_new_ptr(); |
105 | +VSHRI_S 111 0 1111 1 . ... ... ... 0 0000 0 1 . 1 ... 0 @2_shr_h | 97 | tcg_gen_addi_ptr(ptr, cpu_env, pred_full_reg_offset(s, a->rd)); |
106 | +VSHRI_S 111 0 1111 1 . ... ... ... 0 0000 0 1 . 1 ... 0 @2_shr_w | 98 | |
107 | + | 99 | - gen_helper_sve_whilel(t2, ptr, t2, t3); |
108 | +VSHRI_U 111 1 1111 1 . ... ... ... 0 0000 0 1 . 1 ... 0 @2_shr_b | 100 | + gen_helper_sve_whilel(t2, ptr, t2, tcg_constant_i32(desc)); |
109 | +VSHRI_U 111 1 1111 1 . ... ... ... 0 0000 0 1 . 1 ... 0 @2_shr_h | 101 | do_pred_flags(t2); |
110 | +VSHRI_U 111 1 1111 1 . ... ... ... 0 0000 0 1 . 1 ... 0 @2_shr_w | 102 | |
111 | + | 103 | tcg_temp_free_ptr(ptr); |
112 | +VRSHRI_S 111 0 1111 1 . ... ... ... 0 0010 0 1 . 1 ... 0 @2_shr_b | 104 | tcg_temp_free_i32(t2); |
113 | +VRSHRI_S 111 0 1111 1 . ... ... ... 0 0010 0 1 . 1 ... 0 @2_shr_h | 105 | - tcg_temp_free_i32(t3); |
114 | +VRSHRI_S 111 0 1111 1 . ... ... ... 0 0010 0 1 . 1 ... 0 @2_shr_w | 106 | return true; |
115 | + | ||
116 | +VRSHRI_U 111 1 1111 1 . ... ... ... 0 0010 0 1 . 1 ... 0 @2_shr_b | ||
117 | +VRSHRI_U 111 1 1111 1 . ... ... ... 0 0010 0 1 . 1 ... 0 @2_shr_h | ||
118 | +VRSHRI_U 111 1 1111 1 . ... ... ... 0 0010 0 1 . 1 ... 0 @2_shr_w | ||
119 | diff --git a/target/arm/mve_helper.c b/target/arm/mve_helper.c | ||
120 | index XXXXXXX..XXXXXXX 100644 | ||
121 | --- a/target/arm/mve_helper.c | ||
122 | +++ b/target/arm/mve_helper.c | ||
123 | @@ -XXX,XX +XXX,XX @@ DO_VADDV(vaddvuw, 4, uint32_t) | ||
124 | DO_2SHIFT(OP##b, 1, uint8_t, FN) \ | ||
125 | DO_2SHIFT(OP##h, 2, uint16_t, FN) \ | ||
126 | DO_2SHIFT(OP##w, 4, uint32_t, FN) | ||
127 | +#define DO_2SHIFT_S(OP, FN) \ | ||
128 | + DO_2SHIFT(OP##b, 1, int8_t, FN) \ | ||
129 | + DO_2SHIFT(OP##h, 2, int16_t, FN) \ | ||
130 | + DO_2SHIFT(OP##w, 4, int32_t, FN) | ||
131 | |||
132 | #define DO_2SHIFT_SAT_U(OP, FN) \ | ||
133 | DO_2SHIFT_SAT(OP##b, 1, uint8_t, FN) \ | ||
134 | @@ -XXX,XX +XXX,XX @@ DO_VADDV(vaddvuw, 4, uint32_t) | ||
135 | DO_2SHIFT_SAT(OP##w, 4, int32_t, FN) | ||
136 | |||
137 | DO_2SHIFT_U(vshli_u, DO_VSHLU) | ||
138 | +DO_2SHIFT_S(vshli_s, DO_VSHLS) | ||
139 | DO_2SHIFT_SAT_U(vqshli_u, DO_UQSHL_OP) | ||
140 | DO_2SHIFT_SAT_S(vqshli_s, DO_SQSHL_OP) | ||
141 | DO_2SHIFT_SAT_S(vqshlui_s, DO_SUQSHL_OP) | ||
142 | +DO_2SHIFT_U(vrshli_u, DO_VRSHLU) | ||
143 | +DO_2SHIFT_S(vrshli_s, DO_VRSHLS) | ||
144 | diff --git a/target/arm/translate-mve.c b/target/arm/translate-mve.c | ||
145 | index XXXXXXX..XXXXXXX 100644 | ||
146 | --- a/target/arm/translate-mve.c | ||
147 | +++ b/target/arm/translate-mve.c | ||
148 | @@ -XXX,XX +XXX,XX @@ DO_2SHIFT(VSHLI, vshli_u, false) | ||
149 | DO_2SHIFT(VQSHLI_S, vqshli_s, false) | ||
150 | DO_2SHIFT(VQSHLI_U, vqshli_u, false) | ||
151 | DO_2SHIFT(VQSHLUI, vqshlui_s, false) | ||
152 | +/* These right shifts use a left-shift helper with negated shift count */ | ||
153 | +DO_2SHIFT(VSHRI_S, vshli_s, true) | ||
154 | +DO_2SHIFT(VSHRI_U, vshli_u, true) | ||
155 | +DO_2SHIFT(VRSHRI_S, vrshli_s, true) | ||
156 | +DO_2SHIFT(VRSHRI_U, vrshli_u, true) | ||
157 | diff --git a/target/arm/translate-neon.c b/target/arm/translate-neon.c | ||
158 | index XXXXXXX..XXXXXXX 100644 | ||
159 | --- a/target/arm/translate-neon.c | ||
160 | +++ b/target/arm/translate-neon.c | ||
161 | @@ -XXX,XX +XXX,XX @@ static inline int plus1(DisasContext *s, int x) | ||
162 | return x + 1; | ||
163 | } | 107 | } |
164 | 108 | ||
165 | -static inline int rsub_64(DisasContext *s, int x) | ||
166 | -{ | ||
167 | - return 64 - x; | ||
168 | -} | ||
169 | - | ||
170 | -static inline int rsub_32(DisasContext *s, int x) | ||
171 | -{ | ||
172 | - return 32 - x; | ||
173 | -} | ||
174 | -static inline int rsub_16(DisasContext *s, int x) | ||
175 | -{ | ||
176 | - return 16 - x; | ||
177 | -} | ||
178 | -static inline int rsub_8(DisasContext *s, int x) | ||
179 | -{ | ||
180 | - return 8 - x; | ||
181 | -} | ||
182 | - | ||
183 | static inline int neon_3same_fp_size(DisasContext *s, int x) | ||
184 | { | ||
185 | /* Convert 0==fp32, 1==fp16 into a MO_* value */ | ||
186 | -- | 109 | -- |
187 | 2.20.1 | 110 | 2.25.1 |
188 | |||
189 | diff view generated by jsdifflib |
1 | From: Nolan Leake <nolan@sigbus.net> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | This is just enough to make reboot and poweroff work. Works for | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
4 | linux, u-boot, and the arm trusted firmware. Not tested, but should | 4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
5 | work for plan9, and bare-metal/hobby OSes, since they seem to generally | 5 | Message-id: 20220426163043.100432-43-richard.henderson@linaro.org |
6 | do what linux does for reset. | ||
7 | |||
8 | The watchdog timer functionality is not yet implemented. | ||
9 | |||
10 | Resolves: https://gitlab.com/qemu-project/qemu/-/issues/64 | ||
11 | Signed-off-by: Nolan Leake <nolan@sigbus.net> | ||
12 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
13 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
14 | Message-id: 20210625210209.1870217-1-nolan@sigbus.net | ||
15 | [PMM: tweaked commit title; fixed region size to 0x200; | ||
16 | moved header file to include/] | ||
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
18 | --- | 7 | --- |
19 | include/hw/arm/bcm2835_peripherals.h | 3 +- | 8 | target/arm/translate-sve.c | 12 ++++-------- |
20 | include/hw/misc/bcm2835_powermgt.h | 29 +++++ | 9 | 1 file changed, 4 insertions(+), 8 deletions(-) |
21 | hw/arm/bcm2835_peripherals.c | 13 ++- | ||
22 | hw/misc/bcm2835_powermgt.c | 160 +++++++++++++++++++++++++++ | ||
23 | hw/misc/meson.build | 1 + | ||
24 | 5 files changed, 204 insertions(+), 2 deletions(-) | ||
25 | create mode 100644 include/hw/misc/bcm2835_powermgt.h | ||
26 | create mode 100644 hw/misc/bcm2835_powermgt.c | ||
27 | 10 | ||
28 | diff --git a/include/hw/arm/bcm2835_peripherals.h b/include/hw/arm/bcm2835_peripherals.h | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
29 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
30 | --- a/include/hw/arm/bcm2835_peripherals.h | 13 | --- a/target/arm/translate-sve.c |
31 | +++ b/include/hw/arm/bcm2835_peripherals.h | 14 | +++ b/target/arm/translate-sve.c |
32 | @@ -XXX,XX +XXX,XX @@ | 15 | @@ -XXX,XX +XXX,XX @@ static bool trans_LD1_zpiz(DisasContext *s, arg_LD1_zpiz *a) |
33 | #include "hw/misc/bcm2835_mphi.h" | 16 | gen_helper_gvec_mem_scatter *fn = NULL; |
34 | #include "hw/misc/bcm2835_thermal.h" | 17 | bool be = s->be_data == MO_BE; |
35 | #include "hw/misc/bcm2835_cprman.h" | 18 | bool mte = s->mte_active[0]; |
36 | +#include "hw/misc/bcm2835_powermgt.h" | 19 | - TCGv_i64 imm; |
37 | #include "hw/sd/sdhci.h" | 20 | |
38 | #include "hw/sd/bcm2835_sdhost.h" | 21 | if (a->esz < a->msz || (a->esz == a->msz && !a->u)) { |
39 | #include "hw/gpio/bcm2835_gpio.h" | 22 | return false; |
40 | @@ -XXX,XX +XXX,XX @@ struct BCM2835PeripheralState { | 23 | @@ -XXX,XX +XXX,XX @@ static bool trans_LD1_zpiz(DisasContext *s, arg_LD1_zpiz *a) |
41 | BCM2835MphiState mphi; | 24 | /* Treat LD1_zpiz (zn[x] + imm) the same way as LD1_zprz (rn + zm[x]) |
42 | UnimplementedDeviceState txp; | 25 | * by loading the immediate into the scalar parameter. |
43 | UnimplementedDeviceState armtmr; | 26 | */ |
44 | - UnimplementedDeviceState powermgt; | 27 | - imm = tcg_const_i64(a->imm << a->msz); |
45 | + BCM2835PowerMgtState powermgt; | 28 | - do_mem_zpz(s, a->rd, a->pg, a->rn, 0, imm, a->msz, false, fn); |
46 | BCM2835CprmanState cprman; | 29 | - tcg_temp_free_i64(imm); |
47 | PL011State uart0; | 30 | + do_mem_zpz(s, a->rd, a->pg, a->rn, 0, |
48 | BCM2835AuxState aux; | 31 | + tcg_constant_i64(a->imm << a->msz), a->msz, false, fn); |
49 | diff --git a/include/hw/misc/bcm2835_powermgt.h b/include/hw/misc/bcm2835_powermgt.h | 32 | return true; |
50 | new file mode 100644 | ||
51 | index XXXXXXX..XXXXXXX | ||
52 | --- /dev/null | ||
53 | +++ b/include/hw/misc/bcm2835_powermgt.h | ||
54 | @@ -XXX,XX +XXX,XX @@ | ||
55 | +/* | ||
56 | + * BCM2835 Power Management emulation | ||
57 | + * | ||
58 | + * Copyright (C) 2017 Marcin Chojnacki <marcinch7@gmail.com> | ||
59 | + * Copyright (C) 2021 Nolan Leake <nolan@sigbus.net> | ||
60 | + * | ||
61 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
62 | + * See the COPYING file in the top-level directory. | ||
63 | + */ | ||
64 | + | ||
65 | +#ifndef BCM2835_POWERMGT_H | ||
66 | +#define BCM2835_POWERMGT_H | ||
67 | + | ||
68 | +#include "hw/sysbus.h" | ||
69 | +#include "qom/object.h" | ||
70 | + | ||
71 | +#define TYPE_BCM2835_POWERMGT "bcm2835-powermgt" | ||
72 | +OBJECT_DECLARE_SIMPLE_TYPE(BCM2835PowerMgtState, BCM2835_POWERMGT) | ||
73 | + | ||
74 | +struct BCM2835PowerMgtState { | ||
75 | + SysBusDevice busdev; | ||
76 | + MemoryRegion iomem; | ||
77 | + | ||
78 | + uint32_t rstc; | ||
79 | + uint32_t rsts; | ||
80 | + uint32_t wdog; | ||
81 | +}; | ||
82 | + | ||
83 | +#endif | ||
84 | diff --git a/hw/arm/bcm2835_peripherals.c b/hw/arm/bcm2835_peripherals.c | ||
85 | index XXXXXXX..XXXXXXX 100644 | ||
86 | --- a/hw/arm/bcm2835_peripherals.c | ||
87 | +++ b/hw/arm/bcm2835_peripherals.c | ||
88 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_peripherals_init(Object *obj) | ||
89 | |||
90 | object_property_add_const_link(OBJECT(&s->dwc2), "dma-mr", | ||
91 | OBJECT(&s->gpu_bus_mr)); | ||
92 | + | ||
93 | + /* Power Management */ | ||
94 | + object_initialize_child(obj, "powermgt", &s->powermgt, | ||
95 | + TYPE_BCM2835_POWERMGT); | ||
96 | } | 33 | } |
97 | 34 | ||
98 | static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp) | 35 | @@ -XXX,XX +XXX,XX @@ static bool trans_ST1_zpiz(DisasContext *s, arg_ST1_zpiz *a) |
99 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp) | 36 | gen_helper_gvec_mem_scatter *fn = NULL; |
100 | qdev_get_gpio_in_named(DEVICE(&s->ic), BCM2835_IC_GPU_IRQ, | 37 | bool be = s->be_data == MO_BE; |
101 | INTERRUPT_USB)); | 38 | bool mte = s->mte_active[0]; |
102 | 39 | - TCGv_i64 imm; | |
103 | + /* Power Management */ | 40 | |
104 | + if (!sysbus_realize(SYS_BUS_DEVICE(&s->powermgt), errp)) { | 41 | if (a->esz < a->msz) { |
105 | + return; | 42 | return false; |
106 | + } | 43 | @@ -XXX,XX +XXX,XX @@ static bool trans_ST1_zpiz(DisasContext *s, arg_ST1_zpiz *a) |
107 | + | 44 | /* Treat ST1_zpiz (zn[x] + imm) the same way as ST1_zprz (rn + zm[x]) |
108 | + memory_region_add_subregion(&s->peri_mr, PM_OFFSET, | 45 | * by loading the immediate into the scalar parameter. |
109 | + sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->powermgt), 0)); | 46 | */ |
110 | + | 47 | - imm = tcg_const_i64(a->imm << a->msz); |
111 | create_unimp(s, &s->txp, "bcm2835-txp", TXP_OFFSET, 0x1000); | 48 | - do_mem_zpz(s, a->rd, a->pg, a->rn, 0, imm, a->msz, true, fn); |
112 | create_unimp(s, &s->armtmr, "bcm2835-sp804", ARMCTRL_TIMER0_1_OFFSET, 0x40); | 49 | - tcg_temp_free_i64(imm); |
113 | - create_unimp(s, &s->powermgt, "bcm2835-powermgt", PM_OFFSET, 0x114); | 50 | + do_mem_zpz(s, a->rd, a->pg, a->rn, 0, |
114 | create_unimp(s, &s->i2s, "bcm2835-i2s", I2S_OFFSET, 0x100); | 51 | + tcg_constant_i64(a->imm << a->msz), a->msz, true, fn); |
115 | create_unimp(s, &s->smi, "bcm2835-smi", SMI_OFFSET, 0x100); | 52 | return true; |
116 | create_unimp(s, &s->spi[0], "bcm2835-spi0", SPI0_OFFSET, 0x20); | 53 | } |
117 | diff --git a/hw/misc/bcm2835_powermgt.c b/hw/misc/bcm2835_powermgt.c | 54 | |
118 | new file mode 100644 | ||
119 | index XXXXXXX..XXXXXXX | ||
120 | --- /dev/null | ||
121 | +++ b/hw/misc/bcm2835_powermgt.c | ||
122 | @@ -XXX,XX +XXX,XX @@ | ||
123 | +/* | ||
124 | + * BCM2835 Power Management emulation | ||
125 | + * | ||
126 | + * Copyright (C) 2017 Marcin Chojnacki <marcinch7@gmail.com> | ||
127 | + * Copyright (C) 2021 Nolan Leake <nolan@sigbus.net> | ||
128 | + * | ||
129 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
130 | + * See the COPYING file in the top-level directory. | ||
131 | + */ | ||
132 | + | ||
133 | +#include "qemu/osdep.h" | ||
134 | +#include "qemu/log.h" | ||
135 | +#include "qemu/module.h" | ||
136 | +#include "hw/misc/bcm2835_powermgt.h" | ||
137 | +#include "migration/vmstate.h" | ||
138 | +#include "sysemu/runstate.h" | ||
139 | + | ||
140 | +#define PASSWORD 0x5a000000 | ||
141 | +#define PASSWORD_MASK 0xff000000 | ||
142 | + | ||
143 | +#define R_RSTC 0x1c | ||
144 | +#define V_RSTC_RESET 0x20 | ||
145 | +#define R_RSTS 0x20 | ||
146 | +#define V_RSTS_POWEROFF 0x555 /* Linux uses partition 63 to indicate halt. */ | ||
147 | +#define R_WDOG 0x24 | ||
148 | + | ||
149 | +static uint64_t bcm2835_powermgt_read(void *opaque, hwaddr offset, | ||
150 | + unsigned size) | ||
151 | +{ | ||
152 | + BCM2835PowerMgtState *s = (BCM2835PowerMgtState *)opaque; | ||
153 | + uint32_t res = 0; | ||
154 | + | ||
155 | + switch (offset) { | ||
156 | + case R_RSTC: | ||
157 | + res = s->rstc; | ||
158 | + break; | ||
159 | + case R_RSTS: | ||
160 | + res = s->rsts; | ||
161 | + break; | ||
162 | + case R_WDOG: | ||
163 | + res = s->wdog; | ||
164 | + break; | ||
165 | + | ||
166 | + default: | ||
167 | + qemu_log_mask(LOG_UNIMP, | ||
168 | + "bcm2835_powermgt_read: Unknown offset 0x%08"HWADDR_PRIx | ||
169 | + "\n", offset); | ||
170 | + res = 0; | ||
171 | + break; | ||
172 | + } | ||
173 | + | ||
174 | + return res; | ||
175 | +} | ||
176 | + | ||
177 | +static void bcm2835_powermgt_write(void *opaque, hwaddr offset, | ||
178 | + uint64_t value, unsigned size) | ||
179 | +{ | ||
180 | + BCM2835PowerMgtState *s = (BCM2835PowerMgtState *)opaque; | ||
181 | + | ||
182 | + if ((value & PASSWORD_MASK) != PASSWORD) { | ||
183 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
184 | + "bcm2835_powermgt_write: Bad password 0x%"PRIx64 | ||
185 | + " at offset 0x%08"HWADDR_PRIx"\n", | ||
186 | + value, offset); | ||
187 | + return; | ||
188 | + } | ||
189 | + | ||
190 | + value = value & ~PASSWORD_MASK; | ||
191 | + | ||
192 | + switch (offset) { | ||
193 | + case R_RSTC: | ||
194 | + s->rstc = value; | ||
195 | + if (value & V_RSTC_RESET) { | ||
196 | + if ((s->rsts & 0xfff) == V_RSTS_POWEROFF) { | ||
197 | + qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN); | ||
198 | + } else { | ||
199 | + qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); | ||
200 | + } | ||
201 | + } | ||
202 | + break; | ||
203 | + case R_RSTS: | ||
204 | + qemu_log_mask(LOG_UNIMP, | ||
205 | + "bcm2835_powermgt_write: RSTS\n"); | ||
206 | + s->rsts = value; | ||
207 | + break; | ||
208 | + case R_WDOG: | ||
209 | + qemu_log_mask(LOG_UNIMP, | ||
210 | + "bcm2835_powermgt_write: WDOG\n"); | ||
211 | + s->wdog = value; | ||
212 | + break; | ||
213 | + | ||
214 | + default: | ||
215 | + qemu_log_mask(LOG_UNIMP, | ||
216 | + "bcm2835_powermgt_write: Unknown offset 0x%08"HWADDR_PRIx | ||
217 | + "\n", offset); | ||
218 | + break; | ||
219 | + } | ||
220 | +} | ||
221 | + | ||
222 | +static const MemoryRegionOps bcm2835_powermgt_ops = { | ||
223 | + .read = bcm2835_powermgt_read, | ||
224 | + .write = bcm2835_powermgt_write, | ||
225 | + .endianness = DEVICE_NATIVE_ENDIAN, | ||
226 | + .impl.min_access_size = 4, | ||
227 | + .impl.max_access_size = 4, | ||
228 | +}; | ||
229 | + | ||
230 | +static const VMStateDescription vmstate_bcm2835_powermgt = { | ||
231 | + .name = TYPE_BCM2835_POWERMGT, | ||
232 | + .version_id = 1, | ||
233 | + .minimum_version_id = 1, | ||
234 | + .fields = (VMStateField[]) { | ||
235 | + VMSTATE_UINT32(rstc, BCM2835PowerMgtState), | ||
236 | + VMSTATE_UINT32(rsts, BCM2835PowerMgtState), | ||
237 | + VMSTATE_UINT32(wdog, BCM2835PowerMgtState), | ||
238 | + VMSTATE_END_OF_LIST() | ||
239 | + } | ||
240 | +}; | ||
241 | + | ||
242 | +static void bcm2835_powermgt_init(Object *obj) | ||
243 | +{ | ||
244 | + BCM2835PowerMgtState *s = BCM2835_POWERMGT(obj); | ||
245 | + | ||
246 | + memory_region_init_io(&s->iomem, obj, &bcm2835_powermgt_ops, s, | ||
247 | + TYPE_BCM2835_POWERMGT, 0x200); | ||
248 | + sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->iomem); | ||
249 | +} | ||
250 | + | ||
251 | +static void bcm2835_powermgt_reset(DeviceState *dev) | ||
252 | +{ | ||
253 | + BCM2835PowerMgtState *s = BCM2835_POWERMGT(dev); | ||
254 | + | ||
255 | + /* https://elinux.org/BCM2835_registers#PM */ | ||
256 | + s->rstc = 0x00000102; | ||
257 | + s->rsts = 0x00001000; | ||
258 | + s->wdog = 0x00000000; | ||
259 | +} | ||
260 | + | ||
261 | +static void bcm2835_powermgt_class_init(ObjectClass *klass, void *data) | ||
262 | +{ | ||
263 | + DeviceClass *dc = DEVICE_CLASS(klass); | ||
264 | + | ||
265 | + dc->reset = bcm2835_powermgt_reset; | ||
266 | + dc->vmsd = &vmstate_bcm2835_powermgt; | ||
267 | +} | ||
268 | + | ||
269 | +static TypeInfo bcm2835_powermgt_info = { | ||
270 | + .name = TYPE_BCM2835_POWERMGT, | ||
271 | + .parent = TYPE_SYS_BUS_DEVICE, | ||
272 | + .instance_size = sizeof(BCM2835PowerMgtState), | ||
273 | + .class_init = bcm2835_powermgt_class_init, | ||
274 | + .instance_init = bcm2835_powermgt_init, | ||
275 | +}; | ||
276 | + | ||
277 | +static void bcm2835_powermgt_register_types(void) | ||
278 | +{ | ||
279 | + type_register_static(&bcm2835_powermgt_info); | ||
280 | +} | ||
281 | + | ||
282 | +type_init(bcm2835_powermgt_register_types) | ||
283 | diff --git a/hw/misc/meson.build b/hw/misc/meson.build | ||
284 | index XXXXXXX..XXXXXXX 100644 | ||
285 | --- a/hw/misc/meson.build | ||
286 | +++ b/hw/misc/meson.build | ||
287 | @@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_RASPI', if_true: files( | ||
288 | 'bcm2835_rng.c', | ||
289 | 'bcm2835_thermal.c', | ||
290 | 'bcm2835_cprman.c', | ||
291 | + 'bcm2835_powermgt.c', | ||
292 | )) | ||
293 | softmmu_ss.add(when: 'CONFIG_SLAVIO', if_true: files('slavio_misc.c')) | ||
294 | softmmu_ss.add(when: 'CONFIG_ZYNQ', if_true: files('zynq_slcr.c', 'zynq-xadc.c')) | ||
295 | -- | 55 | -- |
296 | 2.20.1 | 56 | 2.25.1 |
297 | |||
298 | diff view generated by jsdifflib |
1 | Implement the MVE VSHLC insn, which performs a shift left of the | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | entire vector with carry in bits provided from a general purpose | ||
3 | register and carry out bits written back to that register. | ||
4 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-44-richard.henderson@linaro.org | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20210628135835.6690-14-peter.maydell@linaro.org | ||
8 | --- | 7 | --- |
9 | target/arm/helper-mve.h | 2 ++ | 8 | target/arm/translate-sve.c | 4 +--- |
10 | target/arm/mve.decode | 2 ++ | 9 | 1 file changed, 1 insertion(+), 3 deletions(-) |
11 | target/arm/mve_helper.c | 38 ++++++++++++++++++++++++++++++++++++++ | ||
12 | target/arm/translate-mve.c | 30 ++++++++++++++++++++++++++++++ | ||
13 | 4 files changed, 72 insertions(+) | ||
14 | 10 | ||
15 | diff --git a/target/arm/helper-mve.h b/target/arm/helper-mve.h | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
16 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/helper-mve.h | 13 | --- a/target/arm/translate-sve.c |
18 | +++ b/target/arm/helper-mve.h | 14 | +++ b/target/arm/translate-sve.c |
19 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_4(mve_vqrshrunbb, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 15 | @@ -XXX,XX +XXX,XX @@ static bool trans_SUBR_zzi(DisasContext *s, arg_rri_esz *a) |
20 | DEF_HELPER_FLAGS_4(mve_vqrshrunbh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 16 | } |
21 | DEF_HELPER_FLAGS_4(mve_vqrshruntb, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 17 | if (sve_access_check(s)) { |
22 | DEF_HELPER_FLAGS_4(mve_vqrshrunth, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 18 | unsigned vsz = vec_full_reg_size(s); |
23 | + | 19 | - TCGv_i64 c = tcg_const_i64(a->imm); |
24 | +DEF_HELPER_FLAGS_4(mve_vshlc, TCG_CALL_NO_WG, i32, env, ptr, i32, i32) | 20 | tcg_gen_gvec_2s(vec_full_reg_offset(s, a->rd), |
25 | diff --git a/target/arm/mve.decode b/target/arm/mve.decode | 21 | vec_full_reg_offset(s, a->rn), |
26 | index XXXXXXX..XXXXXXX 100644 | 22 | - vsz, vsz, c, &op[a->esz]); |
27 | --- a/target/arm/mve.decode | 23 | - tcg_temp_free_i64(c); |
28 | +++ b/target/arm/mve.decode | 24 | + vsz, vsz, tcg_constant_i64(a->imm), &op[a->esz]); |
29 | @@ -XXX,XX +XXX,XX @@ VQRSHRUNB 111 1 1110 1 . ... ... ... 0 1111 1 1 . 0 ... 0 @2_shr_b | 25 | } |
30 | VQRSHRUNB 111 1 1110 1 . ... ... ... 0 1111 1 1 . 0 ... 0 @2_shr_h | 26 | return true; |
31 | VQRSHRUNT 111 1 1110 1 . ... ... ... 1 1111 1 1 . 0 ... 0 @2_shr_b | 27 | } |
32 | VQRSHRUNT 111 1 1110 1 . ... ... ... 1 1111 1 1 . 0 ... 0 @2_shr_h | ||
33 | + | ||
34 | +VSHLC 111 0 1110 1 . 1 imm:5 ... 0 1111 1100 rdm:4 qd=%qd | ||
35 | diff --git a/target/arm/mve_helper.c b/target/arm/mve_helper.c | ||
36 | index XXXXXXX..XXXXXXX 100644 | ||
37 | --- a/target/arm/mve_helper.c | ||
38 | +++ b/target/arm/mve_helper.c | ||
39 | @@ -XXX,XX +XXX,XX @@ DO_VSHRN_SAT_UB(vqrshrnb_ub, vqrshrnt_ub, DO_RSHRN_UB) | ||
40 | DO_VSHRN_SAT_UH(vqrshrnb_uh, vqrshrnt_uh, DO_RSHRN_UH) | ||
41 | DO_VSHRN_SAT_SB(vqrshrunbb, vqrshruntb, DO_RSHRUN_B) | ||
42 | DO_VSHRN_SAT_SH(vqrshrunbh, vqrshrunth, DO_RSHRUN_H) | ||
43 | + | ||
44 | +uint32_t HELPER(mve_vshlc)(CPUARMState *env, void *vd, uint32_t rdm, | ||
45 | + uint32_t shift) | ||
46 | +{ | ||
47 | + uint32_t *d = vd; | ||
48 | + uint16_t mask = mve_element_mask(env); | ||
49 | + unsigned e; | ||
50 | + uint32_t r; | ||
51 | + | ||
52 | + /* | ||
53 | + * For each 32-bit element, we shift it left, bringing in the | ||
54 | + * low 'shift' bits of rdm at the bottom. Bits shifted out at | ||
55 | + * the top become the new rdm, if the predicate mask permits. | ||
56 | + * The final rdm value is returned to update the register. | ||
57 | + * shift == 0 here means "shift by 32 bits". | ||
58 | + */ | ||
59 | + if (shift == 0) { | ||
60 | + for (e = 0; e < 16 / 4; e++, mask >>= 4) { | ||
61 | + r = rdm; | ||
62 | + if (mask & 1) { | ||
63 | + rdm = d[H4(e)]; | ||
64 | + } | ||
65 | + mergemask(&d[H4(e)], r, mask); | ||
66 | + } | ||
67 | + } else { | ||
68 | + uint32_t shiftmask = MAKE_64BIT_MASK(0, shift); | ||
69 | + | ||
70 | + for (e = 0; e < 16 / 4; e++, mask >>= 4) { | ||
71 | + r = (d[H4(e)] << shift) | (rdm & shiftmask); | ||
72 | + if (mask & 1) { | ||
73 | + rdm = d[H4(e)] >> (32 - shift); | ||
74 | + } | ||
75 | + mergemask(&d[H4(e)], r, mask); | ||
76 | + } | ||
77 | + } | ||
78 | + mve_advance_vpt(env); | ||
79 | + return rdm; | ||
80 | +} | ||
81 | diff --git a/target/arm/translate-mve.c b/target/arm/translate-mve.c | ||
82 | index XXXXXXX..XXXXXXX 100644 | ||
83 | --- a/target/arm/translate-mve.c | ||
84 | +++ b/target/arm/translate-mve.c | ||
85 | @@ -XXX,XX +XXX,XX @@ DO_2SHIFT_N(VQRSHRNB_U, vqrshrnb_u) | ||
86 | DO_2SHIFT_N(VQRSHRNT_U, vqrshrnt_u) | ||
87 | DO_2SHIFT_N(VQRSHRUNB, vqrshrunb) | ||
88 | DO_2SHIFT_N(VQRSHRUNT, vqrshrunt) | ||
89 | + | ||
90 | +static bool trans_VSHLC(DisasContext *s, arg_VSHLC *a) | ||
91 | +{ | ||
92 | + /* | ||
93 | + * Whole Vector Left Shift with Carry. The carry is taken | ||
94 | + * from a general purpose register and written back there. | ||
95 | + * An imm of 0 means "shift by 32". | ||
96 | + */ | ||
97 | + TCGv_ptr qd; | ||
98 | + TCGv_i32 rdm; | ||
99 | + | ||
100 | + if (!dc_isar_feature(aa32_mve, s) || !mve_check_qreg_bank(s, a->qd)) { | ||
101 | + return false; | ||
102 | + } | ||
103 | + if (a->rdm == 13 || a->rdm == 15) { | ||
104 | + /* CONSTRAINED UNPREDICTABLE: we UNDEF */ | ||
105 | + return false; | ||
106 | + } | ||
107 | + if (!mve_eci_check(s) || !vfp_access_check(s)) { | ||
108 | + return true; | ||
109 | + } | ||
110 | + | ||
111 | + qd = mve_qreg_ptr(a->qd); | ||
112 | + rdm = load_reg(s, a->rdm); | ||
113 | + gen_helper_mve_vshlc(rdm, cpu_env, qd, rdm, tcg_constant_i32(a->imm)); | ||
114 | + store_reg(s, a->rdm, rdm); | ||
115 | + tcg_temp_free_ptr(qd); | ||
116 | + mve_update_eci(s); | ||
117 | + return true; | ||
118 | +} | ||
119 | -- | 28 | -- |
120 | 2.20.1 | 29 | 2.25.1 |
121 | |||
122 | diff view generated by jsdifflib |
1 | Implement the MVE logical-immediate insns (VMOV, VMVN, | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | VORR and VBIC). These have essentially the same encoding | ||
3 | as their Neon equivalents, and we implement the decode | ||
4 | in the same way. | ||
5 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-45-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20210628135835.6690-7-peter.maydell@linaro.org | ||
9 | --- | 7 | --- |
10 | target/arm/helper-mve.h | 4 +++ | 8 | target/arm/translate-sve.c | 15 +++++---------- |
11 | target/arm/mve.decode | 17 +++++++++++++ | 9 | 1 file changed, 5 insertions(+), 10 deletions(-) |
12 | target/arm/mve_helper.c | 24 ++++++++++++++++++ | ||
13 | target/arm/translate-mve.c | 50 ++++++++++++++++++++++++++++++++++++++ | ||
14 | 4 files changed, 95 insertions(+) | ||
15 | 10 | ||
16 | diff --git a/target/arm/helper-mve.h b/target/arm/helper-mve.h | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
17 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/helper-mve.h | 13 | --- a/target/arm/translate-sve.c |
19 | +++ b/target/arm/helper-mve.h | 14 | +++ b/target/arm/translate-sve.c |
20 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_3(mve_vaddvsh, TCG_CALL_NO_WG, i32, env, ptr, i32) | 15 | @@ -XXX,XX +XXX,XX @@ static bool do_zzi_sat(DisasContext *s, arg_rri_esz *a, bool u, bool d) |
21 | DEF_HELPER_FLAGS_3(mve_vaddvuh, TCG_CALL_NO_WG, i32, env, ptr, i32) | 16 | return false; |
22 | DEF_HELPER_FLAGS_3(mve_vaddvsw, TCG_CALL_NO_WG, i32, env, ptr, i32) | 17 | } |
23 | DEF_HELPER_FLAGS_3(mve_vaddvuw, TCG_CALL_NO_WG, i32, env, ptr, i32) | 18 | if (sve_access_check(s)) { |
24 | + | 19 | - TCGv_i64 val = tcg_const_i64(a->imm); |
25 | +DEF_HELPER_FLAGS_3(mve_vmovi, TCG_CALL_NO_WG, void, env, ptr, i64) | 20 | - do_sat_addsub_vec(s, a->esz, a->rd, a->rn, val, u, d); |
26 | +DEF_HELPER_FLAGS_3(mve_vandi, TCG_CALL_NO_WG, void, env, ptr, i64) | 21 | - tcg_temp_free_i64(val); |
27 | +DEF_HELPER_FLAGS_3(mve_vorri, TCG_CALL_NO_WG, void, env, ptr, i64) | 22 | + do_sat_addsub_vec(s, a->esz, a->rd, a->rn, |
28 | diff --git a/target/arm/mve.decode b/target/arm/mve.decode | 23 | + tcg_constant_i64(a->imm), u, d); |
29 | index XXXXXXX..XXXXXXX 100644 | 24 | } |
30 | --- a/target/arm/mve.decode | ||
31 | +++ b/target/arm/mve.decode | ||
32 | @@ -XXX,XX +XXX,XX @@ | ||
33 | # VQDMULL has size in bit 28: 0 for 16 bit, 1 for 32 bit | ||
34 | %size_28 28:1 !function=plus_1 | ||
35 | |||
36 | +# 1imm format immediate | ||
37 | +%imm_28_16_0 28:1 16:3 0:4 | ||
38 | + | ||
39 | &vldr_vstr rn qd imm p a w size l u | ||
40 | &1op qd qm size | ||
41 | &2op qd qm qn size | ||
42 | &2scalar qd qn rm size | ||
43 | +&1imm qd imm cmode op | ||
44 | |||
45 | @vldr_vstr ....... . . . . l:1 rn:4 ... ...... imm:7 &vldr_vstr qd=%qd u=0 | ||
46 | # Note that both Rn and Qd are 3 bits only (no D bit) | ||
47 | @@ -XXX,XX +XXX,XX @@ | ||
48 | @2op_nosz .... .... .... .... .... .... .... .... &2op qd=%qd qm=%qm qn=%qn size=0 | ||
49 | @2op_sz28 .... .... .... .... .... .... .... .... &2op qd=%qd qm=%qm qn=%qn \ | ||
50 | size=%size_28 | ||
51 | +@1imm .... .... .... .... .... cmode:4 .. op:1 . .... &1imm qd=%qd imm=%imm_28_16_0 | ||
52 | |||
53 | # The _rev suffix indicates that Vn and Vm are reversed. This is | ||
54 | # the case for shifts. In the Arm ARM these insns are documented | ||
55 | @@ -XXX,XX +XXX,XX @@ VADDV 111 u:1 1110 1111 size:2 01 ... 0 1111 0 0 a:1 0 qm:3 0 rda=%rd | ||
56 | # Predicate operations | ||
57 | %mask_22_13 22:1 13:3 | ||
58 | VPST 1111 1110 0 . 11 000 1 ... 0 1111 0100 1101 mask=%mask_22_13 | ||
59 | + | ||
60 | +# Logical immediate operations (1 reg and modified-immediate) | ||
61 | + | ||
62 | +# The cmode/op bits here decode VORR/VBIC/VMOV/VMVN, but | ||
63 | +# not in a way we can conveniently represent in decodetree without | ||
64 | +# a lot of repetition: | ||
65 | +# VORR: op=0, (cmode & 1) && cmode < 12 | ||
66 | +# VBIC: op=1, (cmode & 1) && cmode < 12 | ||
67 | +# VMOV: everything else | ||
68 | +# So we have a single decode line and check the cmode/op in the | ||
69 | +# trans function. | ||
70 | +Vimm_1r 111 . 1111 1 . 00 0 ... ... 0 .... 0 1 . 1 .... @1imm | ||
71 | diff --git a/target/arm/mve_helper.c b/target/arm/mve_helper.c | ||
72 | index XXXXXXX..XXXXXXX 100644 | ||
73 | --- a/target/arm/mve_helper.c | ||
74 | +++ b/target/arm/mve_helper.c | ||
75 | @@ -XXX,XX +XXX,XX @@ DO_1OP(vnegw, 4, int32_t, DO_NEG) | ||
76 | DO_1OP(vfnegh, 8, uint64_t, DO_FNEGH) | ||
77 | DO_1OP(vfnegs, 8, uint64_t, DO_FNEGS) | ||
78 | |||
79 | +/* | ||
80 | + * 1 operand immediates: Vda is destination and possibly also one source. | ||
81 | + * All these insns work at 64-bit widths. | ||
82 | + */ | ||
83 | +#define DO_1OP_IMM(OP, FN) \ | ||
84 | + void HELPER(mve_##OP)(CPUARMState *env, void *vda, uint64_t imm) \ | ||
85 | + { \ | ||
86 | + uint64_t *da = vda; \ | ||
87 | + uint16_t mask = mve_element_mask(env); \ | ||
88 | + unsigned e; \ | ||
89 | + for (e = 0; e < 16 / 8; e++, mask >>= 8) { \ | ||
90 | + mergemask(&da[H8(e)], FN(da[H8(e)], imm), mask); \ | ||
91 | + } \ | ||
92 | + mve_advance_vpt(env); \ | ||
93 | + } | ||
94 | + | ||
95 | +#define DO_MOVI(N, I) (I) | ||
96 | +#define DO_ANDI(N, I) ((N) & (I)) | ||
97 | +#define DO_ORRI(N, I) ((N) | (I)) | ||
98 | + | ||
99 | +DO_1OP_IMM(vmovi, DO_MOVI) | ||
100 | +DO_1OP_IMM(vandi, DO_ANDI) | ||
101 | +DO_1OP_IMM(vorri, DO_ORRI) | ||
102 | + | ||
103 | #define DO_2OP(OP, ESIZE, TYPE, FN) \ | ||
104 | void HELPER(glue(mve_, OP))(CPUARMState *env, \ | ||
105 | void *vd, void *vn, void *vm) \ | ||
106 | diff --git a/target/arm/translate-mve.c b/target/arm/translate-mve.c | ||
107 | index XXXXXXX..XXXXXXX 100644 | ||
108 | --- a/target/arm/translate-mve.c | ||
109 | +++ b/target/arm/translate-mve.c | ||
110 | @@ -XXX,XX +XXX,XX @@ typedef void MVEGenTwoOpFn(TCGv_ptr, TCGv_ptr, TCGv_ptr, TCGv_ptr); | ||
111 | typedef void MVEGenTwoOpScalarFn(TCGv_ptr, TCGv_ptr, TCGv_ptr, TCGv_i32); | ||
112 | typedef void MVEGenDualAccOpFn(TCGv_i64, TCGv_ptr, TCGv_ptr, TCGv_ptr, TCGv_i64); | ||
113 | typedef void MVEGenVADDVFn(TCGv_i32, TCGv_ptr, TCGv_ptr, TCGv_i32); | ||
114 | +typedef void MVEGenOneOpImmFn(TCGv_ptr, TCGv_ptr, TCGv_i64); | ||
115 | |||
116 | /* Return the offset of a Qn register (same semantics as aa32_vfp_qreg()) */ | ||
117 | static inline long mve_qreg_offset(unsigned reg) | ||
118 | @@ -XXX,XX +XXX,XX @@ static bool trans_VADDV(DisasContext *s, arg_VADDV *a) | ||
119 | mve_update_eci(s); | ||
120 | return true; | 25 | return true; |
121 | } | 26 | } |
122 | + | 27 | @@ -XXX,XX +XXX,XX @@ static bool do_zzi_ool(DisasContext *s, arg_rri_esz *a, gen_helper_gvec_2i *fn) |
123 | +static bool do_1imm(DisasContext *s, arg_1imm *a, MVEGenOneOpImmFn *fn) | 28 | { |
124 | +{ | 29 | if (sve_access_check(s)) { |
125 | + TCGv_ptr qd; | 30 | unsigned vsz = vec_full_reg_size(s); |
126 | + uint64_t imm; | 31 | - TCGv_i64 c = tcg_const_i64(a->imm); |
127 | + | 32 | - |
128 | + if (!dc_isar_feature(aa32_mve, s) || | 33 | tcg_gen_gvec_2i_ool(vec_full_reg_offset(s, a->rd), |
129 | + !mve_check_qreg_bank(s, a->qd) || | 34 | vec_full_reg_offset(s, a->rn), |
130 | + !fn) { | 35 | - c, vsz, vsz, 0, fn); |
131 | + return false; | 36 | - tcg_temp_free_i64(c); |
132 | + } | 37 | + tcg_constant_i64(a->imm), vsz, vsz, 0, fn); |
133 | + if (!mve_eci_check(s) || !vfp_access_check(s)) { | 38 | } |
134 | + return true; | 39 | return true; |
135 | + } | 40 | } |
136 | + | 41 | @@ -XXX,XX +XXX,XX @@ static void do_fp_scalar(DisasContext *s, int zd, int zn, int pg, bool is_fp16, |
137 | + imm = asimd_imm_const(a->imm, a->cmode, a->op); | 42 | static void do_fp_imm(DisasContext *s, arg_rpri_esz *a, uint64_t imm, |
138 | + | 43 | gen_helper_sve_fp2scalar *fn) |
139 | + qd = mve_qreg_ptr(a->qd); | 44 | { |
140 | + fn(cpu_env, qd, tcg_constant_i64(imm)); | 45 | - TCGv_i64 temp = tcg_const_i64(imm); |
141 | + tcg_temp_free_ptr(qd); | 46 | - do_fp_scalar(s, a->rd, a->rn, a->pg, a->esz == MO_16, temp, fn); |
142 | + mve_update_eci(s); | 47 | - tcg_temp_free_i64(temp); |
143 | + return true; | 48 | + do_fp_scalar(s, a->rd, a->rn, a->pg, a->esz == MO_16, |
144 | +} | 49 | + tcg_constant_i64(imm), fn); |
145 | + | 50 | } |
146 | +static bool trans_Vimm_1r(DisasContext *s, arg_1imm *a) | 51 | |
147 | +{ | 52 | #define DO_FP_IMM(NAME, name, const0, const1) \ |
148 | + /* Handle decode of cmode/op here between VORR/VBIC/VMOV */ | ||
149 | + MVEGenOneOpImmFn *fn; | ||
150 | + | ||
151 | + if ((a->cmode & 1) && a->cmode < 12) { | ||
152 | + if (a->op) { | ||
153 | + /* | ||
154 | + * For op=1, the immediate will be inverted by asimd_imm_const(), | ||
155 | + * so the VBIC becomes a logical AND operation. | ||
156 | + */ | ||
157 | + fn = gen_helper_mve_vandi; | ||
158 | + } else { | ||
159 | + fn = gen_helper_mve_vorri; | ||
160 | + } | ||
161 | + } else { | ||
162 | + /* There is one unallocated cmode/op combination in this space */ | ||
163 | + if (a->cmode == 15 && a->op == 1) { | ||
164 | + return false; | ||
165 | + } | ||
166 | + /* asimd_imm_const() sorts out VMVNI vs VMOVI for us */ | ||
167 | + fn = gen_helper_mve_vmovi; | ||
168 | + } | ||
169 | + return do_1imm(s, a, fn); | ||
170 | +} | ||
171 | -- | 53 | -- |
172 | 2.20.1 | 54 | 2.25.1 |
173 | |||
174 | diff view generated by jsdifflib |
1 | Implement the MVE shift-right-and-narrow insn VSHRN and VRSHRN. | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | do_urshr() is borrowed from sve_helper.c. | 3 | In these cases, 't' did double-duty as zero source and |
4 | temporary destination. Split the two uses. | ||
4 | 5 | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Message-id: 20220426163043.100432-46-richard.henderson@linaro.org | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20210628135835.6690-12-peter.maydell@linaro.org | ||
8 | --- | 10 | --- |
9 | target/arm/helper-mve.h | 10 ++++++++++ | 11 | target/arm/translate-sve.c | 17 ++++++++--------- |
10 | target/arm/mve.decode | 11 +++++++++++ | 12 | 1 file changed, 8 insertions(+), 9 deletions(-) |
11 | target/arm/mve_helper.c | 40 ++++++++++++++++++++++++++++++++++++++ | ||
12 | target/arm/translate-mve.c | 15 ++++++++++++++ | ||
13 | 4 files changed, 76 insertions(+) | ||
14 | 13 | ||
15 | diff --git a/target/arm/helper-mve.h b/target/arm/helper-mve.h | 14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
16 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/helper-mve.h | 16 | --- a/target/arm/translate-sve.c |
18 | +++ b/target/arm/helper-mve.h | 17 | +++ b/target/arm/translate-sve.c |
19 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_4(mve_vsriw, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 18 | @@ -XXX,XX +XXX,XX @@ static void do_predtest(DisasContext *s, int dofs, int gofs, int words) |
20 | DEF_HELPER_FLAGS_4(mve_vslib, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 19 | { |
21 | DEF_HELPER_FLAGS_4(mve_vslih, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 20 | TCGv_ptr dptr = tcg_temp_new_ptr(); |
22 | DEF_HELPER_FLAGS_4(mve_vsliw, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 21 | TCGv_ptr gptr = tcg_temp_new_ptr(); |
23 | + | 22 | - TCGv_i32 t; |
24 | +DEF_HELPER_FLAGS_4(mve_vshrnbb, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 23 | + TCGv_i32 t = tcg_temp_new_i32(); |
25 | +DEF_HELPER_FLAGS_4(mve_vshrnbh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 24 | |
26 | +DEF_HELPER_FLAGS_4(mve_vshrntb, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 25 | tcg_gen_addi_ptr(dptr, cpu_env, dofs); |
27 | +DEF_HELPER_FLAGS_4(mve_vshrnth, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 26 | tcg_gen_addi_ptr(gptr, cpu_env, gofs); |
28 | + | 27 | - t = tcg_const_i32(words); |
29 | +DEF_HELPER_FLAGS_4(mve_vrshrnbb, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 28 | |
30 | +DEF_HELPER_FLAGS_4(mve_vrshrnbh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 29 | - gen_helper_sve_predtest(t, dptr, gptr, t); |
31 | +DEF_HELPER_FLAGS_4(mve_vrshrntb, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 30 | + gen_helper_sve_predtest(t, dptr, gptr, tcg_constant_i32(words)); |
32 | +DEF_HELPER_FLAGS_4(mve_vrshrnth, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 31 | tcg_temp_free_ptr(dptr); |
33 | diff --git a/target/arm/mve.decode b/target/arm/mve.decode | 32 | tcg_temp_free_ptr(gptr); |
34 | index XXXXXXX..XXXXXXX 100644 | 33 | |
35 | --- a/target/arm/mve.decode | 34 | @@ -XXX,XX +XXX,XX @@ static bool do_pfirst_pnext(DisasContext *s, arg_rr_esz *a, |
36 | +++ b/target/arm/mve.decode | 35 | |
37 | @@ -XXX,XX +XXX,XX @@ VSRI 111 1 1111 1 . ... ... ... 0 0100 0 1 . 1 ... 0 @2_shr_w | 36 | tcg_gen_addi_ptr(t_pd, cpu_env, pred_full_reg_offset(s, a->rd)); |
38 | VSLI 111 1 1111 1 . ... ... ... 0 0101 0 1 . 1 ... 0 @2_shl_b | 37 | tcg_gen_addi_ptr(t_pg, cpu_env, pred_full_reg_offset(s, a->rn)); |
39 | VSLI 111 1 1111 1 . ... ... ... 0 0101 0 1 . 1 ... 0 @2_shl_h | 38 | - t = tcg_const_i32(desc); |
40 | VSLI 111 1 1111 1 . ... ... ... 0 0101 0 1 . 1 ... 0 @2_shl_w | 39 | + t = tcg_temp_new_i32(); |
41 | + | 40 | |
42 | +# Narrowing shifts (which only support b and h sizes) | 41 | - gen_fn(t, t_pd, t_pg, t); |
43 | +VSHRNB 111 0 1110 1 . ... ... ... 0 1111 1 1 . 0 ... 1 @2_shr_b | 42 | + gen_fn(t, t_pd, t_pg, tcg_constant_i32(desc)); |
44 | +VSHRNB 111 0 1110 1 . ... ... ... 0 1111 1 1 . 0 ... 1 @2_shr_h | 43 | tcg_temp_free_ptr(t_pd); |
45 | +VSHRNT 111 0 1110 1 . ... ... ... 1 1111 1 1 . 0 ... 1 @2_shr_b | 44 | tcg_temp_free_ptr(t_pg); |
46 | +VSHRNT 111 0 1110 1 . ... ... ... 1 1111 1 1 . 0 ... 1 @2_shr_h | 45 | |
47 | + | 46 | @@ -XXX,XX +XXX,XX @@ static bool do_ppzz_flags(DisasContext *s, arg_rprr_esz *a, |
48 | +VRSHRNB 111 1 1110 1 . ... ... ... 0 1111 1 1 . 0 ... 1 @2_shr_b | 47 | } |
49 | +VRSHRNB 111 1 1110 1 . ... ... ... 0 1111 1 1 . 0 ... 1 @2_shr_h | 48 | |
50 | +VRSHRNT 111 1 1110 1 . ... ... ... 1 1111 1 1 . 0 ... 1 @2_shr_b | 49 | vsz = vec_full_reg_size(s); |
51 | +VRSHRNT 111 1 1110 1 . ... ... ... 1 1111 1 1 . 0 ... 1 @2_shr_h | 50 | - t = tcg_const_i32(simd_desc(vsz, vsz, 0)); |
52 | diff --git a/target/arm/mve_helper.c b/target/arm/mve_helper.c | 51 | + t = tcg_temp_new_i32(); |
53 | index XXXXXXX..XXXXXXX 100644 | 52 | pd = tcg_temp_new_ptr(); |
54 | --- a/target/arm/mve_helper.c | 53 | zn = tcg_temp_new_ptr(); |
55 | +++ b/target/arm/mve_helper.c | 54 | zm = tcg_temp_new_ptr(); |
56 | @@ -XXX,XX +XXX,XX @@ DO_2SHIFT_INSERT(vsliw, 4, DO_SHL, SHL_MASK) | 55 | @@ -XXX,XX +XXX,XX @@ static bool do_ppzz_flags(DisasContext *s, arg_rprr_esz *a, |
57 | 56 | tcg_gen_addi_ptr(zm, cpu_env, vec_full_reg_offset(s, a->rm)); | |
58 | DO_VSHLL_ALL(vshllb, false) | 57 | tcg_gen_addi_ptr(pg, cpu_env, pred_full_reg_offset(s, a->pg)); |
59 | DO_VSHLL_ALL(vshllt, true) | 58 | |
60 | + | 59 | - gen_fn(t, pd, zn, zm, pg, t); |
61 | +/* | 60 | + gen_fn(t, pd, zn, zm, pg, tcg_constant_i32(simd_desc(vsz, vsz, 0))); |
62 | + * Narrowing right shifts, taking a double sized input, shifting it | 61 | |
63 | + * and putting the result in either the top or bottom half of the output. | 62 | tcg_temp_free_ptr(pd); |
64 | + * ESIZE, TYPE are the output, and LESIZE, LTYPE the input. | 63 | tcg_temp_free_ptr(zn); |
65 | + */ | 64 | @@ -XXX,XX +XXX,XX @@ static bool do_ppzi_flags(DisasContext *s, arg_rpri_esz *a, |
66 | +#define DO_VSHRN(OP, TOP, ESIZE, TYPE, LESIZE, LTYPE, FN) \ | 65 | } |
67 | + void HELPER(glue(mve_, OP))(CPUARMState *env, void *vd, \ | 66 | |
68 | + void *vm, uint32_t shift) \ | 67 | vsz = vec_full_reg_size(s); |
69 | + { \ | 68 | - t = tcg_const_i32(simd_desc(vsz, vsz, a->imm)); |
70 | + LTYPE *m = vm; \ | 69 | + t = tcg_temp_new_i32(); |
71 | + TYPE *d = vd; \ | 70 | pd = tcg_temp_new_ptr(); |
72 | + uint16_t mask = mve_element_mask(env); \ | 71 | zn = tcg_temp_new_ptr(); |
73 | + unsigned le; \ | 72 | pg = tcg_temp_new_ptr(); |
74 | + for (le = 0; le < 16 / LESIZE; le++, mask >>= LESIZE) { \ | 73 | @@ -XXX,XX +XXX,XX @@ static bool do_ppzi_flags(DisasContext *s, arg_rpri_esz *a, |
75 | + TYPE r = FN(m[H##LESIZE(le)], shift); \ | 74 | tcg_gen_addi_ptr(zn, cpu_env, vec_full_reg_offset(s, a->rn)); |
76 | + mergemask(&d[H##ESIZE(le * 2 + TOP)], r, mask); \ | 75 | tcg_gen_addi_ptr(pg, cpu_env, pred_full_reg_offset(s, a->pg)); |
77 | + } \ | 76 | |
78 | + mve_advance_vpt(env); \ | 77 | - gen_fn(t, pd, zn, pg, t); |
79 | + } | 78 | + gen_fn(t, pd, zn, pg, tcg_constant_i32(simd_desc(vsz, vsz, a->imm))); |
80 | + | 79 | |
81 | +#define DO_VSHRN_ALL(OP, FN) \ | 80 | tcg_temp_free_ptr(pd); |
82 | + DO_VSHRN(OP##bb, false, 1, uint8_t, 2, uint16_t, FN) \ | 81 | tcg_temp_free_ptr(zn); |
83 | + DO_VSHRN(OP##bh, false, 2, uint16_t, 4, uint32_t, FN) \ | ||
84 | + DO_VSHRN(OP##tb, true, 1, uint8_t, 2, uint16_t, FN) \ | ||
85 | + DO_VSHRN(OP##th, true, 2, uint16_t, 4, uint32_t, FN) | ||
86 | + | ||
87 | +static inline uint64_t do_urshr(uint64_t x, unsigned sh) | ||
88 | +{ | ||
89 | + if (likely(sh < 64)) { | ||
90 | + return (x >> sh) + ((x >> (sh - 1)) & 1); | ||
91 | + } else if (sh == 64) { | ||
92 | + return x >> 63; | ||
93 | + } else { | ||
94 | + return 0; | ||
95 | + } | ||
96 | +} | ||
97 | + | ||
98 | +DO_VSHRN_ALL(vshrn, DO_SHR) | ||
99 | +DO_VSHRN_ALL(vrshrn, do_urshr) | ||
100 | diff --git a/target/arm/translate-mve.c b/target/arm/translate-mve.c | ||
101 | index XXXXXXX..XXXXXXX 100644 | ||
102 | --- a/target/arm/translate-mve.c | ||
103 | +++ b/target/arm/translate-mve.c | ||
104 | @@ -XXX,XX +XXX,XX @@ DO_VSHLL(VSHLL_BS, vshllbs) | ||
105 | DO_VSHLL(VSHLL_BU, vshllbu) | ||
106 | DO_VSHLL(VSHLL_TS, vshllts) | ||
107 | DO_VSHLL(VSHLL_TU, vshlltu) | ||
108 | + | ||
109 | +#define DO_2SHIFT_N(INSN, FN) \ | ||
110 | + static bool trans_##INSN(DisasContext *s, arg_2shift *a) \ | ||
111 | + { \ | ||
112 | + static MVEGenTwoOpShiftFn * const fns[] = { \ | ||
113 | + gen_helper_mve_##FN##b, \ | ||
114 | + gen_helper_mve_##FN##h, \ | ||
115 | + }; \ | ||
116 | + return do_2shift(s, a, fns[a->size], false); \ | ||
117 | + } | ||
118 | + | ||
119 | +DO_2SHIFT_N(VSHRNB, vshrnb) | ||
120 | +DO_2SHIFT_N(VSHRNT, vshrnt) | ||
121 | +DO_2SHIFT_N(VRSHRNB, vrshrnb) | ||
122 | +DO_2SHIFT_N(VRSHRNT, vrshrnt) | ||
123 | -- | 82 | -- |
124 | 2.20.1 | 83 | 2.25.1 |
125 | |||
126 | diff view generated by jsdifflib |
1 | From: Patrick Venture <venture@google.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Adds a line-item reference to the supported quanta-q71l-bmc aspeed | 3 | In these cases, 't' did double-duty as zero source and |
4 | entry. | 4 | temporary destination. Split the two uses and narrow |
5 | the scope of the temp. | ||
5 | 6 | ||
6 | Signed-off-by: Patrick Venture <venture@google.com> | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Message-id: 20210615192848.1065297-2-venture@google.com | 9 | Message-id: 20220426163043.100432-47-richard.henderson@linaro.org |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 11 | --- |
11 | docs/system/arm/aspeed.rst | 1 + | 12 | target/arm/translate-sve.c | 18 ++++++++++-------- |
12 | 1 file changed, 1 insertion(+) | 13 | 1 file changed, 10 insertions(+), 8 deletions(-) |
13 | 14 | ||
14 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst | 15 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
15 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/docs/system/arm/aspeed.rst | 17 | --- a/target/arm/translate-sve.c |
17 | +++ b/docs/system/arm/aspeed.rst | 18 | +++ b/target/arm/translate-sve.c |
18 | @@ -XXX,XX +XXX,XX @@ etc. | 19 | @@ -XXX,XX +XXX,XX @@ static bool do_brk3(DisasContext *s, arg_rprr_s *a, |
19 | AST2400 SoC based machines : | 20 | TCGv_ptr n = tcg_temp_new_ptr(); |
20 | 21 | TCGv_ptr m = tcg_temp_new_ptr(); | |
21 | - ``palmetto-bmc`` OpenPOWER Palmetto POWER8 BMC | 22 | TCGv_ptr g = tcg_temp_new_ptr(); |
22 | +- ``quanta-q71l-bmc`` OpenBMC Quanta BMC | 23 | - TCGv_i32 t = tcg_const_i32(FIELD_DP32(0, PREDDESC, OPRSZ, vsz)); |
23 | 24 | + TCGv_i32 desc = tcg_constant_i32(FIELD_DP32(0, PREDDESC, OPRSZ, vsz)); | |
24 | AST2500 SoC based machines : | 25 | |
26 | tcg_gen_addi_ptr(d, cpu_env, pred_full_reg_offset(s, a->rd)); | ||
27 | tcg_gen_addi_ptr(n, cpu_env, pred_full_reg_offset(s, a->rn)); | ||
28 | @@ -XXX,XX +XXX,XX @@ static bool do_brk3(DisasContext *s, arg_rprr_s *a, | ||
29 | tcg_gen_addi_ptr(g, cpu_env, pred_full_reg_offset(s, a->pg)); | ||
30 | |||
31 | if (a->s) { | ||
32 | - fn_s(t, d, n, m, g, t); | ||
33 | + TCGv_i32 t = tcg_temp_new_i32(); | ||
34 | + fn_s(t, d, n, m, g, desc); | ||
35 | do_pred_flags(t); | ||
36 | + tcg_temp_free_i32(t); | ||
37 | } else { | ||
38 | - fn(d, n, m, g, t); | ||
39 | + fn(d, n, m, g, desc); | ||
40 | } | ||
41 | tcg_temp_free_ptr(d); | ||
42 | tcg_temp_free_ptr(n); | ||
43 | tcg_temp_free_ptr(m); | ||
44 | tcg_temp_free_ptr(g); | ||
45 | - tcg_temp_free_i32(t); | ||
46 | return true; | ||
47 | } | ||
48 | |||
49 | @@ -XXX,XX +XXX,XX @@ static bool do_brk2(DisasContext *s, arg_rpr_s *a, | ||
50 | TCGv_ptr d = tcg_temp_new_ptr(); | ||
51 | TCGv_ptr n = tcg_temp_new_ptr(); | ||
52 | TCGv_ptr g = tcg_temp_new_ptr(); | ||
53 | - TCGv_i32 t = tcg_const_i32(FIELD_DP32(0, PREDDESC, OPRSZ, vsz)); | ||
54 | + TCGv_i32 desc = tcg_constant_i32(FIELD_DP32(0, PREDDESC, OPRSZ, vsz)); | ||
55 | |||
56 | tcg_gen_addi_ptr(d, cpu_env, pred_full_reg_offset(s, a->rd)); | ||
57 | tcg_gen_addi_ptr(n, cpu_env, pred_full_reg_offset(s, a->rn)); | ||
58 | tcg_gen_addi_ptr(g, cpu_env, pred_full_reg_offset(s, a->pg)); | ||
59 | |||
60 | if (a->s) { | ||
61 | - fn_s(t, d, n, g, t); | ||
62 | + TCGv_i32 t = tcg_temp_new_i32(); | ||
63 | + fn_s(t, d, n, g, desc); | ||
64 | do_pred_flags(t); | ||
65 | + tcg_temp_free_i32(t); | ||
66 | } else { | ||
67 | - fn(d, n, g, t); | ||
68 | + fn(d, n, g, desc); | ||
69 | } | ||
70 | tcg_temp_free_ptr(d); | ||
71 | tcg_temp_free_ptr(n); | ||
72 | tcg_temp_free_ptr(g); | ||
73 | - tcg_temp_free_i32(t); | ||
74 | return true; | ||
75 | } | ||
25 | 76 | ||
26 | -- | 77 | -- |
27 | 2.20.1 | 78 | 2.25.1 |
28 | |||
29 | diff view generated by jsdifflib |
1 | Implement the MVE VADDLV insn; this is similar to VADDV, except | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | that it accumulates 32-bit elements into a 64-bit accumulator | ||
3 | stored in a pair of general-purpose registers. | ||
4 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20220426163043.100432-48-richard.henderson@linaro.org | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20210628135835.6690-15-peter.maydell@linaro.org | ||
8 | --- | 7 | --- |
9 | target/arm/helper-mve.h | 3 ++ | 8 | target/arm/translate-sve.c | 54 ++++++++++---------------------------- |
10 | target/arm/mve.decode | 6 +++- | 9 | 1 file changed, 14 insertions(+), 40 deletions(-) |
11 | target/arm/mve_helper.c | 19 ++++++++++++ | ||
12 | target/arm/translate-mve.c | 63 ++++++++++++++++++++++++++++++++++++++ | ||
13 | 4 files changed, 90 insertions(+), 1 deletion(-) | ||
14 | 10 | ||
15 | diff --git a/target/arm/helper-mve.h b/target/arm/helper-mve.h | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
16 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/helper-mve.h | 13 | --- a/target/arm/translate-sve.c |
18 | +++ b/target/arm/helper-mve.h | 14 | +++ b/target/arm/translate-sve.c |
19 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_3(mve_vaddvuh, TCG_CALL_NO_WG, i32, env, ptr, i32) | 15 | @@ -XXX,XX +XXX,XX @@ static bool do_vpz_ool(DisasContext *s, arg_rpr_esz *a, |
20 | DEF_HELPER_FLAGS_3(mve_vaddvsw, TCG_CALL_NO_WG, i32, env, ptr, i32) | 16 | return true; |
21 | DEF_HELPER_FLAGS_3(mve_vaddvuw, TCG_CALL_NO_WG, i32, env, ptr, i32) | 17 | } |
22 | 18 | ||
23 | +DEF_HELPER_FLAGS_3(mve_vaddlv_s, TCG_CALL_NO_WG, i64, env, ptr, i64) | 19 | - desc = tcg_const_i32(simd_desc(vsz, vsz, 0)); |
24 | +DEF_HELPER_FLAGS_3(mve_vaddlv_u, TCG_CALL_NO_WG, i64, env, ptr, i64) | 20 | + desc = tcg_constant_i32(simd_desc(vsz, vsz, 0)); |
25 | + | 21 | temp = tcg_temp_new_i64(); |
26 | DEF_HELPER_FLAGS_3(mve_vmovi, TCG_CALL_NO_WG, void, env, ptr, i64) | 22 | t_zn = tcg_temp_new_ptr(); |
27 | DEF_HELPER_FLAGS_3(mve_vandi, TCG_CALL_NO_WG, void, env, ptr, i64) | 23 | t_pg = tcg_temp_new_ptr(); |
28 | DEF_HELPER_FLAGS_3(mve_vorri, TCG_CALL_NO_WG, void, env, ptr, i64) | 24 | @@ -XXX,XX +XXX,XX @@ static bool do_vpz_ool(DisasContext *s, arg_rpr_esz *a, |
29 | diff --git a/target/arm/mve.decode b/target/arm/mve.decode | 25 | fn(temp, t_zn, t_pg, desc); |
30 | index XXXXXXX..XXXXXXX 100644 | 26 | tcg_temp_free_ptr(t_zn); |
31 | --- a/target/arm/mve.decode | 27 | tcg_temp_free_ptr(t_pg); |
32 | +++ b/target/arm/mve.decode | 28 | - tcg_temp_free_i32(desc); |
33 | @@ -XXX,XX +XXX,XX @@ VQDMULH_scalar 1110 1110 0 . .. ... 1 ... 0 1110 . 110 .... @2scalar | 29 | |
34 | VQRDMULH_scalar 1111 1110 0 . .. ... 1 ... 0 1110 . 110 .... @2scalar | 30 | write_fp_dreg(s, a->rd, temp); |
35 | 31 | tcg_temp_free_i64(temp); | |
36 | # Vector add across vector | 32 | @@ -XXX,XX +XXX,XX @@ static void do_index(DisasContext *s, int esz, int rd, |
37 | -VADDV 111 u:1 1110 1111 size:2 01 ... 0 1111 0 0 a:1 0 qm:3 0 rda=%rdalo | 33 | TCGv_i64 start, TCGv_i64 incr) |
38 | +{ | 34 | { |
39 | + VADDV 111 u:1 1110 1111 size:2 01 ... 0 1111 0 0 a:1 0 qm:3 0 rda=%rdalo | 35 | unsigned vsz = vec_full_reg_size(s); |
40 | + VADDLV 111 u:1 1110 1 ... 1001 ... 0 1111 00 a:1 0 qm:3 0 \ | 36 | - TCGv_i32 desc = tcg_const_i32(simd_desc(vsz, vsz, 0)); |
41 | + rdahi=%rdahi rdalo=%rdalo | 37 | + TCGv_i32 desc = tcg_constant_i32(simd_desc(vsz, vsz, 0)); |
42 | +} | 38 | TCGv_ptr t_zd = tcg_temp_new_ptr(); |
43 | 39 | ||
44 | # Predicate operations | 40 | tcg_gen_addi_ptr(t_zd, cpu_env, vec_full_reg_offset(s, rd)); |
45 | %mask_22_13 22:1 13:3 | 41 | @@ -XXX,XX +XXX,XX @@ static void do_index(DisasContext *s, int esz, int rd, |
46 | diff --git a/target/arm/mve_helper.c b/target/arm/mve_helper.c | 42 | tcg_temp_free_i32(i32); |
47 | index XXXXXXX..XXXXXXX 100644 | 43 | } |
48 | --- a/target/arm/mve_helper.c | 44 | tcg_temp_free_ptr(t_zd); |
49 | +++ b/target/arm/mve_helper.c | 45 | - tcg_temp_free_i32(desc); |
50 | @@ -XXX,XX +XXX,XX @@ DO_VADDV(vaddvub, 1, uint8_t) | 46 | } |
51 | DO_VADDV(vaddvuh, 2, uint16_t) | 47 | |
52 | DO_VADDV(vaddvuw, 4, uint32_t) | 48 | static bool trans_INDEX_ii(DisasContext *s, arg_INDEX_ii *a) |
53 | 49 | @@ -XXX,XX +XXX,XX @@ static void do_sat_addsub_vec(DisasContext *s, int esz, int rd, int rn, | |
54 | +#define DO_VADDLV(OP, TYPE, LTYPE) \ | 50 | nptr = tcg_temp_new_ptr(); |
55 | + uint64_t HELPER(glue(mve_, OP))(CPUARMState *env, void *vm, \ | 51 | tcg_gen_addi_ptr(dptr, cpu_env, vec_full_reg_offset(s, rd)); |
56 | + uint64_t ra) \ | 52 | tcg_gen_addi_ptr(nptr, cpu_env, vec_full_reg_offset(s, rn)); |
57 | + { \ | 53 | - desc = tcg_const_i32(simd_desc(vsz, vsz, 0)); |
58 | + uint16_t mask = mve_element_mask(env); \ | 54 | + desc = tcg_constant_i32(simd_desc(vsz, vsz, 0)); |
59 | + unsigned e; \ | 55 | |
60 | + TYPE *m = vm; \ | 56 | switch (esz) { |
61 | + for (e = 0; e < 16 / 4; e++, mask >>= 4) { \ | 57 | case MO_8: |
62 | + if (mask & 1) { \ | 58 | @@ -XXX,XX +XXX,XX @@ static void do_sat_addsub_vec(DisasContext *s, int esz, int rd, int rn, |
63 | + ra += (LTYPE)m[H4(e)]; \ | 59 | |
64 | + } \ | 60 | tcg_temp_free_ptr(dptr); |
65 | + } \ | 61 | tcg_temp_free_ptr(nptr); |
66 | + mve_advance_vpt(env); \ | 62 | - tcg_temp_free_i32(desc); |
67 | + return ra; \ | 63 | } |
68 | + } \ | 64 | |
69 | + | 65 | static bool trans_CNT_r(DisasContext *s, arg_CNT_r *a) |
70 | +DO_VADDLV(vaddlv_s, int32_t, int64_t) | 66 | @@ -XXX,XX +XXX,XX @@ static void do_cpy_m(DisasContext *s, int esz, int rd, int rn, int pg, |
71 | +DO_VADDLV(vaddlv_u, uint32_t, uint64_t) | 67 | gen_helper_sve_cpy_m_s, gen_helper_sve_cpy_m_d, |
72 | + | 68 | }; |
73 | /* Shifts by immediate */ | 69 | unsigned vsz = vec_full_reg_size(s); |
74 | #define DO_2SHIFT(OP, ESIZE, TYPE, FN) \ | 70 | - TCGv_i32 desc = tcg_const_i32(simd_desc(vsz, vsz, 0)); |
75 | void HELPER(glue(mve_, OP))(CPUARMState *env, void *vd, \ | 71 | + TCGv_i32 desc = tcg_constant_i32(simd_desc(vsz, vsz, 0)); |
76 | diff --git a/target/arm/translate-mve.c b/target/arm/translate-mve.c | 72 | TCGv_ptr t_zd = tcg_temp_new_ptr(); |
77 | index XXXXXXX..XXXXXXX 100644 | 73 | TCGv_ptr t_zn = tcg_temp_new_ptr(); |
78 | --- a/target/arm/translate-mve.c | 74 | TCGv_ptr t_pg = tcg_temp_new_ptr(); |
79 | +++ b/target/arm/translate-mve.c | 75 | @@ -XXX,XX +XXX,XX @@ static void do_cpy_m(DisasContext *s, int esz, int rd, int rn, int pg, |
80 | @@ -XXX,XX +XXX,XX @@ static bool trans_VADDV(DisasContext *s, arg_VADDV *a) | 76 | tcg_temp_free_ptr(t_zd); |
77 | tcg_temp_free_ptr(t_zn); | ||
78 | tcg_temp_free_ptr(t_pg); | ||
79 | - tcg_temp_free_i32(desc); | ||
80 | } | ||
81 | |||
82 | static bool trans_FCPY(DisasContext *s, arg_FCPY *a) | ||
83 | @@ -XXX,XX +XXX,XX @@ static void do_insr_i64(DisasContext *s, arg_rrr_esz *a, TCGv_i64 val) | ||
84 | gen_helper_sve_insr_s, gen_helper_sve_insr_d, | ||
85 | }; | ||
86 | unsigned vsz = vec_full_reg_size(s); | ||
87 | - TCGv_i32 desc = tcg_const_i32(simd_desc(vsz, vsz, 0)); | ||
88 | + TCGv_i32 desc = tcg_constant_i32(simd_desc(vsz, vsz, 0)); | ||
89 | TCGv_ptr t_zd = tcg_temp_new_ptr(); | ||
90 | TCGv_ptr t_zn = tcg_temp_new_ptr(); | ||
91 | |||
92 | @@ -XXX,XX +XXX,XX @@ static void do_insr_i64(DisasContext *s, arg_rrr_esz *a, TCGv_i64 val) | ||
93 | |||
94 | tcg_temp_free_ptr(t_zd); | ||
95 | tcg_temp_free_ptr(t_zn); | ||
96 | - tcg_temp_free_i32(desc); | ||
97 | } | ||
98 | |||
99 | static bool trans_INSR_f(DisasContext *s, arg_rrr_esz *a) | ||
100 | @@ -XXX,XX +XXX,XX @@ static bool do_perm_pred3(DisasContext *s, arg_rrr_esz *a, bool high_odd, | ||
101 | TCGv_ptr t_d = tcg_temp_new_ptr(); | ||
102 | TCGv_ptr t_n = tcg_temp_new_ptr(); | ||
103 | TCGv_ptr t_m = tcg_temp_new_ptr(); | ||
104 | - TCGv_i32 t_desc; | ||
105 | uint32_t desc = 0; | ||
106 | |||
107 | desc = FIELD_DP32(desc, PREDDESC, OPRSZ, vsz); | ||
108 | @@ -XXX,XX +XXX,XX @@ static bool do_perm_pred3(DisasContext *s, arg_rrr_esz *a, bool high_odd, | ||
109 | tcg_gen_addi_ptr(t_d, cpu_env, pred_full_reg_offset(s, a->rd)); | ||
110 | tcg_gen_addi_ptr(t_n, cpu_env, pred_full_reg_offset(s, a->rn)); | ||
111 | tcg_gen_addi_ptr(t_m, cpu_env, pred_full_reg_offset(s, a->rm)); | ||
112 | - t_desc = tcg_const_i32(desc); | ||
113 | |||
114 | - fn(t_d, t_n, t_m, t_desc); | ||
115 | + fn(t_d, t_n, t_m, tcg_constant_i32(desc)); | ||
116 | |||
117 | tcg_temp_free_ptr(t_d); | ||
118 | tcg_temp_free_ptr(t_n); | ||
119 | tcg_temp_free_ptr(t_m); | ||
120 | - tcg_temp_free_i32(t_desc); | ||
81 | return true; | 121 | return true; |
82 | } | 122 | } |
83 | 123 | ||
84 | +static bool trans_VADDLV(DisasContext *s, arg_VADDLV *a) | 124 | @@ -XXX,XX +XXX,XX @@ static bool do_perm_pred2(DisasContext *s, arg_rr_esz *a, bool high_odd, |
85 | +{ | 125 | unsigned vsz = pred_full_reg_size(s); |
86 | + /* | 126 | TCGv_ptr t_d = tcg_temp_new_ptr(); |
87 | + * Vector Add Long Across Vector: accumulate the 32-bit | 127 | TCGv_ptr t_n = tcg_temp_new_ptr(); |
88 | + * elements of the vector into a 64-bit result stored in | 128 | - TCGv_i32 t_desc; |
89 | + * a pair of general-purpose registers. | 129 | uint32_t desc = 0; |
90 | + * No need to check Qm's bank: it is only 3 bits in decode. | 130 | |
91 | + */ | 131 | tcg_gen_addi_ptr(t_d, cpu_env, pred_full_reg_offset(s, a->rd)); |
92 | + TCGv_ptr qm; | 132 | @@ -XXX,XX +XXX,XX @@ static bool do_perm_pred2(DisasContext *s, arg_rr_esz *a, bool high_odd, |
93 | + TCGv_i64 rda; | 133 | desc = FIELD_DP32(desc, PREDDESC, OPRSZ, vsz); |
94 | + TCGv_i32 rdalo, rdahi; | 134 | desc = FIELD_DP32(desc, PREDDESC, ESZ, a->esz); |
95 | + | 135 | desc = FIELD_DP32(desc, PREDDESC, DATA, high_odd); |
96 | + if (!dc_isar_feature(aa32_mve, s)) { | 136 | - t_desc = tcg_const_i32(desc); |
97 | + return false; | 137 | |
98 | + } | 138 | - fn(t_d, t_n, t_desc); |
99 | + /* | 139 | + fn(t_d, t_n, tcg_constant_i32(desc)); |
100 | + * rdahi == 13 is UNPREDICTABLE; rdahi == 15 is a related | 140 | |
101 | + * encoding; rdalo always has bit 0 clear so cannot be 13 or 15. | 141 | - tcg_temp_free_i32(t_desc); |
102 | + */ | 142 | tcg_temp_free_ptr(t_d); |
103 | + if (a->rdahi == 13 || a->rdahi == 15) { | 143 | tcg_temp_free_ptr(t_n); |
104 | + return false; | 144 | return true; |
105 | + } | 145 | @@ -XXX,XX +XXX,XX @@ static void find_last_active(DisasContext *s, TCGv_i32 ret, int esz, int pg) |
106 | + if (!mve_eci_check(s) || !vfp_access_check(s)) { | 146 | * round up, as we do elsewhere, because we need the exact size. |
107 | + return true; | 147 | */ |
108 | + } | 148 | TCGv_ptr t_p = tcg_temp_new_ptr(); |
109 | + | 149 | - TCGv_i32 t_desc; |
110 | + /* | 150 | unsigned desc = 0; |
111 | + * This insn is subject to beat-wise execution. Partial execution | 151 | |
112 | + * of an A=0 (no-accumulate) insn which does not execute the first | 152 | desc = FIELD_DP32(desc, PREDDESC, OPRSZ, pred_full_reg_size(s)); |
113 | + * beat must start with the current value of RdaHi:RdaLo, not zero. | 153 | desc = FIELD_DP32(desc, PREDDESC, ESZ, esz); |
114 | + */ | 154 | |
115 | + if (a->a || mve_skip_first_beat(s)) { | 155 | tcg_gen_addi_ptr(t_p, cpu_env, pred_full_reg_offset(s, pg)); |
116 | + /* Accumulate input from RdaHi:RdaLo */ | 156 | - t_desc = tcg_const_i32(desc); |
117 | + rda = tcg_temp_new_i64(); | 157 | |
118 | + rdalo = load_reg(s, a->rdalo); | 158 | - gen_helper_sve_last_active_element(ret, t_p, t_desc); |
119 | + rdahi = load_reg(s, a->rdahi); | 159 | + gen_helper_sve_last_active_element(ret, t_p, tcg_constant_i32(desc)); |
120 | + tcg_gen_concat_i32_i64(rda, rdalo, rdahi); | 160 | |
121 | + tcg_temp_free_i32(rdalo); | 161 | - tcg_temp_free_i32(t_desc); |
122 | + tcg_temp_free_i32(rdahi); | 162 | tcg_temp_free_ptr(t_p); |
123 | + } else { | 163 | } |
124 | + /* Accumulate starting at zero */ | 164 | |
125 | + rda = tcg_const_i64(0); | 165 | @@ -XXX,XX +XXX,XX @@ static void do_cntp(DisasContext *s, TCGv_i64 val, int esz, int pn, int pg) |
126 | + } | 166 | TCGv_ptr t_pn = tcg_temp_new_ptr(); |
127 | + | 167 | TCGv_ptr t_pg = tcg_temp_new_ptr(); |
128 | + qm = mve_qreg_ptr(a->qm); | 168 | unsigned desc = 0; |
129 | + if (a->u) { | 169 | - TCGv_i32 t_desc; |
130 | + gen_helper_mve_vaddlv_u(rda, cpu_env, qm, rda); | 170 | |
131 | + } else { | 171 | desc = FIELD_DP32(desc, PREDDESC, OPRSZ, psz); |
132 | + gen_helper_mve_vaddlv_s(rda, cpu_env, qm, rda); | 172 | desc = FIELD_DP32(desc, PREDDESC, ESZ, esz); |
133 | + } | 173 | |
134 | + tcg_temp_free_ptr(qm); | 174 | tcg_gen_addi_ptr(t_pn, cpu_env, pred_full_reg_offset(s, pn)); |
135 | + | 175 | tcg_gen_addi_ptr(t_pg, cpu_env, pred_full_reg_offset(s, pg)); |
136 | + rdalo = tcg_temp_new_i32(); | 176 | - t_desc = tcg_const_i32(desc); |
137 | + rdahi = tcg_temp_new_i32(); | 177 | |
138 | + tcg_gen_extrl_i64_i32(rdalo, rda); | 178 | - gen_helper_sve_cntp(val, t_pn, t_pg, t_desc); |
139 | + tcg_gen_extrh_i64_i32(rdahi, rda); | 179 | + gen_helper_sve_cntp(val, t_pn, t_pg, tcg_constant_i32(desc)); |
140 | + store_reg(s, a->rdalo, rdalo); | 180 | tcg_temp_free_ptr(t_pn); |
141 | + store_reg(s, a->rdahi, rdahi); | 181 | tcg_temp_free_ptr(t_pg); |
142 | + tcg_temp_free_i64(rda); | 182 | - tcg_temp_free_i32(t_desc); |
143 | + mve_update_eci(s); | 183 | } |
144 | + return true; | 184 | } |
145 | +} | 185 | |
146 | + | 186 | @@ -XXX,XX +XXX,XX @@ static void do_reduce(DisasContext *s, arg_rpr_esz *a, |
147 | static bool do_1imm(DisasContext *s, arg_1imm *a, MVEGenOneOpImmFn *fn) | ||
148 | { | 187 | { |
149 | TCGv_ptr qd; | 188 | unsigned vsz = vec_full_reg_size(s); |
189 | unsigned p2vsz = pow2ceil(vsz); | ||
190 | - TCGv_i32 t_desc = tcg_const_i32(simd_desc(vsz, vsz, p2vsz)); | ||
191 | + TCGv_i32 t_desc = tcg_constant_i32(simd_desc(vsz, vsz, p2vsz)); | ||
192 | TCGv_ptr t_zn, t_pg, status; | ||
193 | TCGv_i64 temp; | ||
194 | |||
195 | @@ -XXX,XX +XXX,XX @@ static void do_reduce(DisasContext *s, arg_rpr_esz *a, | ||
196 | tcg_temp_free_ptr(t_zn); | ||
197 | tcg_temp_free_ptr(t_pg); | ||
198 | tcg_temp_free_ptr(status); | ||
199 | - tcg_temp_free_i32(t_desc); | ||
200 | |||
201 | write_fp_dreg(s, a->rd, temp); | ||
202 | tcg_temp_free_i64(temp); | ||
203 | @@ -XXX,XX +XXX,XX @@ static bool trans_FADDA(DisasContext *s, arg_rprr_esz *a) | ||
204 | tcg_gen_addi_ptr(t_rm, cpu_env, vec_full_reg_offset(s, a->rm)); | ||
205 | tcg_gen_addi_ptr(t_pg, cpu_env, pred_full_reg_offset(s, a->pg)); | ||
206 | t_fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); | ||
207 | - t_desc = tcg_const_i32(simd_desc(vsz, vsz, 0)); | ||
208 | + t_desc = tcg_constant_i32(simd_desc(vsz, vsz, 0)); | ||
209 | |||
210 | fns[a->esz - 1](t_val, t_val, t_rm, t_pg, t_fpst, t_desc); | ||
211 | |||
212 | - tcg_temp_free_i32(t_desc); | ||
213 | tcg_temp_free_ptr(t_fpst); | ||
214 | tcg_temp_free_ptr(t_pg); | ||
215 | tcg_temp_free_ptr(t_rm); | ||
216 | @@ -XXX,XX +XXX,XX @@ static void do_fp_scalar(DisasContext *s, int zd, int zn, int pg, bool is_fp16, | ||
217 | tcg_gen_addi_ptr(t_pg, cpu_env, pred_full_reg_offset(s, pg)); | ||
218 | |||
219 | status = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_FPCR); | ||
220 | - desc = tcg_const_i32(simd_desc(vsz, vsz, 0)); | ||
221 | + desc = tcg_constant_i32(simd_desc(vsz, vsz, 0)); | ||
222 | fn(t_zd, t_zn, t_pg, scalar, status, desc); | ||
223 | |||
224 | - tcg_temp_free_i32(desc); | ||
225 | tcg_temp_free_ptr(status); | ||
226 | tcg_temp_free_ptr(t_pg); | ||
227 | tcg_temp_free_ptr(t_zn); | ||
228 | @@ -XXX,XX +XXX,XX @@ static void do_mem_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr, | ||
229 | { | ||
230 | unsigned vsz = vec_full_reg_size(s); | ||
231 | TCGv_ptr t_pg; | ||
232 | - TCGv_i32 t_desc; | ||
233 | int desc = 0; | ||
234 | |||
235 | /* | ||
236 | @@ -XXX,XX +XXX,XX @@ static void do_mem_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr, | ||
237 | } | ||
238 | |||
239 | desc = simd_desc(vsz, vsz, zt | desc); | ||
240 | - t_desc = tcg_const_i32(desc); | ||
241 | t_pg = tcg_temp_new_ptr(); | ||
242 | |||
243 | tcg_gen_addi_ptr(t_pg, cpu_env, pred_full_reg_offset(s, pg)); | ||
244 | - fn(cpu_env, t_pg, addr, t_desc); | ||
245 | + fn(cpu_env, t_pg, addr, tcg_constant_i32(desc)); | ||
246 | |||
247 | tcg_temp_free_ptr(t_pg); | ||
248 | - tcg_temp_free_i32(t_desc); | ||
249 | } | ||
250 | |||
251 | /* Indexed by [mte][be][dtype][nreg] */ | ||
252 | @@ -XXX,XX +XXX,XX @@ static void do_mem_zpz(DisasContext *s, int zt, int pg, int zm, | ||
253 | TCGv_ptr t_zm = tcg_temp_new_ptr(); | ||
254 | TCGv_ptr t_pg = tcg_temp_new_ptr(); | ||
255 | TCGv_ptr t_zt = tcg_temp_new_ptr(); | ||
256 | - TCGv_i32 t_desc; | ||
257 | int desc = 0; | ||
258 | |||
259 | if (s->mte_active[0]) { | ||
260 | @@ -XXX,XX +XXX,XX @@ static void do_mem_zpz(DisasContext *s, int zt, int pg, int zm, | ||
261 | desc <<= SVE_MTEDESC_SHIFT; | ||
262 | } | ||
263 | desc = simd_desc(vsz, vsz, desc | scale); | ||
264 | - t_desc = tcg_const_i32(desc); | ||
265 | |||
266 | tcg_gen_addi_ptr(t_pg, cpu_env, pred_full_reg_offset(s, pg)); | ||
267 | tcg_gen_addi_ptr(t_zm, cpu_env, vec_full_reg_offset(s, zm)); | ||
268 | tcg_gen_addi_ptr(t_zt, cpu_env, vec_full_reg_offset(s, zt)); | ||
269 | - fn(cpu_env, t_zt, t_pg, t_zm, scalar, t_desc); | ||
270 | + fn(cpu_env, t_zt, t_pg, t_zm, scalar, tcg_constant_i32(desc)); | ||
271 | |||
272 | tcg_temp_free_ptr(t_zt); | ||
273 | tcg_temp_free_ptr(t_zm); | ||
274 | tcg_temp_free_ptr(t_pg); | ||
275 | - tcg_temp_free_i32(t_desc); | ||
276 | } | ||
277 | |||
278 | /* Indexed by [mte][be][ff][xs][u][msz]. */ | ||
150 | -- | 279 | -- |
151 | 2.20.1 | 280 | 2.25.1 |
152 | |||
153 | diff view generated by jsdifflib |
1 | From: Joe Komlodi <joe.komlodi@xilinx.com> | 1 | From: Damien Hedde <damien.hedde@greensocs.com> |
---|---|---|---|
2 | 2 | ||
3 | If the CPU is running in default NaN mode (FPCR.DN == 1) and we execute | 3 | As of now, cryptographic instructions ISAR fields are never cleared so |
4 | FRSQRTE, FRECPE, or FRECPX with a signaling NaN, parts_silence_nan_frac() will | 4 | we can end up with a cpu with cryptographic instructions but no |
5 | assert due to fpst->default_nan_mode being set. | 5 | floating-point/neon instructions which is not a possible configuration |
6 | according to Arm specifications. | ||
6 | 7 | ||
7 | To avoid this, we check to see what NaN mode we're running in before we call | 8 | In QEMU, we have 3 kinds of cpus regarding cryptographic instructions: |
8 | floatxx_silence_nan(). | 9 | + no support |
10 | + cortex-a57/a72: cryptographic extension is optional, | ||
11 | floating-point/neon is not. | ||
12 | + cortex-a53: crytographic extension is optional as well as | ||
13 | floating-point/neon. But cryptographic requires | ||
14 | floating-point/neon support. | ||
9 | 15 | ||
10 | Signed-off-by: Joe Komlodi <joe.komlodi@xilinx.com> | 16 | Therefore we can safely clear the ISAR fields when neon is disabled. |
17 | |||
18 | Note that other Arm cpus seem to follow this. For example cortex-a55 is | ||
19 | like cortex-a53 and cortex-a76/cortex-a710 are like cortex-a57/a72. | ||
20 | |||
21 | Signed-off-by: Damien Hedde <damien.hedde@greensocs.com> | ||
11 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 22 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
12 | Message-id: 1624662174-175828-2-git-send-email-joe.komlodi@xilinx.com | 23 | Message-id: 20220427090117.6954-1-damien.hedde@greensocs.com |
13 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 24 | [PMM: fixed commit message typos] |
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 25 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
15 | --- | 26 | --- |
16 | target/arm/helper-a64.c | 12 +++++++++--- | 27 | target/arm/cpu.c | 9 +++++++++ |
17 | target/arm/vfp_helper.c | 24 ++++++++++++++++++------ | 28 | 1 file changed, 9 insertions(+) |
18 | 2 files changed, 27 insertions(+), 9 deletions(-) | ||
19 | 29 | ||
20 | diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c | 30 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c |
21 | index XXXXXXX..XXXXXXX 100644 | 31 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/target/arm/helper-a64.c | 32 | --- a/target/arm/cpu.c |
23 | +++ b/target/arm/helper-a64.c | 33 | +++ b/target/arm/cpu.c |
24 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(frecpx_f16)(uint32_t a, void *fpstp) | 34 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) |
25 | float16 nan = a; | 35 | unset_feature(env, ARM_FEATURE_NEON); |
26 | if (float16_is_signaling_nan(a, fpst)) { | 36 | |
27 | float_raise(float_flag_invalid, fpst); | 37 | t = cpu->isar.id_aa64isar0; |
28 | - nan = float16_silence_nan(a, fpst); | 38 | + t = FIELD_DP64(t, ID_AA64ISAR0, AES, 0); |
29 | + if (!fpst->default_nan_mode) { | 39 | + t = FIELD_DP64(t, ID_AA64ISAR0, SHA1, 0); |
30 | + nan = float16_silence_nan(a, fpst); | 40 | + t = FIELD_DP64(t, ID_AA64ISAR0, SHA2, 0); |
31 | + } | 41 | + t = FIELD_DP64(t, ID_AA64ISAR0, SHA3, 0); |
32 | } | 42 | + t = FIELD_DP64(t, ID_AA64ISAR0, SM3, 0); |
33 | if (fpst->default_nan_mode) { | 43 | + t = FIELD_DP64(t, ID_AA64ISAR0, SM4, 0); |
34 | nan = float16_default_nan(fpst); | 44 | t = FIELD_DP64(t, ID_AA64ISAR0, DP, 0); |
35 | @@ -XXX,XX +XXX,XX @@ float32 HELPER(frecpx_f32)(float32 a, void *fpstp) | 45 | cpu->isar.id_aa64isar0 = t; |
36 | float32 nan = a; | 46 | |
37 | if (float32_is_signaling_nan(a, fpst)) { | 47 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) |
38 | float_raise(float_flag_invalid, fpst); | 48 | cpu->isar.id_aa64pfr0 = t; |
39 | - nan = float32_silence_nan(a, fpst); | 49 | |
40 | + if (!fpst->default_nan_mode) { | 50 | u = cpu->isar.id_isar5; |
41 | + nan = float32_silence_nan(a, fpst); | 51 | + u = FIELD_DP32(u, ID_ISAR5, AES, 0); |
42 | + } | 52 | + u = FIELD_DP32(u, ID_ISAR5, SHA1, 0); |
43 | } | 53 | + u = FIELD_DP32(u, ID_ISAR5, SHA2, 0); |
44 | if (fpst->default_nan_mode) { | 54 | u = FIELD_DP32(u, ID_ISAR5, RDM, 0); |
45 | nan = float32_default_nan(fpst); | 55 | u = FIELD_DP32(u, ID_ISAR5, VCMA, 0); |
46 | @@ -XXX,XX +XXX,XX @@ float64 HELPER(frecpx_f64)(float64 a, void *fpstp) | 56 | cpu->isar.id_isar5 = u; |
47 | float64 nan = a; | ||
48 | if (float64_is_signaling_nan(a, fpst)) { | ||
49 | float_raise(float_flag_invalid, fpst); | ||
50 | - nan = float64_silence_nan(a, fpst); | ||
51 | + if (!fpst->default_nan_mode) { | ||
52 | + nan = float64_silence_nan(a, fpst); | ||
53 | + } | ||
54 | } | ||
55 | if (fpst->default_nan_mode) { | ||
56 | nan = float64_default_nan(fpst); | ||
57 | diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c | ||
58 | index XXXXXXX..XXXXXXX 100644 | ||
59 | --- a/target/arm/vfp_helper.c | ||
60 | +++ b/target/arm/vfp_helper.c | ||
61 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(recpe_f16)(uint32_t input, void *fpstp) | ||
62 | float16 nan = f16; | ||
63 | if (float16_is_signaling_nan(f16, fpst)) { | ||
64 | float_raise(float_flag_invalid, fpst); | ||
65 | - nan = float16_silence_nan(f16, fpst); | ||
66 | + if (!fpst->default_nan_mode) { | ||
67 | + nan = float16_silence_nan(f16, fpst); | ||
68 | + } | ||
69 | } | ||
70 | if (fpst->default_nan_mode) { | ||
71 | nan = float16_default_nan(fpst); | ||
72 | @@ -XXX,XX +XXX,XX @@ float32 HELPER(recpe_f32)(float32 input, void *fpstp) | ||
73 | float32 nan = f32; | ||
74 | if (float32_is_signaling_nan(f32, fpst)) { | ||
75 | float_raise(float_flag_invalid, fpst); | ||
76 | - nan = float32_silence_nan(f32, fpst); | ||
77 | + if (!fpst->default_nan_mode) { | ||
78 | + nan = float32_silence_nan(f32, fpst); | ||
79 | + } | ||
80 | } | ||
81 | if (fpst->default_nan_mode) { | ||
82 | nan = float32_default_nan(fpst); | ||
83 | @@ -XXX,XX +XXX,XX @@ float64 HELPER(recpe_f64)(float64 input, void *fpstp) | ||
84 | float64 nan = f64; | ||
85 | if (float64_is_signaling_nan(f64, fpst)) { | ||
86 | float_raise(float_flag_invalid, fpst); | ||
87 | - nan = float64_silence_nan(f64, fpst); | ||
88 | + if (!fpst->default_nan_mode) { | ||
89 | + nan = float64_silence_nan(f64, fpst); | ||
90 | + } | ||
91 | } | ||
92 | if (fpst->default_nan_mode) { | ||
93 | nan = float64_default_nan(fpst); | ||
94 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(rsqrte_f16)(uint32_t input, void *fpstp) | ||
95 | float16 nan = f16; | ||
96 | if (float16_is_signaling_nan(f16, s)) { | ||
97 | float_raise(float_flag_invalid, s); | ||
98 | - nan = float16_silence_nan(f16, s); | ||
99 | + if (!s->default_nan_mode) { | ||
100 | + nan = float16_silence_nan(f16, fpstp); | ||
101 | + } | ||
102 | } | ||
103 | if (s->default_nan_mode) { | ||
104 | nan = float16_default_nan(s); | ||
105 | @@ -XXX,XX +XXX,XX @@ float32 HELPER(rsqrte_f32)(float32 input, void *fpstp) | ||
106 | float32 nan = f32; | ||
107 | if (float32_is_signaling_nan(f32, s)) { | ||
108 | float_raise(float_flag_invalid, s); | ||
109 | - nan = float32_silence_nan(f32, s); | ||
110 | + if (!s->default_nan_mode) { | ||
111 | + nan = float32_silence_nan(f32, fpstp); | ||
112 | + } | ||
113 | } | ||
114 | if (s->default_nan_mode) { | ||
115 | nan = float32_default_nan(s); | ||
116 | @@ -XXX,XX +XXX,XX @@ float64 HELPER(rsqrte_f64)(float64 input, void *fpstp) | ||
117 | float64 nan = f64; | ||
118 | if (float64_is_signaling_nan(f64, s)) { | ||
119 | float_raise(float_flag_invalid, s); | ||
120 | - nan = float64_silence_nan(f64, s); | ||
121 | + if (!s->default_nan_mode) { | ||
122 | + nan = float64_silence_nan(f64, fpstp); | ||
123 | + } | ||
124 | } | ||
125 | if (s->default_nan_mode) { | ||
126 | nan = float64_default_nan(s); | ||
127 | -- | 57 | -- |
128 | 2.20.1 | 58 | 2.25.1 |
129 | |||
130 | diff view generated by jsdifflib |
1 | The initial implementation of the MVE VRMLALDAVH and VRMLSLDAVH | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | insns had some bugs: | ||
3 | * the 32x32 multiply of elements was being done as 32x32->32, | ||
4 | not 32x32->64 | ||
5 | * we were incorrectly maintaining the accumulator in its full | ||
6 | 72-bit form across all 4 beats of the insn; in the pseudocode | ||
7 | it is squashed back into the 64 bits of the RdaHi:RdaLo | ||
8 | registers after each beat | ||
9 | 2 | ||
10 | In particular, fixing the second of these allows us to recast | 3 | While defining these names, use the correct field width of 5 not 4 for |
11 | the implementation to avoid 128-bit arithmetic entirely. | 4 | DBGWCR.MASK. This typo prevented setting a watchpoint larger than 32k. |
12 | 5 | ||
13 | Since the element size here is always 4, we can also drop the | 6 | Reported-by: Chris Howard <cvz185@web.de> |
14 | parameterization of ESIZE to make the code a little more readable. | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
9 | Message-id: 20220427051926.295223-1-richard.henderson@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | target/arm/internals.h | 12 ++++++++++++ | ||
13 | target/arm/debug_helper.c | 10 +++++----- | ||
14 | target/arm/helper.c | 8 ++++---- | ||
15 | target/arm/kvm64.c | 14 +++++++------- | ||
16 | 4 files changed, 28 insertions(+), 16 deletions(-) | ||
15 | 17 | ||
16 | Suggested-by: Richard Henderson <richard.henderson@linaro.org> | 18 | diff --git a/target/arm/internals.h b/target/arm/internals.h |
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
18 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
19 | Message-id: 20210628135835.6690-3-peter.maydell@linaro.org | ||
20 | --- | ||
21 | target/arm/mve_helper.c | 38 +++++++++++++++++++++----------------- | ||
22 | 1 file changed, 21 insertions(+), 17 deletions(-) | ||
23 | |||
24 | diff --git a/target/arm/mve_helper.c b/target/arm/mve_helper.c | ||
25 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/target/arm/mve_helper.c | 20 | --- a/target/arm/internals.h |
27 | +++ b/target/arm/mve_helper.c | 21 | +++ b/target/arm/internals.h |
28 | @@ -XXX,XX +XXX,XX @@ | 22 | @@ -XXX,XX +XXX,XX @@ FIELD(V7M_EXCRET, RES1, 7, 25) /* including the must-be-1 prefix */ |
29 | */ | 23 | */ |
30 | 24 | #define FNC_RETURN_MIN_MAGIC 0xfefffffe | |
31 | #include "qemu/osdep.h" | 25 | |
32 | -#include "qemu/int128.h" | 26 | +/* Bit definitions for DBGWCRn and DBGWCRn_EL1 */ |
33 | #include "cpu.h" | 27 | +FIELD(DBGWCR, E, 0, 1) |
34 | #include "internals.h" | 28 | +FIELD(DBGWCR, PAC, 1, 2) |
35 | #include "vec_internal.h" | 29 | +FIELD(DBGWCR, LSC, 3, 2) |
36 | @@ -XXX,XX +XXX,XX @@ DO_LDAV(vmlsldavsw, 4, int32_t, false, +=, -=) | 30 | +FIELD(DBGWCR, BAS, 5, 8) |
37 | DO_LDAV(vmlsldavxsw, 4, int32_t, true, +=, -=) | 31 | +FIELD(DBGWCR, HMC, 13, 1) |
38 | 32 | +FIELD(DBGWCR, SSC, 14, 2) | |
39 | /* | 33 | +FIELD(DBGWCR, LBN, 16, 4) |
40 | - * Rounding multiply add long dual accumulate high: we must keep | 34 | +FIELD(DBGWCR, WT, 20, 1) |
41 | - * a 72-bit internal accumulator value and return the top 64 bits. | 35 | +FIELD(DBGWCR, MASK, 24, 5) |
42 | + * Rounding multiply add long dual accumulate high. In the pseudocode | 36 | +FIELD(DBGWCR, SSCE, 29, 1) |
43 | + * this is implemented with a 72-bit internal accumulator value of which | 37 | + |
44 | + * the top 64 bits are returned. We optimize this to avoid having to | 38 | /* We use a few fake FSR values for internal purposes in M profile. |
45 | + * use 128-bit arithmetic -- we can do this because the 74-bit accumulator | 39 | * M profile cores don't have A/R format FSRs, but currently our |
46 | + * is squashed back into 64-bits after each beat. | 40 | * get_phys_addr() code assumes A/R profile and reports failures via |
47 | */ | 41 | diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c |
48 | -#define DO_LDAVH(OP, ESIZE, TYPE, XCHG, EVENACC, ODDACC, TO128) \ | 42 | index XXXXXXX..XXXXXXX 100644 |
49 | +#define DO_LDAVH(OP, TYPE, LTYPE, XCHG, SUB) \ | 43 | --- a/target/arm/debug_helper.c |
50 | uint64_t HELPER(glue(mve_, OP))(CPUARMState *env, void *vn, \ | 44 | +++ b/target/arm/debug_helper.c |
51 | void *vm, uint64_t a) \ | 45 | @@ -XXX,XX +XXX,XX @@ static bool bp_wp_matches(ARMCPU *cpu, int n, bool is_wp) |
52 | { \ | 46 | * Non-Secure to simplify the code slightly compared to the full |
53 | uint16_t mask = mve_element_mask(env); \ | 47 | * table in the ARM ARM. |
54 | unsigned e; \ | 48 | */ |
55 | TYPE *n = vn, *m = vm; \ | 49 | - pac = extract64(cr, 1, 2); |
56 | - Int128 acc = int128_lshift(TO128(a), 8); \ | 50 | - hmc = extract64(cr, 13, 1); |
57 | - for (e = 0; e < 16 / ESIZE; e++, mask >>= ESIZE) { \ | 51 | - ssc = extract64(cr, 14, 2); |
58 | + for (e = 0; e < 16 / 4; e++, mask >>= 4) { \ | 52 | + pac = FIELD_EX64(cr, DBGWCR, PAC); |
59 | if (mask & 1) { \ | 53 | + hmc = FIELD_EX64(cr, DBGWCR, HMC); |
60 | + LTYPE mul; \ | 54 | + ssc = FIELD_EX64(cr, DBGWCR, SSC); |
61 | if (e & 1) { \ | 55 | |
62 | - acc = ODDACC(acc, TO128(n[H##ESIZE(e - 1 * XCHG)] * \ | 56 | switch (ssc) { |
63 | - m[H##ESIZE(e)])); \ | 57 | case 0: |
64 | + mul = (LTYPE)n[H4(e - 1 * XCHG)] * m[H4(e)]; \ | 58 | @@ -XXX,XX +XXX,XX @@ static bool bp_wp_matches(ARMCPU *cpu, int n, bool is_wp) |
65 | + if (SUB) { \ | 59 | g_assert_not_reached(); |
66 | + mul = -mul; \ | ||
67 | + } \ | ||
68 | } else { \ | ||
69 | - acc = EVENACC(acc, TO128(n[H##ESIZE(e + 1 * XCHG)] * \ | ||
70 | - m[H##ESIZE(e)])); \ | ||
71 | + mul = (LTYPE)n[H4(e + 1 * XCHG)] * m[H4(e)]; \ | ||
72 | } \ | ||
73 | - acc = int128_add(acc, int128_make64(1 << 7)); \ | ||
74 | + mul = (mul >> 8) + ((mul >> 7) & 1); \ | ||
75 | + a += mul; \ | ||
76 | } \ | ||
77 | } \ | ||
78 | mve_advance_vpt(env); \ | ||
79 | - return int128_getlo(int128_rshift(acc, 8)); \ | ||
80 | + return a; \ | ||
81 | } | 60 | } |
82 | 61 | ||
83 | -DO_LDAVH(vrmlaldavhsw, 4, int32_t, false, int128_add, int128_add, int128_makes64) | 62 | - wt = extract64(cr, 20, 1); |
84 | -DO_LDAVH(vrmlaldavhxsw, 4, int32_t, true, int128_add, int128_add, int128_makes64) | 63 | - lbn = extract64(cr, 16, 4); |
85 | +DO_LDAVH(vrmlaldavhsw, int32_t, int64_t, false, false) | 64 | + wt = FIELD_EX64(cr, DBGWCR, WT); |
86 | +DO_LDAVH(vrmlaldavhxsw, int32_t, int64_t, true, false) | 65 | + lbn = FIELD_EX64(cr, DBGWCR, LBN); |
87 | 66 | ||
88 | -DO_LDAVH(vrmlaldavhuw, 4, uint32_t, false, int128_add, int128_add, int128_make64) | 67 | if (wt && !linked_bp_matches(cpu, lbn)) { |
89 | +DO_LDAVH(vrmlaldavhuw, uint32_t, uint64_t, false, false) | 68 | return false; |
90 | 69 | diff --git a/target/arm/helper.c b/target/arm/helper.c | |
91 | -DO_LDAVH(vrmlsldavhsw, 4, int32_t, false, int128_add, int128_sub, int128_makes64) | 70 | index XXXXXXX..XXXXXXX 100644 |
92 | -DO_LDAVH(vrmlsldavhxsw, 4, int32_t, true, int128_add, int128_sub, int128_makes64) | 71 | --- a/target/arm/helper.c |
93 | +DO_LDAVH(vrmlsldavhsw, int32_t, int64_t, false, true) | 72 | +++ b/target/arm/helper.c |
94 | +DO_LDAVH(vrmlsldavhxsw, int32_t, int64_t, true, true) | 73 | @@ -XXX,XX +XXX,XX @@ void hw_watchpoint_update(ARMCPU *cpu, int n) |
95 | 74 | env->cpu_watchpoint[n] = NULL; | |
96 | /* Vector add across vector */ | 75 | } |
97 | #define DO_VADDV(OP, ESIZE, TYPE) \ | 76 | |
77 | - if (!extract64(wcr, 0, 1)) { | ||
78 | + if (!FIELD_EX64(wcr, DBGWCR, E)) { | ||
79 | /* E bit clear : watchpoint disabled */ | ||
80 | return; | ||
81 | } | ||
82 | |||
83 | - switch (extract64(wcr, 3, 2)) { | ||
84 | + switch (FIELD_EX64(wcr, DBGWCR, LSC)) { | ||
85 | case 0: | ||
86 | /* LSC 00 is reserved and must behave as if the wp is disabled */ | ||
87 | return; | ||
88 | @@ -XXX,XX +XXX,XX @@ void hw_watchpoint_update(ARMCPU *cpu, int n) | ||
89 | * CONSTRAINED UNPREDICTABLE; we opt to ignore BAS in this case, | ||
90 | * thus generating a watchpoint for every byte in the masked region. | ||
91 | */ | ||
92 | - mask = extract64(wcr, 24, 4); | ||
93 | + mask = FIELD_EX64(wcr, DBGWCR, MASK); | ||
94 | if (mask == 1 || mask == 2) { | ||
95 | /* Reserved values of MASK; we must act as if the mask value was | ||
96 | * some non-reserved value, or as if the watchpoint were disabled. | ||
97 | @@ -XXX,XX +XXX,XX @@ void hw_watchpoint_update(ARMCPU *cpu, int n) | ||
98 | wvr &= ~(len - 1); | ||
99 | } else { | ||
100 | /* Watchpoint covers bytes defined by the byte address select bits */ | ||
101 | - int bas = extract64(wcr, 5, 8); | ||
102 | + int bas = FIELD_EX64(wcr, DBGWCR, BAS); | ||
103 | int basstart; | ||
104 | |||
105 | if (extract64(wvr, 2, 1)) { | ||
106 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c | ||
107 | index XXXXXXX..XXXXXXX 100644 | ||
108 | --- a/target/arm/kvm64.c | ||
109 | +++ b/target/arm/kvm64.c | ||
110 | @@ -XXX,XX +XXX,XX @@ static int insert_hw_watchpoint(target_ulong addr, | ||
111 | target_ulong len, int type) | ||
112 | { | ||
113 | HWWatchpoint wp = { | ||
114 | - .wcr = 1, /* E=1, enable */ | ||
115 | + .wcr = R_DBGWCR_E_MASK, /* E=1, enable */ | ||
116 | .wvr = addr & (~0x7ULL), | ||
117 | .details = { .vaddr = addr, .len = len } | ||
118 | }; | ||
119 | @@ -XXX,XX +XXX,XX @@ static int insert_hw_watchpoint(target_ulong addr, | ||
120 | * HMC=0 SSC=0 PAC=3 will hit EL0 or EL1, any security state, | ||
121 | * valid whether EL3 is implemented or not | ||
122 | */ | ||
123 | - wp.wcr = deposit32(wp.wcr, 1, 2, 3); | ||
124 | + wp.wcr = FIELD_DP64(wp.wcr, DBGWCR, PAC, 3); | ||
125 | |||
126 | switch (type) { | ||
127 | case GDB_WATCHPOINT_READ: | ||
128 | - wp.wcr = deposit32(wp.wcr, 3, 2, 1); | ||
129 | + wp.wcr = FIELD_DP64(wp.wcr, DBGWCR, LSC, 1); | ||
130 | wp.details.flags = BP_MEM_READ; | ||
131 | break; | ||
132 | case GDB_WATCHPOINT_WRITE: | ||
133 | - wp.wcr = deposit32(wp.wcr, 3, 2, 2); | ||
134 | + wp.wcr = FIELD_DP64(wp.wcr, DBGWCR, LSC, 2); | ||
135 | wp.details.flags = BP_MEM_WRITE; | ||
136 | break; | ||
137 | case GDB_WATCHPOINT_ACCESS: | ||
138 | - wp.wcr = deposit32(wp.wcr, 3, 2, 3); | ||
139 | + wp.wcr = FIELD_DP64(wp.wcr, DBGWCR, LSC, 3); | ||
140 | wp.details.flags = BP_MEM_ACCESS; | ||
141 | break; | ||
142 | default: | ||
143 | @@ -XXX,XX +XXX,XX @@ static int insert_hw_watchpoint(target_ulong addr, | ||
144 | int bits = ctz64(len); | ||
145 | |||
146 | wp.wvr &= ~((1 << bits) - 1); | ||
147 | - wp.wcr = deposit32(wp.wcr, 24, 4, bits); | ||
148 | - wp.wcr = deposit32(wp.wcr, 5, 8, 0xff); | ||
149 | + wp.wcr = FIELD_DP64(wp.wcr, DBGWCR, MASK, bits); | ||
150 | + wp.wcr = FIELD_DP64(wp.wcr, DBGWCR, BAS, 0xff); | ||
151 | } else { | ||
152 | return -ENOBUFS; | ||
153 | } | ||
98 | -- | 154 | -- |
99 | 2.20.1 | 155 | 2.25.1 |
100 | 156 | ||
101 | 157 | diff view generated by jsdifflib |
1 | From: Patrick Venture <venture@google.com> | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Add line item reference to quanta-gbs-bmc machine. | 3 | The Record bit in the Context Descriptor tells the SMMU to report fault |
4 | events to the event queue. Since we don't cache the Record bit at the | ||
5 | moment, access faults from a cached Context Descriptor are never | ||
6 | reported. Store the Record bit in the cached SMMUTransCfg. | ||
4 | 7 | ||
5 | Signed-off-by: Patrick Venture <venture@google.com> | 8 | Fixes: 9bde7f0674fe ("hw/arm/smmuv3: Implement translate callback") |
6 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | 9 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> |
7 | Message-id: 20210615192848.1065297-3-venture@google.com | 10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
8 | [PMM: fixed underline Sphinx warning] | 11 | Reviewed-by: Eric Auger <eric.auger@redhat.com> |
12 | Message-id: 20220427111543.124620-1-jean-philippe@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 14 | --- |
11 | docs/system/arm/nuvoton.rst | 5 +++-- | 15 | hw/arm/smmuv3-internal.h | 1 - |
12 | 1 file changed, 3 insertions(+), 2 deletions(-) | 16 | include/hw/arm/smmu-common.h | 1 + |
17 | hw/arm/smmuv3.c | 14 +++++++------- | ||
18 | 3 files changed, 8 insertions(+), 8 deletions(-) | ||
13 | 19 | ||
14 | diff --git a/docs/system/arm/nuvoton.rst b/docs/system/arm/nuvoton.rst | 20 | diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h |
15 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/docs/system/arm/nuvoton.rst | 22 | --- a/hw/arm/smmuv3-internal.h |
17 | +++ b/docs/system/arm/nuvoton.rst | 23 | +++ b/hw/arm/smmuv3-internal.h |
18 | @@ -XXX,XX +XXX,XX @@ | 24 | @@ -XXX,XX +XXX,XX @@ typedef struct SMMUEventInfo { |
19 | -Nuvoton iBMC boards (``npcm750-evb``, ``quanta-gsj``) | 25 | SMMUEventType type; |
20 | -===================================================== | 26 | uint32_t sid; |
21 | +Nuvoton iBMC boards (``*-bmc``, ``npcm750-evb``, ``quanta-gsj``) | 27 | bool recorded; |
22 | +================================================================ | 28 | - bool record_trans_faults; |
23 | 29 | bool inval_ste_allowed; | |
24 | The `Nuvoton iBMC`_ chips (NPCM7xx) are a family of ARM-based SoCs that are | 30 | union { |
25 | designed to be used as Baseboard Management Controllers (BMCs) in various | 31 | struct { |
26 | @@ -XXX,XX +XXX,XX @@ segment. The following machines are based on this chip : | 32 | diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h |
27 | The NPCM730 SoC has two Cortex-A9 cores and is targeted for Data Center and | 33 | index XXXXXXX..XXXXXXX 100644 |
28 | Hyperscale applications. The following machines are based on this chip : | 34 | --- a/include/hw/arm/smmu-common.h |
29 | 35 | +++ b/include/hw/arm/smmu-common.h | |
30 | +- ``quanta-gbs-bmc`` Quanta GBS server BMC | 36 | @@ -XXX,XX +XXX,XX @@ typedef struct SMMUTransCfg { |
31 | - ``quanta-gsj`` Quanta GSJ server BMC | 37 | bool disabled; /* smmu is disabled */ |
32 | 38 | bool bypassed; /* translation is bypassed */ | |
33 | There are also two more SoCs, NPCM710 and NPCM705, which are single-core | 39 | bool aborted; /* translation is aborted */ |
40 | + bool record_faults; /* record fault events */ | ||
41 | uint64_t ttb; /* TT base address */ | ||
42 | uint8_t oas; /* output address width */ | ||
43 | uint8_t tbi; /* Top Byte Ignore */ | ||
44 | diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c | ||
45 | index XXXXXXX..XXXXXXX 100644 | ||
46 | --- a/hw/arm/smmuv3.c | ||
47 | +++ b/hw/arm/smmuv3.c | ||
48 | @@ -XXX,XX +XXX,XX @@ static int decode_cd(SMMUTransCfg *cfg, CD *cd, SMMUEventInfo *event) | ||
49 | trace_smmuv3_decode_cd_tt(i, tt->tsz, tt->ttb, tt->granule_sz, tt->had); | ||
50 | } | ||
51 | |||
52 | - event->record_trans_faults = CD_R(cd); | ||
53 | + cfg->record_faults = CD_R(cd); | ||
54 | |||
55 | return 0; | ||
56 | |||
57 | @@ -XXX,XX +XXX,XX @@ static IOMMUTLBEntry smmuv3_translate(IOMMUMemoryRegion *mr, hwaddr addr, | ||
58 | |||
59 | tt = select_tt(cfg, addr); | ||
60 | if (!tt) { | ||
61 | - if (event.record_trans_faults) { | ||
62 | + if (cfg->record_faults) { | ||
63 | event.type = SMMU_EVT_F_TRANSLATION; | ||
64 | event.u.f_translation.addr = addr; | ||
65 | event.u.f_translation.rnw = flag & 0x1; | ||
66 | @@ -XXX,XX +XXX,XX @@ static IOMMUTLBEntry smmuv3_translate(IOMMUMemoryRegion *mr, hwaddr addr, | ||
67 | if (cached_entry) { | ||
68 | if ((flag & IOMMU_WO) && !(cached_entry->entry.perm & IOMMU_WO)) { | ||
69 | status = SMMU_TRANS_ERROR; | ||
70 | - if (event.record_trans_faults) { | ||
71 | + if (cfg->record_faults) { | ||
72 | event.type = SMMU_EVT_F_PERMISSION; | ||
73 | event.u.f_permission.addr = addr; | ||
74 | event.u.f_permission.rnw = flag & 0x1; | ||
75 | @@ -XXX,XX +XXX,XX @@ static IOMMUTLBEntry smmuv3_translate(IOMMUMemoryRegion *mr, hwaddr addr, | ||
76 | event.u.f_walk_eabt.addr2 = ptw_info.addr; | ||
77 | break; | ||
78 | case SMMU_PTW_ERR_TRANSLATION: | ||
79 | - if (event.record_trans_faults) { | ||
80 | + if (cfg->record_faults) { | ||
81 | event.type = SMMU_EVT_F_TRANSLATION; | ||
82 | event.u.f_translation.addr = addr; | ||
83 | event.u.f_translation.rnw = flag & 0x1; | ||
84 | } | ||
85 | break; | ||
86 | case SMMU_PTW_ERR_ADDR_SIZE: | ||
87 | - if (event.record_trans_faults) { | ||
88 | + if (cfg->record_faults) { | ||
89 | event.type = SMMU_EVT_F_ADDR_SIZE; | ||
90 | event.u.f_addr_size.addr = addr; | ||
91 | event.u.f_addr_size.rnw = flag & 0x1; | ||
92 | } | ||
93 | break; | ||
94 | case SMMU_PTW_ERR_ACCESS: | ||
95 | - if (event.record_trans_faults) { | ||
96 | + if (cfg->record_faults) { | ||
97 | event.type = SMMU_EVT_F_ACCESS; | ||
98 | event.u.f_access.addr = addr; | ||
99 | event.u.f_access.rnw = flag & 0x1; | ||
100 | } | ||
101 | break; | ||
102 | case SMMU_PTW_ERR_PERMISSION: | ||
103 | - if (event.record_trans_faults) { | ||
104 | + if (cfg->record_faults) { | ||
105 | event.type = SMMU_EVT_F_PERMISSION; | ||
106 | event.u.f_permission.addr = addr; | ||
107 | event.u.f_permission.rnw = flag & 0x1; | ||
34 | -- | 108 | -- |
35 | 2.20.1 | 109 | 2.25.1 |
36 | |||
37 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Add a test booting and quickly shutdown a raspi2 machine, | 3 | Make the translation error message prettier by adding a missing space |
4 | to test the power management model: | 4 | before the parenthesis. |
5 | 5 | ||
6 | (1/1) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_raspi2_initrd: | 6 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> |
7 | console: [ 0.000000] Booting Linux on physical CPU 0xf00 | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
8 | console: [ 0.000000] Linux version 4.14.98-v7+ (dom@dom-XPS-13-9370) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1200 SMP Tue Feb 12 20:27:48 GMT 2019 | 8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> |
9 | console: [ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d | 9 | Message-id: 20220427111543.124620-2-jean-philippe@linaro.org |
10 | console: [ 0.000000] CPU: div instructions available: patching division code | ||
11 | console: [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache | ||
12 | console: [ 0.000000] OF: fdt: Machine model: Raspberry Pi 2 Model B | ||
13 | ... | ||
14 | console: Boot successful. | ||
15 | console: cat /proc/cpuinfo | ||
16 | console: / # cat /proc/cpuinfo | ||
17 | ... | ||
18 | console: processor : 3 | ||
19 | console: model name : ARMv7 Processor rev 5 (v7l) | ||
20 | console: BogoMIPS : 125.00 | ||
21 | console: Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm | ||
22 | console: CPU implementer : 0x41 | ||
23 | console: CPU architecture: 7 | ||
24 | console: CPU variant : 0x0 | ||
25 | console: CPU part : 0xc07 | ||
26 | console: CPU revision : 5 | ||
27 | console: Hardware : BCM2835 | ||
28 | console: Revision : 0000 | ||
29 | console: Serial : 0000000000000000 | ||
30 | console: cat /proc/iomem | ||
31 | console: / # cat /proc/iomem | ||
32 | console: 00000000-3bffffff : System RAM | ||
33 | console: 00008000-00afffff : Kernel code | ||
34 | console: 00c00000-00d468ef : Kernel data | ||
35 | console: 3f006000-3f006fff : dwc_otg | ||
36 | console: 3f007000-3f007eff : /soc/dma@7e007000 | ||
37 | console: 3f00b880-3f00b8bf : /soc/mailbox@7e00b880 | ||
38 | console: 3f100000-3f100027 : /soc/watchdog@7e100000 | ||
39 | console: 3f101000-3f102fff : /soc/cprman@7e101000 | ||
40 | console: 3f200000-3f2000b3 : /soc/gpio@7e200000 | ||
41 | PASS (24.59 s) | ||
42 | RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 | ||
43 | JOB TIME : 25.02 s | ||
44 | |||
45 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
46 | Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com> | ||
47 | Message-id: 20210531113837.1689775-1-f4bug@amsat.org | ||
48 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
49 | --- | 11 | --- |
50 | tests/acceptance/boot_linux_console.py | 43 ++++++++++++++++++++++++++ | 12 | hw/arm/smmuv3.c | 2 +- |
51 | 1 file changed, 43 insertions(+) | 13 | 1 file changed, 1 insertion(+), 1 deletion(-) |
52 | 14 | ||
53 | diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py | 15 | diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c |
54 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
55 | --- a/tests/acceptance/boot_linux_console.py | 17 | --- a/hw/arm/smmuv3.c |
56 | +++ b/tests/acceptance/boot_linux_console.py | 18 | +++ b/hw/arm/smmuv3.c |
57 | @@ -XXX,XX +XXX,XX @@ | 19 | @@ -XXX,XX +XXX,XX @@ epilogue: |
58 | from avocado import skip | 20 | break; |
59 | from avocado import skipUnless | 21 | case SMMU_TRANS_ERROR: |
60 | from avocado_qemu import Test | 22 | qemu_log_mask(LOG_GUEST_ERROR, |
61 | +from avocado_qemu import exec_command | 23 | - "%s translation failed for iova=0x%"PRIx64"(%s)\n", |
62 | from avocado_qemu import exec_command_and_wait_for_pattern | 24 | + "%s translation failed for iova=0x%"PRIx64" (%s)\n", |
63 | from avocado_qemu import interrupt_interactive_console_until_pattern | 25 | mr->parent_obj.name, addr, smmu_event_string(event.type)); |
64 | from avocado_qemu import wait_for_console_pattern | 26 | smmuv3_record_event(s, &event); |
65 | @@ -XXX,XX +XXX,XX @@ def test_arm_raspi2_uart0(self): | 27 | break; |
66 | """ | ||
67 | self.do_test_arm_raspi2(0) | ||
68 | |||
69 | + def test_arm_raspi2_initrd(self): | ||
70 | + """ | ||
71 | + :avocado: tags=arch:arm | ||
72 | + :avocado: tags=machine:raspi2 | ||
73 | + """ | ||
74 | + deb_url = ('http://archive.raspberrypi.org/debian/' | ||
75 | + 'pool/main/r/raspberrypi-firmware/' | ||
76 | + 'raspberrypi-kernel_1.20190215-1_armhf.deb') | ||
77 | + deb_hash = 'cd284220b32128c5084037553db3c482426f3972' | ||
78 | + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) | ||
79 | + kernel_path = self.extract_from_deb(deb_path, '/boot/kernel7.img') | ||
80 | + dtb_path = self.extract_from_deb(deb_path, '/boot/bcm2709-rpi-2-b.dtb') | ||
81 | + | ||
82 | + initrd_url = ('https://github.com/groeck/linux-build-test/raw/' | ||
83 | + '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/' | ||
84 | + 'arm/rootfs-armv7a.cpio.gz') | ||
85 | + initrd_hash = '604b2e45cdf35045846b8bbfbf2129b1891bdc9c' | ||
86 | + initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash) | ||
87 | + initrd_path = os.path.join(self.workdir, 'rootfs.cpio') | ||
88 | + archive.gzip_uncompress(initrd_path_gz, initrd_path) | ||
89 | + | ||
90 | + self.vm.set_console() | ||
91 | + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + | ||
92 | + 'earlycon=pl011,0x3f201000 console=ttyAMA0 ' | ||
93 | + 'panic=-1 noreboot ' + | ||
94 | + 'dwc_otg.fiq_fsm_enable=0') | ||
95 | + self.vm.add_args('-kernel', kernel_path, | ||
96 | + '-dtb', dtb_path, | ||
97 | + '-initrd', initrd_path, | ||
98 | + '-append', kernel_command_line, | ||
99 | + '-no-reboot') | ||
100 | + self.vm.launch() | ||
101 | + self.wait_for_console_pattern('Boot successful.') | ||
102 | + | ||
103 | + exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', | ||
104 | + 'BCM2835') | ||
105 | + exec_command_and_wait_for_pattern(self, 'cat /proc/iomem', | ||
106 | + '/soc/cprman@7e101000') | ||
107 | + exec_command(self, 'halt') | ||
108 | + # Wait for VM to shut down gracefully | ||
109 | + self.vm.wait() | ||
110 | + | ||
111 | def test_arm_exynos4210_initrd(self): | ||
112 | """ | ||
113 | :avocado: tags=arch:arm | ||
114 | -- | 28 | -- |
115 | 2.20.1 | 29 | 2.25.1 |
116 | |||
117 | diff view generated by jsdifflib |
1 | Implement the MVE VSRI and VSLI insns, which perform a | 1 | The Arm FEAT_TTL architectural feature allows the guest to provide an |
---|---|---|---|
2 | shift-and-insert operation. | 2 | optional hint in an AArch64 TLB invalidate operation about which |
3 | translation table level holds the leaf entry for the address being | ||
4 | invalidated. QEMU's TLB implementation doesn't need that hint, and | ||
5 | we correctly ignore the (previously RES0) bits in TLB invalidate | ||
6 | operation values that are now used for the TTL field. So we can | ||
7 | simply advertise support for it in our 'max' CPU. | ||
3 | 8 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Message-id: 20210628135835.6690-11-peter.maydell@linaro.org | 11 | Message-id: 20220426160422.2353158-2-peter.maydell@linaro.org |
7 | --- | 12 | --- |
8 | target/arm/helper-mve.h | 8 ++++++++ | 13 | docs/system/arm/emulation.rst | 1 + |
9 | target/arm/mve.decode | 9 ++++++++ | 14 | target/arm/cpu64.c | 1 + |
10 | target/arm/mve_helper.c | 42 ++++++++++++++++++++++++++++++++++++++ | 15 | 2 files changed, 2 insertions(+) |
11 | target/arm/translate-mve.c | 3 +++ | ||
12 | 4 files changed, 62 insertions(+) | ||
13 | 16 | ||
14 | diff --git a/target/arm/helper-mve.h b/target/arm/helper-mve.h | 17 | diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst |
15 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/helper-mve.h | 19 | --- a/docs/system/arm/emulation.rst |
17 | +++ b/target/arm/helper-mve.h | 20 | +++ b/docs/system/arm/emulation.rst |
18 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_4(mve_vshlltsb, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 21 | @@ -XXX,XX +XXX,XX @@ the following architecture extensions: |
19 | DEF_HELPER_FLAGS_4(mve_vshlltsh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 22 | - FEAT_TLBIOS (TLB invalidate instructions in Outer Shareable domain) |
20 | DEF_HELPER_FLAGS_4(mve_vshlltub, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 23 | - FEAT_TLBIRANGE (TLB invalidate range instructions) |
21 | DEF_HELPER_FLAGS_4(mve_vshlltuh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 24 | - FEAT_TTCNP (Translation table Common not private translations) |
22 | + | 25 | +- FEAT_TTL (Translation Table Level) |
23 | +DEF_HELPER_FLAGS_4(mve_vsrib, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 26 | - FEAT_TTST (Small translation tables) |
24 | +DEF_HELPER_FLAGS_4(mve_vsrih, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 27 | - FEAT_UAO (Unprivileged Access Override control) |
25 | +DEF_HELPER_FLAGS_4(mve_vsriw, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 28 | - FEAT_VHE (Virtualization Host Extensions) |
26 | + | 29 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c |
27 | +DEF_HELPER_FLAGS_4(mve_vslib, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | ||
28 | +DEF_HELPER_FLAGS_4(mve_vslih, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | ||
29 | +DEF_HELPER_FLAGS_4(mve_vsliw, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | ||
30 | diff --git a/target/arm/mve.decode b/target/arm/mve.decode | ||
31 | index XXXXXXX..XXXXXXX 100644 | 30 | index XXXXXXX..XXXXXXX 100644 |
32 | --- a/target/arm/mve.decode | 31 | --- a/target/arm/cpu64.c |
33 | +++ b/target/arm/mve.decode | 32 | +++ b/target/arm/cpu64.c |
34 | @@ -XXX,XX +XXX,XX @@ VSHLL_TS 111 0 1110 1 . 1 .. ... ... 1 1111 0 1 . 0 ... 0 @2_shll_h | 33 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) |
35 | 34 | t = FIELD_DP64(t, ID_AA64MMFR2, CNP, 1); /* TTCNP */ | |
36 | VSHLL_TU 111 1 1110 1 . 1 .. ... ... 1 1111 0 1 . 0 ... 0 @2_shll_b | 35 | t = FIELD_DP64(t, ID_AA64MMFR2, ST, 1); /* TTST */ |
37 | VSHLL_TU 111 1 1110 1 . 1 .. ... ... 1 1111 0 1 . 0 ... 0 @2_shll_h | 36 | t = FIELD_DP64(t, ID_AA64MMFR2, VARANGE, 1); /* FEAT_LVA */ |
38 | + | 37 | + t = FIELD_DP64(t, ID_AA64MMFR2, TTL, 1); /* FEAT_TTL */ |
39 | +# Shift-and-insert | 38 | cpu->isar.id_aa64mmfr2 = t; |
40 | +VSRI 111 1 1111 1 . ... ... ... 0 0100 0 1 . 1 ... 0 @2_shr_b | 39 | |
41 | +VSRI 111 1 1111 1 . ... ... ... 0 0100 0 1 . 1 ... 0 @2_shr_h | 40 | t = cpu->isar.id_aa64zfr0; |
42 | +VSRI 111 1 1111 1 . ... ... ... 0 0100 0 1 . 1 ... 0 @2_shr_w | ||
43 | + | ||
44 | +VSLI 111 1 1111 1 . ... ... ... 0 0101 0 1 . 1 ... 0 @2_shl_b | ||
45 | +VSLI 111 1 1111 1 . ... ... ... 0 0101 0 1 . 1 ... 0 @2_shl_h | ||
46 | +VSLI 111 1 1111 1 . ... ... ... 0 0101 0 1 . 1 ... 0 @2_shl_w | ||
47 | diff --git a/target/arm/mve_helper.c b/target/arm/mve_helper.c | ||
48 | index XXXXXXX..XXXXXXX 100644 | ||
49 | --- a/target/arm/mve_helper.c | ||
50 | +++ b/target/arm/mve_helper.c | ||
51 | @@ -XXX,XX +XXX,XX @@ DO_2SHIFT_SAT_S(vqshlui_s, DO_SUQSHL_OP) | ||
52 | DO_2SHIFT_U(vrshli_u, DO_VRSHLU) | ||
53 | DO_2SHIFT_S(vrshli_s, DO_VRSHLS) | ||
54 | |||
55 | +/* Shift-and-insert; we always work with 64 bits at a time */ | ||
56 | +#define DO_2SHIFT_INSERT(OP, ESIZE, SHIFTFN, MASKFN) \ | ||
57 | + void HELPER(glue(mve_, OP))(CPUARMState *env, void *vd, \ | ||
58 | + void *vm, uint32_t shift) \ | ||
59 | + { \ | ||
60 | + uint64_t *d = vd, *m = vm; \ | ||
61 | + uint16_t mask; \ | ||
62 | + uint64_t shiftmask; \ | ||
63 | + unsigned e; \ | ||
64 | + if (shift == 0 || shift == ESIZE * 8) { \ | ||
65 | + /* \ | ||
66 | + * Only VSLI can shift by 0; only VSRI can shift by <dt>. \ | ||
67 | + * The generic logic would give the right answer for 0 but \ | ||
68 | + * fails for <dt>. \ | ||
69 | + */ \ | ||
70 | + goto done; \ | ||
71 | + } \ | ||
72 | + assert(shift < ESIZE * 8); \ | ||
73 | + mask = mve_element_mask(env); \ | ||
74 | + /* ESIZE / 2 gives the MO_* value if ESIZE is in [1,2,4] */ \ | ||
75 | + shiftmask = dup_const(ESIZE / 2, MASKFN(ESIZE * 8, shift)); \ | ||
76 | + for (e = 0; e < 16 / 8; e++, mask >>= 8) { \ | ||
77 | + uint64_t r = (SHIFTFN(m[H8(e)], shift) & shiftmask) | \ | ||
78 | + (d[H8(e)] & ~shiftmask); \ | ||
79 | + mergemask(&d[H8(e)], r, mask); \ | ||
80 | + } \ | ||
81 | +done: \ | ||
82 | + mve_advance_vpt(env); \ | ||
83 | + } | ||
84 | + | ||
85 | +#define DO_SHL(N, SHIFT) ((N) << (SHIFT)) | ||
86 | +#define DO_SHR(N, SHIFT) ((N) >> (SHIFT)) | ||
87 | +#define SHL_MASK(EBITS, SHIFT) MAKE_64BIT_MASK((SHIFT), (EBITS) - (SHIFT)) | ||
88 | +#define SHR_MASK(EBITS, SHIFT) MAKE_64BIT_MASK(0, (EBITS) - (SHIFT)) | ||
89 | + | ||
90 | +DO_2SHIFT_INSERT(vsrib, 1, DO_SHR, SHR_MASK) | ||
91 | +DO_2SHIFT_INSERT(vsrih, 2, DO_SHR, SHR_MASK) | ||
92 | +DO_2SHIFT_INSERT(vsriw, 4, DO_SHR, SHR_MASK) | ||
93 | +DO_2SHIFT_INSERT(vslib, 1, DO_SHL, SHL_MASK) | ||
94 | +DO_2SHIFT_INSERT(vslih, 2, DO_SHL, SHL_MASK) | ||
95 | +DO_2SHIFT_INSERT(vsliw, 4, DO_SHL, SHL_MASK) | ||
96 | + | ||
97 | /* | ||
98 | * Long shifts taking half-sized inputs from top or bottom of the input | ||
99 | * vector and producing a double-width result. ESIZE, TYPE are for | ||
100 | diff --git a/target/arm/translate-mve.c b/target/arm/translate-mve.c | ||
101 | index XXXXXXX..XXXXXXX 100644 | ||
102 | --- a/target/arm/translate-mve.c | ||
103 | +++ b/target/arm/translate-mve.c | ||
104 | @@ -XXX,XX +XXX,XX @@ DO_2SHIFT(VSHRI_U, vshli_u, true) | ||
105 | DO_2SHIFT(VRSHRI_S, vrshli_s, true) | ||
106 | DO_2SHIFT(VRSHRI_U, vrshli_u, true) | ||
107 | |||
108 | +DO_2SHIFT(VSRI, vsri, false) | ||
109 | +DO_2SHIFT(VSLI, vsli, false) | ||
110 | + | ||
111 | #define DO_VSHLL(INSN, FN) \ | ||
112 | static bool trans_##INSN(DisasContext *s, arg_2shift *a) \ | ||
113 | { \ | ||
114 | -- | 41 | -- |
115 | 2.20.1 | 42 | 2.25.1 |
116 | |||
117 | diff view generated by jsdifflib |
1 | Implement the MVE VHLL (vector shift left long) insn. This has two | 1 | The description in the Arm ARM of the requirements of FEAT_BBM is |
---|---|---|---|
2 | encodings: the T1 encoding is the usual shift-by-immediate format, | 2 | admirably clear on the guarantees it provides software, but slightly |
3 | and the T2 encoding is a special case where the shift count is always | 3 | more obscure on what that means for implementations. The description |
4 | equal to the element size. | 4 | of the equivalent SMMU feature in the SMMU specification (IHI0070D.b |
5 | section 3.21.1) is perhaps a bit more detailed and includes some | ||
6 | example valid implementation choices. (The SMMU version of this | ||
7 | feature is slightly tighter than the CPU version: the CPU is permitted | ||
8 | to raise TLB Conflict aborts in some situations that the SMMU may | ||
9 | not. This doesn't matter for QEMU because we don't want to do TLB | ||
10 | Conflict aborts anyway.) | ||
11 | |||
12 | The informal summary of FEAT_BBM is that it is about permitting an OS | ||
13 | to switch a range of memory between "covered by a huge page" and | ||
14 | "covered by a sequence of normal pages" without having to engage in | ||
15 | the 'break-before-make' dance that has traditionally been | ||
16 | necessary. The 'break-before-make' sequence is: | ||
17 | |||
18 | * replace the old translation table entry with an invalid entry | ||
19 | * execute a DSB insn | ||
20 | * execute a broadcast TLB invalidate insn | ||
21 | * execute a DSB insn | ||
22 | * write the new translation table entry | ||
23 | * execute a DSB insn | ||
24 | |||
25 | The point of this is to ensure that no TLB can simultaneously contain | ||
26 | TLB entries for the old and the new entry, which would traditionally | ||
27 | be UNPREDICTABLE (allowing the CPU to generate a TLB Conflict fault | ||
28 | or to use a random mishmash of values from the old and the new | ||
29 | entry). FEAT_BBM level 2 says "for the specific case where the only | ||
30 | thing that changed is the size of the block, the TLB is guaranteed | ||
31 | not to do weird things even if there are multiple entries for an | ||
32 | address", which means that software can now do: | ||
33 | |||
34 | * replace old translation table entry with new entry | ||
35 | * DSB | ||
36 | * broadcast TLB invalidate | ||
37 | * DSB | ||
38 | |||
39 | As the SMMU spec notes, valid ways to do this include: | ||
40 | |||
41 | * if there are multiple entries in the TLB for an address, | ||
42 | choose one of them and use it, ignoring the others | ||
43 | * if there are multiple entries in the TLB for an address, | ||
44 | throw them all out and do a page table walk to get a new one | ||
45 | |||
46 | QEMU's page table walk implementation for Arm CPUs already meets the | ||
47 | requirements for FEAT_BBM level 2. When we cache an entry in our TCG | ||
48 | TLB, we do so only for the specific (non-huge) page that the address | ||
49 | is in, and there is no way for the TLB data structure to ever have | ||
50 | more than one TLB entry for that page. (We handle huge pages only in | ||
51 | that we track what part of the address space is covered by huge pages | ||
52 | so that a TLB invalidate operation for an address in a huge page | ||
53 | results in an invalidation of the whole TLB.) We ignore the Contiguous | ||
54 | bit in page table entries, so we don't have to do anything for the | ||
55 | parts of FEAT_BBM that deal with changis to the Contiguous bit. | ||
56 | |||
57 | FEAT_BBM level 2 also requires that the nT bit in block descriptors | ||
58 | must be ignored; since commit 39a1fd25287f5dece5 we do this. | ||
59 | |||
60 | It's therefore safe for QEMU to advertise FEAT_BBM level 2 by | ||
61 | setting ID_AA64MMFR2_EL1.BBM to 2. | ||
5 | 62 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 63 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 64 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Message-id: 20210628135835.6690-10-peter.maydell@linaro.org | 65 | Message-id: 20220426160422.2353158-3-peter.maydell@linaro.org |
9 | --- | 66 | --- |
10 | target/arm/helper-mve.h | 9 +++++++ | 67 | docs/system/arm/emulation.rst | 1 + |
11 | target/arm/mve.decode | 53 +++++++++++++++++++++++++++++++++++--- | 68 | target/arm/cpu64.c | 1 + |
12 | target/arm/mve_helper.c | 32 +++++++++++++++++++++++ | 69 | 2 files changed, 2 insertions(+) |
13 | target/arm/translate-mve.c | 15 +++++++++++ | ||
14 | 4 files changed, 105 insertions(+), 4 deletions(-) | ||
15 | 70 | ||
16 | diff --git a/target/arm/helper-mve.h b/target/arm/helper-mve.h | 71 | diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst |
17 | index XXXXXXX..XXXXXXX 100644 | 72 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/helper-mve.h | 73 | --- a/docs/system/arm/emulation.rst |
19 | +++ b/target/arm/helper-mve.h | 74 | +++ b/docs/system/arm/emulation.rst |
20 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_4(mve_vrshli_sw, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 75 | @@ -XXX,XX +XXX,XX @@ the following architecture extensions: |
21 | DEF_HELPER_FLAGS_4(mve_vrshli_ub, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 76 | - FEAT_AA32HPD (AArch32 hierarchical permission disables) |
22 | DEF_HELPER_FLAGS_4(mve_vrshli_uh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 77 | - FEAT_AA32I8MM (AArch32 Int8 matrix multiplication instructions) |
23 | DEF_HELPER_FLAGS_4(mve_vrshli_uw, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 78 | - FEAT_AES (AESD and AESE instructions) |
24 | + | 79 | +- FEAT_BBM at level 2 (Translation table break-before-make levels) |
25 | +DEF_HELPER_FLAGS_4(mve_vshllbsb, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 80 | - FEAT_BF16 (AArch64 BFloat16 instructions) |
26 | +DEF_HELPER_FLAGS_4(mve_vshllbsh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 81 | - FEAT_BTI (Branch Target Identification) |
27 | +DEF_HELPER_FLAGS_4(mve_vshllbub, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 82 | - FEAT_DIT (Data Independent Timing instructions) |
28 | +DEF_HELPER_FLAGS_4(mve_vshllbuh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 83 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c |
29 | +DEF_HELPER_FLAGS_4(mve_vshlltsb, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | ||
30 | +DEF_HELPER_FLAGS_4(mve_vshlltsh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | ||
31 | +DEF_HELPER_FLAGS_4(mve_vshlltub, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | ||
32 | +DEF_HELPER_FLAGS_4(mve_vshlltuh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | ||
33 | diff --git a/target/arm/mve.decode b/target/arm/mve.decode | ||
34 | index XXXXXXX..XXXXXXX 100644 | 84 | index XXXXXXX..XXXXXXX 100644 |
35 | --- a/target/arm/mve.decode | 85 | --- a/target/arm/cpu64.c |
36 | +++ b/target/arm/mve.decode | 86 | +++ b/target/arm/cpu64.c |
37 | @@ -XXX,XX +XXX,XX @@ | 87 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) |
38 | @2_shl_h .... .... .. 01 shift:4 .... .... .... .... &2shift qd=%qd qm=%qm size=1 | 88 | t = FIELD_DP64(t, ID_AA64MMFR2, ST, 1); /* TTST */ |
39 | @2_shl_w .... .... .. 1 shift:5 .... .... .... .... &2shift qd=%qd qm=%qm size=2 | 89 | t = FIELD_DP64(t, ID_AA64MMFR2, VARANGE, 1); /* FEAT_LVA */ |
40 | 90 | t = FIELD_DP64(t, ID_AA64MMFR2, TTL, 1); /* FEAT_TTL */ | |
41 | +@2_shll_b .... .... ... 01 shift:3 .... .... .... .... &2shift qd=%qd qm=%qm size=0 | 91 | + t = FIELD_DP64(t, ID_AA64MMFR2, BBM, 2); /* FEAT_BBM at level 2 */ |
42 | +@2_shll_h .... .... ... 1 shift:4 .... .... .... .... &2shift qd=%qd qm=%qm size=1 | 92 | cpu->isar.id_aa64mmfr2 = t; |
43 | +# VSHLL encoding T2 where shift == esize | 93 | |
44 | +@2_shll_esize_b .... .... .... 00 .. .... .... .... .... &2shift \ | 94 | t = cpu->isar.id_aa64zfr0; |
45 | + qd=%qd qm=%qm size=0 shift=8 | ||
46 | +@2_shll_esize_h .... .... .... 01 .. .... .... .... .... &2shift \ | ||
47 | + qd=%qd qm=%qm size=1 shift=16 | ||
48 | + | ||
49 | # Right shifts are encoded as N - shift, where N is the element size in bits. | ||
50 | %rshift_i5 16:5 !function=rsub_32 | ||
51 | %rshift_i4 16:4 !function=rsub_16 | ||
52 | @@ -XXX,XX +XXX,XX @@ VADD 1110 1111 0 . .. ... 0 ... 0 1000 . 1 . 0 ... 0 @2op | ||
53 | VSUB 1111 1111 0 . .. ... 0 ... 0 1000 . 1 . 0 ... 0 @2op | ||
54 | VMUL 1110 1111 0 . .. ... 0 ... 0 1001 . 1 . 1 ... 0 @2op | ||
55 | |||
56 | -VMULH_S 111 0 1110 0 . .. ...1 ... 0 1110 . 0 . 0 ... 1 @2op | ||
57 | -VMULH_U 111 1 1110 0 . .. ...1 ... 0 1110 . 0 . 0 ... 1 @2op | ||
58 | +# The VSHLL T2 encoding is not a @2op pattern, but is here because it | ||
59 | +# overlaps what would be size=0b11 VMULH/VRMULH | ||
60 | +{ | ||
61 | + VSHLL_BS 111 0 1110 0 . 11 .. 01 ... 0 1110 0 0 . 0 ... 1 @2_shll_esize_b | ||
62 | + VSHLL_BS 111 0 1110 0 . 11 .. 01 ... 0 1110 0 0 . 0 ... 1 @2_shll_esize_h | ||
63 | |||
64 | -VRMULH_S 111 0 1110 0 . .. ...1 ... 1 1110 . 0 . 0 ... 1 @2op | ||
65 | -VRMULH_U 111 1 1110 0 . .. ...1 ... 1 1110 . 0 . 0 ... 1 @2op | ||
66 | + VMULH_S 111 0 1110 0 . .. ...1 ... 0 1110 . 0 . 0 ... 1 @2op | ||
67 | +} | ||
68 | + | ||
69 | +{ | ||
70 | + VSHLL_BU 111 1 1110 0 . 11 .. 01 ... 0 1110 0 0 . 0 ... 1 @2_shll_esize_b | ||
71 | + VSHLL_BU 111 1 1110 0 . 11 .. 01 ... 0 1110 0 0 . 0 ... 1 @2_shll_esize_h | ||
72 | + | ||
73 | + VMULH_U 111 1 1110 0 . .. ...1 ... 0 1110 . 0 . 0 ... 1 @2op | ||
74 | +} | ||
75 | + | ||
76 | +{ | ||
77 | + VSHLL_TS 111 0 1110 0 . 11 .. 01 ... 1 1110 0 0 . 0 ... 1 @2_shll_esize_b | ||
78 | + VSHLL_TS 111 0 1110 0 . 11 .. 01 ... 1 1110 0 0 . 0 ... 1 @2_shll_esize_h | ||
79 | + | ||
80 | + VRMULH_S 111 0 1110 0 . .. ...1 ... 1 1110 . 0 . 0 ... 1 @2op | ||
81 | +} | ||
82 | + | ||
83 | +{ | ||
84 | + VSHLL_TU 111 1 1110 0 . 11 .. 01 ... 1 1110 0 0 . 0 ... 1 @2_shll_esize_b | ||
85 | + VSHLL_TU 111 1 1110 0 . 11 .. 01 ... 1 1110 0 0 . 0 ... 1 @2_shll_esize_h | ||
86 | + | ||
87 | + VRMULH_U 111 1 1110 0 . .. ...1 ... 1 1110 . 0 . 0 ... 1 @2op | ||
88 | +} | ||
89 | |||
90 | VMAX_S 111 0 1111 0 . .. ... 0 ... 0 0110 . 1 . 0 ... 0 @2op | ||
91 | VMAX_U 111 1 1111 0 . .. ... 0 ... 0 0110 . 1 . 0 ... 0 @2op | ||
92 | @@ -XXX,XX +XXX,XX @@ VRSHRI_S 111 0 1111 1 . ... ... ... 0 0010 0 1 . 1 ... 0 @2_shr_w | ||
93 | VRSHRI_U 111 1 1111 1 . ... ... ... 0 0010 0 1 . 1 ... 0 @2_shr_b | ||
94 | VRSHRI_U 111 1 1111 1 . ... ... ... 0 0010 0 1 . 1 ... 0 @2_shr_h | ||
95 | VRSHRI_U 111 1 1111 1 . ... ... ... 0 0010 0 1 . 1 ... 0 @2_shr_w | ||
96 | + | ||
97 | +# VSHLL T1 encoding; the T2 VSHLL encoding is elsewhere in this file | ||
98 | +VSHLL_BS 111 0 1110 1 . 1 .. ... ... 0 1111 0 1 . 0 ... 0 @2_shll_b | ||
99 | +VSHLL_BS 111 0 1110 1 . 1 .. ... ... 0 1111 0 1 . 0 ... 0 @2_shll_h | ||
100 | + | ||
101 | +VSHLL_BU 111 1 1110 1 . 1 .. ... ... 0 1111 0 1 . 0 ... 0 @2_shll_b | ||
102 | +VSHLL_BU 111 1 1110 1 . 1 .. ... ... 0 1111 0 1 . 0 ... 0 @2_shll_h | ||
103 | + | ||
104 | +VSHLL_TS 111 0 1110 1 . 1 .. ... ... 1 1111 0 1 . 0 ... 0 @2_shll_b | ||
105 | +VSHLL_TS 111 0 1110 1 . 1 .. ... ... 1 1111 0 1 . 0 ... 0 @2_shll_h | ||
106 | + | ||
107 | +VSHLL_TU 111 1 1110 1 . 1 .. ... ... 1 1111 0 1 . 0 ... 0 @2_shll_b | ||
108 | +VSHLL_TU 111 1 1110 1 . 1 .. ... ... 1 1111 0 1 . 0 ... 0 @2_shll_h | ||
109 | diff --git a/target/arm/mve_helper.c b/target/arm/mve_helper.c | ||
110 | index XXXXXXX..XXXXXXX 100644 | ||
111 | --- a/target/arm/mve_helper.c | ||
112 | +++ b/target/arm/mve_helper.c | ||
113 | @@ -XXX,XX +XXX,XX @@ DO_2SHIFT_SAT_S(vqshli_s, DO_SQSHL_OP) | ||
114 | DO_2SHIFT_SAT_S(vqshlui_s, DO_SUQSHL_OP) | ||
115 | DO_2SHIFT_U(vrshli_u, DO_VRSHLU) | ||
116 | DO_2SHIFT_S(vrshli_s, DO_VRSHLS) | ||
117 | + | ||
118 | +/* | ||
119 | + * Long shifts taking half-sized inputs from top or bottom of the input | ||
120 | + * vector and producing a double-width result. ESIZE, TYPE are for | ||
121 | + * the input, and LESIZE, LTYPE for the output. | ||
122 | + * Unlike the normal shift helpers, we do not handle negative shift counts, | ||
123 | + * because the long shift is strictly left-only. | ||
124 | + */ | ||
125 | +#define DO_VSHLL(OP, TOP, ESIZE, TYPE, LESIZE, LTYPE) \ | ||
126 | + void HELPER(glue(mve_, OP))(CPUARMState *env, void *vd, \ | ||
127 | + void *vm, uint32_t shift) \ | ||
128 | + { \ | ||
129 | + LTYPE *d = vd; \ | ||
130 | + TYPE *m = vm; \ | ||
131 | + uint16_t mask = mve_element_mask(env); \ | ||
132 | + unsigned le; \ | ||
133 | + assert(shift <= 16); \ | ||
134 | + for (le = 0; le < 16 / LESIZE; le++, mask >>= LESIZE) { \ | ||
135 | + LTYPE r = (LTYPE)m[H##ESIZE(le * 2 + TOP)] << shift; \ | ||
136 | + mergemask(&d[H##LESIZE(le)], r, mask); \ | ||
137 | + } \ | ||
138 | + mve_advance_vpt(env); \ | ||
139 | + } | ||
140 | + | ||
141 | +#define DO_VSHLL_ALL(OP, TOP) \ | ||
142 | + DO_VSHLL(OP##sb, TOP, 1, int8_t, 2, int16_t) \ | ||
143 | + DO_VSHLL(OP##ub, TOP, 1, uint8_t, 2, uint16_t) \ | ||
144 | + DO_VSHLL(OP##sh, TOP, 2, int16_t, 4, int32_t) \ | ||
145 | + DO_VSHLL(OP##uh, TOP, 2, uint16_t, 4, uint32_t) \ | ||
146 | + | ||
147 | +DO_VSHLL_ALL(vshllb, false) | ||
148 | +DO_VSHLL_ALL(vshllt, true) | ||
149 | diff --git a/target/arm/translate-mve.c b/target/arm/translate-mve.c | ||
150 | index XXXXXXX..XXXXXXX 100644 | ||
151 | --- a/target/arm/translate-mve.c | ||
152 | +++ b/target/arm/translate-mve.c | ||
153 | @@ -XXX,XX +XXX,XX @@ DO_2SHIFT(VSHRI_S, vshli_s, true) | ||
154 | DO_2SHIFT(VSHRI_U, vshli_u, true) | ||
155 | DO_2SHIFT(VRSHRI_S, vrshli_s, true) | ||
156 | DO_2SHIFT(VRSHRI_U, vrshli_u, true) | ||
157 | + | ||
158 | +#define DO_VSHLL(INSN, FN) \ | ||
159 | + static bool trans_##INSN(DisasContext *s, arg_2shift *a) \ | ||
160 | + { \ | ||
161 | + static MVEGenTwoOpShiftFn * const fns[] = { \ | ||
162 | + gen_helper_mve_##FN##b, \ | ||
163 | + gen_helper_mve_##FN##h, \ | ||
164 | + }; \ | ||
165 | + return do_2shift(s, a, fns[a->size], false); \ | ||
166 | + } | ||
167 | + | ||
168 | +DO_VSHLL(VSHLL_BS, vshllbs) | ||
169 | +DO_VSHLL(VSHLL_BU, vshllbu) | ||
170 | +DO_VSHLL(VSHLL_TS, vshllts) | ||
171 | +DO_VSHLL(VSHLL_TU, vshlltu) | ||
172 | -- | 95 | -- |
173 | 2.20.1 | 96 | 2.25.1 |
174 | |||
175 | diff view generated by jsdifflib |
1 | Implement the MVE shift-vector-left-by-immediate insns VSHL, VQSHL | 1 | The Arm SMMUv3 includes an optional feature equivalent to the CPU |
---|---|---|---|
2 | and VQSHLU. | 2 | FEAT_BBM, which permits an OS to switch a range of memory between |
3 | "covered by a huge page" and "covered by a sequence of normal pages" | ||
4 | without having to engage in the traditional 'break-before-make' | ||
5 | dance. (This is particularly important for the SMMU, because devices | ||
6 | performing I/O through an SMMU are less likely to be able to cope with | ||
7 | the window in the sequence where an access results in a translation | ||
8 | fault.) The SMMU spec explicitly notes that one of the valid ways to | ||
9 | be a BBM level 2 compliant implementation is: | ||
10 | * if there are multiple entries in the TLB for an address, | ||
11 | choose one of them and use it, ignoring the others | ||
3 | 12 | ||
4 | The size-and-immediate encoding here is the same as Neon, and we | 13 | Our SMMU TLB implementation (unlike our CPU TLB) does allow multiple |
5 | handle it the same way neon-dp.decode does. | 14 | TLB entries for an address, because the translation table level is |
15 | part of the SMMUIOTLBKey, and so our IOTLB hashtable can include | ||
16 | entries for the same address where the leaf was at different levels | ||
17 | (i.e. both hugepage and normal page). Our TLB lookup implementation in | ||
18 | smmu_iotlb_lookup() will always find the entry with the lowest level | ||
19 | (i.e. it prefers the hugepage over the normal page) and ignore any | ||
20 | others. TLB invalidation correctly removes all TLB entries matching | ||
21 | the specified address or address range (unless the guest specifies the | ||
22 | leaf level explicitly, in which case it gets what it asked for). So we | ||
23 | can validly advertise support for BBML level 2. | ||
24 | |||
25 | Note that we still can't yet advertise ourselves as an SMMU v3.2, | ||
26 | because v3.2 requires support for the S2FWB feature, which we don't | ||
27 | yet implement. | ||
6 | 28 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 29 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 30 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20210628135835.6690-8-peter.maydell@linaro.org | 31 | Reviewed-by: Eric Auger <eric.auger@redhat.com> |
32 | Message-id: 20220426160422.2353158-4-peter.maydell@linaro.org | ||
10 | --- | 33 | --- |
11 | target/arm/helper-mve.h | 16 +++++++++++ | 34 | hw/arm/smmuv3-internal.h | 1 + |
12 | target/arm/mve.decode | 23 +++++++++++++++ | 35 | hw/arm/smmuv3.c | 1 + |
13 | target/arm/mve_helper.c | 57 ++++++++++++++++++++++++++++++++++++++ | 36 | 2 files changed, 2 insertions(+) |
14 | target/arm/translate-mve.c | 51 ++++++++++++++++++++++++++++++++++ | ||
15 | 4 files changed, 147 insertions(+) | ||
16 | 37 | ||
17 | diff --git a/target/arm/helper-mve.h b/target/arm/helper-mve.h | 38 | diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h |
18 | index XXXXXXX..XXXXXXX 100644 | 39 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/target/arm/helper-mve.h | 40 | --- a/hw/arm/smmuv3-internal.h |
20 | +++ b/target/arm/helper-mve.h | 41 | +++ b/hw/arm/smmuv3-internal.h |
21 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_3(mve_vaddvuw, TCG_CALL_NO_WG, i32, env, ptr, i32) | 42 | @@ -XXX,XX +XXX,XX @@ REG32(IDR2, 0x8) |
22 | DEF_HELPER_FLAGS_3(mve_vmovi, TCG_CALL_NO_WG, void, env, ptr, i64) | 43 | REG32(IDR3, 0xc) |
23 | DEF_HELPER_FLAGS_3(mve_vandi, TCG_CALL_NO_WG, void, env, ptr, i64) | 44 | FIELD(IDR3, HAD, 2, 1); |
24 | DEF_HELPER_FLAGS_3(mve_vorri, TCG_CALL_NO_WG, void, env, ptr, i64) | 45 | FIELD(IDR3, RIL, 10, 1); |
25 | + | 46 | + FIELD(IDR3, BBML, 11, 2); |
26 | +DEF_HELPER_FLAGS_4(mve_vshli_ub, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 47 | REG32(IDR4, 0x10) |
27 | +DEF_HELPER_FLAGS_4(mve_vshli_uh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 48 | REG32(IDR5, 0x14) |
28 | +DEF_HELPER_FLAGS_4(mve_vshli_uw, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | 49 | FIELD(IDR5, OAS, 0, 3); |
29 | + | 50 | diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c |
30 | +DEF_HELPER_FLAGS_4(mve_vqshli_sb, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | ||
31 | +DEF_HELPER_FLAGS_4(mve_vqshli_sh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | ||
32 | +DEF_HELPER_FLAGS_4(mve_vqshli_sw, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | ||
33 | + | ||
34 | +DEF_HELPER_FLAGS_4(mve_vqshli_ub, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | ||
35 | +DEF_HELPER_FLAGS_4(mve_vqshli_uh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | ||
36 | +DEF_HELPER_FLAGS_4(mve_vqshli_uw, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | ||
37 | + | ||
38 | +DEF_HELPER_FLAGS_4(mve_vqshlui_sb, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | ||
39 | +DEF_HELPER_FLAGS_4(mve_vqshlui_sh, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | ||
40 | +DEF_HELPER_FLAGS_4(mve_vqshlui_sw, TCG_CALL_NO_WG, void, env, ptr, ptr, i32) | ||
41 | diff --git a/target/arm/mve.decode b/target/arm/mve.decode | ||
42 | index XXXXXXX..XXXXXXX 100644 | 51 | index XXXXXXX..XXXXXXX 100644 |
43 | --- a/target/arm/mve.decode | 52 | --- a/hw/arm/smmuv3.c |
44 | +++ b/target/arm/mve.decode | 53 | +++ b/hw/arm/smmuv3.c |
45 | @@ -XXX,XX +XXX,XX @@ | 54 | @@ -XXX,XX +XXX,XX @@ static void smmuv3_init_regs(SMMUv3State *s) |
46 | &2op qd qm qn size | 55 | |
47 | &2scalar qd qn rm size | 56 | s->idr[3] = FIELD_DP32(s->idr[3], IDR3, RIL, 1); |
48 | &1imm qd imm cmode op | 57 | s->idr[3] = FIELD_DP32(s->idr[3], IDR3, HAD, 1); |
49 | +&2shift qd qm shift size | 58 | + s->idr[3] = FIELD_DP32(s->idr[3], IDR3, BBML, 2); |
50 | 59 | ||
51 | @vldr_vstr ....... . . . . l:1 rn:4 ... ...... imm:7 &vldr_vstr qd=%qd u=0 | 60 | /* 4K, 16K and 64K granule support */ |
52 | # Note that both Rn and Qd are 3 bits only (no D bit) | 61 | s->idr[5] = FIELD_DP32(s->idr[5], IDR5, GRAN4K, 1); |
53 | @@ -XXX,XX +XXX,XX @@ | ||
54 | @2scalar .... .... .. size:2 .... .... .... .... rm:4 &2scalar qd=%qd qn=%qn | ||
55 | @2scalar_nosz .... .... .... .... .... .... .... rm:4 &2scalar qd=%qd qn=%qn | ||
56 | |||
57 | +@2_shl_b .... .... .. 001 shift:3 .... .... .... .... &2shift qd=%qd qm=%qm size=0 | ||
58 | +@2_shl_h .... .... .. 01 shift:4 .... .... .... .... &2shift qd=%qd qm=%qm size=1 | ||
59 | +@2_shl_w .... .... .. 1 shift:5 .... .... .... .... &2shift qd=%qd qm=%qm size=2 | ||
60 | + | ||
61 | # Vector loads and stores | ||
62 | |||
63 | # Widening loads and narrowing stores: | ||
64 | @@ -XXX,XX +XXX,XX @@ VPST 1111 1110 0 . 11 000 1 ... 0 1111 0100 1101 mask=%mask_22_13 | ||
65 | # So we have a single decode line and check the cmode/op in the | ||
66 | # trans function. | ||
67 | Vimm_1r 111 . 1111 1 . 00 0 ... ... 0 .... 0 1 . 1 .... @1imm | ||
68 | + | ||
69 | +# Shifts by immediate | ||
70 | + | ||
71 | +VSHLI 111 0 1111 1 . ... ... ... 0 0101 0 1 . 1 ... 0 @2_shl_b | ||
72 | +VSHLI 111 0 1111 1 . ... ... ... 0 0101 0 1 . 1 ... 0 @2_shl_h | ||
73 | +VSHLI 111 0 1111 1 . ... ... ... 0 0101 0 1 . 1 ... 0 @2_shl_w | ||
74 | + | ||
75 | +VQSHLI_S 111 0 1111 1 . ... ... ... 0 0111 0 1 . 1 ... 0 @2_shl_b | ||
76 | +VQSHLI_S 111 0 1111 1 . ... ... ... 0 0111 0 1 . 1 ... 0 @2_shl_h | ||
77 | +VQSHLI_S 111 0 1111 1 . ... ... ... 0 0111 0 1 . 1 ... 0 @2_shl_w | ||
78 | + | ||
79 | +VQSHLI_U 111 1 1111 1 . ... ... ... 0 0111 0 1 . 1 ... 0 @2_shl_b | ||
80 | +VQSHLI_U 111 1 1111 1 . ... ... ... 0 0111 0 1 . 1 ... 0 @2_shl_h | ||
81 | +VQSHLI_U 111 1 1111 1 . ... ... ... 0 0111 0 1 . 1 ... 0 @2_shl_w | ||
82 | + | ||
83 | +VQSHLUI 111 1 1111 1 . ... ... ... 0 0110 0 1 . 1 ... 0 @2_shl_b | ||
84 | +VQSHLUI 111 1 1111 1 . ... ... ... 0 0110 0 1 . 1 ... 0 @2_shl_h | ||
85 | +VQSHLUI 111 1 1111 1 . ... ... ... 0 0110 0 1 . 1 ... 0 @2_shl_w | ||
86 | diff --git a/target/arm/mve_helper.c b/target/arm/mve_helper.c | ||
87 | index XXXXXXX..XXXXXXX 100644 | ||
88 | --- a/target/arm/mve_helper.c | ||
89 | +++ b/target/arm/mve_helper.c | ||
90 | @@ -XXX,XX +XXX,XX @@ DO_2OP_SAT(vqsubsw, 4, int32_t, DO_SQSUB_W) | ||
91 | WRAP_QRSHL_HELPER(do_sqrshl_bhs, N, M, true, satp) | ||
92 | #define DO_UQRSHL_OP(N, M, satp) \ | ||
93 | WRAP_QRSHL_HELPER(do_uqrshl_bhs, N, M, true, satp) | ||
94 | +#define DO_SUQSHL_OP(N, M, satp) \ | ||
95 | + WRAP_QRSHL_HELPER(do_suqrshl_bhs, N, M, false, satp) | ||
96 | |||
97 | DO_2OP_SAT_S(vqshls, DO_SQSHL_OP) | ||
98 | DO_2OP_SAT_U(vqshlu, DO_UQSHL_OP) | ||
99 | @@ -XXX,XX +XXX,XX @@ DO_VADDV(vaddvsw, 4, uint32_t) | ||
100 | DO_VADDV(vaddvub, 1, uint8_t) | ||
101 | DO_VADDV(vaddvuh, 2, uint16_t) | ||
102 | DO_VADDV(vaddvuw, 4, uint32_t) | ||
103 | + | ||
104 | +/* Shifts by immediate */ | ||
105 | +#define DO_2SHIFT(OP, ESIZE, TYPE, FN) \ | ||
106 | + void HELPER(glue(mve_, OP))(CPUARMState *env, void *vd, \ | ||
107 | + void *vm, uint32_t shift) \ | ||
108 | + { \ | ||
109 | + TYPE *d = vd, *m = vm; \ | ||
110 | + uint16_t mask = mve_element_mask(env); \ | ||
111 | + unsigned e; \ | ||
112 | + for (e = 0; e < 16 / ESIZE; e++, mask >>= ESIZE) { \ | ||
113 | + mergemask(&d[H##ESIZE(e)], \ | ||
114 | + FN(m[H##ESIZE(e)], shift), mask); \ | ||
115 | + } \ | ||
116 | + mve_advance_vpt(env); \ | ||
117 | + } | ||
118 | + | ||
119 | +#define DO_2SHIFT_SAT(OP, ESIZE, TYPE, FN) \ | ||
120 | + void HELPER(glue(mve_, OP))(CPUARMState *env, void *vd, \ | ||
121 | + void *vm, uint32_t shift) \ | ||
122 | + { \ | ||
123 | + TYPE *d = vd, *m = vm; \ | ||
124 | + uint16_t mask = mve_element_mask(env); \ | ||
125 | + unsigned e; \ | ||
126 | + bool qc = false; \ | ||
127 | + for (e = 0; e < 16 / ESIZE; e++, mask >>= ESIZE) { \ | ||
128 | + bool sat = false; \ | ||
129 | + mergemask(&d[H##ESIZE(e)], \ | ||
130 | + FN(m[H##ESIZE(e)], shift, &sat), mask); \ | ||
131 | + qc |= sat & mask & 1; \ | ||
132 | + } \ | ||
133 | + if (qc) { \ | ||
134 | + env->vfp.qc[0] = qc; \ | ||
135 | + } \ | ||
136 | + mve_advance_vpt(env); \ | ||
137 | + } | ||
138 | + | ||
139 | +/* provide unsigned 2-op shift helpers for all sizes */ | ||
140 | +#define DO_2SHIFT_U(OP, FN) \ | ||
141 | + DO_2SHIFT(OP##b, 1, uint8_t, FN) \ | ||
142 | + DO_2SHIFT(OP##h, 2, uint16_t, FN) \ | ||
143 | + DO_2SHIFT(OP##w, 4, uint32_t, FN) | ||
144 | + | ||
145 | +#define DO_2SHIFT_SAT_U(OP, FN) \ | ||
146 | + DO_2SHIFT_SAT(OP##b, 1, uint8_t, FN) \ | ||
147 | + DO_2SHIFT_SAT(OP##h, 2, uint16_t, FN) \ | ||
148 | + DO_2SHIFT_SAT(OP##w, 4, uint32_t, FN) | ||
149 | +#define DO_2SHIFT_SAT_S(OP, FN) \ | ||
150 | + DO_2SHIFT_SAT(OP##b, 1, int8_t, FN) \ | ||
151 | + DO_2SHIFT_SAT(OP##h, 2, int16_t, FN) \ | ||
152 | + DO_2SHIFT_SAT(OP##w, 4, int32_t, FN) | ||
153 | + | ||
154 | +DO_2SHIFT_U(vshli_u, DO_VSHLU) | ||
155 | +DO_2SHIFT_SAT_U(vqshli_u, DO_UQSHL_OP) | ||
156 | +DO_2SHIFT_SAT_S(vqshli_s, DO_SQSHL_OP) | ||
157 | +DO_2SHIFT_SAT_S(vqshlui_s, DO_SUQSHL_OP) | ||
158 | diff --git a/target/arm/translate-mve.c b/target/arm/translate-mve.c | ||
159 | index XXXXXXX..XXXXXXX 100644 | ||
160 | --- a/target/arm/translate-mve.c | ||
161 | +++ b/target/arm/translate-mve.c | ||
162 | @@ -XXX,XX +XXX,XX @@ typedef void MVEGenLdStFn(TCGv_ptr, TCGv_ptr, TCGv_i32); | ||
163 | typedef void MVEGenOneOpFn(TCGv_ptr, TCGv_ptr, TCGv_ptr); | ||
164 | typedef void MVEGenTwoOpFn(TCGv_ptr, TCGv_ptr, TCGv_ptr, TCGv_ptr); | ||
165 | typedef void MVEGenTwoOpScalarFn(TCGv_ptr, TCGv_ptr, TCGv_ptr, TCGv_i32); | ||
166 | +typedef void MVEGenTwoOpShiftFn(TCGv_ptr, TCGv_ptr, TCGv_ptr, TCGv_i32); | ||
167 | typedef void MVEGenDualAccOpFn(TCGv_i64, TCGv_ptr, TCGv_ptr, TCGv_ptr, TCGv_i64); | ||
168 | typedef void MVEGenVADDVFn(TCGv_i32, TCGv_ptr, TCGv_ptr, TCGv_i32); | ||
169 | typedef void MVEGenOneOpImmFn(TCGv_ptr, TCGv_ptr, TCGv_i64); | ||
170 | @@ -XXX,XX +XXX,XX @@ static bool trans_Vimm_1r(DisasContext *s, arg_1imm *a) | ||
171 | } | ||
172 | return do_1imm(s, a, fn); | ||
173 | } | ||
174 | + | ||
175 | +static bool do_2shift(DisasContext *s, arg_2shift *a, MVEGenTwoOpShiftFn fn, | ||
176 | + bool negateshift) | ||
177 | +{ | ||
178 | + TCGv_ptr qd, qm; | ||
179 | + int shift = a->shift; | ||
180 | + | ||
181 | + if (!dc_isar_feature(aa32_mve, s) || | ||
182 | + !mve_check_qreg_bank(s, a->qd | a->qm) || | ||
183 | + !fn) { | ||
184 | + return false; | ||
185 | + } | ||
186 | + if (!mve_eci_check(s) || !vfp_access_check(s)) { | ||
187 | + return true; | ||
188 | + } | ||
189 | + | ||
190 | + /* | ||
191 | + * When we handle a right shift insn using a left-shift helper | ||
192 | + * which permits a negative shift count to indicate a right-shift, | ||
193 | + * we must negate the shift count. | ||
194 | + */ | ||
195 | + if (negateshift) { | ||
196 | + shift = -shift; | ||
197 | + } | ||
198 | + | ||
199 | + qd = mve_qreg_ptr(a->qd); | ||
200 | + qm = mve_qreg_ptr(a->qm); | ||
201 | + fn(cpu_env, qd, qm, tcg_constant_i32(shift)); | ||
202 | + tcg_temp_free_ptr(qd); | ||
203 | + tcg_temp_free_ptr(qm); | ||
204 | + mve_update_eci(s); | ||
205 | + return true; | ||
206 | +} | ||
207 | + | ||
208 | +#define DO_2SHIFT(INSN, FN, NEGATESHIFT) \ | ||
209 | + static bool trans_##INSN(DisasContext *s, arg_2shift *a) \ | ||
210 | + { \ | ||
211 | + static MVEGenTwoOpShiftFn * const fns[] = { \ | ||
212 | + gen_helper_mve_##FN##b, \ | ||
213 | + gen_helper_mve_##FN##h, \ | ||
214 | + gen_helper_mve_##FN##w, \ | ||
215 | + NULL, \ | ||
216 | + }; \ | ||
217 | + return do_2shift(s, a, fns[a->size], NEGATESHIFT); \ | ||
218 | + } | ||
219 | + | ||
220 | +DO_2SHIFT(VSHLI, vshli_u, false) | ||
221 | +DO_2SHIFT(VQSHLI_S, vqshli_s, false) | ||
222 | +DO_2SHIFT(VQSHLI_U, vqshli_u, false) | ||
223 | +DO_2SHIFT(VQSHLUI, vqshlui_s, false) | ||
224 | -- | 62 | -- |
225 | 2.20.1 | 63 | 2.25.1 |
226 | |||
227 | diff view generated by jsdifflib |