1 | First pullreq for arm of the 4.1 series, since I'm back from | 1 | Massive pullreq but almost all of that is RTH's SVE |
---|---|---|---|
2 | holiday now. This is mostly my M-profile FPU series and Philippe's | 2 | refactoring patchset. The other interesting thing here is |
3 | devices.h cleanup. I have a pile of other patchsets to work through | 3 | the fix for compiling on aarch64 macos. |
4 | in my to-review folder, but 42 patches is definitely quite | ||
5 | big enough to send now... | ||
6 | 4 | ||
7 | thanks | 5 | thanks |
8 | -- PMM | 6 | -- PMM |
9 | 7 | ||
10 | The following changes since commit 413a99a92c13ec408dcf2adaa87918dc81e890c8: | 8 | The following changes since commit f7a1ea403e0282a7f57edd4298c4f65f24165da5: |
11 | 9 | ||
12 | Add Nios II semihosting support. (2019-04-29 16:09:51 +0100) | 10 | Merge tag 'misc-pull-request' of gitlab.com:marcandre.lureau/qemu into staging (2022-05-29 16:34:56 -0700) |
13 | 11 | ||
14 | are available in the Git repository at: | 12 | are available in the Git repository at: |
15 | 13 | ||
16 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20190429 | 14 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20220530 |
17 | 15 | ||
18 | for you to fetch changes up to 437cc27ddfded3bbab6afd5ac1761e0e195edba7: | 16 | for you to fetch changes up to b1071174d2a2ab371082b7d4b5f19e98edc61ac6: |
19 | 17 | ||
20 | hw/devices: Move SMSC 91C111 declaration into a new header (2019-04-29 17:57:21 +0100) | 18 | target/arm: Remove aa64_sve check from before disas_sve (2022-05-30 17:05:12 +0100) |
21 | 19 | ||
22 | ---------------------------------------------------------------- | 20 | ---------------------------------------------------------------- |
23 | target-arm queue: | 21 | target-arm queue: |
24 | * remove "bag of random stuff" hw/devices.h header | 22 | * docs/system/arm: Add FEAT_HCX to list of emulated features |
25 | * implement FPU for Cortex-M and enable it for Cortex-M4 and -M33 | 23 | * target/arm/hvf: Include missing "cpregs.h" |
26 | * hw/dma: Compile the bcm2835_dma device as common object | 24 | * hw/sd/allwinner-sdhost: report FIFO water level as 1 when data ready |
27 | * configure: Remove --source-path option | 25 | * SVE: refactor to use TRANS/TRANS_FEAT macros and push |
28 | * hw/ssi/xilinx_spips: Avoid variable length array | 26 | SVE feature check down to individual insn level |
29 | * hw/arm/smmuv3: Remove SMMUNotifierNode | ||
30 | 27 | ||
31 | ---------------------------------------------------------------- | 28 | ---------------------------------------------------------------- |
32 | Eric Auger (1): | 29 | Icenowy Zheng (1): |
33 | hw/arm/smmuv3: Remove SMMUNotifierNode | 30 | hw/sd/allwinner-sdhost: report FIFO water level as 1 when data ready |
34 | 31 | ||
35 | Peter Maydell (28): | 32 | Peter Maydell (1): |
36 | hw/ssi/xilinx_spips: Avoid variable length array | 33 | docs/system/arm: Add FEAT_HCX to list of emulated features |
37 | configure: Remove --source-path option | ||
38 | target/arm: Make sure M-profile FPSCR RES0 bits are not settable | ||
39 | hw/intc/armv7m_nvic: Allow reading of M-profile MVFR* registers | ||
40 | target/arm: Implement dummy versions of M-profile FP-related registers | ||
41 | target/arm: Disable most VFP sysregs for M-profile | ||
42 | target/arm: Honour M-profile FP enable bits | ||
43 | target/arm: Decode FP instructions for M profile | ||
44 | target/arm: Clear CONTROL_S.SFPA in SG insn if FPU present | ||
45 | target/arm: Handle SFPA and FPCA bits in reads and writes of CONTROL | ||
46 | target/arm/helper: don't return early for STKOF faults during stacking | ||
47 | target/arm: Handle floating point registers in exception entry | ||
48 | target/arm: Implement v7m_update_fpccr() | ||
49 | target/arm: Clear CONTROL.SFPA in BXNS and BLXNS | ||
50 | target/arm: Clean excReturn bits when tail chaining | ||
51 | target/arm: Allow for floating point in callee stack integrity check | ||
52 | target/arm: Handle floating point registers in exception return | ||
53 | target/arm: Move NS TBFLAG from bit 19 to bit 6 | ||
54 | target/arm: Overlap VECSTRIDE and XSCALE_CPAR TB flags | ||
55 | target/arm: Set FPCCR.S when executing M-profile floating point insns | ||
56 | target/arm: Activate M-profile floating point context when FPCCR.ASPEN is set | ||
57 | target/arm: New helper function arm_v7m_mmu_idx_all() | ||
58 | target/arm: New function armv7m_nvic_set_pending_lazyfp() | ||
59 | target/arm: Add lazy-FP-stacking support to v7m_stack_write() | ||
60 | target/arm: Implement M-profile lazy FP state preservation | ||
61 | target/arm: Implement VLSTM for v7M CPUs with an FPU | ||
62 | target/arm: Implement VLLDM for v7M CPUs with an FPU | ||
63 | target/arm: Enable FPU for Cortex-M4 and Cortex-M33 | ||
64 | 34 | ||
65 | Philippe Mathieu-Daudé (13): | 35 | Philippe Mathieu-Daudé (1): |
66 | hw/dma: Compile the bcm2835_dma device as common object | 36 | target/arm/hvf: Include missing "cpregs.h" |
67 | hw/arm/aspeed: Use TYPE_TMP105/TYPE_PCA9552 instead of hardcoded string | ||
68 | hw/arm/nseries: Use TYPE_TMP105 instead of hardcoded string | ||
69 | hw/display/tc6393xb: Remove unused functions | ||
70 | hw/devices: Move TC6393XB declarations into a new header | ||
71 | hw/devices: Move Blizzard declarations into a new header | ||
72 | hw/devices: Move CBus declarations into a new header | ||
73 | hw/devices: Move Gamepad declarations into a new header | ||
74 | hw/devices: Move TI touchscreen declarations into a new header | ||
75 | hw/devices: Move LAN9118 declarations into a new header | ||
76 | hw/net/ne2000-isa: Add guards to the header | ||
77 | hw/net/lan9118: Export TYPE_LAN9118 and use it instead of hardcoded string | ||
78 | hw/devices: Move SMSC 91C111 declaration into a new header | ||
79 | 37 | ||
80 | configure | 10 +- | 38 | Richard Henderson (114): |
81 | hw/dma/Makefile.objs | 2 +- | 39 | target/arm: Introduce TRANS, TRANS_FEAT |
82 | include/hw/arm/omap.h | 6 +- | 40 | target/arm: Move null function and sve check into gen_gvec_ool_zz |
83 | include/hw/arm/smmu-common.h | 8 +- | 41 | target/arm: Use TRANS_FEAT for gen_gvec_ool_zz |
84 | include/hw/devices.h | 62 --- | 42 | target/arm: Move null function and sve check into gen_gvec_ool_zzz |
85 | include/hw/display/blizzard.h | 22 ++ | 43 | target/arm: Introduce gen_gvec_ool_arg_zzz |
86 | include/hw/display/tc6393xb.h | 24 ++ | 44 | target/arm: Use TRANS_FEAT for gen_gvec_ool_arg_zzz |
87 | include/hw/input/gamepad.h | 19 + | 45 | target/arm: Use TRANS_FEAT for do_sve2_zzz_ool |
88 | include/hw/input/tsc2xxx.h | 36 ++ | 46 | target/arm: Move null function and sve check into gen_gvec_ool_zzzz |
89 | include/hw/misc/cbus.h | 32 ++ | 47 | target/arm: Use TRANS_FEAT for gen_gvec_ool_zzzz |
90 | include/hw/net/lan9118.h | 21 + | 48 | target/arm: Introduce gen_gvec_ool_arg_zzzz |
91 | include/hw/net/ne2000-isa.h | 6 + | 49 | target/arm: Use TRANS_FEAT for do_sve2_zzzz_ool |
92 | include/hw/net/smc91c111.h | 19 + | 50 | target/arm: Use TRANS_FEAT for gen_gvec_ool_arg_zzzz |
93 | include/qemu/typedefs.h | 1 - | 51 | target/arm: Rename do_zzxz_ool to gen_gvec_ool_arg_zzxz |
94 | target/arm/cpu.h | 95 ++++- | 52 | target/arm: Use TRANS_FEAT for gen_gvec_ool_arg_zzxz |
95 | target/arm/helper.h | 5 + | 53 | target/arm: Use TRANS_FEAT for do_sve2_zzz_data |
96 | target/arm/translate.h | 3 + | 54 | target/arm: Use TRANS_FEAT for do_sve2_zzzz_data |
97 | hw/arm/aspeed.c | 13 +- | 55 | target/arm: Use TRANS_FEAT for do_sve2_zzw_data |
98 | hw/arm/exynos4_boards.c | 3 +- | 56 | target/arm: Use TRANS_FEAT for USDOT_zzzz |
99 | hw/arm/gumstix.c | 2 +- | 57 | target/arm: Move null function and sve check into gen_gvec_ool_zzp |
100 | hw/arm/integratorcp.c | 2 +- | 58 | target/arm: Introduce gen_gvec_ool_arg_zpz |
101 | hw/arm/kzm.c | 2 +- | 59 | target/arm: Use TRANS_FEAT for gen_gvec_ool_arg_zpz |
102 | hw/arm/mainstone.c | 2 +- | 60 | target/arm: Use TRANS_FEAT for do_sve2_zpz_data |
103 | hw/arm/mps2-tz.c | 3 +- | 61 | target/arm: Rename do_zpzi_ool to gen_gvec_ool_arg_zpzi |
104 | hw/arm/mps2.c | 2 +- | 62 | target/arm: Use TRANS_FEAT for gen_gvec_ool_arg_zpzi |
105 | hw/arm/nseries.c | 7 +- | 63 | target/arm: Move null function and sve check into gen_gvec_ool_zzzp |
106 | hw/arm/palm.c | 2 +- | 64 | target/arm: Introduce gen_gvec_ool_arg_zpzz |
107 | hw/arm/realview.c | 3 +- | 65 | target/arm: Use TRANS_FEAT for gen_gvec_ool_arg_zpzz |
108 | hw/arm/smmu-common.c | 6 +- | 66 | target/arm: Use TRANS_FEAT for do_sve2_zpzz_ool |
109 | hw/arm/smmuv3.c | 28 +- | 67 | target/arm: Merge gen_gvec_fn_zz into do_mov_z |
110 | hw/arm/stellaris.c | 2 +- | 68 | target/arm: Move null function and sve check into gen_gvec_fn_zzz |
111 | hw/arm/tosa.c | 2 +- | 69 | target/arm: Rename do_zzz_fn to gen_gvec_fn_arg_zzz |
112 | hw/arm/versatilepb.c | 2 +- | 70 | target/arm: More use of gen_gvec_fn_arg_zzz |
113 | hw/arm/vexpress.c | 2 +- | 71 | target/arm: Use TRANS_FEAT for gen_gvec_fn_arg_zzz |
114 | hw/display/blizzard.c | 2 +- | 72 | target/arm: Use TRANS_FEAT for do_sve2_fn_zzz |
115 | hw/display/tc6393xb.c | 18 +- | 73 | target/arm: Use TRANS_FEAT for RAX1 |
116 | hw/input/stellaris_input.c | 2 +- | 74 | target/arm: Introduce gen_gvec_fn_arg_zzzz |
117 | hw/input/tsc2005.c | 2 +- | 75 | target/arm: Use TRANS_FEAT for do_sve2_zzzz_fn |
118 | hw/input/tsc210x.c | 4 +- | 76 | target/arm: Introduce gen_gvec_fn_zzi |
119 | hw/intc/armv7m_nvic.c | 261 +++++++++++++ | 77 | target/arm: Use TRANS_FEAT for do_zz_dbm |
120 | hw/misc/cbus.c | 2 +- | 78 | target/arm: Hoist sve access check through do_sel_z |
121 | hw/net/lan9118.c | 3 +- | 79 | target/arm: Introduce gen_gvec_fn_arg_zzi |
122 | hw/net/smc91c111.c | 2 +- | 80 | target/arm: Use TRANS_FEAT for do_sve2_fn2i |
123 | hw/ssi/xilinx_spips.c | 6 +- | 81 | target/arm: Use TRANS_FEAT for do_vpz_ool |
124 | target/arm/cpu.c | 20 + | 82 | target/arm: Use TRANS_FEAT for do_shift_imm |
125 | target/arm/helper.c | 873 +++++++++++++++++++++++++++++++++++++++--- | 83 | target/arm: Introduce do_shift_zpzi |
126 | target/arm/machine.c | 16 + | 84 | target/arm: Use TRANS_FEAT for do_shift_zpzi |
127 | target/arm/translate.c | 150 +++++++- | 85 | target/arm: Use TRANS_FEAT for do_zpzzz_ool |
128 | target/arm/vfp_helper.c | 8 + | 86 | target/arm: Move sve check into do_index |
129 | MAINTAINERS | 7 + | 87 | target/arm: Use TRANS_FEAT for do_index |
130 | 50 files changed, 1595 insertions(+), 235 deletions(-) | 88 | target/arm: Use TRANS_FEAT for do_adr |
131 | delete mode 100644 include/hw/devices.h | 89 | target/arm: Use TRANS_FEAT for do_predset |
132 | create mode 100644 include/hw/display/blizzard.h | 90 | target/arm: Use TRANS_FEAT for RDFFR, WRFFR |
133 | create mode 100644 include/hw/display/tc6393xb.h | 91 | target/arm: Use TRANS_FEAT for do_pfirst_pnext |
134 | create mode 100644 include/hw/input/gamepad.h | 92 | target/arm: Use TRANS_FEAT for do_EXT |
135 | create mode 100644 include/hw/input/tsc2xxx.h | 93 | target/arm: Use TRANS_FEAT for do_perm_pred3 |
136 | create mode 100644 include/hw/misc/cbus.h | 94 | target/arm: Use TRANS_FEAT for do_perm_pred2 |
137 | create mode 100644 include/hw/net/lan9118.h | 95 | target/arm: Move sve zip high_ofs into simd_data |
138 | create mode 100644 include/hw/net/smc91c111.h | 96 | target/arm: Use gen_gvec_ool_arg_zzz for do_zip, do_zip_q |
97 | target/arm: Use TRANS_FEAT for do_zip, do_zip_q | ||
98 | target/arm: Use TRANS_FEAT for do_clast_vector | ||
99 | target/arm: Use TRANS_FEAT for do_clast_fp | ||
100 | target/arm: Use TRANS_FEAT for do_clast_general | ||
101 | target/arm: Use TRANS_FEAT for do_last_fp | ||
102 | target/arm: Use TRANS_FEAT for do_last_general | ||
103 | target/arm: Use TRANS_FEAT for SPLICE | ||
104 | target/arm: Use TRANS_FEAT for do_ppzz_flags | ||
105 | target/arm: Use TRANS_FEAT for do_sve2_ppzz_flags | ||
106 | target/arm: Use TRANS_FEAT for do_ppzi_flags | ||
107 | target/arm: Use TRANS_FEAT for do_brk2, do_brk3 | ||
108 | target/arm: Use TRANS_FEAT for MUL_zzi | ||
109 | target/arm: Reject dup_i w/ shifted byte early | ||
110 | target/arm: Reject add/sub w/ shifted byte early | ||
111 | target/arm: Reject copy w/ shifted byte early | ||
112 | target/arm: Use TRANS_FEAT for ADD_zzi | ||
113 | target/arm: Use TRANS_FEAT for do_zzi_sat | ||
114 | target/arm: Use TRANS_FEAT for do_zzi_ool | ||
115 | target/arm: Introduce gen_gvec_{ptr,fpst}_zzzz | ||
116 | target/arm: Use TRANS_FEAT for FMMLA | ||
117 | target/arm: Move sve check into gen_gvec_fn_ppp | ||
118 | target/arm: Implement NOT (prediates) alias | ||
119 | target/arm: Use TRANS_FEAT for SEL_zpzz | ||
120 | target/arm: Use TRANS_FEAT for MOVPRFX | ||
121 | target/arm: Use TRANS_FEAT for FMLA | ||
122 | target/arm: Use TRANS_FEAT for BFMLA | ||
123 | target/arm: Rename do_zzz_fp to gen_gvec_ool_fpst_arg_zzz | ||
124 | target/arm: Use TRANS_FEAT for DO_FP3 | ||
125 | target/arm: Use TRANS_FEAT for FMUL_zzx | ||
126 | target/arm: Use TRANS_FEAT for FTMAD | ||
127 | target/arm: Move null function and sve check into do_reduce | ||
128 | target/arm: Use TRANS_FEAT for do_reduce | ||
129 | target/arm: Use TRANS_FEAT for FRECPE, FRSQRTE | ||
130 | target/arm: Expand frint_fns for MO_8 | ||
131 | target/arm: Rename do_zpz_ptr to gen_gvec_ool_fpst_arg_zpz | ||
132 | target/arm: Move null function and sve check into do_frint_mode | ||
133 | target/arm: Use TRANS_FEAT for do_frint_mode | ||
134 | target/arm: Use TRANS_FEAT for FLOGB | ||
135 | target/arm: Use TRANS_FEAT for do_ppz_fp | ||
136 | target/arm: Rename do_zpzz_ptr to gen_gvec_fpst_arg_zpzz | ||
137 | target/arm: Use TRANS_FEAT for gen_gvec_fpst_arg_zpzz | ||
138 | target/arm: Use TRANS_FEAT for FCADD | ||
139 | target/arm: Introduce gen_gvec_fpst_zzzzp | ||
140 | target/arm: Use TRANS_FEAT for gen_gvec_fpst_zzzzp | ||
141 | target/arm: Move null function and sve check into do_fp_imm | ||
142 | target/arm: Use TRANS_FEAT for DO_FP_IMM | ||
143 | target/arm: Use TRANS_FEAT for DO_FPCMP | ||
144 | target/arm: Remove assert in trans_FCMLA_zzxz | ||
145 | target/arm: Use TRANS_FEAT for FCMLA_zzxz | ||
146 | target/arm: Use TRANS_FEAT for do_narrow_extract | ||
147 | target/arm: Use TRANS_FEAT for do_shll_tb | ||
148 | target/arm: Use TRANS_FEAT for do_shr_narrow | ||
149 | target/arm: Use TRANS_FEAT for do_FMLAL_zzzw | ||
150 | target/arm: Use TRANS_FEAT for do_FMLAL_zzxw | ||
151 | target/arm: Add sve feature check for remaining trans_* functions | ||
152 | target/arm: Remove aa64_sve check from before disas_sve | ||
139 | 153 | ||
154 | docs/system/arm/emulation.rst | 1 + | ||
155 | target/arm/translate.h | 11 + | ||
156 | target/arm/sve.decode | 57 +- | ||
157 | hw/sd/allwinner-sdhost.c | 7 + | ||
158 | target/arm/hvf/hvf.c | 1 + | ||
159 | target/arm/sve_helper.c | 6 +- | ||
160 | target/arm/translate-a64.c | 2 +- | ||
161 | target/arm/translate-sve.c | 5367 +++++++++++++++-------------------------- | ||
162 | 8 files changed, 2067 insertions(+), 3385 deletions(-) | ||
163 | diff view generated by jsdifflib |
1 | Enable the FPU by default for the Cortex-M4 and Cortex-M33. | 1 | In commit 5814d587fe861fe9 we added support for emulating |
---|---|---|---|
2 | FEAT_HCX (Support for the HCRX_EL2 register). However we | ||
3 | forgot to add it to the list in emulated.rst. Correct the | ||
4 | omission. | ||
2 | 5 | ||
6 | Fixes: 5814d587fe861fe9 ("target/arm: Enable FEAT_HCX for -cpu max") | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
5 | Message-id: 20190416125744.27770-27-peter.maydell@linaro.org | 9 | Message-id: 20220520084320.424166-1-peter.maydell@linaro.org |
6 | --- | 10 | --- |
7 | target/arm/cpu.c | 8 ++++++++ | 11 | docs/system/arm/emulation.rst | 1 + |
8 | 1 file changed, 8 insertions(+) | 12 | 1 file changed, 1 insertion(+) |
9 | 13 | ||
10 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | 14 | diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst |
11 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
12 | --- a/target/arm/cpu.c | 16 | --- a/docs/system/arm/emulation.rst |
13 | +++ b/target/arm/cpu.c | 17 | +++ b/docs/system/arm/emulation.rst |
14 | @@ -XXX,XX +XXX,XX @@ static void cortex_m4_initfn(Object *obj) | 18 | @@ -XXX,XX +XXX,XX @@ the following architecture extensions: |
15 | set_feature(&cpu->env, ARM_FEATURE_M); | 19 | - FEAT_FRINTTS (Floating-point to integer instructions) |
16 | set_feature(&cpu->env, ARM_FEATURE_M_MAIN); | 20 | - FEAT_FlagM (Flag manipulation instructions v2) |
17 | set_feature(&cpu->env, ARM_FEATURE_THUMB_DSP); | 21 | - FEAT_FlagM2 (Enhancements to flag manipulation instructions) |
18 | + set_feature(&cpu->env, ARM_FEATURE_VFP4); | 22 | +- FEAT_HCX (Support for the HCRX_EL2 register) |
19 | cpu->midr = 0x410fc240; /* r0p0 */ | 23 | - FEAT_HPDS (Hierarchical permission disables) |
20 | cpu->pmsav7_dregion = 8; | 24 | - FEAT_I8MM (AArch64 Int8 matrix multiplication instructions) |
21 | + cpu->isar.mvfr0 = 0x10110021; | 25 | - FEAT_IDST (ID space trap handling) |
22 | + cpu->isar.mvfr1 = 0x11000011; | ||
23 | + cpu->isar.mvfr2 = 0x00000000; | ||
24 | cpu->id_pfr0 = 0x00000030; | ||
25 | cpu->id_pfr1 = 0x00000200; | ||
26 | cpu->id_dfr0 = 0x00100000; | ||
27 | @@ -XXX,XX +XXX,XX @@ static void cortex_m33_initfn(Object *obj) | ||
28 | set_feature(&cpu->env, ARM_FEATURE_M_MAIN); | ||
29 | set_feature(&cpu->env, ARM_FEATURE_M_SECURITY); | ||
30 | set_feature(&cpu->env, ARM_FEATURE_THUMB_DSP); | ||
31 | + set_feature(&cpu->env, ARM_FEATURE_VFP4); | ||
32 | cpu->midr = 0x410fd213; /* r0p3 */ | ||
33 | cpu->pmsav7_dregion = 16; | ||
34 | cpu->sau_sregion = 8; | ||
35 | + cpu->isar.mvfr0 = 0x10110021; | ||
36 | + cpu->isar.mvfr1 = 0x11000011; | ||
37 | + cpu->isar.mvfr2 = 0x00000040; | ||
38 | cpu->id_pfr0 = 0x00000030; | ||
39 | cpu->id_pfr1 = 0x00000210; | ||
40 | cpu->id_dfr0 = 0x00200000; | ||
41 | -- | 26 | -- |
42 | 2.20.1 | 27 | 2.25.1 |
43 | |||
44 | diff view generated by jsdifflib |
1 | If the floating point extension is present, then the SG instruction | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | must clear the CONTROL_S.SFPA bit. Implement this. | ||
3 | 2 | ||
4 | (On a no-FPU system the bit will always be zero, so we don't need | 3 | Fix when building HVF on macOS Aarch64: |
5 | to make the clearing of the bit conditional on ARM_FEATURE_VFP.) | ||
6 | 4 | ||
5 | target/arm/hvf/hvf.c:586:15: error: unknown type name 'ARMCPRegInfo'; did you mean 'ARMCPUInfo'? | ||
6 | const ARMCPRegInfo *ri; | ||
7 | ^~~~~~~~~~~~ | ||
8 | ARMCPUInfo | ||
9 | target/arm/cpu-qom.h:38:3: note: 'ARMCPUInfo' declared here | ||
10 | } ARMCPUInfo; | ||
11 | ^ | ||
12 | target/arm/hvf/hvf.c:589:14: error: implicit declaration of function 'get_arm_cp_reginfo' is invalid in C99 [-Werror,-Wimplicit-function-declaration] | ||
13 | ri = get_arm_cp_reginfo(arm_cpu->cp_regs, key); | ||
14 | ^ | ||
15 | target/arm/hvf/hvf.c:589:12: warning: incompatible integer to pointer conversion assigning to 'const ARMCPUInfo *' (aka 'const struct ARMCPUInfo *') from 'int' [-Wint-conversion] | ||
16 | ri = get_arm_cp_reginfo(arm_cpu->cp_regs, key); | ||
17 | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
18 | target/arm/hvf/hvf.c:591:26: error: no member named 'type' in 'struct ARMCPUInfo' | ||
19 | assert(!(ri->type & ARM_CP_NO_RAW)); | ||
20 | ~~ ^ | ||
21 | /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/assert.h:99:25: note: expanded from macro 'assert' | ||
22 | (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __ASSERT_FILE_NAME, __LINE__, #e) : (void)0) | ||
23 | ^ | ||
24 | target/arm/hvf/hvf.c:591:33: error: use of undeclared identifier 'ARM_CP_NO_RAW' | ||
25 | assert(!(ri->type & ARM_CP_NO_RAW)); | ||
26 | ^ | ||
27 | 1 warning and 4 errors generated. | ||
28 | |||
29 | Fixes: cf7c6d1004 ("target/arm: Split out cpregs.h") | ||
30 | Reported-by: Duncan Bayne <duncan@bayne.id.au> | ||
31 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
32 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
33 | Message-id: 20220525161926.34233-1-philmd@fungible.com | ||
34 | Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1029 | ||
35 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 36 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20190416125744.27770-8-peter.maydell@linaro.org | ||
10 | --- | 37 | --- |
11 | target/arm/helper.c | 1 + | 38 | target/arm/hvf/hvf.c | 1 + |
12 | 1 file changed, 1 insertion(+) | 39 | 1 file changed, 1 insertion(+) |
13 | 40 | ||
14 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 41 | diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c |
15 | index XXXXXXX..XXXXXXX 100644 | 42 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/helper.c | 43 | --- a/target/arm/hvf/hvf.c |
17 | +++ b/target/arm/helper.c | 44 | +++ b/target/arm/hvf/hvf.c |
18 | @@ -XXX,XX +XXX,XX @@ static bool v7m_handle_execute_nsc(ARMCPU *cpu) | 45 | @@ -XXX,XX +XXX,XX @@ |
19 | qemu_log_mask(CPU_LOG_INT, "...really an SG instruction at 0x%08" PRIx32 | 46 | #include "sysemu/hvf_int.h" |
20 | ", executing it\n", env->regs[15]); | 47 | #include "sysemu/hw_accel.h" |
21 | env->regs[14] &= ~1; | 48 | #include "hvf_arm.h" |
22 | + env->v7m.control[M_REG_S] &= ~R_V7M_CONTROL_SFPA_MASK; | 49 | +#include "cpregs.h" |
23 | switch_v7m_security_state(env, true); | 50 | |
24 | xpsr_write(env, 0, XPSR_IT); | 51 | #include <mach/mach_time.h> |
25 | env->regs[15] += 4; | 52 | |
26 | -- | 53 | -- |
27 | 2.20.1 | 54 | 2.25.1 |
28 | 55 | ||
29 | 56 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Icenowy Zheng <uwu@icenowy.me> |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Markus Armbruster <armbru@redhat.com> | 3 | U-Boot queries the FIFO water level to reduce checking status register |
4 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 4 | when doing PIO SD card operation. |
5 | Message-id: 20190412165416.7977-12-philmd@redhat.com | 5 | |
6 | Report a FIFO water level of 1 when data is ready, to prevent the code | ||
7 | from trying to read 0 words from the FIFO each time. | ||
8 | |||
9 | Signed-off-by: Icenowy Zheng <uwu@icenowy.me> | ||
10 | Message-id: 20220520124200.2112699-1-uwu@icenowy.me | ||
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 13 | --- |
8 | include/hw/net/lan9118.h | 2 ++ | 14 | hw/sd/allwinner-sdhost.c | 7 +++++++ |
9 | hw/arm/exynos4_boards.c | 3 ++- | 15 | 1 file changed, 7 insertions(+) |
10 | hw/arm/mps2-tz.c | 3 ++- | ||
11 | hw/net/lan9118.c | 1 - | ||
12 | 4 files changed, 6 insertions(+), 3 deletions(-) | ||
13 | 16 | ||
14 | diff --git a/include/hw/net/lan9118.h b/include/hw/net/lan9118.h | 17 | diff --git a/hw/sd/allwinner-sdhost.c b/hw/sd/allwinner-sdhost.c |
15 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/include/hw/net/lan9118.h | 19 | --- a/hw/sd/allwinner-sdhost.c |
17 | +++ b/include/hw/net/lan9118.h | 20 | +++ b/hw/sd/allwinner-sdhost.c |
18 | @@ -XXX,XX +XXX,XX @@ | 21 | @@ -XXX,XX +XXX,XX @@ enum { |
19 | #include "hw/irq.h" | ||
20 | #include "net/net.h" | ||
21 | |||
22 | +#define TYPE_LAN9118 "lan9118" | ||
23 | + | ||
24 | void lan9118_init(NICInfo *, uint32_t, qemu_irq); | ||
25 | |||
26 | #endif | ||
27 | diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c | ||
28 | index XXXXXXX..XXXXXXX 100644 | ||
29 | --- a/hw/arm/exynos4_boards.c | ||
30 | +++ b/hw/arm/exynos4_boards.c | ||
31 | @@ -XXX,XX +XXX,XX @@ | ||
32 | #include "hw/arm/arm.h" | ||
33 | #include "exec/address-spaces.h" | ||
34 | #include "hw/arm/exynos4210.h" | ||
35 | +#include "hw/net/lan9118.h" | ||
36 | #include "hw/boards.h" | ||
37 | |||
38 | #undef DEBUG | ||
39 | @@ -XXX,XX +XXX,XX @@ static void lan9215_init(uint32_t base, qemu_irq irq) | ||
40 | /* This should be a 9215 but the 9118 is close enough */ | ||
41 | if (nd_table[0].used) { | ||
42 | qemu_check_nic_model(&nd_table[0], "lan9118"); | ||
43 | - dev = qdev_create(NULL, "lan9118"); | ||
44 | + dev = qdev_create(NULL, TYPE_LAN9118); | ||
45 | qdev_set_nic_properties(dev, &nd_table[0]); | ||
46 | qdev_prop_set_uint32(dev, "mode_16bit", 1); | ||
47 | qdev_init_nofail(dev); | ||
48 | diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c | ||
49 | index XXXXXXX..XXXXXXX 100644 | ||
50 | --- a/hw/arm/mps2-tz.c | ||
51 | +++ b/hw/arm/mps2-tz.c | ||
52 | @@ -XXX,XX +XXX,XX @@ | ||
53 | #include "hw/arm/armsse.h" | ||
54 | #include "hw/dma/pl080.h" | ||
55 | #include "hw/ssi/pl022.h" | ||
56 | +#include "hw/net/lan9118.h" | ||
57 | #include "net/net.h" | ||
58 | #include "hw/core/split-irq.h" | ||
59 | |||
60 | @@ -XXX,XX +XXX,XX @@ static MemoryRegion *make_eth_dev(MPS2TZMachineState *mms, void *opaque, | ||
61 | * except that it doesn't support the checksum-offload feature. | ||
62 | */ | ||
63 | qemu_check_nic_model(nd, "lan9118"); | ||
64 | - mms->lan9118 = qdev_create(NULL, "lan9118"); | ||
65 | + mms->lan9118 = qdev_create(NULL, TYPE_LAN9118); | ||
66 | qdev_set_nic_properties(mms->lan9118, nd); | ||
67 | qdev_init_nofail(mms->lan9118); | ||
68 | |||
69 | diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c | ||
70 | index XXXXXXX..XXXXXXX 100644 | ||
71 | --- a/hw/net/lan9118.c | ||
72 | +++ b/hw/net/lan9118.c | ||
73 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_lan9118_packet = { | ||
74 | } | ||
75 | }; | 22 | }; |
76 | 23 | ||
77 | -#define TYPE_LAN9118 "lan9118" | 24 | enum { |
78 | #define LAN9118(obj) OBJECT_CHECK(lan9118_state, (obj), TYPE_LAN9118) | 25 | + SD_STAR_FIFO_EMPTY = (1 << 2), |
79 | 26 | SD_STAR_CARD_PRESENT = (1 << 8), | |
80 | typedef struct { | 27 | + SD_STAR_FIFO_LEVEL_1 = (1 << 17), |
28 | }; | ||
29 | |||
30 | enum { | ||
31 | @@ -XXX,XX +XXX,XX @@ static uint64_t allwinner_sdhost_read(void *opaque, hwaddr offset, | ||
32 | break; | ||
33 | case REG_SD_STAR: /* Status */ | ||
34 | res = s->status; | ||
35 | + if (sdbus_data_ready(&s->sdbus)) { | ||
36 | + res |= SD_STAR_FIFO_LEVEL_1; | ||
37 | + } else { | ||
38 | + res |= SD_STAR_FIFO_EMPTY; | ||
39 | + } | ||
40 | break; | ||
41 | case REG_SD_FWLR: /* FIFO Water Level */ | ||
42 | res = s->fifo_wlevel; | ||
81 | -- | 43 | -- |
82 | 2.20.1 | 44 | 2.25.1 |
83 | |||
84 | diff view generated by jsdifflib |
1 | The M-profile FPCCR.ASPEN bit indicates that automatic floating-point | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | context preservation is enabled. Before executing any floating-point | ||
3 | instruction, if FPCCR.ASPEN is set and the CONTROL FPCA/SFPA bits | ||
4 | indicate that there is no active floating point context then we | ||
5 | must create a new context (by initializing FPSCR and setting | ||
6 | FPCA/SFPA to indicate that the context is now active). In the | ||
7 | pseudocode this is handled by ExecuteFPCheck(). | ||
8 | 2 | ||
9 | Implement this with a new TB flag which tracks whether we | 3 | Steal the idea for these leaf function expanders from PowerPC. |
10 | need to create a new FP context. | ||
11 | 4 | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20220527181907.189259-2-richard.henderson@linaro.org | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
14 | Message-id: 20190416125744.27770-20-peter.maydell@linaro.org | ||
15 | --- | 9 | --- |
16 | target/arm/cpu.h | 2 ++ | 10 | target/arm/translate.h | 11 +++++++++++ |
17 | target/arm/translate.h | 1 + | 11 | 1 file changed, 11 insertions(+) |
18 | target/arm/helper.c | 13 +++++++++++++ | ||
19 | target/arm/translate.c | 29 +++++++++++++++++++++++++++++ | ||
20 | 4 files changed, 45 insertions(+) | ||
21 | 12 | ||
22 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
23 | index XXXXXXX..XXXXXXX 100644 | ||
24 | --- a/target/arm/cpu.h | ||
25 | +++ b/target/arm/cpu.h | ||
26 | @@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_A32, NS, 6, 1) | ||
27 | FIELD(TBFLAG_A32, VFPEN, 7, 1) | ||
28 | FIELD(TBFLAG_A32, CONDEXEC, 8, 8) | ||
29 | FIELD(TBFLAG_A32, SCTLR_B, 16, 1) | ||
30 | +/* For M profile only, set if we must create a new FP context */ | ||
31 | +FIELD(TBFLAG_A32, NEW_FP_CTXT_NEEDED, 19, 1) | ||
32 | /* For M profile only, set if FPCCR.S does not match current security state */ | ||
33 | FIELD(TBFLAG_A32, FPCCR_S_WRONG, 20, 1) | ||
34 | /* For M profile only, Handler (ie not Thread) mode */ | ||
35 | diff --git a/target/arm/translate.h b/target/arm/translate.h | 13 | diff --git a/target/arm/translate.h b/target/arm/translate.h |
36 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
37 | --- a/target/arm/translate.h | 15 | --- a/target/arm/translate.h |
38 | +++ b/target/arm/translate.h | 16 | +++ b/target/arm/translate.h |
39 | @@ -XXX,XX +XXX,XX @@ typedef struct DisasContext { | 17 | @@ -XXX,XX +XXX,XX @@ static inline MemOp finalize_memop(DisasContext *s, MemOp opc) |
40 | bool v8m_secure; /* true if v8M and we're in Secure mode */ | 18 | */ |
41 | bool v8m_stackcheck; /* true if we need to perform v8M stack limit checks */ | 19 | uint64_t asimd_imm_const(uint32_t imm, int cmode, int op); |
42 | bool v8m_fpccr_s_wrong; /* true if v8M FPCCR.S != v8m_secure */ | 20 | |
43 | + bool v7m_new_fp_ctxt_needed; /* ASPEN set but no active FP context */ | 21 | +/* |
44 | /* Immediate value in AArch32 SVC insn; must be set if is_jmp == DISAS_SWI | 22 | + * Helpers for implementing sets of trans_* functions. |
45 | * so that top level loop can generate correct syndrome information. | 23 | + * Defer the implementation of NAME to FUNC, with optional extra arguments. |
46 | */ | 24 | + */ |
47 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 25 | +#define TRANS(NAME, FUNC, ...) \ |
48 | index XXXXXXX..XXXXXXX 100644 | 26 | + static bool trans_##NAME(DisasContext *s, arg_##NAME *a) \ |
49 | --- a/target/arm/helper.c | 27 | + { return FUNC(s, __VA_ARGS__); } |
50 | +++ b/target/arm/helper.c | 28 | +#define TRANS_FEAT(NAME, FEAT, FUNC, ...) \ |
51 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | 29 | + static bool trans_##NAME(DisasContext *s, arg_##NAME *a) \ |
52 | flags = FIELD_DP32(flags, TBFLAG_A32, FPCCR_S_WRONG, 1); | 30 | + { return dc_isar_feature(FEAT, s) && FUNC(s, __VA_ARGS__); } |
53 | } | ||
54 | |||
55 | + if (arm_feature(env, ARM_FEATURE_M) && | ||
56 | + (env->v7m.fpccr[env->v7m.secure] & R_V7M_FPCCR_ASPEN_MASK) && | ||
57 | + (!(env->v7m.control[M_REG_S] & R_V7M_CONTROL_FPCA_MASK) || | ||
58 | + (env->v7m.secure && | ||
59 | + !(env->v7m.control[M_REG_S] & R_V7M_CONTROL_SFPA_MASK)))) { | ||
60 | + /* | ||
61 | + * ASPEN is set, but FPCA/SFPA indicate that there is no active | ||
62 | + * FP context; we must create a new FP context before executing | ||
63 | + * any FP insn. | ||
64 | + */ | ||
65 | + flags = FIELD_DP32(flags, TBFLAG_A32, NEW_FP_CTXT_NEEDED, 1); | ||
66 | + } | ||
67 | + | 31 | + |
68 | *pflags = flags; | 32 | #endif /* TARGET_ARM_TRANSLATE_H */ |
69 | *cs_base = 0; | ||
70 | } | ||
71 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
72 | index XXXXXXX..XXXXXXX 100644 | ||
73 | --- a/target/arm/translate.c | ||
74 | +++ b/target/arm/translate.c | ||
75 | @@ -XXX,XX +XXX,XX @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) | ||
76 | /* Don't need to do this for any further FP insns in this TB */ | ||
77 | s->v8m_fpccr_s_wrong = false; | ||
78 | } | ||
79 | + | ||
80 | + if (s->v7m_new_fp_ctxt_needed) { | ||
81 | + /* | ||
82 | + * Create new FP context by updating CONTROL.FPCA, CONTROL.SFPA | ||
83 | + * and the FPSCR. | ||
84 | + */ | ||
85 | + TCGv_i32 control, fpscr; | ||
86 | + uint32_t bits = R_V7M_CONTROL_FPCA_MASK; | ||
87 | + | ||
88 | + fpscr = load_cpu_field(v7m.fpdscr[s->v8m_secure]); | ||
89 | + gen_helper_vfp_set_fpscr(cpu_env, fpscr); | ||
90 | + tcg_temp_free_i32(fpscr); | ||
91 | + /* | ||
92 | + * We don't need to arrange to end the TB, because the only | ||
93 | + * parts of FPSCR which we cache in the TB flags are the VECLEN | ||
94 | + * and VECSTRIDE, and those don't exist for M-profile. | ||
95 | + */ | ||
96 | + | ||
97 | + if (s->v8m_secure) { | ||
98 | + bits |= R_V7M_CONTROL_SFPA_MASK; | ||
99 | + } | ||
100 | + control = load_cpu_field(v7m.control[M_REG_S]); | ||
101 | + tcg_gen_ori_i32(control, control, bits); | ||
102 | + store_cpu_field(control, v7m.control[M_REG_S]); | ||
103 | + /* Don't need to do this for any further FP insns in this TB */ | ||
104 | + s->v7m_new_fp_ctxt_needed = false; | ||
105 | + } | ||
106 | } | ||
107 | |||
108 | if (extract32(insn, 28, 4) == 0xf) { | ||
109 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) | ||
110 | regime_is_secure(env, dc->mmu_idx); | ||
111 | dc->v8m_stackcheck = FIELD_EX32(tb_flags, TBFLAG_A32, STACKCHECK); | ||
112 | dc->v8m_fpccr_s_wrong = FIELD_EX32(tb_flags, TBFLAG_A32, FPCCR_S_WRONG); | ||
113 | + dc->v7m_new_fp_ctxt_needed = | ||
114 | + FIELD_EX32(tb_flags, TBFLAG_A32, NEW_FP_CTXT_NEEDED); | ||
115 | dc->cp_regs = cpu->cp_regs; | ||
116 | dc->features = env->features; | ||
117 | |||
118 | -- | 33 | -- |
119 | 2.20.1 | 34 | 2.25.1 |
120 | |||
121 | 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 | Message-id: 20220527181907.189259-3-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 36 +++++++++++++++--------------------- | ||
9 | 1 file changed, 15 insertions(+), 21 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 int pred_gvec_reg_size(DisasContext *s) | ||
16 | } | ||
17 | |||
18 | /* Invoke an out-of-line helper on 2 Zregs. */ | ||
19 | -static void gen_gvec_ool_zz(DisasContext *s, gen_helper_gvec_2 *fn, | ||
20 | +static bool gen_gvec_ool_zz(DisasContext *s, gen_helper_gvec_2 *fn, | ||
21 | int rd, int rn, int data) | ||
22 | { | ||
23 | - unsigned vsz = vec_full_reg_size(s); | ||
24 | - tcg_gen_gvec_2_ool(vec_full_reg_offset(s, rd), | ||
25 | - vec_full_reg_offset(s, rn), | ||
26 | - vsz, vsz, data, fn); | ||
27 | + if (fn == NULL) { | ||
28 | + return false; | ||
29 | + } | ||
30 | + if (sve_access_check(s)) { | ||
31 | + unsigned vsz = vec_full_reg_size(s); | ||
32 | + tcg_gen_gvec_2_ool(vec_full_reg_offset(s, rd), | ||
33 | + vec_full_reg_offset(s, rn), | ||
34 | + vsz, vsz, data, fn); | ||
35 | + } | ||
36 | + return true; | ||
37 | } | ||
38 | |||
39 | /* Invoke an out-of-line helper on 3 Zregs. */ | ||
40 | @@ -XXX,XX +XXX,XX @@ static bool trans_FEXPA(DisasContext *s, arg_rr_esz *a) | ||
41 | gen_helper_sve_fexpa_s, | ||
42 | gen_helper_sve_fexpa_d, | ||
43 | }; | ||
44 | - if (a->esz == 0) { | ||
45 | - return false; | ||
46 | - } | ||
47 | - if (sve_access_check(s)) { | ||
48 | - gen_gvec_ool_zz(s, fns[a->esz], a->rd, a->rn, 0); | ||
49 | - } | ||
50 | - return true; | ||
51 | + return gen_gvec_ool_zz(s, fns[a->esz], a->rd, a->rn, 0); | ||
52 | } | ||
53 | |||
54 | static bool trans_FTSSEL(DisasContext *s, arg_rrr_esz *a) | ||
55 | @@ -XXX,XX +XXX,XX @@ static bool trans_REV_v(DisasContext *s, arg_rr_esz *a) | ||
56 | gen_helper_sve_rev_b, gen_helper_sve_rev_h, | ||
57 | gen_helper_sve_rev_s, gen_helper_sve_rev_d | ||
58 | }; | ||
59 | - | ||
60 | - if (sve_access_check(s)) { | ||
61 | - gen_gvec_ool_zz(s, fns[a->esz], a->rd, a->rn, 0); | ||
62 | - } | ||
63 | - return true; | ||
64 | + return gen_gvec_ool_zz(s, fns[a->esz], a->rd, a->rn, 0); | ||
65 | } | ||
66 | |||
67 | static bool trans_TBL(DisasContext *s, arg_rrr_esz *a) | ||
68 | @@ -XXX,XX +XXX,XX @@ static bool trans_AESMC(DisasContext *s, arg_AESMC *a) | ||
69 | if (!dc_isar_feature(aa64_sve2_aes, s)) { | ||
70 | return false; | ||
71 | } | ||
72 | - if (sve_access_check(s)) { | ||
73 | - gen_gvec_ool_zz(s, gen_helper_crypto_aesmc, a->rd, a->rd, a->decrypt); | ||
74 | - } | ||
75 | - return true; | ||
76 | + return gen_gvec_ool_zz(s, gen_helper_crypto_aesmc, | ||
77 | + a->rd, a->rd, a->decrypt); | ||
78 | } | ||
79 | |||
80 | static bool do_aese(DisasContext *s, arg_rrr_esz *a, bool decrypt) | ||
81 | -- | ||
82 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions using gen_gvec_ool_zz to TRANS_FEAT. | ||
4 | |||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20220527181907.189259-4-richard.henderson@linaro.org | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | target/arm/translate-sve.c | 39 +++++++++++++------------------------- | ||
11 | 1 file changed, 13 insertions(+), 26 deletions(-) | ||
12 | |||
13 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/arm/translate-sve.c | ||
16 | +++ b/target/arm/translate-sve.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static bool trans_ADR_u32(DisasContext *s, arg_rrri *a) | ||
18 | *** SVE Integer Misc - Unpredicated Group | ||
19 | */ | ||
20 | |||
21 | -static bool trans_FEXPA(DisasContext *s, arg_rr_esz *a) | ||
22 | -{ | ||
23 | - static gen_helper_gvec_2 * const fns[4] = { | ||
24 | - NULL, | ||
25 | - gen_helper_sve_fexpa_h, | ||
26 | - gen_helper_sve_fexpa_s, | ||
27 | - gen_helper_sve_fexpa_d, | ||
28 | - }; | ||
29 | - return gen_gvec_ool_zz(s, fns[a->esz], a->rd, a->rn, 0); | ||
30 | -} | ||
31 | +static gen_helper_gvec_2 * const fexpa_fns[4] = { | ||
32 | + NULL, gen_helper_sve_fexpa_h, | ||
33 | + gen_helper_sve_fexpa_s, gen_helper_sve_fexpa_d, | ||
34 | +}; | ||
35 | +TRANS_FEAT(FEXPA, aa64_sve, gen_gvec_ool_zz, | ||
36 | + fexpa_fns[a->esz], a->rd, a->rn, 0) | ||
37 | |||
38 | static bool trans_FTSSEL(DisasContext *s, arg_rrr_esz *a) | ||
39 | { | ||
40 | @@ -XXX,XX +XXX,XX @@ static bool trans_INSR_r(DisasContext *s, arg_rrr_esz *a) | ||
41 | return true; | ||
42 | } | ||
43 | |||
44 | -static bool trans_REV_v(DisasContext *s, arg_rr_esz *a) | ||
45 | -{ | ||
46 | - static gen_helper_gvec_2 * const fns[4] = { | ||
47 | - gen_helper_sve_rev_b, gen_helper_sve_rev_h, | ||
48 | - gen_helper_sve_rev_s, gen_helper_sve_rev_d | ||
49 | - }; | ||
50 | - return gen_gvec_ool_zz(s, fns[a->esz], a->rd, a->rn, 0); | ||
51 | -} | ||
52 | +static gen_helper_gvec_2 * const rev_fns[4] = { | ||
53 | + gen_helper_sve_rev_b, gen_helper_sve_rev_h, | ||
54 | + gen_helper_sve_rev_s, gen_helper_sve_rev_d | ||
55 | +}; | ||
56 | +TRANS_FEAT(REV_v, aa64_sve, gen_gvec_ool_zz, rev_fns[a->esz], a->rd, a->rn, 0) | ||
57 | |||
58 | static bool trans_TBL(DisasContext *s, arg_rrr_esz *a) | ||
59 | { | ||
60 | @@ -XXX,XX +XXX,XX @@ static bool trans_USDOT_zzzz(DisasContext *s, arg_USDOT_zzzz *a) | ||
61 | return true; | ||
62 | } | ||
63 | |||
64 | -static bool trans_AESMC(DisasContext *s, arg_AESMC *a) | ||
65 | -{ | ||
66 | - if (!dc_isar_feature(aa64_sve2_aes, s)) { | ||
67 | - return false; | ||
68 | - } | ||
69 | - return gen_gvec_ool_zz(s, gen_helper_crypto_aesmc, | ||
70 | - a->rd, a->rd, a->decrypt); | ||
71 | -} | ||
72 | +TRANS_FEAT(AESMC, aa64_sve2_aes, gen_gvec_ool_zz, | ||
73 | + gen_helper_crypto_aesmc, a->rd, a->rd, a->decrypt) | ||
74 | |||
75 | static bool do_aese(DisasContext *s, arg_rrr_esz *a, bool decrypt) | ||
76 | { | ||
77 | -- | ||
78 | 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 | Message-id: 20220527181907.189259-5-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 74 ++++++++++++-------------------------- | ||
9 | 1 file changed, 23 insertions(+), 51 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 gen_gvec_ool_zz(DisasContext *s, gen_helper_gvec_2 *fn, | ||
16 | } | ||
17 | |||
18 | /* Invoke an out-of-line helper on 3 Zregs. */ | ||
19 | -static void gen_gvec_ool_zzz(DisasContext *s, gen_helper_gvec_3 *fn, | ||
20 | +static bool gen_gvec_ool_zzz(DisasContext *s, gen_helper_gvec_3 *fn, | ||
21 | int rd, int rn, int rm, int data) | ||
22 | { | ||
23 | - unsigned vsz = vec_full_reg_size(s); | ||
24 | - tcg_gen_gvec_3_ool(vec_full_reg_offset(s, rd), | ||
25 | - vec_full_reg_offset(s, rn), | ||
26 | - vec_full_reg_offset(s, rm), | ||
27 | - vsz, vsz, data, fn); | ||
28 | + if (fn == NULL) { | ||
29 | + return false; | ||
30 | + } | ||
31 | + if (sve_access_check(s)) { | ||
32 | + unsigned vsz = vec_full_reg_size(s); | ||
33 | + tcg_gen_gvec_3_ool(vec_full_reg_offset(s, rd), | ||
34 | + vec_full_reg_offset(s, rn), | ||
35 | + vec_full_reg_offset(s, rm), | ||
36 | + vsz, vsz, data, fn); | ||
37 | + } | ||
38 | + return true; | ||
39 | } | ||
40 | |||
41 | /* Invoke an out-of-line helper on 4 Zregs. */ | ||
42 | @@ -XXX,XX +XXX,XX @@ static bool trans_LSL_zzi(DisasContext *s, arg_rri_esz *a) | ||
43 | |||
44 | static bool do_zzw_ool(DisasContext *s, arg_rrr_esz *a, gen_helper_gvec_3 *fn) | ||
45 | { | ||
46 | - if (fn == NULL) { | ||
47 | - return false; | ||
48 | - } | ||
49 | - if (sve_access_check(s)) { | ||
50 | - gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, 0); | ||
51 | - } | ||
52 | - return true; | ||
53 | + return gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, 0); | ||
54 | } | ||
55 | |||
56 | #define DO_ZZW(NAME, name) \ | ||
57 | @@ -XXX,XX +XXX,XX @@ static bool trans_RDVL(DisasContext *s, arg_RDVL *a) | ||
58 | |||
59 | static bool do_adr(DisasContext *s, arg_rrri *a, gen_helper_gvec_3 *fn) | ||
60 | { | ||
61 | - if (sve_access_check(s)) { | ||
62 | - gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, a->imm); | ||
63 | - } | ||
64 | - return true; | ||
65 | + return gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, a->imm); | ||
66 | } | ||
67 | |||
68 | static bool trans_ADR_p32(DisasContext *s, arg_rrri *a) | ||
69 | @@ -XXX,XX +XXX,XX @@ static bool trans_FTSSEL(DisasContext *s, arg_rrr_esz *a) | ||
70 | gen_helper_sve_ftssel_s, | ||
71 | gen_helper_sve_ftssel_d, | ||
72 | }; | ||
73 | - if (a->esz == 0) { | ||
74 | - return false; | ||
75 | - } | ||
76 | - if (sve_access_check(s)) { | ||
77 | - gen_gvec_ool_zzz(s, fns[a->esz], a->rd, a->rn, a->rm, 0); | ||
78 | - } | ||
79 | - return true; | ||
80 | + return gen_gvec_ool_zzz(s, fns[a->esz], a->rd, a->rn, a->rm, 0); | ||
81 | } | ||
82 | |||
83 | /* | ||
84 | @@ -XXX,XX +XXX,XX @@ static bool trans_TBL(DisasContext *s, arg_rrr_esz *a) | ||
85 | gen_helper_sve_tbl_b, gen_helper_sve_tbl_h, | ||
86 | gen_helper_sve_tbl_s, gen_helper_sve_tbl_d | ||
87 | }; | ||
88 | - | ||
89 | - if (sve_access_check(s)) { | ||
90 | - gen_gvec_ool_zzz(s, fns[a->esz], a->rd, a->rn, a->rm, 0); | ||
91 | - } | ||
92 | - return true; | ||
93 | + return gen_gvec_ool_zzz(s, fns[a->esz], a->rd, a->rn, a->rm, 0); | ||
94 | } | ||
95 | |||
96 | static bool trans_TBL_sve2(DisasContext *s, arg_rrr_esz *a) | ||
97 | @@ -XXX,XX +XXX,XX @@ static bool trans_TBX(DisasContext *s, arg_rrr_esz *a) | ||
98 | if (!dc_isar_feature(aa64_sve2, s)) { | ||
99 | return false; | ||
100 | } | ||
101 | - if (sve_access_check(s)) { | ||
102 | - gen_gvec_ool_zzz(s, fns[a->esz], a->rd, a->rn, a->rm, 0); | ||
103 | - } | ||
104 | - return true; | ||
105 | + return gen_gvec_ool_zzz(s, fns[a->esz], a->rd, a->rn, a->rm, 0); | ||
106 | } | ||
107 | |||
108 | static bool trans_UNPK(DisasContext *s, arg_UNPK *a) | ||
109 | @@ -XXX,XX +XXX,XX @@ static bool do_zip(DisasContext *s, arg_rrr_esz *a, bool high) | ||
110 | static bool do_zzz_data_ool(DisasContext *s, arg_rrr_esz *a, int data, | ||
111 | gen_helper_gvec_3 *fn) | ||
112 | { | ||
113 | - if (sve_access_check(s)) { | ||
114 | - gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, data); | ||
115 | - } | ||
116 | - return true; | ||
117 | + return gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, data); | ||
118 | } | ||
119 | |||
120 | static bool trans_ZIP1_z(DisasContext *s, arg_rrr_esz *a) | ||
121 | @@ -XXX,XX +XXX,XX @@ static bool trans_MUL_zzz(DisasContext *s, arg_rrr_esz *a) | ||
122 | static bool do_sve2_zzz_ool(DisasContext *s, arg_rrr_esz *a, | ||
123 | gen_helper_gvec_3 *fn) | ||
124 | { | ||
125 | - if (fn == NULL || !dc_isar_feature(aa64_sve2, s)) { | ||
126 | + if (!dc_isar_feature(aa64_sve2, s)) { | ||
127 | return false; | ||
128 | } | ||
129 | - if (sve_access_check(s)) { | ||
130 | - gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, 0); | ||
131 | - } | ||
132 | - return true; | ||
133 | + return gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, 0); | ||
134 | } | ||
135 | |||
136 | static bool trans_SMULH_zzz(DisasContext *s, arg_rrr_esz *a) | ||
137 | @@ -XXX,XX +XXX,XX @@ static bool do_aese(DisasContext *s, arg_rrr_esz *a, bool decrypt) | ||
138 | if (!dc_isar_feature(aa64_sve2_aes, s)) { | ||
139 | return false; | ||
140 | } | ||
141 | - if (sve_access_check(s)) { | ||
142 | - gen_gvec_ool_zzz(s, gen_helper_crypto_aese, | ||
143 | - a->rd, a->rn, a->rm, decrypt); | ||
144 | - } | ||
145 | - return true; | ||
146 | + return gen_gvec_ool_zzz(s, gen_helper_crypto_aese, | ||
147 | + a->rd, a->rn, a->rm, decrypt); | ||
148 | } | ||
149 | |||
150 | static bool trans_AESE(DisasContext *s, arg_rrr_esz *a) | ||
151 | @@ -XXX,XX +XXX,XX @@ static bool do_sm4(DisasContext *s, arg_rrr_esz *a, gen_helper_gvec_3 *fn) | ||
152 | if (!dc_isar_feature(aa64_sve2_sm4, s)) { | ||
153 | return false; | ||
154 | } | ||
155 | - if (sve_access_check(s)) { | ||
156 | - gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, 0); | ||
157 | - } | ||
158 | - return true; | ||
159 | + return gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, 0); | ||
160 | } | ||
161 | |||
162 | static bool trans_SM4E(DisasContext *s, arg_rrr_esz *a) | ||
163 | -- | ||
164 | 2.25.1 | diff view generated by jsdifflib |
1 | We are close to running out of TB flags for AArch32; we could | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | start using the cs_base word, but before we do that we can | ||
3 | economise on our usage by sharing the same bits for the VFP | ||
4 | VECSTRIDE field and the XScale XSCALE_CPAR field. This | ||
5 | works because no XScale CPU ever had VFP. | ||
6 | 2 | ||
3 | Use gen_gvec_ool_arg_zzz instead of gen_gvec_ool_zzz | ||
4 | when the arguments come from arg_rrr_esz. | ||
5 | Replaces do_zzw_ool and do_zzz_data_ool. | ||
6 | |||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20220527181907.189259-6-richard.henderson@linaro.org | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20190416125744.27770-18-peter.maydell@linaro.org | ||
10 | --- | 11 | --- |
11 | target/arm/cpu.h | 10 ++++++---- | 12 | target/arm/translate-sve.c | 48 +++++++++++++++++--------------------- |
12 | target/arm/cpu.c | 7 +++++++ | 13 | 1 file changed, 21 insertions(+), 27 deletions(-) |
13 | target/arm/helper.c | 6 +++++- | ||
14 | target/arm/translate.c | 9 +++++++-- | ||
15 | 4 files changed, 25 insertions(+), 7 deletions(-) | ||
16 | 14 | ||
17 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 15 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
18 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/target/arm/cpu.h | 17 | --- a/target/arm/translate-sve.c |
20 | +++ b/target/arm/cpu.h | 18 | +++ b/target/arm/translate-sve.c |
21 | @@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_ANY, BE_DATA, 23, 1) | 19 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_zzz(DisasContext *s, gen_helper_gvec_3 *fn, |
22 | FIELD(TBFLAG_A32, THUMB, 0, 1) | 20 | return true; |
23 | FIELD(TBFLAG_A32, VECLEN, 1, 3) | 21 | } |
24 | FIELD(TBFLAG_A32, VECSTRIDE, 4, 2) | 22 | |
25 | +/* | 23 | +static bool gen_gvec_ool_arg_zzz(DisasContext *s, gen_helper_gvec_3 *fn, |
26 | + * We store the bottom two bits of the CPAR as TB flags and handle | 24 | + arg_rrr_esz *a, int data) |
27 | + * checks on the other bits at runtime. This shares the same bits as | 25 | +{ |
28 | + * VECSTRIDE, which is OK as no XScale CPU has VFP. | 26 | + return gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, data); |
29 | + */ | 27 | +} |
30 | +FIELD(TBFLAG_A32, XSCALE_CPAR, 4, 2) | 28 | + |
29 | /* Invoke an out-of-line helper on 4 Zregs. */ | ||
30 | static void gen_gvec_ool_zzzz(DisasContext *s, gen_helper_gvec_4 *fn, | ||
31 | int rd, int rn, int rm, int ra, int data) | ||
32 | @@ -XXX,XX +XXX,XX @@ static bool trans_LSL_zzi(DisasContext *s, arg_rri_esz *a) | ||
33 | return do_shift_imm(s, a, false, tcg_gen_gvec_shli); | ||
34 | } | ||
35 | |||
36 | -static bool do_zzw_ool(DisasContext *s, arg_rrr_esz *a, gen_helper_gvec_3 *fn) | ||
37 | -{ | ||
38 | - return gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, 0); | ||
39 | -} | ||
40 | - | ||
41 | #define DO_ZZW(NAME, name) \ | ||
42 | static bool trans_##NAME##_zzw(DisasContext *s, arg_rrr_esz *a) \ | ||
43 | { \ | ||
44 | @@ -XXX,XX +XXX,XX @@ static bool trans_##NAME##_zzw(DisasContext *s, arg_rrr_esz *a) \ | ||
45 | gen_helper_sve_##name##_zzw_b, gen_helper_sve_##name##_zzw_h, \ | ||
46 | gen_helper_sve_##name##_zzw_s, NULL \ | ||
47 | }; \ | ||
48 | - return do_zzw_ool(s, a, fns[a->esz]); \ | ||
49 | + return gen_gvec_ool_arg_zzz(s, fns[a->esz], a, 0); \ | ||
50 | } | ||
51 | |||
52 | DO_ZZW(ASR, asr) | ||
53 | @@ -XXX,XX +XXX,XX @@ static bool trans_FTSSEL(DisasContext *s, arg_rrr_esz *a) | ||
54 | gen_helper_sve_ftssel_s, | ||
55 | gen_helper_sve_ftssel_d, | ||
56 | }; | ||
57 | - return gen_gvec_ool_zzz(s, fns[a->esz], a->rd, a->rn, a->rm, 0); | ||
58 | + return gen_gvec_ool_arg_zzz(s, fns[a->esz], a, 0); | ||
59 | } | ||
60 | |||
31 | /* | 61 | /* |
32 | * Indicates whether cp register reads and writes by guest code should access | 62 | @@ -XXX,XX +XXX,XX @@ static bool trans_TBL(DisasContext *s, arg_rrr_esz *a) |
33 | * the secure or nonsecure bank of banked registers; note that this is not | 63 | gen_helper_sve_tbl_b, gen_helper_sve_tbl_h, |
34 | @@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_A32, NS, 6, 1) | 64 | gen_helper_sve_tbl_s, gen_helper_sve_tbl_d |
35 | FIELD(TBFLAG_A32, VFPEN, 7, 1) | 65 | }; |
36 | FIELD(TBFLAG_A32, CONDEXEC, 8, 8) | 66 | - return gen_gvec_ool_zzz(s, fns[a->esz], a->rd, a->rn, a->rm, 0); |
37 | FIELD(TBFLAG_A32, SCTLR_B, 16, 1) | 67 | + return gen_gvec_ool_arg_zzz(s, fns[a->esz], a, 0); |
38 | -/* We store the bottom two bits of the CPAR as TB flags and handle | 68 | } |
39 | - * checks on the other bits at runtime | 69 | |
40 | - */ | 70 | static bool trans_TBL_sve2(DisasContext *s, arg_rrr_esz *a) |
41 | -FIELD(TBFLAG_A32, XSCALE_CPAR, 17, 2) | 71 | @@ -XXX,XX +XXX,XX @@ static bool trans_TBX(DisasContext *s, arg_rrr_esz *a) |
42 | /* For M profile only, Handler (ie not Thread) mode */ | 72 | if (!dc_isar_feature(aa64_sve2, s)) { |
43 | FIELD(TBFLAG_A32, HANDLER, 21, 1) | 73 | return false; |
44 | /* For M profile only, whether we should generate stack-limit checks */ | ||
45 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
46 | index XXXXXXX..XXXXXXX 100644 | ||
47 | --- a/target/arm/cpu.c | ||
48 | +++ b/target/arm/cpu.c | ||
49 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) | ||
50 | set_feature(env, ARM_FEATURE_THUMB_DSP); | ||
51 | } | 74 | } |
52 | 75 | - return gen_gvec_ool_zzz(s, fns[a->esz], a->rd, a->rn, a->rm, 0); | |
53 | + /* | 76 | + return gen_gvec_ool_arg_zzz(s, fns[a->esz], a, 0); |
54 | + * We rely on no XScale CPU having VFP so we can use the same bits in the | 77 | } |
55 | + * TB flags field for VECSTRIDE and XSCALE_CPAR. | 78 | |
56 | + */ | 79 | static bool trans_UNPK(DisasContext *s, arg_UNPK *a) |
57 | + assert(!(arm_feature(env, ARM_FEATURE_VFP) && | 80 | @@ -XXX,XX +XXX,XX @@ static bool do_zip(DisasContext *s, arg_rrr_esz *a, bool high) |
58 | + arm_feature(env, ARM_FEATURE_XSCALE))); | 81 | return true; |
59 | + | 82 | } |
60 | if (arm_feature(env, ARM_FEATURE_V7) && | 83 | |
61 | !arm_feature(env, ARM_FEATURE_M) && | 84 | -static bool do_zzz_data_ool(DisasContext *s, arg_rrr_esz *a, int data, |
62 | !arm_feature(env, ARM_FEATURE_PMSA)) { | 85 | - gen_helper_gvec_3 *fn) |
63 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 86 | -{ |
64 | index XXXXXXX..XXXXXXX 100644 | 87 | - return gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, data); |
65 | --- a/target/arm/helper.c | 88 | -} |
66 | +++ b/target/arm/helper.c | 89 | - |
67 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | 90 | static bool trans_ZIP1_z(DisasContext *s, arg_rrr_esz *a) |
68 | || arm_el_is_aa64(env, 1) || arm_feature(env, ARM_FEATURE_M)) { | 91 | { |
69 | flags = FIELD_DP32(flags, TBFLAG_A32, VFPEN, 1); | 92 | return do_zip(s, a, false); |
70 | } | 93 | @@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_3 * const uzp_fns[4] = { |
71 | - flags = FIELD_DP32(flags, TBFLAG_A32, XSCALE_CPAR, env->cp15.c15_cpar); | 94 | |
72 | + /* Note that XSCALE_CPAR shares bits with VECSTRIDE */ | 95 | static bool trans_UZP1_z(DisasContext *s, arg_rrr_esz *a) |
73 | + if (arm_feature(env, ARM_FEATURE_XSCALE)) { | 96 | { |
74 | + flags = FIELD_DP32(flags, TBFLAG_A32, | 97 | - return do_zzz_data_ool(s, a, 0, uzp_fns[a->esz]); |
75 | + XSCALE_CPAR, env->cp15.c15_cpar); | 98 | + return gen_gvec_ool_arg_zzz(s, uzp_fns[a->esz], a, 0); |
76 | + } | 99 | } |
100 | |||
101 | static bool trans_UZP2_z(DisasContext *s, arg_rrr_esz *a) | ||
102 | { | ||
103 | - return do_zzz_data_ool(s, a, 1 << a->esz, uzp_fns[a->esz]); | ||
104 | + return gen_gvec_ool_arg_zzz(s, uzp_fns[a->esz], a, 1 << a->esz); | ||
105 | } | ||
106 | |||
107 | static bool trans_UZP1_q(DisasContext *s, arg_rrr_esz *a) | ||
108 | @@ -XXX,XX +XXX,XX @@ static bool trans_UZP1_q(DisasContext *s, arg_rrr_esz *a) | ||
109 | if (!dc_isar_feature(aa64_sve_f64mm, s)) { | ||
110 | return false; | ||
77 | } | 111 | } |
78 | 112 | - return do_zzz_data_ool(s, a, 0, gen_helper_sve2_uzp_q); | |
79 | flags = FIELD_DP32(flags, TBFLAG_ANY, MMUIDX, arm_to_core_mmu_idx(mmu_idx)); | 113 | + return gen_gvec_ool_arg_zzz(s, gen_helper_sve2_uzp_q, a, 0); |
80 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 114 | } |
81 | index XXXXXXX..XXXXXXX 100644 | 115 | |
82 | --- a/target/arm/translate.c | 116 | static bool trans_UZP2_q(DisasContext *s, arg_rrr_esz *a) |
83 | +++ b/target/arm/translate.c | 117 | @@ -XXX,XX +XXX,XX @@ static bool trans_UZP2_q(DisasContext *s, arg_rrr_esz *a) |
84 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) | 118 | if (!dc_isar_feature(aa64_sve_f64mm, s)) { |
85 | dc->fp_excp_el = FIELD_EX32(tb_flags, TBFLAG_ANY, FPEXC_EL); | 119 | return false; |
86 | dc->vfp_enabled = FIELD_EX32(tb_flags, TBFLAG_A32, VFPEN); | 120 | } |
87 | dc->vec_len = FIELD_EX32(tb_flags, TBFLAG_A32, VECLEN); | 121 | - return do_zzz_data_ool(s, a, 16, gen_helper_sve2_uzp_q); |
88 | - dc->vec_stride = FIELD_EX32(tb_flags, TBFLAG_A32, VECSTRIDE); | 122 | + return gen_gvec_ool_arg_zzz(s, gen_helper_sve2_uzp_q, a, 16); |
89 | - dc->c15_cpar = FIELD_EX32(tb_flags, TBFLAG_A32, XSCALE_CPAR); | 123 | } |
90 | + if (arm_feature(env, ARM_FEATURE_XSCALE)) { | 124 | |
91 | + dc->c15_cpar = FIELD_EX32(tb_flags, TBFLAG_A32, XSCALE_CPAR); | 125 | static gen_helper_gvec_3 * const trn_fns[4] = { |
92 | + dc->vec_stride = 0; | 126 | @@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_3 * const trn_fns[4] = { |
93 | + } else { | 127 | |
94 | + dc->vec_stride = FIELD_EX32(tb_flags, TBFLAG_A32, VECSTRIDE); | 128 | static bool trans_TRN1_z(DisasContext *s, arg_rrr_esz *a) |
95 | + dc->c15_cpar = 0; | 129 | { |
96 | + } | 130 | - return do_zzz_data_ool(s, a, 0, trn_fns[a->esz]); |
97 | dc->v7m_handler_mode = FIELD_EX32(tb_flags, TBFLAG_A32, HANDLER); | 131 | + return gen_gvec_ool_arg_zzz(s, trn_fns[a->esz], a, 0); |
98 | dc->v8m_secure = arm_feature(env, ARM_FEATURE_M_SECURITY) && | 132 | } |
99 | regime_is_secure(env, dc->mmu_idx); | 133 | |
134 | static bool trans_TRN2_z(DisasContext *s, arg_rrr_esz *a) | ||
135 | { | ||
136 | - return do_zzz_data_ool(s, a, 1 << a->esz, trn_fns[a->esz]); | ||
137 | + return gen_gvec_ool_arg_zzz(s, trn_fns[a->esz], a, 1 << a->esz); | ||
138 | } | ||
139 | |||
140 | static bool trans_TRN1_q(DisasContext *s, arg_rrr_esz *a) | ||
141 | @@ -XXX,XX +XXX,XX @@ static bool trans_TRN1_q(DisasContext *s, arg_rrr_esz *a) | ||
142 | if (!dc_isar_feature(aa64_sve_f64mm, s)) { | ||
143 | return false; | ||
144 | } | ||
145 | - return do_zzz_data_ool(s, a, 0, gen_helper_sve2_trn_q); | ||
146 | + return gen_gvec_ool_arg_zzz(s, gen_helper_sve2_trn_q, a, 0); | ||
147 | } | ||
148 | |||
149 | static bool trans_TRN2_q(DisasContext *s, arg_rrr_esz *a) | ||
150 | @@ -XXX,XX +XXX,XX @@ static bool trans_TRN2_q(DisasContext *s, arg_rrr_esz *a) | ||
151 | if (!dc_isar_feature(aa64_sve_f64mm, s)) { | ||
152 | return false; | ||
153 | } | ||
154 | - return do_zzz_data_ool(s, a, 16, gen_helper_sve2_trn_q); | ||
155 | + return gen_gvec_ool_arg_zzz(s, gen_helper_sve2_trn_q, a, 16); | ||
156 | } | ||
157 | |||
158 | /* | ||
159 | @@ -XXX,XX +XXX,XX @@ static bool do_sve2_zzz_ool(DisasContext *s, arg_rrr_esz *a, | ||
160 | if (!dc_isar_feature(aa64_sve2, s)) { | ||
161 | return false; | ||
162 | } | ||
163 | - return gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, 0); | ||
164 | + return gen_gvec_ool_arg_zzz(s, fn, a, 0); | ||
165 | } | ||
166 | |||
167 | static bool trans_SMULH_zzz(DisasContext *s, arg_rrr_esz *a) | ||
168 | @@ -XXX,XX +XXX,XX @@ static bool do_aese(DisasContext *s, arg_rrr_esz *a, bool decrypt) | ||
169 | if (!dc_isar_feature(aa64_sve2_aes, s)) { | ||
170 | return false; | ||
171 | } | ||
172 | - return gen_gvec_ool_zzz(s, gen_helper_crypto_aese, | ||
173 | - a->rd, a->rn, a->rm, decrypt); | ||
174 | + return gen_gvec_ool_arg_zzz(s, gen_helper_crypto_aese, a, decrypt); | ||
175 | } | ||
176 | |||
177 | static bool trans_AESE(DisasContext *s, arg_rrr_esz *a) | ||
178 | @@ -XXX,XX +XXX,XX @@ static bool do_sm4(DisasContext *s, arg_rrr_esz *a, gen_helper_gvec_3 *fn) | ||
179 | if (!dc_isar_feature(aa64_sve2_sm4, s)) { | ||
180 | return false; | ||
181 | } | ||
182 | - return gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, 0); | ||
183 | + return gen_gvec_ool_arg_zzz(s, fn, a, 0); | ||
184 | } | ||
185 | |||
186 | static bool trans_SM4E(DisasContext *s, arg_rrr_esz *a) | ||
100 | -- | 187 | -- |
101 | 2.20.1 | 188 | 2.25.1 |
102 | |||
103 | diff view generated by jsdifflib |
1 | Move the NS TBFLAG down from bit 19 to bit 6, which has not | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | been used since commit c1e3781090b9d36c60 in 2015, when we | 2 | |
3 | started passing the entire MMU index in the TB flags rather | 3 | Convert SVE translation functions using |
4 | than just a 'privilege level' bit. | 4 | gen_gvec_ool_arg_zzz to TRANS_FEAT. |
5 | 5 | ||
6 | This rearrangement is not strictly necessary, but means that | 6 | Remove trivial wrappers do_aese, do_sm4. |
7 | we can put M-profile-only bits next to each other rather | 7 | |
8 | than scattered across the flag word. | 8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
9 | 9 | Message-id: 20220527181907.189259-7-richard.henderson@linaro.org | |
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
12 | Message-id: 20190416125744.27770-17-peter.maydell@linaro.org | ||
13 | --- | 12 | --- |
14 | target/arm/cpu.h | 11 ++++++----- | 13 | target/arm/translate-sve.c | 165 ++++++++++--------------------------- |
15 | 1 file changed, 6 insertions(+), 5 deletions(-) | 14 | 1 file changed, 45 insertions(+), 120 deletions(-) |
16 | 15 | ||
17 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 16 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
18 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/target/arm/cpu.h | 18 | --- a/target/arm/translate-sve.c |
20 | +++ b/target/arm/cpu.h | 19 | +++ b/target/arm/translate-sve.c |
21 | @@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_ANY, BE_DATA, 23, 1) | 20 | @@ -XXX,XX +XXX,XX @@ static bool trans_LSL_zzi(DisasContext *s, arg_rri_esz *a) |
22 | FIELD(TBFLAG_A32, THUMB, 0, 1) | 21 | } |
23 | FIELD(TBFLAG_A32, VECLEN, 1, 3) | 22 | |
24 | FIELD(TBFLAG_A32, VECSTRIDE, 4, 2) | 23 | #define DO_ZZW(NAME, name) \ |
25 | +/* | 24 | -static bool trans_##NAME##_zzw(DisasContext *s, arg_rrr_esz *a) \ |
26 | + * Indicates whether cp register reads and writes by guest code should access | 25 | -{ \ |
27 | + * the secure or nonsecure bank of banked registers; note that this is not | 26 | - static gen_helper_gvec_3 * const fns[4] = { \ |
28 | + * the same thing as the current security state of the processor! | 27 | + static gen_helper_gvec_3 * const name##_zzw_fns[4] = { \ |
29 | + */ | 28 | gen_helper_sve_##name##_zzw_b, gen_helper_sve_##name##_zzw_h, \ |
30 | +FIELD(TBFLAG_A32, NS, 6, 1) | 29 | gen_helper_sve_##name##_zzw_s, NULL \ |
31 | FIELD(TBFLAG_A32, VFPEN, 7, 1) | 30 | }; \ |
32 | FIELD(TBFLAG_A32, CONDEXEC, 8, 8) | 31 | - return gen_gvec_ool_arg_zzz(s, fns[a->esz], a, 0); \ |
33 | FIELD(TBFLAG_A32, SCTLR_B, 16, 1) | 32 | -} |
34 | @@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_A32, SCTLR_B, 16, 1) | 33 | + TRANS_FEAT(NAME, aa64_sve, gen_gvec_ool_arg_zzz, \ |
35 | * checks on the other bits at runtime | 34 | + name##_zzw_fns[a->esz], a, 0) |
36 | */ | 35 | |
37 | FIELD(TBFLAG_A32, XSCALE_CPAR, 17, 2) | 36 | -DO_ZZW(ASR, asr) |
38 | -/* Indicates whether cp register reads and writes by guest code should access | 37 | -DO_ZZW(LSR, lsr) |
39 | - * the secure or nonsecure bank of banked registers; note that this is not | 38 | -DO_ZZW(LSL, lsl) |
40 | - * the same thing as the current security state of the processor! | 39 | +DO_ZZW(ASR_zzw, asr) |
41 | - */ | 40 | +DO_ZZW(LSR_zzw, lsr) |
42 | -FIELD(TBFLAG_A32, NS, 19, 1) | 41 | +DO_ZZW(LSL_zzw, lsl) |
43 | /* For M profile only, Handler (ie not Thread) mode */ | 42 | |
44 | FIELD(TBFLAG_A32, HANDLER, 21, 1) | 43 | #undef DO_ZZW |
45 | /* For M profile only, whether we should generate stack-limit checks */ | 44 | |
45 | @@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_2 * const fexpa_fns[4] = { | ||
46 | TRANS_FEAT(FEXPA, aa64_sve, gen_gvec_ool_zz, | ||
47 | fexpa_fns[a->esz], a->rd, a->rn, 0) | ||
48 | |||
49 | -static bool trans_FTSSEL(DisasContext *s, arg_rrr_esz *a) | ||
50 | -{ | ||
51 | - static gen_helper_gvec_3 * const fns[4] = { | ||
52 | - NULL, | ||
53 | - gen_helper_sve_ftssel_h, | ||
54 | - gen_helper_sve_ftssel_s, | ||
55 | - gen_helper_sve_ftssel_d, | ||
56 | - }; | ||
57 | - return gen_gvec_ool_arg_zzz(s, fns[a->esz], a, 0); | ||
58 | -} | ||
59 | +static gen_helper_gvec_3 * const ftssel_fns[4] = { | ||
60 | + NULL, gen_helper_sve_ftssel_h, | ||
61 | + gen_helper_sve_ftssel_s, gen_helper_sve_ftssel_d, | ||
62 | +}; | ||
63 | +TRANS_FEAT(FTSSEL, aa64_sve, gen_gvec_ool_arg_zzz, ftssel_fns[a->esz], a, 0) | ||
64 | |||
65 | /* | ||
66 | *** SVE Predicate Logical Operations Group | ||
67 | @@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_2 * const rev_fns[4] = { | ||
68 | }; | ||
69 | TRANS_FEAT(REV_v, aa64_sve, gen_gvec_ool_zz, rev_fns[a->esz], a->rd, a->rn, 0) | ||
70 | |||
71 | -static bool trans_TBL(DisasContext *s, arg_rrr_esz *a) | ||
72 | -{ | ||
73 | - static gen_helper_gvec_3 * const fns[4] = { | ||
74 | - gen_helper_sve_tbl_b, gen_helper_sve_tbl_h, | ||
75 | - gen_helper_sve_tbl_s, gen_helper_sve_tbl_d | ||
76 | - }; | ||
77 | - return gen_gvec_ool_arg_zzz(s, fns[a->esz], a, 0); | ||
78 | -} | ||
79 | +static gen_helper_gvec_3 * const sve_tbl_fns[4] = { | ||
80 | + gen_helper_sve_tbl_b, gen_helper_sve_tbl_h, | ||
81 | + gen_helper_sve_tbl_s, gen_helper_sve_tbl_d | ||
82 | +}; | ||
83 | +TRANS_FEAT(TBL, aa64_sve, gen_gvec_ool_arg_zzz, sve_tbl_fns[a->esz], a, 0) | ||
84 | |||
85 | static bool trans_TBL_sve2(DisasContext *s, arg_rrr_esz *a) | ||
86 | { | ||
87 | @@ -XXX,XX +XXX,XX @@ static bool trans_TBL_sve2(DisasContext *s, arg_rrr_esz *a) | ||
88 | return true; | ||
89 | } | ||
90 | |||
91 | -static bool trans_TBX(DisasContext *s, arg_rrr_esz *a) | ||
92 | -{ | ||
93 | - static gen_helper_gvec_3 * const fns[4] = { | ||
94 | - gen_helper_sve2_tbx_b, gen_helper_sve2_tbx_h, | ||
95 | - gen_helper_sve2_tbx_s, gen_helper_sve2_tbx_d | ||
96 | - }; | ||
97 | - | ||
98 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
99 | - return false; | ||
100 | - } | ||
101 | - return gen_gvec_ool_arg_zzz(s, fns[a->esz], a, 0); | ||
102 | -} | ||
103 | +static gen_helper_gvec_3 * const tbx_fns[4] = { | ||
104 | + gen_helper_sve2_tbx_b, gen_helper_sve2_tbx_h, | ||
105 | + gen_helper_sve2_tbx_s, gen_helper_sve2_tbx_d | ||
106 | +}; | ||
107 | +TRANS_FEAT(TBX, aa64_sve2, gen_gvec_ool_arg_zzz, tbx_fns[a->esz], a, 0) | ||
108 | |||
109 | static bool trans_UNPK(DisasContext *s, arg_UNPK *a) | ||
110 | { | ||
111 | @@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_3 * const uzp_fns[4] = { | ||
112 | gen_helper_sve_uzp_s, gen_helper_sve_uzp_d, | ||
113 | }; | ||
114 | |||
115 | -static bool trans_UZP1_z(DisasContext *s, arg_rrr_esz *a) | ||
116 | -{ | ||
117 | - return gen_gvec_ool_arg_zzz(s, uzp_fns[a->esz], a, 0); | ||
118 | -} | ||
119 | +TRANS_FEAT(UZP1_z, aa64_sve, gen_gvec_ool_arg_zzz, | ||
120 | + uzp_fns[a->esz], a, 0) | ||
121 | +TRANS_FEAT(UZP2_z, aa64_sve, gen_gvec_ool_arg_zzz, | ||
122 | + uzp_fns[a->esz], a, 1 << a->esz) | ||
123 | |||
124 | -static bool trans_UZP2_z(DisasContext *s, arg_rrr_esz *a) | ||
125 | -{ | ||
126 | - return gen_gvec_ool_arg_zzz(s, uzp_fns[a->esz], a, 1 << a->esz); | ||
127 | -} | ||
128 | - | ||
129 | -static bool trans_UZP1_q(DisasContext *s, arg_rrr_esz *a) | ||
130 | -{ | ||
131 | - if (!dc_isar_feature(aa64_sve_f64mm, s)) { | ||
132 | - return false; | ||
133 | - } | ||
134 | - return gen_gvec_ool_arg_zzz(s, gen_helper_sve2_uzp_q, a, 0); | ||
135 | -} | ||
136 | - | ||
137 | -static bool trans_UZP2_q(DisasContext *s, arg_rrr_esz *a) | ||
138 | -{ | ||
139 | - if (!dc_isar_feature(aa64_sve_f64mm, s)) { | ||
140 | - return false; | ||
141 | - } | ||
142 | - return gen_gvec_ool_arg_zzz(s, gen_helper_sve2_uzp_q, a, 16); | ||
143 | -} | ||
144 | +TRANS_FEAT(UZP1_q, aa64_sve_f64mm, gen_gvec_ool_arg_zzz, | ||
145 | + gen_helper_sve2_uzp_q, a, 0) | ||
146 | +TRANS_FEAT(UZP2_q, aa64_sve_f64mm, gen_gvec_ool_arg_zzz, | ||
147 | + gen_helper_sve2_uzp_q, a, 16) | ||
148 | |||
149 | static gen_helper_gvec_3 * const trn_fns[4] = { | ||
150 | gen_helper_sve_trn_b, gen_helper_sve_trn_h, | ||
151 | gen_helper_sve_trn_s, gen_helper_sve_trn_d, | ||
152 | }; | ||
153 | |||
154 | -static bool trans_TRN1_z(DisasContext *s, arg_rrr_esz *a) | ||
155 | -{ | ||
156 | - return gen_gvec_ool_arg_zzz(s, trn_fns[a->esz], a, 0); | ||
157 | -} | ||
158 | +TRANS_FEAT(TRN1_z, aa64_sve, gen_gvec_ool_arg_zzz, | ||
159 | + trn_fns[a->esz], a, 0) | ||
160 | +TRANS_FEAT(TRN2_z, aa64_sve, gen_gvec_ool_arg_zzz, | ||
161 | + trn_fns[a->esz], a, 1 << a->esz) | ||
162 | |||
163 | -static bool trans_TRN2_z(DisasContext *s, arg_rrr_esz *a) | ||
164 | -{ | ||
165 | - return gen_gvec_ool_arg_zzz(s, trn_fns[a->esz], a, 1 << a->esz); | ||
166 | -} | ||
167 | - | ||
168 | -static bool trans_TRN1_q(DisasContext *s, arg_rrr_esz *a) | ||
169 | -{ | ||
170 | - if (!dc_isar_feature(aa64_sve_f64mm, s)) { | ||
171 | - return false; | ||
172 | - } | ||
173 | - return gen_gvec_ool_arg_zzz(s, gen_helper_sve2_trn_q, a, 0); | ||
174 | -} | ||
175 | - | ||
176 | -static bool trans_TRN2_q(DisasContext *s, arg_rrr_esz *a) | ||
177 | -{ | ||
178 | - if (!dc_isar_feature(aa64_sve_f64mm, s)) { | ||
179 | - return false; | ||
180 | - } | ||
181 | - return gen_gvec_ool_arg_zzz(s, gen_helper_sve2_trn_q, a, 16); | ||
182 | -} | ||
183 | +TRANS_FEAT(TRN1_q, aa64_sve_f64mm, gen_gvec_ool_arg_zzz, | ||
184 | + gen_helper_sve2_trn_q, a, 0) | ||
185 | +TRANS_FEAT(TRN2_q, aa64_sve_f64mm, gen_gvec_ool_arg_zzz, | ||
186 | + gen_helper_sve2_trn_q, a, 16) | ||
187 | |||
188 | /* | ||
189 | *** SVE Permute Vector - Predicated Group | ||
190 | @@ -XXX,XX +XXX,XX @@ static bool trans_USDOT_zzzz(DisasContext *s, arg_USDOT_zzzz *a) | ||
191 | TRANS_FEAT(AESMC, aa64_sve2_aes, gen_gvec_ool_zz, | ||
192 | gen_helper_crypto_aesmc, a->rd, a->rd, a->decrypt) | ||
193 | |||
194 | -static bool do_aese(DisasContext *s, arg_rrr_esz *a, bool decrypt) | ||
195 | -{ | ||
196 | - if (!dc_isar_feature(aa64_sve2_aes, s)) { | ||
197 | - return false; | ||
198 | - } | ||
199 | - return gen_gvec_ool_arg_zzz(s, gen_helper_crypto_aese, a, decrypt); | ||
200 | -} | ||
201 | +TRANS_FEAT(AESE, aa64_sve2_aes, gen_gvec_ool_arg_zzz, | ||
202 | + gen_helper_crypto_aese, a, false) | ||
203 | +TRANS_FEAT(AESD, aa64_sve2_aes, gen_gvec_ool_arg_zzz, | ||
204 | + gen_helper_crypto_aese, a, true) | ||
205 | |||
206 | -static bool trans_AESE(DisasContext *s, arg_rrr_esz *a) | ||
207 | -{ | ||
208 | - return do_aese(s, a, false); | ||
209 | -} | ||
210 | - | ||
211 | -static bool trans_AESD(DisasContext *s, arg_rrr_esz *a) | ||
212 | -{ | ||
213 | - return do_aese(s, a, true); | ||
214 | -} | ||
215 | - | ||
216 | -static bool do_sm4(DisasContext *s, arg_rrr_esz *a, gen_helper_gvec_3 *fn) | ||
217 | -{ | ||
218 | - if (!dc_isar_feature(aa64_sve2_sm4, s)) { | ||
219 | - return false; | ||
220 | - } | ||
221 | - return gen_gvec_ool_arg_zzz(s, fn, a, 0); | ||
222 | -} | ||
223 | - | ||
224 | -static bool trans_SM4E(DisasContext *s, arg_rrr_esz *a) | ||
225 | -{ | ||
226 | - return do_sm4(s, a, gen_helper_crypto_sm4e); | ||
227 | -} | ||
228 | - | ||
229 | -static bool trans_SM4EKEY(DisasContext *s, arg_rrr_esz *a) | ||
230 | -{ | ||
231 | - return do_sm4(s, a, gen_helper_crypto_sm4ekey); | ||
232 | -} | ||
233 | +TRANS_FEAT(SM4E, aa64_sve2_sm4, gen_gvec_ool_arg_zzz, | ||
234 | + gen_helper_crypto_sm4e, a, 0) | ||
235 | +TRANS_FEAT(SM4EKEY, aa64_sve2_sm4, gen_gvec_ool_arg_zzz, | ||
236 | + gen_helper_crypto_sm4ekey, a, 0) | ||
237 | |||
238 | static bool trans_RAX1(DisasContext *s, arg_rrr_esz *a) | ||
239 | { | ||
46 | -- | 240 | -- |
47 | 2.20.1 | 241 | 2.25.1 |
48 | |||
49 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions using do_sve2_zzz_ool | ||
4 | to use TRANS_FEAT and gen_gvec_ool_arg_zzz. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-8-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 88 ++++++++++++++------------------------ | ||
12 | 1 file changed, 31 insertions(+), 57 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static bool trans_MUL_zzz(DisasContext *s, arg_rrr_esz *a) | ||
19 | return true; | ||
20 | } | ||
21 | |||
22 | -static bool do_sve2_zzz_ool(DisasContext *s, arg_rrr_esz *a, | ||
23 | - gen_helper_gvec_3 *fn) | ||
24 | -{ | ||
25 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
26 | - return false; | ||
27 | - } | ||
28 | - return gen_gvec_ool_arg_zzz(s, fn, a, 0); | ||
29 | -} | ||
30 | +static gen_helper_gvec_3 * const smulh_zzz_fns[4] = { | ||
31 | + gen_helper_gvec_smulh_b, gen_helper_gvec_smulh_h, | ||
32 | + gen_helper_gvec_smulh_s, gen_helper_gvec_smulh_d, | ||
33 | +}; | ||
34 | +TRANS_FEAT(SMULH_zzz, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
35 | + smulh_zzz_fns[a->esz], a, 0) | ||
36 | |||
37 | -static bool trans_SMULH_zzz(DisasContext *s, arg_rrr_esz *a) | ||
38 | -{ | ||
39 | - static gen_helper_gvec_3 * const fns[4] = { | ||
40 | - gen_helper_gvec_smulh_b, gen_helper_gvec_smulh_h, | ||
41 | - gen_helper_gvec_smulh_s, gen_helper_gvec_smulh_d, | ||
42 | - }; | ||
43 | - return do_sve2_zzz_ool(s, a, fns[a->esz]); | ||
44 | -} | ||
45 | +static gen_helper_gvec_3 * const umulh_zzz_fns[4] = { | ||
46 | + gen_helper_gvec_umulh_b, gen_helper_gvec_umulh_h, | ||
47 | + gen_helper_gvec_umulh_s, gen_helper_gvec_umulh_d, | ||
48 | +}; | ||
49 | +TRANS_FEAT(UMULH_zzz, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
50 | + umulh_zzz_fns[a->esz], a, 0) | ||
51 | |||
52 | -static bool trans_UMULH_zzz(DisasContext *s, arg_rrr_esz *a) | ||
53 | -{ | ||
54 | - static gen_helper_gvec_3 * const fns[4] = { | ||
55 | - gen_helper_gvec_umulh_b, gen_helper_gvec_umulh_h, | ||
56 | - gen_helper_gvec_umulh_s, gen_helper_gvec_umulh_d, | ||
57 | - }; | ||
58 | - return do_sve2_zzz_ool(s, a, fns[a->esz]); | ||
59 | -} | ||
60 | +TRANS_FEAT(PMUL_zzz, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
61 | + gen_helper_gvec_pmul_b, a, 0) | ||
62 | |||
63 | -static bool trans_PMUL_zzz(DisasContext *s, arg_rrr_esz *a) | ||
64 | -{ | ||
65 | - return do_sve2_zzz_ool(s, a, gen_helper_gvec_pmul_b); | ||
66 | -} | ||
67 | +static gen_helper_gvec_3 * const sqdmulh_zzz_fns[4] = { | ||
68 | + gen_helper_sve2_sqdmulh_b, gen_helper_sve2_sqdmulh_h, | ||
69 | + gen_helper_sve2_sqdmulh_s, gen_helper_sve2_sqdmulh_d, | ||
70 | +}; | ||
71 | +TRANS_FEAT(SQDMULH_zzz, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
72 | + sqdmulh_zzz_fns[a->esz], a, 0) | ||
73 | |||
74 | -static bool trans_SQDMULH_zzz(DisasContext *s, arg_rrr_esz *a) | ||
75 | -{ | ||
76 | - static gen_helper_gvec_3 * const fns[4] = { | ||
77 | - gen_helper_sve2_sqdmulh_b, gen_helper_sve2_sqdmulh_h, | ||
78 | - gen_helper_sve2_sqdmulh_s, gen_helper_sve2_sqdmulh_d, | ||
79 | - }; | ||
80 | - return do_sve2_zzz_ool(s, a, fns[a->esz]); | ||
81 | -} | ||
82 | - | ||
83 | -static bool trans_SQRDMULH_zzz(DisasContext *s, arg_rrr_esz *a) | ||
84 | -{ | ||
85 | - static gen_helper_gvec_3 * const fns[4] = { | ||
86 | - gen_helper_sve2_sqrdmulh_b, gen_helper_sve2_sqrdmulh_h, | ||
87 | - gen_helper_sve2_sqrdmulh_s, gen_helper_sve2_sqrdmulh_d, | ||
88 | - }; | ||
89 | - return do_sve2_zzz_ool(s, a, fns[a->esz]); | ||
90 | -} | ||
91 | +static gen_helper_gvec_3 * const sqrdmulh_zzz_fns[4] = { | ||
92 | + gen_helper_sve2_sqrdmulh_b, gen_helper_sve2_sqrdmulh_h, | ||
93 | + gen_helper_sve2_sqrdmulh_s, gen_helper_sve2_sqrdmulh_d, | ||
94 | +}; | ||
95 | +TRANS_FEAT(SQRDMULH_zzz, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
96 | + sqrdmulh_zzz_fns[a->esz], a, 0) | ||
97 | |||
98 | /* | ||
99 | * SVE2 Integer - Predicated | ||
100 | @@ -XXX,XX +XXX,XX @@ static bool trans_UQRSHRNT(DisasContext *s, arg_rri_esz *a) | ||
101 | } | ||
102 | |||
103 | #define DO_SVE2_ZZZ_NARROW(NAME, name) \ | ||
104 | -static bool trans_##NAME(DisasContext *s, arg_rrr_esz *a) \ | ||
105 | -{ \ | ||
106 | - static gen_helper_gvec_3 * const fns[4] = { \ | ||
107 | + static gen_helper_gvec_3 * const name##_fns[4] = { \ | ||
108 | NULL, gen_helper_sve2_##name##_h, \ | ||
109 | gen_helper_sve2_##name##_s, gen_helper_sve2_##name##_d, \ | ||
110 | }; \ | ||
111 | - return do_sve2_zzz_ool(s, a, fns[a->esz]); \ | ||
112 | -} | ||
113 | + TRANS_FEAT(NAME, aa64_sve2, gen_gvec_ool_arg_zzz, \ | ||
114 | + name##_fns[a->esz], a, 0) | ||
115 | |||
116 | DO_SVE2_ZZZ_NARROW(ADDHNB, addhnb) | ||
117 | DO_SVE2_ZZZ_NARROW(ADDHNT, addhnt) | ||
118 | @@ -XXX,XX +XXX,XX @@ static bool trans_HISTCNT(DisasContext *s, arg_rprr_esz *a) | ||
119 | return do_sve2_zpzz_ool(s, a, fns[a->esz - 2]); | ||
120 | } | ||
121 | |||
122 | -static bool trans_HISTSEG(DisasContext *s, arg_rrr_esz *a) | ||
123 | -{ | ||
124 | - if (a->esz != 0) { | ||
125 | - return false; | ||
126 | - } | ||
127 | - return do_sve2_zzz_ool(s, a, gen_helper_sve2_histseg); | ||
128 | -} | ||
129 | +TRANS_FEAT(HISTSEG, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
130 | + a->esz == 0 ? gen_helper_sve2_histseg : NULL, a, 0) | ||
131 | |||
132 | static bool do_sve2_zpzz_fp(DisasContext *s, arg_rprr_esz *a, | ||
133 | gen_helper_gvec_4_ptr *fn) | ||
134 | -- | ||
135 | 2.25.1 | diff view generated by jsdifflib |
1 | Handle floating point registers in exception return. | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | This corresponds to pseudocode functions ValidateExceptionReturn(), | ||
3 | ExceptionReturn(), PopStack() and ConsumeExcStackFrame(). | ||
4 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-9-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@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: 20190416125744.27770-16-peter.maydell@linaro.org | ||
8 | --- | 7 | --- |
9 | target/arm/helper.c | 142 +++++++++++++++++++++++++++++++++++++++++++- | 8 | target/arm/translate-sve.c | 102 ++++++++++++++----------------------- |
10 | 1 file changed, 141 insertions(+), 1 deletion(-) | 9 | 1 file changed, 38 insertions(+), 64 deletions(-) |
11 | 10 | ||
12 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
13 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/target/arm/helper.c | 13 | --- a/target/arm/translate-sve.c |
15 | +++ b/target/arm/helper.c | 14 | +++ b/target/arm/translate-sve.c |
16 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) | 15 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_arg_zzz(DisasContext *s, gen_helper_gvec_3 *fn, |
17 | bool rettobase = false; | 16 | } |
18 | bool exc_secure = false; | 17 | |
19 | bool return_to_secure; | 18 | /* Invoke an out-of-line helper on 4 Zregs. */ |
20 | + bool ftype; | 19 | -static void gen_gvec_ool_zzzz(DisasContext *s, gen_helper_gvec_4 *fn, |
21 | + bool restore_s16_s31; | 20 | +static bool gen_gvec_ool_zzzz(DisasContext *s, gen_helper_gvec_4 *fn, |
22 | 21 | int rd, int rn, int rm, int ra, int data) | |
23 | /* If we're not in Handler mode then jumps to magic exception-exit | 22 | { |
24 | * addresses don't have magic behaviour. However for the v8M | 23 | - unsigned vsz = vec_full_reg_size(s); |
25 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) | 24 | - tcg_gen_gvec_4_ool(vec_full_reg_offset(s, rd), |
26 | excret); | 25 | - vec_full_reg_offset(s, rn), |
27 | } | 26 | - vec_full_reg_offset(s, rm), |
28 | 27 | - vec_full_reg_offset(s, ra), | |
29 | + ftype = excret & R_V7M_EXCRET_FTYPE_MASK; | 28 | - vsz, vsz, data, fn); |
29 | + if (fn == NULL) { | ||
30 | + return false; | ||
31 | + } | ||
32 | + if (sve_access_check(s)) { | ||
33 | + unsigned vsz = vec_full_reg_size(s); | ||
34 | + tcg_gen_gvec_4_ool(vec_full_reg_offset(s, rd), | ||
35 | + vec_full_reg_offset(s, rn), | ||
36 | + vec_full_reg_offset(s, rm), | ||
37 | + vec_full_reg_offset(s, ra), | ||
38 | + vsz, vsz, data, fn); | ||
39 | + } | ||
40 | + return true; | ||
41 | } | ||
42 | |||
43 | /* Invoke an out-of-line helper on 2 Zregs and a predicate. */ | ||
44 | @@ -XXX,XX +XXX,XX @@ static bool trans_TBL_sve2(DisasContext *s, arg_rrr_esz *a) | ||
45 | if (!dc_isar_feature(aa64_sve2, s)) { | ||
46 | return false; | ||
47 | } | ||
48 | - if (sve_access_check(s)) { | ||
49 | - gen_gvec_ool_zzzz(s, fns[a->esz], a->rd, a->rn, | ||
50 | - (a->rn + 1) % 32, a->rm, 0); | ||
51 | - } | ||
52 | - return true; | ||
53 | + return gen_gvec_ool_zzzz(s, fns[a->esz], a->rd, a->rn, | ||
54 | + (a->rn + 1) % 32, a->rm, 0); | ||
55 | } | ||
56 | |||
57 | static gen_helper_gvec_3 * const tbx_fns[4] = { | ||
58 | @@ -XXX,XX +XXX,XX @@ static bool trans_DOT_zzzz(DisasContext *s, arg_DOT_zzzz *a) | ||
59 | { gen_helper_gvec_sdot_b, gen_helper_gvec_sdot_h }, | ||
60 | { gen_helper_gvec_udot_b, gen_helper_gvec_udot_h } | ||
61 | }; | ||
62 | - | ||
63 | - if (sve_access_check(s)) { | ||
64 | - gen_gvec_ool_zzzz(s, fns[a->u][a->sz], a->rd, a->rn, a->rm, a->ra, 0); | ||
65 | - } | ||
66 | - return true; | ||
67 | + return gen_gvec_ool_zzzz(s, fns[a->u][a->sz], | ||
68 | + a->rd, a->rn, a->rm, a->ra, 0); | ||
69 | } | ||
70 | |||
71 | /* | ||
72 | @@ -XXX,XX +XXX,XX @@ static bool trans_DOT_zzzz(DisasContext *s, arg_DOT_zzzz *a) | ||
73 | static bool do_zzxz_ool(DisasContext *s, arg_rrxr_esz *a, | ||
74 | gen_helper_gvec_4 *fn) | ||
75 | { | ||
76 | - if (fn == NULL) { | ||
77 | - return false; | ||
78 | - } | ||
79 | - if (sve_access_check(s)) { | ||
80 | - gen_gvec_ool_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, a->index); | ||
81 | - } | ||
82 | - return true; | ||
83 | + return gen_gvec_ool_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, a->index); | ||
84 | } | ||
85 | |||
86 | #define DO_RRXR(NAME, FUNC) \ | ||
87 | @@ -XXX,XX +XXX,XX @@ static bool trans_SQCADD_rot270(DisasContext *s, arg_rrr_esz *a) | ||
88 | static bool do_sve2_zzzz_ool(DisasContext *s, arg_rrrr_esz *a, | ||
89 | gen_helper_gvec_4 *fn, int data) | ||
90 | { | ||
91 | - if (fn == NULL || !dc_isar_feature(aa64_sve2, s)) { | ||
92 | + if (!dc_isar_feature(aa64_sve2, s)) { | ||
93 | return false; | ||
94 | } | ||
95 | - if (sve_access_check(s)) { | ||
96 | - gen_gvec_ool_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, data); | ||
97 | - } | ||
98 | - return true; | ||
99 | + return gen_gvec_ool_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, data); | ||
100 | } | ||
101 | |||
102 | static bool do_abal(DisasContext *s, arg_rrrr_esz *a, bool uns, bool sel) | ||
103 | @@ -XXX,XX +XXX,XX @@ static bool trans_CMLA_zzzz(DisasContext *s, arg_CMLA_zzzz *a) | ||
104 | if (!dc_isar_feature(aa64_sve2, s)) { | ||
105 | return false; | ||
106 | } | ||
107 | - if (sve_access_check(s)) { | ||
108 | - gen_gvec_ool_zzzz(s, fns[a->esz], a->rd, a->rn, a->rm, a->ra, a->rot); | ||
109 | - } | ||
110 | - return true; | ||
111 | + return gen_gvec_ool_zzzz(s, fns[a->esz], a->rd, a->rn, | ||
112 | + a->rm, a->ra, a->rot); | ||
113 | } | ||
114 | |||
115 | static bool trans_CDOT_zzzz(DisasContext *s, arg_CMLA_zzzz *a) | ||
116 | { | ||
117 | - if (!dc_isar_feature(aa64_sve2, s) || a->esz < MO_32) { | ||
118 | + static gen_helper_gvec_4 * const fns[] = { | ||
119 | + NULL, NULL, gen_helper_sve2_cdot_zzzz_s, gen_helper_sve2_cdot_zzzz_d | ||
120 | + }; | ||
30 | + | 121 | + |
31 | + if (!arm_feature(env, ARM_FEATURE_VFP) && !ftype) { | 122 | + if (!dc_isar_feature(aa64_sve2, s)) { |
32 | + qemu_log_mask(LOG_GUEST_ERROR, "M profile: zero FTYPE in exception " | 123 | return false; |
33 | + "exit PC value 0x%" PRIx32 " is UNPREDICTABLE " | 124 | } |
34 | + "if FPU not present\n", | 125 | - if (sve_access_check(s)) { |
35 | + excret); | 126 | - gen_helper_gvec_4 *fn = (a->esz == MO_32 |
36 | + ftype = true; | 127 | - ? gen_helper_sve2_cdot_zzzz_s |
37 | + } | 128 | - : gen_helper_sve2_cdot_zzzz_d); |
38 | + | 129 | - gen_gvec_ool_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, a->rot); |
39 | if (arm_feature(env, ARM_FEATURE_M_SECURITY)) { | 130 | - } |
40 | /* EXC_RETURN.ES validation check (R_SMFL). We must do this before | 131 | - return true; |
41 | * we pick which FAULTMASK to clear. | 132 | + return gen_gvec_ool_zzzz(s, fns[a->esz], a->rd, a->rn, |
42 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) | 133 | + a->rm, a->ra, a->rot); |
43 | */ | 134 | } |
44 | write_v7m_control_spsel_for_secstate(env, return_to_sp_process, exc_secure); | 135 | |
45 | 136 | static bool trans_SQRDCMLAH_zzzz(DisasContext *s, arg_SQRDCMLAH_zzzz *a) | |
46 | + /* | 137 | @@ -XXX,XX +XXX,XX @@ static bool trans_SQRDCMLAH_zzzz(DisasContext *s, arg_SQRDCMLAH_zzzz *a) |
47 | + * Clear scratch FP values left in caller saved registers; this | 138 | if (!dc_isar_feature(aa64_sve2, s)) { |
48 | + * must happen before any kind of tail chaining. | 139 | return false; |
49 | + */ | 140 | } |
50 | + if ((env->v7m.fpccr[M_REG_S] & R_V7M_FPCCR_CLRONRET_MASK) && | 141 | - if (sve_access_check(s)) { |
51 | + (env->v7m.control[M_REG_S] & R_V7M_CONTROL_FPCA_MASK)) { | 142 | - gen_gvec_ool_zzzz(s, fns[a->esz], a->rd, a->rn, a->rm, a->ra, a->rot); |
52 | + if (env->v7m.fpccr[M_REG_S] & R_V7M_FPCCR_LSPACT_MASK) { | 143 | - } |
53 | + env->v7m.sfsr |= R_V7M_SFSR_LSERR_MASK; | 144 | - return true; |
54 | + armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_SECURE, false); | 145 | + return gen_gvec_ool_zzzz(s, fns[a->esz], a->rd, a->rn, |
55 | + qemu_log_mask(CPU_LOG_INT, "...taking SecureFault on existing " | 146 | + a->rm, a->ra, a->rot); |
56 | + "stackframe: error during lazy state deactivation\n"); | 147 | } |
57 | + v7m_exception_taken(cpu, excret, true, false); | 148 | |
58 | + return; | 149 | static bool trans_USDOT_zzzz(DisasContext *s, arg_USDOT_zzzz *a) |
59 | + } else { | 150 | @@ -XXX,XX +XXX,XX @@ static bool do_i8mm_zzzz_ool(DisasContext *s, arg_rrrr_esz *a, |
60 | + /* Clear s0..s15 and FPSCR */ | 151 | if (!dc_isar_feature(aa64_sve_i8mm, s)) { |
61 | + int i; | 152 | return false; |
62 | + | 153 | } |
63 | + for (i = 0; i < 16; i += 2) { | 154 | - if (sve_access_check(s)) { |
64 | + *aa32_vfp_dreg(env, i / 2) = 0; | 155 | - gen_gvec_ool_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, data); |
65 | + } | 156 | - } |
66 | + vfp_set_fpscr(env, 0); | 157 | - return true; |
67 | + } | 158 | + return gen_gvec_ool_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, data); |
68 | + } | 159 | } |
69 | + | 160 | |
70 | if (sfault) { | 161 | static bool trans_SMMLA(DisasContext *s, arg_rrrr_esz *a) |
71 | env->v7m.sfsr |= R_V7M_SFSR_INVER_MASK; | 162 | @@ -XXX,XX +XXX,XX @@ static bool trans_BFDOT_zzzz(DisasContext *s, arg_rrrr_esz *a) |
72 | armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_SECURE, false); | 163 | if (!dc_isar_feature(aa64_sve_bf16, s)) { |
73 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) | 164 | return false; |
74 | } | 165 | } |
75 | } | 166 | - if (sve_access_check(s)) { |
76 | 167 | - gen_gvec_ool_zzzz(s, gen_helper_gvec_bfdot, | |
77 | + if (!ftype) { | 168 | - a->rd, a->rn, a->rm, a->ra, 0); |
78 | + /* FP present and we need to handle it */ | 169 | - } |
79 | + if (!return_to_secure && | 170 | - return true; |
80 | + (env->v7m.fpccr[M_REG_S] & R_V7M_FPCCR_LSPACT_MASK)) { | 171 | + return gen_gvec_ool_zzzz(s, gen_helper_gvec_bfdot, |
81 | + armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_SECURE, false); | 172 | + a->rd, a->rn, a->rm, a->ra, 0); |
82 | + env->v7m.sfsr |= R_V7M_SFSR_LSERR_MASK; | 173 | } |
83 | + qemu_log_mask(CPU_LOG_INT, | 174 | |
84 | + "...taking SecureFault on existing stackframe: " | 175 | static bool trans_BFDOT_zzxz(DisasContext *s, arg_rrxr_esz *a) |
85 | + "Secure LSPACT set but exception return is " | 176 | @@ -XXX,XX +XXX,XX @@ static bool trans_BFDOT_zzxz(DisasContext *s, arg_rrxr_esz *a) |
86 | + "not to secure state\n"); | 177 | if (!dc_isar_feature(aa64_sve_bf16, s)) { |
87 | + v7m_exception_taken(cpu, excret, true, false); | 178 | return false; |
88 | + return; | 179 | } |
89 | + } | 180 | - if (sve_access_check(s)) { |
90 | + | 181 | - gen_gvec_ool_zzzz(s, gen_helper_gvec_bfdot_idx, |
91 | + restore_s16_s31 = return_to_secure && | 182 | - a->rd, a->rn, a->rm, a->ra, a->index); |
92 | + (env->v7m.fpccr[M_REG_S] & R_V7M_FPCCR_TS_MASK); | 183 | - } |
93 | + | 184 | - return true; |
94 | + if (env->v7m.fpccr[return_to_secure] & R_V7M_FPCCR_LSPACT_MASK) { | 185 | + return gen_gvec_ool_zzzz(s, gen_helper_gvec_bfdot_idx, |
95 | + /* State in FPU is still valid, just clear LSPACT */ | 186 | + a->rd, a->rn, a->rm, a->ra, a->index); |
96 | + env->v7m.fpccr[return_to_secure] &= ~R_V7M_FPCCR_LSPACT_MASK; | 187 | } |
97 | + } else { | 188 | |
98 | + int i; | 189 | static bool trans_BFMMLA(DisasContext *s, arg_rrrr_esz *a) |
99 | + uint32_t fpscr; | 190 | @@ -XXX,XX +XXX,XX @@ static bool trans_BFMMLA(DisasContext *s, arg_rrrr_esz *a) |
100 | + bool cpacr_pass, nsacr_pass; | 191 | if (!dc_isar_feature(aa64_sve_bf16, s)) { |
101 | + | 192 | return false; |
102 | + cpacr_pass = v7m_cpacr_pass(env, return_to_secure, | 193 | } |
103 | + return_to_priv); | 194 | - if (sve_access_check(s)) { |
104 | + nsacr_pass = return_to_secure || | 195 | - gen_gvec_ool_zzzz(s, gen_helper_gvec_bfmmla, |
105 | + extract32(env->v7m.nsacr, 10, 1); | 196 | - a->rd, a->rn, a->rm, a->ra, 0); |
106 | + | 197 | - } |
107 | + if (!cpacr_pass) { | 198 | - return true; |
108 | + armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE, | 199 | + return gen_gvec_ool_zzzz(s, gen_helper_gvec_bfmmla, |
109 | + return_to_secure); | 200 | + a->rd, a->rn, a->rm, a->ra, 0); |
110 | + env->v7m.cfsr[return_to_secure] |= R_V7M_CFSR_NOCP_MASK; | 201 | } |
111 | + qemu_log_mask(CPU_LOG_INT, | 202 | |
112 | + "...taking UsageFault on existing " | 203 | static bool do_BFMLAL_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sel) |
113 | + "stackframe: CPACR.CP10 prevents unstacking " | ||
114 | + "FP regs\n"); | ||
115 | + v7m_exception_taken(cpu, excret, true, false); | ||
116 | + return; | ||
117 | + } else if (!nsacr_pass) { | ||
118 | + armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE, true); | ||
119 | + env->v7m.cfsr[M_REG_S] |= R_V7M_CFSR_INVPC_MASK; | ||
120 | + qemu_log_mask(CPU_LOG_INT, | ||
121 | + "...taking Secure UsageFault on existing " | ||
122 | + "stackframe: NSACR.CP10 prevents unstacking " | ||
123 | + "FP regs\n"); | ||
124 | + v7m_exception_taken(cpu, excret, true, false); | ||
125 | + return; | ||
126 | + } | ||
127 | + | ||
128 | + for (i = 0; i < (restore_s16_s31 ? 32 : 16); i += 2) { | ||
129 | + uint32_t slo, shi; | ||
130 | + uint64_t dn; | ||
131 | + uint32_t faddr = frameptr + 0x20 + 4 * i; | ||
132 | + | ||
133 | + if (i >= 16) { | ||
134 | + faddr += 8; /* Skip the slot for the FPSCR */ | ||
135 | + } | ||
136 | + | ||
137 | + pop_ok = pop_ok && | ||
138 | + v7m_stack_read(cpu, &slo, faddr, mmu_idx) && | ||
139 | + v7m_stack_read(cpu, &shi, faddr + 4, mmu_idx); | ||
140 | + | ||
141 | + if (!pop_ok) { | ||
142 | + break; | ||
143 | + } | ||
144 | + | ||
145 | + dn = (uint64_t)shi << 32 | slo; | ||
146 | + *aa32_vfp_dreg(env, i / 2) = dn; | ||
147 | + } | ||
148 | + pop_ok = pop_ok && | ||
149 | + v7m_stack_read(cpu, &fpscr, frameptr + 0x60, mmu_idx); | ||
150 | + if (pop_ok) { | ||
151 | + vfp_set_fpscr(env, fpscr); | ||
152 | + } | ||
153 | + if (!pop_ok) { | ||
154 | + /* | ||
155 | + * These regs are 0 if security extension present; | ||
156 | + * otherwise merely UNKNOWN. We zero always. | ||
157 | + */ | ||
158 | + for (i = 0; i < (restore_s16_s31 ? 32 : 16); i += 2) { | ||
159 | + *aa32_vfp_dreg(env, i / 2) = 0; | ||
160 | + } | ||
161 | + vfp_set_fpscr(env, 0); | ||
162 | + } | ||
163 | + } | ||
164 | + } | ||
165 | + env->v7m.control[M_REG_S] = FIELD_DP32(env->v7m.control[M_REG_S], | ||
166 | + V7M_CONTROL, FPCA, !ftype); | ||
167 | + | ||
168 | /* Commit to consuming the stack frame */ | ||
169 | frameptr += 0x20; | ||
170 | + if (!ftype) { | ||
171 | + frameptr += 0x48; | ||
172 | + if (restore_s16_s31) { | ||
173 | + frameptr += 0x40; | ||
174 | + } | ||
175 | + } | ||
176 | /* Undo stack alignment (the SPREALIGN bit indicates that the original | ||
177 | * pre-exception SP was not 8-aligned and we added a padding word to | ||
178 | * align it, so we undo this by ORing in the bit that increases it | ||
179 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) | ||
180 | *frame_sp_p = frameptr; | ||
181 | } | ||
182 | /* This xpsr_write() will invalidate frame_sp_p as it may switch stack */ | ||
183 | - xpsr_write(env, xpsr, ~XPSR_SPREALIGN); | ||
184 | + xpsr_write(env, xpsr, ~(XPSR_SPREALIGN | XPSR_SFPA)); | ||
185 | + | ||
186 | + if (env->v7m.secure) { | ||
187 | + bool sfpa = xpsr & XPSR_SFPA; | ||
188 | + | ||
189 | + env->v7m.control[M_REG_S] = FIELD_DP32(env->v7m.control[M_REG_S], | ||
190 | + V7M_CONTROL, SFPA, sfpa); | ||
191 | + } | ||
192 | |||
193 | /* The restored xPSR exception field will be zero if we're | ||
194 | * resuming in Thread mode. If that doesn't match what the | ||
195 | -- | 204 | -- |
196 | 2.20.1 | 205 | 2.25.1 |
197 | |||
198 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions directly using | ||
4 | gen_gvec_ool_zzzz to TRANS_FEAT. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-10-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 89 +++++++++++++------------------------- | ||
12 | 1 file changed, 29 insertions(+), 60 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_3 * const sve_tbl_fns[4] = { | ||
19 | }; | ||
20 | TRANS_FEAT(TBL, aa64_sve, gen_gvec_ool_arg_zzz, sve_tbl_fns[a->esz], a, 0) | ||
21 | |||
22 | -static bool trans_TBL_sve2(DisasContext *s, arg_rrr_esz *a) | ||
23 | -{ | ||
24 | - static gen_helper_gvec_4 * const fns[4] = { | ||
25 | - gen_helper_sve2_tbl_b, gen_helper_sve2_tbl_h, | ||
26 | - gen_helper_sve2_tbl_s, gen_helper_sve2_tbl_d | ||
27 | - }; | ||
28 | - | ||
29 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
30 | - return false; | ||
31 | - } | ||
32 | - return gen_gvec_ool_zzzz(s, fns[a->esz], a->rd, a->rn, | ||
33 | - (a->rn + 1) % 32, a->rm, 0); | ||
34 | -} | ||
35 | +static gen_helper_gvec_4 * const sve2_tbl_fns[4] = { | ||
36 | + gen_helper_sve2_tbl_b, gen_helper_sve2_tbl_h, | ||
37 | + gen_helper_sve2_tbl_s, gen_helper_sve2_tbl_d | ||
38 | +}; | ||
39 | +TRANS_FEAT(TBL_sve2, aa64_sve2, gen_gvec_ool_zzzz, sve2_tbl_fns[a->esz], | ||
40 | + a->rd, a->rn, (a->rn + 1) % 32, a->rm, 0) | ||
41 | |||
42 | static gen_helper_gvec_3 * const tbx_fns[4] = { | ||
43 | gen_helper_sve2_tbx_b, gen_helper_sve2_tbx_h, | ||
44 | @@ -XXX,XX +XXX,XX @@ DO_ZZI(UMIN, umin) | ||
45 | |||
46 | #undef DO_ZZI | ||
47 | |||
48 | -static bool trans_DOT_zzzz(DisasContext *s, arg_DOT_zzzz *a) | ||
49 | -{ | ||
50 | - static gen_helper_gvec_4 * const fns[2][2] = { | ||
51 | - { gen_helper_gvec_sdot_b, gen_helper_gvec_sdot_h }, | ||
52 | - { gen_helper_gvec_udot_b, gen_helper_gvec_udot_h } | ||
53 | - }; | ||
54 | - return gen_gvec_ool_zzzz(s, fns[a->u][a->sz], | ||
55 | - a->rd, a->rn, a->rm, a->ra, 0); | ||
56 | -} | ||
57 | +static gen_helper_gvec_4 * const dot_fns[2][2] = { | ||
58 | + { gen_helper_gvec_sdot_b, gen_helper_gvec_sdot_h }, | ||
59 | + { gen_helper_gvec_udot_b, gen_helper_gvec_udot_h } | ||
60 | +}; | ||
61 | +TRANS_FEAT(DOT_zzzz, aa64_sve, gen_gvec_ool_zzzz, | ||
62 | + dot_fns[a->u][a->sz], a->rd, a->rn, a->rm, a->ra, 0) | ||
63 | |||
64 | /* | ||
65 | * SVE Multiply - Indexed | ||
66 | @@ -XXX,XX +XXX,XX @@ static bool trans_UMLSLT_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
67 | return do_umlsl_zzzw(s, a, true); | ||
68 | } | ||
69 | |||
70 | -static bool trans_CMLA_zzzz(DisasContext *s, arg_CMLA_zzzz *a) | ||
71 | -{ | ||
72 | - static gen_helper_gvec_4 * const fns[] = { | ||
73 | - gen_helper_sve2_cmla_zzzz_b, gen_helper_sve2_cmla_zzzz_h, | ||
74 | - gen_helper_sve2_cmla_zzzz_s, gen_helper_sve2_cmla_zzzz_d, | ||
75 | - }; | ||
76 | +static gen_helper_gvec_4 * const cmla_fns[] = { | ||
77 | + gen_helper_sve2_cmla_zzzz_b, gen_helper_sve2_cmla_zzzz_h, | ||
78 | + gen_helper_sve2_cmla_zzzz_s, gen_helper_sve2_cmla_zzzz_d, | ||
79 | +}; | ||
80 | +TRANS_FEAT(CMLA_zzzz, aa64_sve2, gen_gvec_ool_zzzz, | ||
81 | + cmla_fns[a->esz], a->rd, a->rn, a->rm, a->ra, a->rot) | ||
82 | |||
83 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
84 | - return false; | ||
85 | - } | ||
86 | - return gen_gvec_ool_zzzz(s, fns[a->esz], a->rd, a->rn, | ||
87 | - a->rm, a->ra, a->rot); | ||
88 | -} | ||
89 | +static gen_helper_gvec_4 * const cdot_fns[] = { | ||
90 | + NULL, NULL, gen_helper_sve2_cdot_zzzz_s, gen_helper_sve2_cdot_zzzz_d | ||
91 | +}; | ||
92 | +TRANS_FEAT(CDOT_zzzz, aa64_sve2, gen_gvec_ool_zzzz, | ||
93 | + cdot_fns[a->esz], a->rd, a->rn, a->rm, a->ra, a->rot) | ||
94 | |||
95 | -static bool trans_CDOT_zzzz(DisasContext *s, arg_CMLA_zzzz *a) | ||
96 | -{ | ||
97 | - static gen_helper_gvec_4 * const fns[] = { | ||
98 | - NULL, NULL, gen_helper_sve2_cdot_zzzz_s, gen_helper_sve2_cdot_zzzz_d | ||
99 | - }; | ||
100 | - | ||
101 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
102 | - return false; | ||
103 | - } | ||
104 | - return gen_gvec_ool_zzzz(s, fns[a->esz], a->rd, a->rn, | ||
105 | - a->rm, a->ra, a->rot); | ||
106 | -} | ||
107 | - | ||
108 | -static bool trans_SQRDCMLAH_zzzz(DisasContext *s, arg_SQRDCMLAH_zzzz *a) | ||
109 | -{ | ||
110 | - static gen_helper_gvec_4 * const fns[] = { | ||
111 | - gen_helper_sve2_sqrdcmlah_zzzz_b, gen_helper_sve2_sqrdcmlah_zzzz_h, | ||
112 | - gen_helper_sve2_sqrdcmlah_zzzz_s, gen_helper_sve2_sqrdcmlah_zzzz_d, | ||
113 | - }; | ||
114 | - | ||
115 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
116 | - return false; | ||
117 | - } | ||
118 | - return gen_gvec_ool_zzzz(s, fns[a->esz], a->rd, a->rn, | ||
119 | - a->rm, a->ra, a->rot); | ||
120 | -} | ||
121 | +static gen_helper_gvec_4 * const sqrdcmlah_fns[] = { | ||
122 | + gen_helper_sve2_sqrdcmlah_zzzz_b, gen_helper_sve2_sqrdcmlah_zzzz_h, | ||
123 | + gen_helper_sve2_sqrdcmlah_zzzz_s, gen_helper_sve2_sqrdcmlah_zzzz_d, | ||
124 | +}; | ||
125 | +TRANS_FEAT(SQRDCMLAH_zzzz, aa64_sve2, gen_gvec_ool_zzzz, | ||
126 | + sqrdcmlah_fns[a->esz], a->rd, a->rn, a->rm, a->ra, a->rot) | ||
127 | |||
128 | static bool trans_USDOT_zzzz(DisasContext *s, arg_USDOT_zzzz *a) | ||
129 | { | ||
130 | -- | ||
131 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Use gen_gvec_ool_arg_zzzz instead of gen_gvec_ool_zzzz | ||
4 | when the arguments come from arg_rrrr_esz. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-11-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 16 ++++++++++------ | ||
12 | 1 file changed, 10 insertions(+), 6 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_zzzz(DisasContext *s, gen_helper_gvec_4 *fn, | ||
19 | return true; | ||
20 | } | ||
21 | |||
22 | +static bool gen_gvec_ool_arg_zzzz(DisasContext *s, gen_helper_gvec_4 *fn, | ||
23 | + arg_rrrr_esz *a, int data) | ||
24 | +{ | ||
25 | + return gen_gvec_ool_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, data); | ||
26 | +} | ||
27 | + | ||
28 | /* Invoke an out-of-line helper on 2 Zregs and a predicate. */ | ||
29 | static void gen_gvec_ool_zzp(DisasContext *s, gen_helper_gvec_3 *fn, | ||
30 | int rd, int rn, int pg, int data) | ||
31 | @@ -XXX,XX +XXX,XX @@ static bool do_sve2_zzzz_ool(DisasContext *s, arg_rrrr_esz *a, | ||
32 | if (!dc_isar_feature(aa64_sve2, s)) { | ||
33 | return false; | ||
34 | } | ||
35 | - return gen_gvec_ool_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, data); | ||
36 | + return gen_gvec_ool_arg_zzzz(s, fn, a, data); | ||
37 | } | ||
38 | |||
39 | static bool do_abal(DisasContext *s, arg_rrrr_esz *a, bool uns, bool sel) | ||
40 | @@ -XXX,XX +XXX,XX @@ static bool do_i8mm_zzzz_ool(DisasContext *s, arg_rrrr_esz *a, | ||
41 | if (!dc_isar_feature(aa64_sve_i8mm, s)) { | ||
42 | return false; | ||
43 | } | ||
44 | - return gen_gvec_ool_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, data); | ||
45 | + return gen_gvec_ool_arg_zzzz(s, fn, a, data); | ||
46 | } | ||
47 | |||
48 | static bool trans_SMMLA(DisasContext *s, arg_rrrr_esz *a) | ||
49 | @@ -XXX,XX +XXX,XX @@ static bool trans_BFDOT_zzzz(DisasContext *s, arg_rrrr_esz *a) | ||
50 | if (!dc_isar_feature(aa64_sve_bf16, s)) { | ||
51 | return false; | ||
52 | } | ||
53 | - return gen_gvec_ool_zzzz(s, gen_helper_gvec_bfdot, | ||
54 | - a->rd, a->rn, a->rm, a->ra, 0); | ||
55 | + return gen_gvec_ool_arg_zzzz(s, gen_helper_gvec_bfdot, a, 0); | ||
56 | } | ||
57 | |||
58 | static bool trans_BFDOT_zzxz(DisasContext *s, arg_rrxr_esz *a) | ||
59 | @@ -XXX,XX +XXX,XX @@ static bool trans_BFMMLA(DisasContext *s, arg_rrrr_esz *a) | ||
60 | if (!dc_isar_feature(aa64_sve_bf16, s)) { | ||
61 | return false; | ||
62 | } | ||
63 | - return gen_gvec_ool_zzzz(s, gen_helper_gvec_bfmmla, | ||
64 | - a->rd, a->rn, a->rm, a->ra, 0); | ||
65 | + return gen_gvec_ool_arg_zzzz(s, gen_helper_gvec_bfmmla, a, 0); | ||
66 | } | ||
67 | |||
68 | static bool do_BFMLAL_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sel) | ||
69 | -- | ||
70 | 2.25.1 | diff view generated by jsdifflib |
1 | For v8M floating point support, transitions from Secure | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | to Non-secure state via BLNS and BLXNS must clear the | ||
3 | CONTROL.SFPA bit. (This corresponds to the pseudocode | ||
4 | BranchToNS() function.) | ||
5 | 2 | ||
3 | Convert SVE translation functions using do_sve2_zzzz_ool | ||
4 | to use TRANS_FEAT and gen_gvec_ool_arg_zzzz. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-12-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20190416125744.27770-13-peter.maydell@linaro.org | ||
9 | --- | 10 | --- |
10 | target/arm/helper.c | 4 ++++ | 11 | target/arm/translate-sve.c | 263 +++++++++++-------------------------- |
11 | 1 file changed, 4 insertions(+) | 12 | 1 file changed, 79 insertions(+), 184 deletions(-) |
12 | 13 | ||
13 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
14 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/helper.c | 16 | --- a/target/arm/translate-sve.c |
16 | +++ b/target/arm/helper.c | 17 | +++ b/target/arm/translate-sve.c |
17 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_bxns)(CPUARMState *env, uint32_t dest) | 18 | @@ -XXX,XX +XXX,XX @@ static bool trans_SQCADD_rot270(DisasContext *s, arg_rrr_esz *a) |
18 | /* translate.c should have made BXNS UNDEF unless we're secure */ | 19 | return do_cadd(s, a, true, true); |
19 | assert(env->v7m.secure); | 20 | } |
20 | 21 | ||
21 | + if (!(dest & 1)) { | 22 | -static bool do_sve2_zzzz_ool(DisasContext *s, arg_rrrr_esz *a, |
22 | + env->v7m.control[M_REG_S] &= ~R_V7M_CONTROL_SFPA_MASK; | 23 | - gen_helper_gvec_4 *fn, int data) |
23 | + } | 24 | -{ |
24 | switch_v7m_security_state(env, dest & 1); | 25 | - if (!dc_isar_feature(aa64_sve2, s)) { |
25 | env->thumb = 1; | 26 | - return false; |
26 | env->regs[15] = dest & ~1; | 27 | - } |
27 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_blxns)(CPUARMState *env, uint32_t dest) | 28 | - return gen_gvec_ool_arg_zzzz(s, fn, a, data); |
28 | */ | 29 | -} |
29 | write_v7m_exception(env, 1); | 30 | +static gen_helper_gvec_4 * const sabal_fns[4] = { |
30 | } | 31 | + NULL, gen_helper_sve2_sabal_h, |
31 | + env->v7m.control[M_REG_S] &= ~R_V7M_CONTROL_SFPA_MASK; | 32 | + gen_helper_sve2_sabal_s, gen_helper_sve2_sabal_d, |
32 | switch_v7m_security_state(env, 0); | 33 | +}; |
33 | env->thumb = 1; | 34 | +TRANS_FEAT(SABALB, aa64_sve2, gen_gvec_ool_arg_zzzz, sabal_fns[a->esz], a, 0) |
34 | env->regs[15] = dest; | 35 | +TRANS_FEAT(SABALT, aa64_sve2, gen_gvec_ool_arg_zzzz, sabal_fns[a->esz], a, 1) |
36 | |||
37 | -static bool do_abal(DisasContext *s, arg_rrrr_esz *a, bool uns, bool sel) | ||
38 | -{ | ||
39 | - static gen_helper_gvec_4 * const fns[2][4] = { | ||
40 | - { NULL, gen_helper_sve2_sabal_h, | ||
41 | - gen_helper_sve2_sabal_s, gen_helper_sve2_sabal_d }, | ||
42 | - { NULL, gen_helper_sve2_uabal_h, | ||
43 | - gen_helper_sve2_uabal_s, gen_helper_sve2_uabal_d }, | ||
44 | - }; | ||
45 | - return do_sve2_zzzz_ool(s, a, fns[uns][a->esz], sel); | ||
46 | -} | ||
47 | - | ||
48 | -static bool trans_SABALB(DisasContext *s, arg_rrrr_esz *a) | ||
49 | -{ | ||
50 | - return do_abal(s, a, false, false); | ||
51 | -} | ||
52 | - | ||
53 | -static bool trans_SABALT(DisasContext *s, arg_rrrr_esz *a) | ||
54 | -{ | ||
55 | - return do_abal(s, a, false, true); | ||
56 | -} | ||
57 | - | ||
58 | -static bool trans_UABALB(DisasContext *s, arg_rrrr_esz *a) | ||
59 | -{ | ||
60 | - return do_abal(s, a, true, false); | ||
61 | -} | ||
62 | - | ||
63 | -static bool trans_UABALT(DisasContext *s, arg_rrrr_esz *a) | ||
64 | -{ | ||
65 | - return do_abal(s, a, true, true); | ||
66 | -} | ||
67 | +static gen_helper_gvec_4 * const uabal_fns[4] = { | ||
68 | + NULL, gen_helper_sve2_uabal_h, | ||
69 | + gen_helper_sve2_uabal_s, gen_helper_sve2_uabal_d, | ||
70 | +}; | ||
71 | +TRANS_FEAT(UABALB, aa64_sve2, gen_gvec_ool_arg_zzzz, uabal_fns[a->esz], a, 0) | ||
72 | +TRANS_FEAT(UABALT, aa64_sve2, gen_gvec_ool_arg_zzzz, uabal_fns[a->esz], a, 1) | ||
73 | |||
74 | static bool do_adcl(DisasContext *s, arg_rrrr_esz *a, bool sel) | ||
75 | { | ||
76 | @@ -XXX,XX +XXX,XX @@ static bool do_adcl(DisasContext *s, arg_rrrr_esz *a, bool sel) | ||
77 | * Note that in this case the ESZ field encodes both size and sign. | ||
78 | * Split out 'subtract' into bit 1 of the data field for the helper. | ||
79 | */ | ||
80 | - return do_sve2_zzzz_ool(s, a, fns[a->esz & 1], (a->esz & 2) | sel); | ||
81 | + return gen_gvec_ool_arg_zzzz(s, fns[a->esz & 1], a, (a->esz & 2) | sel); | ||
82 | } | ||
83 | |||
84 | -static bool trans_ADCLB(DisasContext *s, arg_rrrr_esz *a) | ||
85 | -{ | ||
86 | - return do_adcl(s, a, false); | ||
87 | -} | ||
88 | - | ||
89 | -static bool trans_ADCLT(DisasContext *s, arg_rrrr_esz *a) | ||
90 | -{ | ||
91 | - return do_adcl(s, a, true); | ||
92 | -} | ||
93 | +TRANS_FEAT(ADCLB, aa64_sve2, do_adcl, a, false) | ||
94 | +TRANS_FEAT(ADCLT, aa64_sve2, do_adcl, a, true) | ||
95 | |||
96 | static bool do_sve2_fn2i(DisasContext *s, arg_rri_esz *a, GVecGen2iFn *fn) | ||
97 | { | ||
98 | @@ -XXX,XX +XXX,XX @@ static bool trans_FMMLA(DisasContext *s, arg_rrrr_esz *a) | ||
99 | return true; | ||
100 | } | ||
101 | |||
102 | -static bool do_sqdmlal_zzzw(DisasContext *s, arg_rrrr_esz *a, | ||
103 | - bool sel1, bool sel2) | ||
104 | -{ | ||
105 | - static gen_helper_gvec_4 * const fns[] = { | ||
106 | - NULL, gen_helper_sve2_sqdmlal_zzzw_h, | ||
107 | - gen_helper_sve2_sqdmlal_zzzw_s, gen_helper_sve2_sqdmlal_zzzw_d, | ||
108 | - }; | ||
109 | - return do_sve2_zzzz_ool(s, a, fns[a->esz], (sel2 << 1) | sel1); | ||
110 | -} | ||
111 | +static gen_helper_gvec_4 * const sqdmlal_zzzw_fns[] = { | ||
112 | + NULL, gen_helper_sve2_sqdmlal_zzzw_h, | ||
113 | + gen_helper_sve2_sqdmlal_zzzw_s, gen_helper_sve2_sqdmlal_zzzw_d, | ||
114 | +}; | ||
115 | +TRANS_FEAT(SQDMLALB_zzzw, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
116 | + sqdmlal_zzzw_fns[a->esz], a, 0) | ||
117 | +TRANS_FEAT(SQDMLALT_zzzw, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
118 | + sqdmlal_zzzw_fns[a->esz], a, 3) | ||
119 | +TRANS_FEAT(SQDMLALBT, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
120 | + sqdmlal_zzzw_fns[a->esz], a, 2) | ||
121 | |||
122 | -static bool do_sqdmlsl_zzzw(DisasContext *s, arg_rrrr_esz *a, | ||
123 | - bool sel1, bool sel2) | ||
124 | -{ | ||
125 | - static gen_helper_gvec_4 * const fns[] = { | ||
126 | - NULL, gen_helper_sve2_sqdmlsl_zzzw_h, | ||
127 | - gen_helper_sve2_sqdmlsl_zzzw_s, gen_helper_sve2_sqdmlsl_zzzw_d, | ||
128 | - }; | ||
129 | - return do_sve2_zzzz_ool(s, a, fns[a->esz], (sel2 << 1) | sel1); | ||
130 | -} | ||
131 | +static gen_helper_gvec_4 * const sqdmlsl_zzzw_fns[] = { | ||
132 | + NULL, gen_helper_sve2_sqdmlsl_zzzw_h, | ||
133 | + gen_helper_sve2_sqdmlsl_zzzw_s, gen_helper_sve2_sqdmlsl_zzzw_d, | ||
134 | +}; | ||
135 | +TRANS_FEAT(SQDMLSLB_zzzw, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
136 | + sqdmlsl_zzzw_fns[a->esz], a, 0) | ||
137 | +TRANS_FEAT(SQDMLSLT_zzzw, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
138 | + sqdmlsl_zzzw_fns[a->esz], a, 3) | ||
139 | +TRANS_FEAT(SQDMLSLBT, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
140 | + sqdmlsl_zzzw_fns[a->esz], a, 2) | ||
141 | |||
142 | -static bool trans_SQDMLALB_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
143 | -{ | ||
144 | - return do_sqdmlal_zzzw(s, a, false, false); | ||
145 | -} | ||
146 | +static gen_helper_gvec_4 * const sqrdmlah_fns[] = { | ||
147 | + gen_helper_sve2_sqrdmlah_b, gen_helper_sve2_sqrdmlah_h, | ||
148 | + gen_helper_sve2_sqrdmlah_s, gen_helper_sve2_sqrdmlah_d, | ||
149 | +}; | ||
150 | +TRANS_FEAT(SQRDMLAH_zzzz, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
151 | + sqrdmlah_fns[a->esz], a, 0) | ||
152 | |||
153 | -static bool trans_SQDMLALT_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
154 | -{ | ||
155 | - return do_sqdmlal_zzzw(s, a, true, true); | ||
156 | -} | ||
157 | +static gen_helper_gvec_4 * const sqrdmlsh_fns[] = { | ||
158 | + gen_helper_sve2_sqrdmlsh_b, gen_helper_sve2_sqrdmlsh_h, | ||
159 | + gen_helper_sve2_sqrdmlsh_s, gen_helper_sve2_sqrdmlsh_d, | ||
160 | +}; | ||
161 | +TRANS_FEAT(SQRDMLSH_zzzz, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
162 | + sqrdmlsh_fns[a->esz], a, 0) | ||
163 | |||
164 | -static bool trans_SQDMLALBT(DisasContext *s, arg_rrrr_esz *a) | ||
165 | -{ | ||
166 | - return do_sqdmlal_zzzw(s, a, false, true); | ||
167 | -} | ||
168 | +static gen_helper_gvec_4 * const smlal_zzzw_fns[] = { | ||
169 | + NULL, gen_helper_sve2_smlal_zzzw_h, | ||
170 | + gen_helper_sve2_smlal_zzzw_s, gen_helper_sve2_smlal_zzzw_d, | ||
171 | +}; | ||
172 | +TRANS_FEAT(SMLALB_zzzw, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
173 | + smlal_zzzw_fns[a->esz], a, 0) | ||
174 | +TRANS_FEAT(SMLALT_zzzw, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
175 | + smlal_zzzw_fns[a->esz], a, 1) | ||
176 | |||
177 | -static bool trans_SQDMLSLB_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
178 | -{ | ||
179 | - return do_sqdmlsl_zzzw(s, a, false, false); | ||
180 | -} | ||
181 | +static gen_helper_gvec_4 * const umlal_zzzw_fns[] = { | ||
182 | + NULL, gen_helper_sve2_umlal_zzzw_h, | ||
183 | + gen_helper_sve2_umlal_zzzw_s, gen_helper_sve2_umlal_zzzw_d, | ||
184 | +}; | ||
185 | +TRANS_FEAT(UMLALB_zzzw, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
186 | + umlal_zzzw_fns[a->esz], a, 0) | ||
187 | +TRANS_FEAT(UMLALT_zzzw, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
188 | + umlal_zzzw_fns[a->esz], a, 1) | ||
189 | |||
190 | -static bool trans_SQDMLSLT_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
191 | -{ | ||
192 | - return do_sqdmlsl_zzzw(s, a, true, true); | ||
193 | -} | ||
194 | +static gen_helper_gvec_4 * const smlsl_zzzw_fns[] = { | ||
195 | + NULL, gen_helper_sve2_smlsl_zzzw_h, | ||
196 | + gen_helper_sve2_smlsl_zzzw_s, gen_helper_sve2_smlsl_zzzw_d, | ||
197 | +}; | ||
198 | +TRANS_FEAT(SMLSLB_zzzw, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
199 | + smlsl_zzzw_fns[a->esz], a, 0) | ||
200 | +TRANS_FEAT(SMLSLT_zzzw, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
201 | + smlsl_zzzw_fns[a->esz], a, 1) | ||
202 | |||
203 | -static bool trans_SQDMLSLBT(DisasContext *s, arg_rrrr_esz *a) | ||
204 | -{ | ||
205 | - return do_sqdmlsl_zzzw(s, a, false, true); | ||
206 | -} | ||
207 | - | ||
208 | -static bool trans_SQRDMLAH_zzzz(DisasContext *s, arg_rrrr_esz *a) | ||
209 | -{ | ||
210 | - static gen_helper_gvec_4 * const fns[] = { | ||
211 | - gen_helper_sve2_sqrdmlah_b, gen_helper_sve2_sqrdmlah_h, | ||
212 | - gen_helper_sve2_sqrdmlah_s, gen_helper_sve2_sqrdmlah_d, | ||
213 | - }; | ||
214 | - return do_sve2_zzzz_ool(s, a, fns[a->esz], 0); | ||
215 | -} | ||
216 | - | ||
217 | -static bool trans_SQRDMLSH_zzzz(DisasContext *s, arg_rrrr_esz *a) | ||
218 | -{ | ||
219 | - static gen_helper_gvec_4 * const fns[] = { | ||
220 | - gen_helper_sve2_sqrdmlsh_b, gen_helper_sve2_sqrdmlsh_h, | ||
221 | - gen_helper_sve2_sqrdmlsh_s, gen_helper_sve2_sqrdmlsh_d, | ||
222 | - }; | ||
223 | - return do_sve2_zzzz_ool(s, a, fns[a->esz], 0); | ||
224 | -} | ||
225 | - | ||
226 | -static bool do_smlal_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sel) | ||
227 | -{ | ||
228 | - static gen_helper_gvec_4 * const fns[] = { | ||
229 | - NULL, gen_helper_sve2_smlal_zzzw_h, | ||
230 | - gen_helper_sve2_smlal_zzzw_s, gen_helper_sve2_smlal_zzzw_d, | ||
231 | - }; | ||
232 | - return do_sve2_zzzz_ool(s, a, fns[a->esz], sel); | ||
233 | -} | ||
234 | - | ||
235 | -static bool trans_SMLALB_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
236 | -{ | ||
237 | - return do_smlal_zzzw(s, a, false); | ||
238 | -} | ||
239 | - | ||
240 | -static bool trans_SMLALT_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
241 | -{ | ||
242 | - return do_smlal_zzzw(s, a, true); | ||
243 | -} | ||
244 | - | ||
245 | -static bool do_umlal_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sel) | ||
246 | -{ | ||
247 | - static gen_helper_gvec_4 * const fns[] = { | ||
248 | - NULL, gen_helper_sve2_umlal_zzzw_h, | ||
249 | - gen_helper_sve2_umlal_zzzw_s, gen_helper_sve2_umlal_zzzw_d, | ||
250 | - }; | ||
251 | - return do_sve2_zzzz_ool(s, a, fns[a->esz], sel); | ||
252 | -} | ||
253 | - | ||
254 | -static bool trans_UMLALB_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
255 | -{ | ||
256 | - return do_umlal_zzzw(s, a, false); | ||
257 | -} | ||
258 | - | ||
259 | -static bool trans_UMLALT_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
260 | -{ | ||
261 | - return do_umlal_zzzw(s, a, true); | ||
262 | -} | ||
263 | - | ||
264 | -static bool do_smlsl_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sel) | ||
265 | -{ | ||
266 | - static gen_helper_gvec_4 * const fns[] = { | ||
267 | - NULL, gen_helper_sve2_smlsl_zzzw_h, | ||
268 | - gen_helper_sve2_smlsl_zzzw_s, gen_helper_sve2_smlsl_zzzw_d, | ||
269 | - }; | ||
270 | - return do_sve2_zzzz_ool(s, a, fns[a->esz], sel); | ||
271 | -} | ||
272 | - | ||
273 | -static bool trans_SMLSLB_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
274 | -{ | ||
275 | - return do_smlsl_zzzw(s, a, false); | ||
276 | -} | ||
277 | - | ||
278 | -static bool trans_SMLSLT_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
279 | -{ | ||
280 | - return do_smlsl_zzzw(s, a, true); | ||
281 | -} | ||
282 | - | ||
283 | -static bool do_umlsl_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sel) | ||
284 | -{ | ||
285 | - static gen_helper_gvec_4 * const fns[] = { | ||
286 | - NULL, gen_helper_sve2_umlsl_zzzw_h, | ||
287 | - gen_helper_sve2_umlsl_zzzw_s, gen_helper_sve2_umlsl_zzzw_d, | ||
288 | - }; | ||
289 | - return do_sve2_zzzz_ool(s, a, fns[a->esz], sel); | ||
290 | -} | ||
291 | - | ||
292 | -static bool trans_UMLSLB_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
293 | -{ | ||
294 | - return do_umlsl_zzzw(s, a, false); | ||
295 | -} | ||
296 | - | ||
297 | -static bool trans_UMLSLT_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
298 | -{ | ||
299 | - return do_umlsl_zzzw(s, a, true); | ||
300 | -} | ||
301 | +static gen_helper_gvec_4 * const umlsl_zzzw_fns[] = { | ||
302 | + NULL, gen_helper_sve2_umlsl_zzzw_h, | ||
303 | + gen_helper_sve2_umlsl_zzzw_s, gen_helper_sve2_umlsl_zzzw_d, | ||
304 | +}; | ||
305 | +TRANS_FEAT(UMLSLB_zzzw, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
306 | + umlsl_zzzw_fns[a->esz], a, 0) | ||
307 | +TRANS_FEAT(UMLSLT_zzzw, aa64_sve2, gen_gvec_ool_arg_zzzz, | ||
308 | + umlsl_zzzw_fns[a->esz], a, 1) | ||
309 | |||
310 | static gen_helper_gvec_4 * const cmla_fns[] = { | ||
311 | gen_helper_sve2_cmla_zzzz_b, gen_helper_sve2_cmla_zzzz_h, | ||
35 | -- | 312 | -- |
36 | 2.20.1 | 313 | 2.25.1 |
37 | |||
38 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions directly using | ||
4 | gen_gvec_ool_arg_zzzz to TRANS_FEAT. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-13-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 47 ++++++++------------------------------ | ||
12 | 1 file changed, 10 insertions(+), 37 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static bool trans_FMLSLT_zzxw(DisasContext *s, arg_rrxr_esz *a) | ||
19 | return do_FMLAL_zzxw(s, a, true, true); | ||
20 | } | ||
21 | |||
22 | -static bool do_i8mm_zzzz_ool(DisasContext *s, arg_rrrr_esz *a, | ||
23 | - gen_helper_gvec_4 *fn, int data) | ||
24 | -{ | ||
25 | - if (!dc_isar_feature(aa64_sve_i8mm, s)) { | ||
26 | - return false; | ||
27 | - } | ||
28 | - return gen_gvec_ool_arg_zzzz(s, fn, a, data); | ||
29 | -} | ||
30 | +TRANS_FEAT(SMMLA, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz, | ||
31 | + gen_helper_gvec_smmla_b, a, 0) | ||
32 | +TRANS_FEAT(USMMLA, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz, | ||
33 | + gen_helper_gvec_usmmla_b, a, 0) | ||
34 | +TRANS_FEAT(UMMLA, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz, | ||
35 | + gen_helper_gvec_ummla_b, a, 0) | ||
36 | |||
37 | -static bool trans_SMMLA(DisasContext *s, arg_rrrr_esz *a) | ||
38 | -{ | ||
39 | - return do_i8mm_zzzz_ool(s, a, gen_helper_gvec_smmla_b, 0); | ||
40 | -} | ||
41 | - | ||
42 | -static bool trans_USMMLA(DisasContext *s, arg_rrrr_esz *a) | ||
43 | -{ | ||
44 | - return do_i8mm_zzzz_ool(s, a, gen_helper_gvec_usmmla_b, 0); | ||
45 | -} | ||
46 | - | ||
47 | -static bool trans_UMMLA(DisasContext *s, arg_rrrr_esz *a) | ||
48 | -{ | ||
49 | - return do_i8mm_zzzz_ool(s, a, gen_helper_gvec_ummla_b, 0); | ||
50 | -} | ||
51 | - | ||
52 | -static bool trans_BFDOT_zzzz(DisasContext *s, arg_rrrr_esz *a) | ||
53 | -{ | ||
54 | - if (!dc_isar_feature(aa64_sve_bf16, s)) { | ||
55 | - return false; | ||
56 | - } | ||
57 | - return gen_gvec_ool_arg_zzzz(s, gen_helper_gvec_bfdot, a, 0); | ||
58 | -} | ||
59 | +TRANS_FEAT(BFDOT_zzzz, aa64_sve_bf16, gen_gvec_ool_arg_zzzz, | ||
60 | + gen_helper_gvec_bfdot, a, 0) | ||
61 | |||
62 | static bool trans_BFDOT_zzxz(DisasContext *s, arg_rrxr_esz *a) | ||
63 | { | ||
64 | @@ -XXX,XX +XXX,XX @@ static bool trans_BFDOT_zzxz(DisasContext *s, arg_rrxr_esz *a) | ||
65 | a->rd, a->rn, a->rm, a->ra, a->index); | ||
66 | } | ||
67 | |||
68 | -static bool trans_BFMMLA(DisasContext *s, arg_rrrr_esz *a) | ||
69 | -{ | ||
70 | - if (!dc_isar_feature(aa64_sve_bf16, s)) { | ||
71 | - return false; | ||
72 | - } | ||
73 | - return gen_gvec_ool_arg_zzzz(s, gen_helper_gvec_bfmmla, a, 0); | ||
74 | -} | ||
75 | +TRANS_FEAT(BFMMLA, aa64_sve_bf16, gen_gvec_ool_arg_zzzz, | ||
76 | + gen_helper_gvec_bfmmla, a, 0) | ||
77 | |||
78 | static bool do_BFMLAL_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sel) | ||
79 | { | ||
80 | -- | ||
81 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Rename the function to match gen_gvec_ool_arg_zzzz, | ||
4 | and move to be adjacent. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-14-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 18 +++++++++--------- | ||
12 | 1 file changed, 9 insertions(+), 9 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_arg_zzzz(DisasContext *s, gen_helper_gvec_4 *fn, | ||
19 | return gen_gvec_ool_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, data); | ||
20 | } | ||
21 | |||
22 | +static bool gen_gvec_ool_arg_zzxz(DisasContext *s, gen_helper_gvec_4 *fn, | ||
23 | + arg_rrxr_esz *a) | ||
24 | +{ | ||
25 | + return gen_gvec_ool_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, a->index); | ||
26 | +} | ||
27 | + | ||
28 | /* Invoke an out-of-line helper on 2 Zregs and a predicate. */ | ||
29 | static void gen_gvec_ool_zzp(DisasContext *s, gen_helper_gvec_3 *fn, | ||
30 | int rd, int rn, int pg, int data) | ||
31 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(DOT_zzzz, aa64_sve, gen_gvec_ool_zzzz, | ||
32 | * SVE Multiply - Indexed | ||
33 | */ | ||
34 | |||
35 | -static bool do_zzxz_ool(DisasContext *s, arg_rrxr_esz *a, | ||
36 | - gen_helper_gvec_4 *fn) | ||
37 | -{ | ||
38 | - return gen_gvec_ool_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, a->index); | ||
39 | -} | ||
40 | - | ||
41 | #define DO_RRXR(NAME, FUNC) \ | ||
42 | static bool NAME(DisasContext *s, arg_rrxr_esz *a) \ | ||
43 | - { return do_zzxz_ool(s, a, FUNC); } | ||
44 | + { return gen_gvec_ool_arg_zzxz(s, FUNC, a); } | ||
45 | |||
46 | DO_RRXR(trans_SDOT_zzxw_s, gen_helper_gvec_sdot_idx_b) | ||
47 | DO_RRXR(trans_SDOT_zzxw_d, gen_helper_gvec_sdot_idx_h) | ||
48 | @@ -XXX,XX +XXX,XX @@ static bool trans_SUDOT_zzxw_s(DisasContext *s, arg_rrxr_esz *a) | ||
49 | if (!dc_isar_feature(aa64_sve_i8mm, s)) { | ||
50 | return false; | ||
51 | } | ||
52 | - return do_zzxz_ool(s, a, gen_helper_gvec_sudot_idx_b); | ||
53 | + return gen_gvec_ool_arg_zzxz(s, gen_helper_gvec_sudot_idx_b, a); | ||
54 | } | ||
55 | |||
56 | static bool trans_USDOT_zzxw_s(DisasContext *s, arg_rrxr_esz *a) | ||
57 | @@ -XXX,XX +XXX,XX @@ static bool trans_USDOT_zzxw_s(DisasContext *s, arg_rrxr_esz *a) | ||
58 | if (!dc_isar_feature(aa64_sve_i8mm, s)) { | ||
59 | return false; | ||
60 | } | ||
61 | - return do_zzxz_ool(s, a, gen_helper_gvec_usdot_idx_b); | ||
62 | + return gen_gvec_ool_arg_zzxz(s, gen_helper_gvec_usdot_idx_b, a); | ||
63 | } | ||
64 | |||
65 | #undef DO_RRXR | ||
66 | -- | ||
67 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions directly using | ||
4 | gen_gvec_ool_arg_zzxz to TRANS_FEAT. Also include | ||
5 | BFDOT_zzxz, which was using gen_gvec_ool_zzzz. | ||
6 | |||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20220527181907.189259-15-richard.henderson@linaro.org | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | target/arm/translate-sve.c | 48 +++++++++++--------------------------- | ||
13 | 1 file changed, 14 insertions(+), 34 deletions(-) | ||
14 | |||
15 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/target/arm/translate-sve.c | ||
18 | +++ b/target/arm/translate-sve.c | ||
19 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(DOT_zzzz, aa64_sve, gen_gvec_ool_zzzz, | ||
20 | * SVE Multiply - Indexed | ||
21 | */ | ||
22 | |||
23 | -#define DO_RRXR(NAME, FUNC) \ | ||
24 | - static bool NAME(DisasContext *s, arg_rrxr_esz *a) \ | ||
25 | - { return gen_gvec_ool_arg_zzxz(s, FUNC, a); } | ||
26 | +TRANS_FEAT(SDOT_zzxw_s, aa64_sve, gen_gvec_ool_arg_zzxz, | ||
27 | + gen_helper_gvec_sdot_idx_b, a) | ||
28 | +TRANS_FEAT(SDOT_zzxw_d, aa64_sve, gen_gvec_ool_arg_zzxz, | ||
29 | + gen_helper_gvec_sdot_idx_h, a) | ||
30 | +TRANS_FEAT(UDOT_zzxw_s, aa64_sve, gen_gvec_ool_arg_zzxz, | ||
31 | + gen_helper_gvec_udot_idx_b, a) | ||
32 | +TRANS_FEAT(UDOT_zzxw_d, aa64_sve, gen_gvec_ool_arg_zzxz, | ||
33 | + gen_helper_gvec_udot_idx_h, a) | ||
34 | |||
35 | -DO_RRXR(trans_SDOT_zzxw_s, gen_helper_gvec_sdot_idx_b) | ||
36 | -DO_RRXR(trans_SDOT_zzxw_d, gen_helper_gvec_sdot_idx_h) | ||
37 | -DO_RRXR(trans_UDOT_zzxw_s, gen_helper_gvec_udot_idx_b) | ||
38 | -DO_RRXR(trans_UDOT_zzxw_d, gen_helper_gvec_udot_idx_h) | ||
39 | - | ||
40 | -static bool trans_SUDOT_zzxw_s(DisasContext *s, arg_rrxr_esz *a) | ||
41 | -{ | ||
42 | - if (!dc_isar_feature(aa64_sve_i8mm, s)) { | ||
43 | - return false; | ||
44 | - } | ||
45 | - return gen_gvec_ool_arg_zzxz(s, gen_helper_gvec_sudot_idx_b, a); | ||
46 | -} | ||
47 | - | ||
48 | -static bool trans_USDOT_zzxw_s(DisasContext *s, arg_rrxr_esz *a) | ||
49 | -{ | ||
50 | - if (!dc_isar_feature(aa64_sve_i8mm, s)) { | ||
51 | - return false; | ||
52 | - } | ||
53 | - return gen_gvec_ool_arg_zzxz(s, gen_helper_gvec_usdot_idx_b, a); | ||
54 | -} | ||
55 | - | ||
56 | -#undef DO_RRXR | ||
57 | +TRANS_FEAT(SUDOT_zzxw_s, aa64_sve_i8mm, gen_gvec_ool_arg_zzxz, | ||
58 | + gen_helper_gvec_sudot_idx_b, a) | ||
59 | +TRANS_FEAT(USDOT_zzxw_s, aa64_sve_i8mm, gen_gvec_ool_arg_zzxz, | ||
60 | + gen_helper_gvec_usdot_idx_b, a) | ||
61 | |||
62 | static bool do_sve2_zzz_data(DisasContext *s, int rd, int rn, int rm, int data, | ||
63 | gen_helper_gvec_3 *fn) | ||
64 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(UMMLA, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz, | ||
65 | |||
66 | TRANS_FEAT(BFDOT_zzzz, aa64_sve_bf16, gen_gvec_ool_arg_zzzz, | ||
67 | gen_helper_gvec_bfdot, a, 0) | ||
68 | - | ||
69 | -static bool trans_BFDOT_zzxz(DisasContext *s, arg_rrxr_esz *a) | ||
70 | -{ | ||
71 | - if (!dc_isar_feature(aa64_sve_bf16, s)) { | ||
72 | - return false; | ||
73 | - } | ||
74 | - return gen_gvec_ool_zzzz(s, gen_helper_gvec_bfdot_idx, | ||
75 | - a->rd, a->rn, a->rm, a->ra, a->index); | ||
76 | -} | ||
77 | +TRANS_FEAT(BFDOT_zzxz, aa64_sve_bf16, gen_gvec_ool_arg_zzxz, | ||
78 | + gen_helper_gvec_bfdot_idx, a) | ||
79 | |||
80 | TRANS_FEAT(BFMMLA, aa64_sve_bf16, gen_gvec_ool_arg_zzzz, | ||
81 | gen_helper_gvec_bfmmla, a, 0) | ||
82 | -- | ||
83 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions using do_sve2_zzz_data | ||
4 | to use TRANS_FEAT and gen_gvec_ool_zzz. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-16-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 69 ++++++++++++++------------------------ | ||
12 | 1 file changed, 25 insertions(+), 44 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(SUDOT_zzxw_s, aa64_sve_i8mm, gen_gvec_ool_arg_zzxz, | ||
19 | TRANS_FEAT(USDOT_zzxw_s, aa64_sve_i8mm, gen_gvec_ool_arg_zzxz, | ||
20 | gen_helper_gvec_usdot_idx_b, a) | ||
21 | |||
22 | -static bool do_sve2_zzz_data(DisasContext *s, int rd, int rn, int rm, int data, | ||
23 | - gen_helper_gvec_3 *fn) | ||
24 | -{ | ||
25 | - if (fn == NULL || !dc_isar_feature(aa64_sve2, s)) { | ||
26 | - return false; | ||
27 | - } | ||
28 | - if (sve_access_check(s)) { | ||
29 | - unsigned vsz = vec_full_reg_size(s); | ||
30 | - tcg_gen_gvec_3_ool(vec_full_reg_offset(s, rd), | ||
31 | - vec_full_reg_offset(s, rn), | ||
32 | - vec_full_reg_offset(s, rm), | ||
33 | - vsz, vsz, data, fn); | ||
34 | - } | ||
35 | - return true; | ||
36 | -} | ||
37 | - | ||
38 | #define DO_SVE2_RRX(NAME, FUNC) \ | ||
39 | - static bool NAME(DisasContext *s, arg_rrx_esz *a) \ | ||
40 | - { return do_sve2_zzz_data(s, a->rd, a->rn, a->rm, a->index, FUNC); } | ||
41 | + TRANS_FEAT(NAME, aa64_sve, gen_gvec_ool_zzz, FUNC, \ | ||
42 | + a->rd, a->rn, a->rm, a->index) | ||
43 | |||
44 | -DO_SVE2_RRX(trans_MUL_zzx_h, gen_helper_gvec_mul_idx_h) | ||
45 | -DO_SVE2_RRX(trans_MUL_zzx_s, gen_helper_gvec_mul_idx_s) | ||
46 | -DO_SVE2_RRX(trans_MUL_zzx_d, gen_helper_gvec_mul_idx_d) | ||
47 | +DO_SVE2_RRX(MUL_zzx_h, gen_helper_gvec_mul_idx_h) | ||
48 | +DO_SVE2_RRX(MUL_zzx_s, gen_helper_gvec_mul_idx_s) | ||
49 | +DO_SVE2_RRX(MUL_zzx_d, gen_helper_gvec_mul_idx_d) | ||
50 | |||
51 | -DO_SVE2_RRX(trans_SQDMULH_zzx_h, gen_helper_sve2_sqdmulh_idx_h) | ||
52 | -DO_SVE2_RRX(trans_SQDMULH_zzx_s, gen_helper_sve2_sqdmulh_idx_s) | ||
53 | -DO_SVE2_RRX(trans_SQDMULH_zzx_d, gen_helper_sve2_sqdmulh_idx_d) | ||
54 | +DO_SVE2_RRX(SQDMULH_zzx_h, gen_helper_sve2_sqdmulh_idx_h) | ||
55 | +DO_SVE2_RRX(SQDMULH_zzx_s, gen_helper_sve2_sqdmulh_idx_s) | ||
56 | +DO_SVE2_RRX(SQDMULH_zzx_d, gen_helper_sve2_sqdmulh_idx_d) | ||
57 | |||
58 | -DO_SVE2_RRX(trans_SQRDMULH_zzx_h, gen_helper_sve2_sqrdmulh_idx_h) | ||
59 | -DO_SVE2_RRX(trans_SQRDMULH_zzx_s, gen_helper_sve2_sqrdmulh_idx_s) | ||
60 | -DO_SVE2_RRX(trans_SQRDMULH_zzx_d, gen_helper_sve2_sqrdmulh_idx_d) | ||
61 | +DO_SVE2_RRX(SQRDMULH_zzx_h, gen_helper_sve2_sqrdmulh_idx_h) | ||
62 | +DO_SVE2_RRX(SQRDMULH_zzx_s, gen_helper_sve2_sqrdmulh_idx_s) | ||
63 | +DO_SVE2_RRX(SQRDMULH_zzx_d, gen_helper_sve2_sqrdmulh_idx_d) | ||
64 | |||
65 | #undef DO_SVE2_RRX | ||
66 | |||
67 | #define DO_SVE2_RRX_TB(NAME, FUNC, TOP) \ | ||
68 | - static bool NAME(DisasContext *s, arg_rrx_esz *a) \ | ||
69 | - { \ | ||
70 | - return do_sve2_zzz_data(s, a->rd, a->rn, a->rm, \ | ||
71 | - (a->index << 1) | TOP, FUNC); \ | ||
72 | - } | ||
73 | + TRANS_FEAT(NAME, aa64_sve, gen_gvec_ool_zzz, FUNC, \ | ||
74 | + a->rd, a->rn, a->rm, (a->index << 1) | TOP) | ||
75 | |||
76 | -DO_SVE2_RRX_TB(trans_SQDMULLB_zzx_s, gen_helper_sve2_sqdmull_idx_s, false) | ||
77 | -DO_SVE2_RRX_TB(trans_SQDMULLB_zzx_d, gen_helper_sve2_sqdmull_idx_d, false) | ||
78 | -DO_SVE2_RRX_TB(trans_SQDMULLT_zzx_s, gen_helper_sve2_sqdmull_idx_s, true) | ||
79 | -DO_SVE2_RRX_TB(trans_SQDMULLT_zzx_d, gen_helper_sve2_sqdmull_idx_d, true) | ||
80 | +DO_SVE2_RRX_TB(SQDMULLB_zzx_s, gen_helper_sve2_sqdmull_idx_s, false) | ||
81 | +DO_SVE2_RRX_TB(SQDMULLB_zzx_d, gen_helper_sve2_sqdmull_idx_d, false) | ||
82 | +DO_SVE2_RRX_TB(SQDMULLT_zzx_s, gen_helper_sve2_sqdmull_idx_s, true) | ||
83 | +DO_SVE2_RRX_TB(SQDMULLT_zzx_d, gen_helper_sve2_sqdmull_idx_d, true) | ||
84 | |||
85 | -DO_SVE2_RRX_TB(trans_SMULLB_zzx_s, gen_helper_sve2_smull_idx_s, false) | ||
86 | -DO_SVE2_RRX_TB(trans_SMULLB_zzx_d, gen_helper_sve2_smull_idx_d, false) | ||
87 | -DO_SVE2_RRX_TB(trans_SMULLT_zzx_s, gen_helper_sve2_smull_idx_s, true) | ||
88 | -DO_SVE2_RRX_TB(trans_SMULLT_zzx_d, gen_helper_sve2_smull_idx_d, true) | ||
89 | +DO_SVE2_RRX_TB(SMULLB_zzx_s, gen_helper_sve2_smull_idx_s, false) | ||
90 | +DO_SVE2_RRX_TB(SMULLB_zzx_d, gen_helper_sve2_smull_idx_d, false) | ||
91 | +DO_SVE2_RRX_TB(SMULLT_zzx_s, gen_helper_sve2_smull_idx_s, true) | ||
92 | +DO_SVE2_RRX_TB(SMULLT_zzx_d, gen_helper_sve2_smull_idx_d, true) | ||
93 | |||
94 | -DO_SVE2_RRX_TB(trans_UMULLB_zzx_s, gen_helper_sve2_umull_idx_s, false) | ||
95 | -DO_SVE2_RRX_TB(trans_UMULLB_zzx_d, gen_helper_sve2_umull_idx_d, false) | ||
96 | -DO_SVE2_RRX_TB(trans_UMULLT_zzx_s, gen_helper_sve2_umull_idx_s, true) | ||
97 | -DO_SVE2_RRX_TB(trans_UMULLT_zzx_d, gen_helper_sve2_umull_idx_d, true) | ||
98 | +DO_SVE2_RRX_TB(UMULLB_zzx_s, gen_helper_sve2_umull_idx_s, false) | ||
99 | +DO_SVE2_RRX_TB(UMULLB_zzx_d, gen_helper_sve2_umull_idx_d, false) | ||
100 | +DO_SVE2_RRX_TB(UMULLT_zzx_s, gen_helper_sve2_umull_idx_s, true) | ||
101 | +DO_SVE2_RRX_TB(UMULLT_zzx_d, gen_helper_sve2_umull_idx_d, true) | ||
102 | |||
103 | #undef DO_SVE2_RRX_TB | ||
104 | |||
105 | -- | ||
106 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions using do_sve2_zzzz_data | ||
4 | to use TRANS_FEAT and gen_gvec_ool_{zzzz,zzxz}. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-17-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 106 ++++++++++++++----------------------- | ||
12 | 1 file changed, 41 insertions(+), 65 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ DO_SVE2_RRX_TB(UMULLT_zzx_d, gen_helper_sve2_umull_idx_d, true) | ||
19 | |||
20 | #undef DO_SVE2_RRX_TB | ||
21 | |||
22 | -static bool do_sve2_zzzz_data(DisasContext *s, int rd, int rn, int rm, int ra, | ||
23 | - int data, gen_helper_gvec_4 *fn) | ||
24 | -{ | ||
25 | - if (fn == NULL || !dc_isar_feature(aa64_sve2, s)) { | ||
26 | - return false; | ||
27 | - } | ||
28 | - if (sve_access_check(s)) { | ||
29 | - unsigned vsz = vec_full_reg_size(s); | ||
30 | - tcg_gen_gvec_4_ool(vec_full_reg_offset(s, rd), | ||
31 | - vec_full_reg_offset(s, rn), | ||
32 | - vec_full_reg_offset(s, rm), | ||
33 | - vec_full_reg_offset(s, ra), | ||
34 | - vsz, vsz, data, fn); | ||
35 | - } | ||
36 | - return true; | ||
37 | -} | ||
38 | - | ||
39 | #define DO_SVE2_RRXR(NAME, FUNC) \ | ||
40 | - static bool NAME(DisasContext *s, arg_rrxr_esz *a) \ | ||
41 | - { return do_sve2_zzzz_data(s, a->rd, a->rn, a->rm, a->ra, a->index, FUNC); } | ||
42 | + TRANS_FEAT(NAME, aa64_sve2, gen_gvec_ool_arg_zzxz, FUNC, a) | ||
43 | |||
44 | -DO_SVE2_RRXR(trans_MLA_zzxz_h, gen_helper_gvec_mla_idx_h) | ||
45 | -DO_SVE2_RRXR(trans_MLA_zzxz_s, gen_helper_gvec_mla_idx_s) | ||
46 | -DO_SVE2_RRXR(trans_MLA_zzxz_d, gen_helper_gvec_mla_idx_d) | ||
47 | +DO_SVE2_RRXR(MLA_zzxz_h, gen_helper_gvec_mla_idx_h) | ||
48 | +DO_SVE2_RRXR(MLA_zzxz_s, gen_helper_gvec_mla_idx_s) | ||
49 | +DO_SVE2_RRXR(MLA_zzxz_d, gen_helper_gvec_mla_idx_d) | ||
50 | |||
51 | -DO_SVE2_RRXR(trans_MLS_zzxz_h, gen_helper_gvec_mls_idx_h) | ||
52 | -DO_SVE2_RRXR(trans_MLS_zzxz_s, gen_helper_gvec_mls_idx_s) | ||
53 | -DO_SVE2_RRXR(trans_MLS_zzxz_d, gen_helper_gvec_mls_idx_d) | ||
54 | +DO_SVE2_RRXR(MLS_zzxz_h, gen_helper_gvec_mls_idx_h) | ||
55 | +DO_SVE2_RRXR(MLS_zzxz_s, gen_helper_gvec_mls_idx_s) | ||
56 | +DO_SVE2_RRXR(MLS_zzxz_d, gen_helper_gvec_mls_idx_d) | ||
57 | |||
58 | -DO_SVE2_RRXR(trans_SQRDMLAH_zzxz_h, gen_helper_sve2_sqrdmlah_idx_h) | ||
59 | -DO_SVE2_RRXR(trans_SQRDMLAH_zzxz_s, gen_helper_sve2_sqrdmlah_idx_s) | ||
60 | -DO_SVE2_RRXR(trans_SQRDMLAH_zzxz_d, gen_helper_sve2_sqrdmlah_idx_d) | ||
61 | +DO_SVE2_RRXR(SQRDMLAH_zzxz_h, gen_helper_sve2_sqrdmlah_idx_h) | ||
62 | +DO_SVE2_RRXR(SQRDMLAH_zzxz_s, gen_helper_sve2_sqrdmlah_idx_s) | ||
63 | +DO_SVE2_RRXR(SQRDMLAH_zzxz_d, gen_helper_sve2_sqrdmlah_idx_d) | ||
64 | |||
65 | -DO_SVE2_RRXR(trans_SQRDMLSH_zzxz_h, gen_helper_sve2_sqrdmlsh_idx_h) | ||
66 | -DO_SVE2_RRXR(trans_SQRDMLSH_zzxz_s, gen_helper_sve2_sqrdmlsh_idx_s) | ||
67 | -DO_SVE2_RRXR(trans_SQRDMLSH_zzxz_d, gen_helper_sve2_sqrdmlsh_idx_d) | ||
68 | +DO_SVE2_RRXR(SQRDMLSH_zzxz_h, gen_helper_sve2_sqrdmlsh_idx_h) | ||
69 | +DO_SVE2_RRXR(SQRDMLSH_zzxz_s, gen_helper_sve2_sqrdmlsh_idx_s) | ||
70 | +DO_SVE2_RRXR(SQRDMLSH_zzxz_d, gen_helper_sve2_sqrdmlsh_idx_d) | ||
71 | |||
72 | #undef DO_SVE2_RRXR | ||
73 | |||
74 | #define DO_SVE2_RRXR_TB(NAME, FUNC, TOP) \ | ||
75 | - static bool NAME(DisasContext *s, arg_rrxr_esz *a) \ | ||
76 | - { \ | ||
77 | - return do_sve2_zzzz_data(s, a->rd, a->rn, a->rm, a->rd, \ | ||
78 | - (a->index << 1) | TOP, FUNC); \ | ||
79 | - } | ||
80 | + TRANS_FEAT(NAME, aa64_sve2, gen_gvec_ool_zzzz, FUNC, \ | ||
81 | + a->rd, a->rn, a->rm, a->ra, (a->index << 1) | TOP) | ||
82 | |||
83 | -DO_SVE2_RRXR_TB(trans_SQDMLALB_zzxw_s, gen_helper_sve2_sqdmlal_idx_s, false) | ||
84 | -DO_SVE2_RRXR_TB(trans_SQDMLALB_zzxw_d, gen_helper_sve2_sqdmlal_idx_d, false) | ||
85 | -DO_SVE2_RRXR_TB(trans_SQDMLALT_zzxw_s, gen_helper_sve2_sqdmlal_idx_s, true) | ||
86 | -DO_SVE2_RRXR_TB(trans_SQDMLALT_zzxw_d, gen_helper_sve2_sqdmlal_idx_d, true) | ||
87 | +DO_SVE2_RRXR_TB(SQDMLALB_zzxw_s, gen_helper_sve2_sqdmlal_idx_s, false) | ||
88 | +DO_SVE2_RRXR_TB(SQDMLALB_zzxw_d, gen_helper_sve2_sqdmlal_idx_d, false) | ||
89 | +DO_SVE2_RRXR_TB(SQDMLALT_zzxw_s, gen_helper_sve2_sqdmlal_idx_s, true) | ||
90 | +DO_SVE2_RRXR_TB(SQDMLALT_zzxw_d, gen_helper_sve2_sqdmlal_idx_d, true) | ||
91 | |||
92 | -DO_SVE2_RRXR_TB(trans_SQDMLSLB_zzxw_s, gen_helper_sve2_sqdmlsl_idx_s, false) | ||
93 | -DO_SVE2_RRXR_TB(trans_SQDMLSLB_zzxw_d, gen_helper_sve2_sqdmlsl_idx_d, false) | ||
94 | -DO_SVE2_RRXR_TB(trans_SQDMLSLT_zzxw_s, gen_helper_sve2_sqdmlsl_idx_s, true) | ||
95 | -DO_SVE2_RRXR_TB(trans_SQDMLSLT_zzxw_d, gen_helper_sve2_sqdmlsl_idx_d, true) | ||
96 | +DO_SVE2_RRXR_TB(SQDMLSLB_zzxw_s, gen_helper_sve2_sqdmlsl_idx_s, false) | ||
97 | +DO_SVE2_RRXR_TB(SQDMLSLB_zzxw_d, gen_helper_sve2_sqdmlsl_idx_d, false) | ||
98 | +DO_SVE2_RRXR_TB(SQDMLSLT_zzxw_s, gen_helper_sve2_sqdmlsl_idx_s, true) | ||
99 | +DO_SVE2_RRXR_TB(SQDMLSLT_zzxw_d, gen_helper_sve2_sqdmlsl_idx_d, true) | ||
100 | |||
101 | -DO_SVE2_RRXR_TB(trans_SMLALB_zzxw_s, gen_helper_sve2_smlal_idx_s, false) | ||
102 | -DO_SVE2_RRXR_TB(trans_SMLALB_zzxw_d, gen_helper_sve2_smlal_idx_d, false) | ||
103 | -DO_SVE2_RRXR_TB(trans_SMLALT_zzxw_s, gen_helper_sve2_smlal_idx_s, true) | ||
104 | -DO_SVE2_RRXR_TB(trans_SMLALT_zzxw_d, gen_helper_sve2_smlal_idx_d, true) | ||
105 | +DO_SVE2_RRXR_TB(SMLALB_zzxw_s, gen_helper_sve2_smlal_idx_s, false) | ||
106 | +DO_SVE2_RRXR_TB(SMLALB_zzxw_d, gen_helper_sve2_smlal_idx_d, false) | ||
107 | +DO_SVE2_RRXR_TB(SMLALT_zzxw_s, gen_helper_sve2_smlal_idx_s, true) | ||
108 | +DO_SVE2_RRXR_TB(SMLALT_zzxw_d, gen_helper_sve2_smlal_idx_d, true) | ||
109 | |||
110 | -DO_SVE2_RRXR_TB(trans_UMLALB_zzxw_s, gen_helper_sve2_umlal_idx_s, false) | ||
111 | -DO_SVE2_RRXR_TB(trans_UMLALB_zzxw_d, gen_helper_sve2_umlal_idx_d, false) | ||
112 | -DO_SVE2_RRXR_TB(trans_UMLALT_zzxw_s, gen_helper_sve2_umlal_idx_s, true) | ||
113 | -DO_SVE2_RRXR_TB(trans_UMLALT_zzxw_d, gen_helper_sve2_umlal_idx_d, true) | ||
114 | +DO_SVE2_RRXR_TB(UMLALB_zzxw_s, gen_helper_sve2_umlal_idx_s, false) | ||
115 | +DO_SVE2_RRXR_TB(UMLALB_zzxw_d, gen_helper_sve2_umlal_idx_d, false) | ||
116 | +DO_SVE2_RRXR_TB(UMLALT_zzxw_s, gen_helper_sve2_umlal_idx_s, true) | ||
117 | +DO_SVE2_RRXR_TB(UMLALT_zzxw_d, gen_helper_sve2_umlal_idx_d, true) | ||
118 | |||
119 | -DO_SVE2_RRXR_TB(trans_SMLSLB_zzxw_s, gen_helper_sve2_smlsl_idx_s, false) | ||
120 | -DO_SVE2_RRXR_TB(trans_SMLSLB_zzxw_d, gen_helper_sve2_smlsl_idx_d, false) | ||
121 | -DO_SVE2_RRXR_TB(trans_SMLSLT_zzxw_s, gen_helper_sve2_smlsl_idx_s, true) | ||
122 | -DO_SVE2_RRXR_TB(trans_SMLSLT_zzxw_d, gen_helper_sve2_smlsl_idx_d, true) | ||
123 | +DO_SVE2_RRXR_TB(SMLSLB_zzxw_s, gen_helper_sve2_smlsl_idx_s, false) | ||
124 | +DO_SVE2_RRXR_TB(SMLSLB_zzxw_d, gen_helper_sve2_smlsl_idx_d, false) | ||
125 | +DO_SVE2_RRXR_TB(SMLSLT_zzxw_s, gen_helper_sve2_smlsl_idx_s, true) | ||
126 | +DO_SVE2_RRXR_TB(SMLSLT_zzxw_d, gen_helper_sve2_smlsl_idx_d, true) | ||
127 | |||
128 | -DO_SVE2_RRXR_TB(trans_UMLSLB_zzxw_s, gen_helper_sve2_umlsl_idx_s, false) | ||
129 | -DO_SVE2_RRXR_TB(trans_UMLSLB_zzxw_d, gen_helper_sve2_umlsl_idx_d, false) | ||
130 | -DO_SVE2_RRXR_TB(trans_UMLSLT_zzxw_s, gen_helper_sve2_umlsl_idx_s, true) | ||
131 | -DO_SVE2_RRXR_TB(trans_UMLSLT_zzxw_d, gen_helper_sve2_umlsl_idx_d, true) | ||
132 | +DO_SVE2_RRXR_TB(UMLSLB_zzxw_s, gen_helper_sve2_umlsl_idx_s, false) | ||
133 | +DO_SVE2_RRXR_TB(UMLSLB_zzxw_d, gen_helper_sve2_umlsl_idx_d, false) | ||
134 | +DO_SVE2_RRXR_TB(UMLSLT_zzxw_s, gen_helper_sve2_umlsl_idx_s, true) | ||
135 | +DO_SVE2_RRXR_TB(UMLSLT_zzxw_d, gen_helper_sve2_umlsl_idx_d, true) | ||
136 | |||
137 | #undef DO_SVE2_RRXR_TB | ||
138 | |||
139 | #define DO_SVE2_RRXR_ROT(NAME, FUNC) \ | ||
140 | - static bool trans_##NAME(DisasContext *s, arg_##NAME *a) \ | ||
141 | - { \ | ||
142 | - return do_sve2_zzzz_data(s, a->rd, a->rn, a->rm, a->ra, \ | ||
143 | - (a->index << 2) | a->rot, FUNC); \ | ||
144 | - } | ||
145 | + TRANS_FEAT(NAME, aa64_sve2, gen_gvec_ool_zzzz, FUNC, \ | ||
146 | + a->rd, a->rn, a->rm, a->ra, (a->index << 2) | a->rot) | ||
147 | |||
148 | DO_SVE2_RRXR_ROT(CMLA_zzxz_h, gen_helper_sve2_cmla_idx_h) | ||
149 | DO_SVE2_RRXR_ROT(CMLA_zzxz_s, gen_helper_sve2_cmla_idx_s) | ||
150 | -- | ||
151 | 2.25.1 | diff view generated by jsdifflib |
1 | The M-profile CONTROL register has two bits -- SFPA and FPCA -- | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | which relate to floating-point support, and should be RES0 otherwise. | ||
3 | Handle them correctly in the MSR/MRS register access code. | ||
4 | Neither is banked between security states, so they are stored | ||
5 | in v7m.control[M_REG_S] regardless of current security state. | ||
6 | 2 | ||
3 | Convert SVE translation functions using do_sve2_zzw_data | ||
4 | to use TRANS_FEAT and gen_gvec_ool_arg_zzz. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-18-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20190416125744.27770-9-peter.maydell@linaro.org | ||
10 | --- | 10 | --- |
11 | target/arm/helper.c | 57 ++++++++++++++++++++++++++++++++++++++------- | 11 | target/arm/translate-sve.c | 297 ++++++++++++++++++------------------- |
12 | 1 file changed, 49 insertions(+), 8 deletions(-) | 12 | 1 file changed, 145 insertions(+), 152 deletions(-) |
13 | 13 | ||
14 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
15 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/helper.c | 16 | --- a/target/arm/translate-sve.c |
17 | +++ b/target/arm/helper.c | 17 | +++ b/target/arm/translate-sve.c |
18 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg) | 18 | @@ -XXX,XX +XXX,XX @@ DO_SVE2_ZPZZ(USQADD, usqadd) |
19 | return xpsr_read(env) & mask; | 19 | * SVE2 Widening Integer Arithmetic |
20 | break; | 20 | */ |
21 | case 20: /* CONTROL */ | 21 | |
22 | - return env->v7m.control[env->v7m.secure]; | 22 | -static bool do_sve2_zzw_ool(DisasContext *s, arg_rrr_esz *a, |
23 | + { | 23 | - gen_helper_gvec_3 *fn, int data) |
24 | + uint32_t value = env->v7m.control[env->v7m.secure]; | 24 | -{ |
25 | + if (!env->v7m.secure) { | 25 | - if (fn == NULL || !dc_isar_feature(aa64_sve2, s)) { |
26 | + /* SFPA is RAZ/WI from NS; FPCA is stored in the M_REG_S bank */ | 26 | - return false; |
27 | + value |= env->v7m.control[M_REG_S] & R_V7M_CONTROL_FPCA_MASK; | 27 | - } |
28 | + } | 28 | - if (sve_access_check(s)) { |
29 | + return value; | 29 | - unsigned vsz = vec_full_reg_size(s); |
30 | + } | 30 | - tcg_gen_gvec_3_ool(vec_full_reg_offset(s, a->rd), |
31 | case 0x94: /* CONTROL_NS */ | 31 | - vec_full_reg_offset(s, a->rn), |
32 | /* We have to handle this here because unprivileged Secure code | 32 | - vec_full_reg_offset(s, a->rm), |
33 | * can read the NS CONTROL register. | 33 | - vsz, vsz, data, fn); |
34 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg) | 34 | - } |
35 | if (!env->v7m.secure) { | 35 | - return true; |
36 | return 0; | 36 | -} |
37 | } | 37 | +static gen_helper_gvec_3 * const saddl_fns[4] = { |
38 | - return env->v7m.control[M_REG_NS]; | 38 | + NULL, gen_helper_sve2_saddl_h, |
39 | + return env->v7m.control[M_REG_NS] | | 39 | + gen_helper_sve2_saddl_s, gen_helper_sve2_saddl_d, |
40 | + (env->v7m.control[M_REG_S] & R_V7M_CONTROL_FPCA_MASK); | 40 | +}; |
41 | +TRANS_FEAT(SADDLB, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
42 | + saddl_fns[a->esz], a, 0) | ||
43 | +TRANS_FEAT(SADDLT, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
44 | + saddl_fns[a->esz], a, 3) | ||
45 | +TRANS_FEAT(SADDLBT, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
46 | + saddl_fns[a->esz], a, 2) | ||
47 | |||
48 | -#define DO_SVE2_ZZZ_TB(NAME, name, SEL1, SEL2) \ | ||
49 | -static bool trans_##NAME(DisasContext *s, arg_rrr_esz *a) \ | ||
50 | -{ \ | ||
51 | - static gen_helper_gvec_3 * const fns[4] = { \ | ||
52 | - NULL, gen_helper_sve2_##name##_h, \ | ||
53 | - gen_helper_sve2_##name##_s, gen_helper_sve2_##name##_d, \ | ||
54 | - }; \ | ||
55 | - return do_sve2_zzw_ool(s, a, fns[a->esz], (SEL2 << 1) | SEL1); \ | ||
56 | -} | ||
57 | +static gen_helper_gvec_3 * const ssubl_fns[4] = { | ||
58 | + NULL, gen_helper_sve2_ssubl_h, | ||
59 | + gen_helper_sve2_ssubl_s, gen_helper_sve2_ssubl_d, | ||
60 | +}; | ||
61 | +TRANS_FEAT(SSUBLB, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
62 | + ssubl_fns[a->esz], a, 0) | ||
63 | +TRANS_FEAT(SSUBLT, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
64 | + ssubl_fns[a->esz], a, 3) | ||
65 | +TRANS_FEAT(SSUBLBT, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
66 | + ssubl_fns[a->esz], a, 2) | ||
67 | +TRANS_FEAT(SSUBLTB, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
68 | + ssubl_fns[a->esz], a, 1) | ||
69 | |||
70 | -DO_SVE2_ZZZ_TB(SADDLB, saddl, false, false) | ||
71 | -DO_SVE2_ZZZ_TB(SSUBLB, ssubl, false, false) | ||
72 | -DO_SVE2_ZZZ_TB(SABDLB, sabdl, false, false) | ||
73 | +static gen_helper_gvec_3 * const sabdl_fns[4] = { | ||
74 | + NULL, gen_helper_sve2_sabdl_h, | ||
75 | + gen_helper_sve2_sabdl_s, gen_helper_sve2_sabdl_d, | ||
76 | +}; | ||
77 | +TRANS_FEAT(SABDLB, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
78 | + sabdl_fns[a->esz], a, 0) | ||
79 | +TRANS_FEAT(SABDLT, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
80 | + sabdl_fns[a->esz], a, 3) | ||
81 | |||
82 | -DO_SVE2_ZZZ_TB(UADDLB, uaddl, false, false) | ||
83 | -DO_SVE2_ZZZ_TB(USUBLB, usubl, false, false) | ||
84 | -DO_SVE2_ZZZ_TB(UABDLB, uabdl, false, false) | ||
85 | +static gen_helper_gvec_3 * const uaddl_fns[4] = { | ||
86 | + NULL, gen_helper_sve2_uaddl_h, | ||
87 | + gen_helper_sve2_uaddl_s, gen_helper_sve2_uaddl_d, | ||
88 | +}; | ||
89 | +TRANS_FEAT(UADDLB, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
90 | + uaddl_fns[a->esz], a, 0) | ||
91 | +TRANS_FEAT(UADDLT, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
92 | + uaddl_fns[a->esz], a, 3) | ||
93 | |||
94 | -DO_SVE2_ZZZ_TB(SADDLT, saddl, true, true) | ||
95 | -DO_SVE2_ZZZ_TB(SSUBLT, ssubl, true, true) | ||
96 | -DO_SVE2_ZZZ_TB(SABDLT, sabdl, true, true) | ||
97 | +static gen_helper_gvec_3 * const usubl_fns[4] = { | ||
98 | + NULL, gen_helper_sve2_usubl_h, | ||
99 | + gen_helper_sve2_usubl_s, gen_helper_sve2_usubl_d, | ||
100 | +}; | ||
101 | +TRANS_FEAT(USUBLB, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
102 | + usubl_fns[a->esz], a, 0) | ||
103 | +TRANS_FEAT(USUBLT, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
104 | + usubl_fns[a->esz], a, 3) | ||
105 | |||
106 | -DO_SVE2_ZZZ_TB(UADDLT, uaddl, true, true) | ||
107 | -DO_SVE2_ZZZ_TB(USUBLT, usubl, true, true) | ||
108 | -DO_SVE2_ZZZ_TB(UABDLT, uabdl, true, true) | ||
109 | +static gen_helper_gvec_3 * const uabdl_fns[4] = { | ||
110 | + NULL, gen_helper_sve2_uabdl_h, | ||
111 | + gen_helper_sve2_uabdl_s, gen_helper_sve2_uabdl_d, | ||
112 | +}; | ||
113 | +TRANS_FEAT(UABDLB, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
114 | + uabdl_fns[a->esz], a, 0) | ||
115 | +TRANS_FEAT(UABDLT, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
116 | + uabdl_fns[a->esz], a, 3) | ||
117 | |||
118 | -DO_SVE2_ZZZ_TB(SADDLBT, saddl, false, true) | ||
119 | -DO_SVE2_ZZZ_TB(SSUBLBT, ssubl, false, true) | ||
120 | -DO_SVE2_ZZZ_TB(SSUBLTB, ssubl, true, false) | ||
121 | +static gen_helper_gvec_3 * const sqdmull_fns[4] = { | ||
122 | + NULL, gen_helper_sve2_sqdmull_zzz_h, | ||
123 | + gen_helper_sve2_sqdmull_zzz_s, gen_helper_sve2_sqdmull_zzz_d, | ||
124 | +}; | ||
125 | +TRANS_FEAT(SQDMULLB_zzz, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
126 | + sqdmull_fns[a->esz], a, 0) | ||
127 | +TRANS_FEAT(SQDMULLT_zzz, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
128 | + sqdmull_fns[a->esz], a, 3) | ||
129 | |||
130 | -DO_SVE2_ZZZ_TB(SQDMULLB_zzz, sqdmull_zzz, false, false) | ||
131 | -DO_SVE2_ZZZ_TB(SQDMULLT_zzz, sqdmull_zzz, true, true) | ||
132 | +static gen_helper_gvec_3 * const smull_fns[4] = { | ||
133 | + NULL, gen_helper_sve2_smull_zzz_h, | ||
134 | + gen_helper_sve2_smull_zzz_s, gen_helper_sve2_smull_zzz_d, | ||
135 | +}; | ||
136 | +TRANS_FEAT(SMULLB_zzz, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
137 | + smull_fns[a->esz], a, 0) | ||
138 | +TRANS_FEAT(SMULLT_zzz, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
139 | + smull_fns[a->esz], a, 3) | ||
140 | |||
141 | -DO_SVE2_ZZZ_TB(SMULLB_zzz, smull_zzz, false, false) | ||
142 | -DO_SVE2_ZZZ_TB(SMULLT_zzz, smull_zzz, true, true) | ||
143 | +static gen_helper_gvec_3 * const umull_fns[4] = { | ||
144 | + NULL, gen_helper_sve2_umull_zzz_h, | ||
145 | + gen_helper_sve2_umull_zzz_s, gen_helper_sve2_umull_zzz_d, | ||
146 | +}; | ||
147 | +TRANS_FEAT(UMULLB_zzz, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
148 | + umull_fns[a->esz], a, 0) | ||
149 | +TRANS_FEAT(UMULLT_zzz, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
150 | + umull_fns[a->esz], a, 3) | ||
151 | |||
152 | -DO_SVE2_ZZZ_TB(UMULLB_zzz, umull_zzz, false, false) | ||
153 | -DO_SVE2_ZZZ_TB(UMULLT_zzz, umull_zzz, true, true) | ||
154 | - | ||
155 | -static bool do_eor_tb(DisasContext *s, arg_rrr_esz *a, bool sel1) | ||
156 | -{ | ||
157 | - static gen_helper_gvec_3 * const fns[4] = { | ||
158 | - gen_helper_sve2_eoril_b, gen_helper_sve2_eoril_h, | ||
159 | - gen_helper_sve2_eoril_s, gen_helper_sve2_eoril_d, | ||
160 | - }; | ||
161 | - return do_sve2_zzw_ool(s, a, fns[a->esz], (!sel1 << 1) | sel1); | ||
162 | -} | ||
163 | - | ||
164 | -static bool trans_EORBT(DisasContext *s, arg_rrr_esz *a) | ||
165 | -{ | ||
166 | - return do_eor_tb(s, a, false); | ||
167 | -} | ||
168 | - | ||
169 | -static bool trans_EORTB(DisasContext *s, arg_rrr_esz *a) | ||
170 | -{ | ||
171 | - return do_eor_tb(s, a, true); | ||
172 | -} | ||
173 | +static gen_helper_gvec_3 * const eoril_fns[4] = { | ||
174 | + gen_helper_sve2_eoril_b, gen_helper_sve2_eoril_h, | ||
175 | + gen_helper_sve2_eoril_s, gen_helper_sve2_eoril_d, | ||
176 | +}; | ||
177 | +TRANS_FEAT(EORBT, aa64_sve2, gen_gvec_ool_arg_zzz, eoril_fns[a->esz], a, 2) | ||
178 | +TRANS_FEAT(EORTB, aa64_sve2, gen_gvec_ool_arg_zzz, eoril_fns[a->esz], a, 1) | ||
179 | |||
180 | static bool do_trans_pmull(DisasContext *s, arg_rrr_esz *a, bool sel) | ||
181 | { | ||
182 | @@ -XXX,XX +XXX,XX @@ static bool do_trans_pmull(DisasContext *s, arg_rrr_esz *a, bool sel) | ||
183 | if (a->esz == 0 && !dc_isar_feature(aa64_sve2_pmull128, s)) { | ||
184 | return false; | ||
41 | } | 185 | } |
42 | 186 | - return do_sve2_zzw_ool(s, a, fns[a->esz], sel); | |
43 | if (el == 0) { | 187 | + return gen_gvec_ool_arg_zzz(s, fns[a->esz], a, sel); |
44 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val) | 188 | } |
45 | */ | 189 | |
46 | uint32_t mask = extract32(maskreg, 8, 4); | 190 | -static bool trans_PMULLB(DisasContext *s, arg_rrr_esz *a) |
47 | uint32_t reg = extract32(maskreg, 0, 8); | 191 | -{ |
48 | + int cur_el = arm_current_el(env); | 192 | - return do_trans_pmull(s, a, false); |
49 | 193 | -} | |
50 | - if (arm_current_el(env) == 0 && reg > 7) { | 194 | +TRANS_FEAT(PMULLB, aa64_sve2, do_trans_pmull, a, false) |
51 | - /* only xPSR sub-fields may be written by unprivileged */ | 195 | +TRANS_FEAT(PMULLT, aa64_sve2, do_trans_pmull, a, true) |
52 | + if (cur_el == 0 && reg > 7 && reg != 20) { | 196 | |
53 | + /* | 197 | -static bool trans_PMULLT(DisasContext *s, arg_rrr_esz *a) |
54 | + * only xPSR sub-fields and CONTROL.SFPA may be written by | 198 | -{ |
55 | + * unprivileged code | 199 | - return do_trans_pmull(s, a, true); |
56 | + */ | 200 | -} |
57 | return; | 201 | +static gen_helper_gvec_3 * const saddw_fns[4] = { |
58 | } | 202 | + NULL, gen_helper_sve2_saddw_h, |
59 | 203 | + gen_helper_sve2_saddw_s, gen_helper_sve2_saddw_d, | |
60 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val) | 204 | +}; |
61 | env->v7m.control[M_REG_NS] &= ~R_V7M_CONTROL_NPRIV_MASK; | 205 | +TRANS_FEAT(SADDWB, aa64_sve2, gen_gvec_ool_arg_zzz, saddw_fns[a->esz], a, 0) |
62 | env->v7m.control[M_REG_NS] |= val & R_V7M_CONTROL_NPRIV_MASK; | 206 | +TRANS_FEAT(SADDWT, aa64_sve2, gen_gvec_ool_arg_zzz, saddw_fns[a->esz], a, 1) |
63 | } | 207 | |
64 | + /* | 208 | -#define DO_SVE2_ZZZ_WTB(NAME, name, SEL2) \ |
65 | + * SFPA is RAZ/WI from NS. FPCA is RO if NSACR.CP10 == 0, | 209 | -static bool trans_##NAME(DisasContext *s, arg_rrr_esz *a) \ |
66 | + * RES0 if the FPU is not present, and is stored in the S bank | 210 | -{ \ |
67 | + */ | 211 | - static gen_helper_gvec_3 * const fns[4] = { \ |
68 | + if (arm_feature(env, ARM_FEATURE_VFP) && | 212 | - NULL, gen_helper_sve2_##name##_h, \ |
69 | + extract32(env->v7m.nsacr, 10, 1)) { | 213 | - gen_helper_sve2_##name##_s, gen_helper_sve2_##name##_d, \ |
70 | + env->v7m.control[M_REG_S] &= ~R_V7M_CONTROL_FPCA_MASK; | 214 | - }; \ |
71 | + env->v7m.control[M_REG_S] |= val & R_V7M_CONTROL_FPCA_MASK; | 215 | - return do_sve2_zzw_ool(s, a, fns[a->esz], SEL2); \ |
72 | + } | 216 | -} |
73 | return; | 217 | +static gen_helper_gvec_3 * const ssubw_fns[4] = { |
74 | case 0x98: /* SP_NS */ | 218 | + NULL, gen_helper_sve2_ssubw_h, |
75 | { | 219 | + gen_helper_sve2_ssubw_s, gen_helper_sve2_ssubw_d, |
76 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val) | 220 | +}; |
77 | env->v7m.faultmask[env->v7m.secure] = val & 1; | 221 | +TRANS_FEAT(SSUBWB, aa64_sve2, gen_gvec_ool_arg_zzz, ssubw_fns[a->esz], a, 0) |
78 | break; | 222 | +TRANS_FEAT(SSUBWT, aa64_sve2, gen_gvec_ool_arg_zzz, ssubw_fns[a->esz], a, 1) |
79 | case 20: /* CONTROL */ | 223 | |
80 | - /* Writing to the SPSEL bit only has an effect if we are in | 224 | -DO_SVE2_ZZZ_WTB(SADDWB, saddw, false) |
81 | + /* | 225 | -DO_SVE2_ZZZ_WTB(SADDWT, saddw, true) |
82 | + * Writing to the SPSEL bit only has an effect if we are in | 226 | -DO_SVE2_ZZZ_WTB(SSUBWB, ssubw, false) |
83 | * thread mode; other bits can be updated by any privileged code. | 227 | -DO_SVE2_ZZZ_WTB(SSUBWT, ssubw, true) |
84 | * write_v7m_control_spsel() deals with updating the SPSEL bit in | 228 | +static gen_helper_gvec_3 * const uaddw_fns[4] = { |
85 | * env->v7m.control, so we only need update the others. | 229 | + NULL, gen_helper_sve2_uaddw_h, |
86 | * For v7M, we must just ignore explicit writes to SPSEL in handler | 230 | + gen_helper_sve2_uaddw_s, gen_helper_sve2_uaddw_d, |
87 | * mode; for v8M the write is permitted but will have no effect. | 231 | +}; |
88 | + * All these bits are writes-ignored from non-privileged code, | 232 | +TRANS_FEAT(UADDWB, aa64_sve2, gen_gvec_ool_arg_zzz, uaddw_fns[a->esz], a, 0) |
89 | + * except for SFPA. | 233 | +TRANS_FEAT(UADDWT, aa64_sve2, gen_gvec_ool_arg_zzz, uaddw_fns[a->esz], a, 1) |
90 | */ | 234 | |
91 | - if (arm_feature(env, ARM_FEATURE_V8) || | 235 | -DO_SVE2_ZZZ_WTB(UADDWB, uaddw, false) |
92 | - !arm_v7m_is_handler_mode(env)) { | 236 | -DO_SVE2_ZZZ_WTB(UADDWT, uaddw, true) |
93 | + if (cur_el > 0 && (arm_feature(env, ARM_FEATURE_V8) || | 237 | -DO_SVE2_ZZZ_WTB(USUBWB, usubw, false) |
94 | + !arm_v7m_is_handler_mode(env))) { | 238 | -DO_SVE2_ZZZ_WTB(USUBWT, usubw, true) |
95 | write_v7m_control_spsel(env, (val & R_V7M_CONTROL_SPSEL_MASK) != 0); | 239 | +static gen_helper_gvec_3 * const usubw_fns[4] = { |
96 | } | 240 | + NULL, gen_helper_sve2_usubw_h, |
97 | - if (arm_feature(env, ARM_FEATURE_M_MAIN)) { | 241 | + gen_helper_sve2_usubw_s, gen_helper_sve2_usubw_d, |
98 | + if (cur_el > 0 && arm_feature(env, ARM_FEATURE_M_MAIN)) { | 242 | +}; |
99 | env->v7m.control[env->v7m.secure] &= ~R_V7M_CONTROL_NPRIV_MASK; | 243 | +TRANS_FEAT(USUBWB, aa64_sve2, gen_gvec_ool_arg_zzz, usubw_fns[a->esz], a, 0) |
100 | env->v7m.control[env->v7m.secure] |= val & R_V7M_CONTROL_NPRIV_MASK; | 244 | +TRANS_FEAT(USUBWT, aa64_sve2, gen_gvec_ool_arg_zzz, usubw_fns[a->esz], a, 1) |
101 | } | 245 | |
102 | + if (arm_feature(env, ARM_FEATURE_VFP)) { | 246 | static void gen_sshll_vec(unsigned vece, TCGv_vec d, TCGv_vec n, int64_t imm) |
103 | + /* | 247 | { |
104 | + * SFPA is RAZ/WI from NS or if no FPU. | 248 | @@ -XXX,XX +XXX,XX @@ static bool trans_USHLLT(DisasContext *s, arg_rri_esz *a) |
105 | + * FPCA is RO if NSACR.CP10 == 0, RES0 if the FPU is not present. | 249 | return do_sve2_shll_tb(s, a, true, true); |
106 | + * Both are stored in the S bank. | 250 | } |
107 | + */ | 251 | |
108 | + if (env->v7m.secure) { | 252 | -static bool trans_BEXT(DisasContext *s, arg_rrr_esz *a) |
109 | + env->v7m.control[M_REG_S] &= ~R_V7M_CONTROL_SFPA_MASK; | 253 | -{ |
110 | + env->v7m.control[M_REG_S] |= val & R_V7M_CONTROL_SFPA_MASK; | 254 | - static gen_helper_gvec_3 * const fns[4] = { |
111 | + } | 255 | - gen_helper_sve2_bext_b, gen_helper_sve2_bext_h, |
112 | + if (cur_el > 0 && | 256 | - gen_helper_sve2_bext_s, gen_helper_sve2_bext_d, |
113 | + (env->v7m.secure || !arm_feature(env, ARM_FEATURE_M_SECURITY) || | 257 | - }; |
114 | + extract32(env->v7m.nsacr, 10, 1))) { | 258 | - if (!dc_isar_feature(aa64_sve2_bitperm, s)) { |
115 | + env->v7m.control[M_REG_S] &= ~R_V7M_CONTROL_FPCA_MASK; | 259 | - return false; |
116 | + env->v7m.control[M_REG_S] |= val & R_V7M_CONTROL_FPCA_MASK; | 260 | - } |
117 | + } | 261 | - return do_sve2_zzw_ool(s, a, fns[a->esz], 0); |
118 | + } | 262 | -} |
119 | break; | 263 | +static gen_helper_gvec_3 * const bext_fns[4] = { |
120 | default: | 264 | + gen_helper_sve2_bext_b, gen_helper_sve2_bext_h, |
121 | bad_reg: | 265 | + gen_helper_sve2_bext_s, gen_helper_sve2_bext_d, |
266 | +}; | ||
267 | +TRANS_FEAT(BEXT, aa64_sve2_bitperm, gen_gvec_ool_arg_zzz, | ||
268 | + bext_fns[a->esz], a, 0) | ||
269 | |||
270 | -static bool trans_BDEP(DisasContext *s, arg_rrr_esz *a) | ||
271 | -{ | ||
272 | - static gen_helper_gvec_3 * const fns[4] = { | ||
273 | - gen_helper_sve2_bdep_b, gen_helper_sve2_bdep_h, | ||
274 | - gen_helper_sve2_bdep_s, gen_helper_sve2_bdep_d, | ||
275 | - }; | ||
276 | - if (!dc_isar_feature(aa64_sve2_bitperm, s)) { | ||
277 | - return false; | ||
278 | - } | ||
279 | - return do_sve2_zzw_ool(s, a, fns[a->esz], 0); | ||
280 | -} | ||
281 | +static gen_helper_gvec_3 * const bdep_fns[4] = { | ||
282 | + gen_helper_sve2_bdep_b, gen_helper_sve2_bdep_h, | ||
283 | + gen_helper_sve2_bdep_s, gen_helper_sve2_bdep_d, | ||
284 | +}; | ||
285 | +TRANS_FEAT(BDEP, aa64_sve2_bitperm, gen_gvec_ool_arg_zzz, | ||
286 | + bdep_fns[a->esz], a, 0) | ||
287 | |||
288 | -static bool trans_BGRP(DisasContext *s, arg_rrr_esz *a) | ||
289 | -{ | ||
290 | - static gen_helper_gvec_3 * const fns[4] = { | ||
291 | - gen_helper_sve2_bgrp_b, gen_helper_sve2_bgrp_h, | ||
292 | - gen_helper_sve2_bgrp_s, gen_helper_sve2_bgrp_d, | ||
293 | - }; | ||
294 | - if (!dc_isar_feature(aa64_sve2_bitperm, s)) { | ||
295 | - return false; | ||
296 | - } | ||
297 | - return do_sve2_zzw_ool(s, a, fns[a->esz], 0); | ||
298 | -} | ||
299 | +static gen_helper_gvec_3 * const bgrp_fns[4] = { | ||
300 | + gen_helper_sve2_bgrp_b, gen_helper_sve2_bgrp_h, | ||
301 | + gen_helper_sve2_bgrp_s, gen_helper_sve2_bgrp_d, | ||
302 | +}; | ||
303 | +TRANS_FEAT(BGRP, aa64_sve2_bitperm, gen_gvec_ool_arg_zzz, | ||
304 | + bgrp_fns[a->esz], a, 0) | ||
305 | |||
306 | -static bool do_cadd(DisasContext *s, arg_rrr_esz *a, bool sq, bool rot) | ||
307 | -{ | ||
308 | - static gen_helper_gvec_3 * const fns[2][4] = { | ||
309 | - { gen_helper_sve2_cadd_b, gen_helper_sve2_cadd_h, | ||
310 | - gen_helper_sve2_cadd_s, gen_helper_sve2_cadd_d }, | ||
311 | - { gen_helper_sve2_sqcadd_b, gen_helper_sve2_sqcadd_h, | ||
312 | - gen_helper_sve2_sqcadd_s, gen_helper_sve2_sqcadd_d }, | ||
313 | - }; | ||
314 | - return do_sve2_zzw_ool(s, a, fns[sq][a->esz], rot); | ||
315 | -} | ||
316 | +static gen_helper_gvec_3 * const cadd_fns[4] = { | ||
317 | + gen_helper_sve2_cadd_b, gen_helper_sve2_cadd_h, | ||
318 | + gen_helper_sve2_cadd_s, gen_helper_sve2_cadd_d, | ||
319 | +}; | ||
320 | +TRANS_FEAT(CADD_rot90, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
321 | + cadd_fns[a->esz], a, 0) | ||
322 | +TRANS_FEAT(CADD_rot270, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
323 | + cadd_fns[a->esz], a, 1) | ||
324 | |||
325 | -static bool trans_CADD_rot90(DisasContext *s, arg_rrr_esz *a) | ||
326 | -{ | ||
327 | - return do_cadd(s, a, false, false); | ||
328 | -} | ||
329 | - | ||
330 | -static bool trans_CADD_rot270(DisasContext *s, arg_rrr_esz *a) | ||
331 | -{ | ||
332 | - return do_cadd(s, a, false, true); | ||
333 | -} | ||
334 | - | ||
335 | -static bool trans_SQCADD_rot90(DisasContext *s, arg_rrr_esz *a) | ||
336 | -{ | ||
337 | - return do_cadd(s, a, true, false); | ||
338 | -} | ||
339 | - | ||
340 | -static bool trans_SQCADD_rot270(DisasContext *s, arg_rrr_esz *a) | ||
341 | -{ | ||
342 | - return do_cadd(s, a, true, true); | ||
343 | -} | ||
344 | +static gen_helper_gvec_3 * const sqcadd_fns[4] = { | ||
345 | + gen_helper_sve2_sqcadd_b, gen_helper_sve2_sqcadd_h, | ||
346 | + gen_helper_sve2_sqcadd_s, gen_helper_sve2_sqcadd_d, | ||
347 | +}; | ||
348 | +TRANS_FEAT(SQCADD_rot90, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
349 | + sqcadd_fns[a->esz], a, 0) | ||
350 | +TRANS_FEAT(SQCADD_rot270, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
351 | + sqcadd_fns[a->esz], a, 1) | ||
352 | |||
353 | static gen_helper_gvec_4 * const sabal_fns[4] = { | ||
354 | NULL, gen_helper_sve2_sabal_h, | ||
122 | -- | 355 | -- |
123 | 2.20.1 | 356 | 2.25.1 |
124 | |||
125 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | This is the last direct user of tcg_gen_gvec_4_ool. | ||
4 | |||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20220527181907.189259-19-richard.henderson@linaro.org | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | target/arm/translate-sve.c | 17 ++--------------- | ||
11 | 1 file changed, 2 insertions(+), 15 deletions(-) | ||
12 | |||
13 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/arm/translate-sve.c | ||
16 | +++ b/target/arm/translate-sve.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_4 * const sqrdcmlah_fns[] = { | ||
18 | TRANS_FEAT(SQRDCMLAH_zzzz, aa64_sve2, gen_gvec_ool_zzzz, | ||
19 | sqrdcmlah_fns[a->esz], a->rd, a->rn, a->rm, a->ra, a->rot) | ||
20 | |||
21 | -static bool trans_USDOT_zzzz(DisasContext *s, arg_USDOT_zzzz *a) | ||
22 | -{ | ||
23 | - if (a->esz != 2 || !dc_isar_feature(aa64_sve_i8mm, s)) { | ||
24 | - return false; | ||
25 | - } | ||
26 | - if (sve_access_check(s)) { | ||
27 | - unsigned vsz = vec_full_reg_size(s); | ||
28 | - tcg_gen_gvec_4_ool(vec_full_reg_offset(s, a->rd), | ||
29 | - vec_full_reg_offset(s, a->rn), | ||
30 | - vec_full_reg_offset(s, a->rm), | ||
31 | - vec_full_reg_offset(s, a->ra), | ||
32 | - vsz, vsz, 0, gen_helper_gvec_usdot_b); | ||
33 | - } | ||
34 | - return true; | ||
35 | -} | ||
36 | +TRANS_FEAT(USDOT_zzzz, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz, | ||
37 | + a->esz == 2 ? gen_helper_gvec_usdot_b : NULL, a, 0) | ||
38 | |||
39 | TRANS_FEAT(AESMC, aa64_sve2_aes, gen_gvec_ool_zz, | ||
40 | gen_helper_crypto_aesmc, a->rd, a->rd, a->decrypt) | ||
41 | -- | ||
42 | 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 | Message-id: 20220527181907.189259-20-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 37 +++++++++++++++---------------------- | ||
9 | 1 file changed, 15 insertions(+), 22 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 gen_gvec_ool_arg_zzxz(DisasContext *s, gen_helper_gvec_4 *fn, | ||
16 | } | ||
17 | |||
18 | /* Invoke an out-of-line helper on 2 Zregs and a predicate. */ | ||
19 | -static void gen_gvec_ool_zzp(DisasContext *s, gen_helper_gvec_3 *fn, | ||
20 | +static bool gen_gvec_ool_zzp(DisasContext *s, gen_helper_gvec_3 *fn, | ||
21 | int rd, int rn, int pg, int data) | ||
22 | { | ||
23 | - unsigned vsz = vec_full_reg_size(s); | ||
24 | - tcg_gen_gvec_3_ool(vec_full_reg_offset(s, rd), | ||
25 | - vec_full_reg_offset(s, rn), | ||
26 | - pred_full_reg_offset(s, pg), | ||
27 | - vsz, vsz, data, fn); | ||
28 | + if (fn == NULL) { | ||
29 | + return false; | ||
30 | + } | ||
31 | + if (sve_access_check(s)) { | ||
32 | + unsigned vsz = vec_full_reg_size(s); | ||
33 | + tcg_gen_gvec_3_ool(vec_full_reg_offset(s, rd), | ||
34 | + vec_full_reg_offset(s, rn), | ||
35 | + pred_full_reg_offset(s, pg), | ||
36 | + vsz, vsz, data, fn); | ||
37 | + } | ||
38 | + return true; | ||
39 | } | ||
40 | |||
41 | /* Invoke an out-of-line helper on 3 Zregs and a predicate. */ | ||
42 | @@ -XXX,XX +XXX,XX @@ static bool trans_SEL_zpzz(DisasContext *s, arg_rprr_esz *a) | ||
43 | |||
44 | static bool do_zpz_ool(DisasContext *s, arg_rpr_esz *a, gen_helper_gvec_3 *fn) | ||
45 | { | ||
46 | - if (fn == NULL) { | ||
47 | - return false; | ||
48 | - } | ||
49 | - if (sve_access_check(s)) { | ||
50 | - gen_gvec_ool_zzp(s, fn, a->rd, a->rn, a->pg, 0); | ||
51 | - } | ||
52 | - return true; | ||
53 | + return gen_gvec_ool_zzp(s, fn, a->rd, a->rn, a->pg, 0); | ||
54 | } | ||
55 | |||
56 | #define DO_ZPZ(NAME, name) \ | ||
57 | @@ -XXX,XX +XXX,XX @@ static bool do_movz_zpz(DisasContext *s, int rd, int rn, int pg, | ||
58 | gen_helper_sve_movz_b, gen_helper_sve_movz_h, | ||
59 | gen_helper_sve_movz_s, gen_helper_sve_movz_d, | ||
60 | }; | ||
61 | - | ||
62 | - if (sve_access_check(s)) { | ||
63 | - gen_gvec_ool_zzp(s, fns[esz], rd, rn, pg, invert); | ||
64 | - } | ||
65 | - return true; | ||
66 | + return gen_gvec_ool_zzp(s, fns[esz], rd, rn, pg, invert); | ||
67 | } | ||
68 | |||
69 | static bool do_zpzi_ool(DisasContext *s, arg_rpri_esz *a, | ||
70 | gen_helper_gvec_3 *fn) | ||
71 | { | ||
72 | - if (sve_access_check(s)) { | ||
73 | - gen_gvec_ool_zzp(s, fn, a->rd, a->rn, a->pg, a->imm); | ||
74 | - } | ||
75 | - return true; | ||
76 | + return gen_gvec_ool_zzp(s, fn, a->rd, a->rn, a->pg, a->imm); | ||
77 | } | ||
78 | |||
79 | static bool trans_ASR_zpzi(DisasContext *s, arg_rpri_esz *a) | ||
80 | -- | ||
81 | 2.25.1 | diff view generated by jsdifflib |
1 | Correct the decode of the M-profile "coprocessor and | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | floating-point instructions" space: | ||
3 | * op0 == 0b11 is always unallocated | ||
4 | * if the CPU has an FPU then all insns with op1 == 0b101 | ||
5 | are floating point and go to disas_vfp_insn() | ||
6 | 2 | ||
7 | For the moment we leave VLLDM and VLSTM as NOPs; in | 3 | Use gen_gvec_ool_arg_zpz instead of gen_gvec_ool_zzp |
8 | a later commit we will fill in the proper implementation | 4 | when the arguments come from arg_rpr_esz. |
9 | for the case where an FPU is present. | 5 | Replaces do_zpz_ool. |
10 | 6 | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20220527181907.189259-21-richard.henderson@linaro.org | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | Message-id: 20190416125744.27770-7-peter.maydell@linaro.org | ||
14 | --- | 11 | --- |
15 | target/arm/translate.c | 26 ++++++++++++++++++++++---- | 12 | target/arm/translate-sve.c | 45 +++++++++++++++++++++----------------- |
16 | 1 file changed, 22 insertions(+), 4 deletions(-) | 13 | 1 file changed, 25 insertions(+), 20 deletions(-) |
17 | 14 | ||
18 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 15 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
19 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/target/arm/translate.c | 17 | --- a/target/arm/translate-sve.c |
21 | +++ b/target/arm/translate.c | 18 | +++ b/target/arm/translate-sve.c |
22 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | 19 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_zzp(DisasContext *s, gen_helper_gvec_3 *fn, |
23 | case 6: case 7: case 14: case 15: | 20 | return true; |
24 | /* Coprocessor. */ | 21 | } |
25 | if (arm_dc_feature(s, ARM_FEATURE_M)) { | 22 | |
26 | - /* We don't currently implement M profile FP support, | 23 | +static bool gen_gvec_ool_arg_zpz(DisasContext *s, gen_helper_gvec_3 *fn, |
27 | - * so this entire space should give a NOCP fault, with | 24 | + arg_rpr_esz *a, int data) |
28 | - * the exception of the v8M VLLDM and VLSTM insns, which | 25 | +{ |
29 | - * must be NOPs in Secure state and UNDEF in Nonsecure state. | 26 | + return gen_gvec_ool_zzp(s, fn, a->rd, a->rn, a->pg, data); |
30 | + /* 0b111x_11xx_xxxx_xxxx_xxxx_xxxx_xxxx_xxxx */ | 27 | +} |
31 | + if (extract32(insn, 24, 2) == 3) { | ||
32 | + goto illegal_op; /* op0 = 0b11 : unallocated */ | ||
33 | + } | ||
34 | + | 28 | + |
35 | + /* | ||
36 | + * Decode VLLDM and VLSTM first: these are nonstandard because: | ||
37 | + * * if there is no FPU then these insns must NOP in | ||
38 | + * Secure state and UNDEF in Nonsecure state | ||
39 | + * * if there is an FPU then these insns do not have | ||
40 | + * the usual behaviour that disas_vfp_insn() provides of | ||
41 | + * being controlled by CPACR/NSACR enable bits or the | ||
42 | + * lazy-stacking logic. | ||
43 | */ | ||
44 | if (arm_dc_feature(s, ARM_FEATURE_V8) && | ||
45 | (insn & 0xffa00f00) == 0xec200a00) { | ||
46 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
47 | /* Just NOP since FP support is not implemented */ | ||
48 | break; | ||
49 | } | ||
50 | + if (arm_dc_feature(s, ARM_FEATURE_VFP) && | ||
51 | + ((insn >> 8) & 0xe) == 10) { | ||
52 | + /* FP, and the CPU supports it */ | ||
53 | + if (disas_vfp_insn(s, insn)) { | ||
54 | + goto illegal_op; | ||
55 | + } | ||
56 | + break; | ||
57 | + } | ||
58 | + | 29 | + |
59 | /* All other insns: NOCP */ | 30 | /* Invoke an out-of-line helper on 3 Zregs and a predicate. */ |
60 | gen_exception_insn(s, 4, EXCP_NOCP, syn_uncategorized(), | 31 | static void gen_gvec_ool_zzzp(DisasContext *s, gen_helper_gvec_4 *fn, |
61 | default_exception_el(s)); | 32 | int rd, int rn, int rm, int pg, int data) |
33 | @@ -XXX,XX +XXX,XX @@ static bool trans_SEL_zpzz(DisasContext *s, arg_rprr_esz *a) | ||
34 | *** SVE Integer Arithmetic - Unary Predicated Group | ||
35 | */ | ||
36 | |||
37 | -static bool do_zpz_ool(DisasContext *s, arg_rpr_esz *a, gen_helper_gvec_3 *fn) | ||
38 | -{ | ||
39 | - return gen_gvec_ool_zzp(s, fn, a->rd, a->rn, a->pg, 0); | ||
40 | -} | ||
41 | - | ||
42 | #define DO_ZPZ(NAME, name) \ | ||
43 | static bool trans_##NAME(DisasContext *s, arg_rpr_esz *a) \ | ||
44 | { \ | ||
45 | @@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_rpr_esz *a) \ | ||
46 | gen_helper_sve_##name##_b, gen_helper_sve_##name##_h, \ | ||
47 | gen_helper_sve_##name##_s, gen_helper_sve_##name##_d, \ | ||
48 | }; \ | ||
49 | - return do_zpz_ool(s, a, fns[a->esz]); \ | ||
50 | + return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); \ | ||
51 | } | ||
52 | |||
53 | DO_ZPZ(CLS, cls) | ||
54 | @@ -XXX,XX +XXX,XX @@ static bool trans_FABS(DisasContext *s, arg_rpr_esz *a) | ||
55 | gen_helper_sve_fabs_s, | ||
56 | gen_helper_sve_fabs_d | ||
57 | }; | ||
58 | - return do_zpz_ool(s, a, fns[a->esz]); | ||
59 | + return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
60 | } | ||
61 | |||
62 | static bool trans_FNEG(DisasContext *s, arg_rpr_esz *a) | ||
63 | @@ -XXX,XX +XXX,XX @@ static bool trans_FNEG(DisasContext *s, arg_rpr_esz *a) | ||
64 | gen_helper_sve_fneg_s, | ||
65 | gen_helper_sve_fneg_d | ||
66 | }; | ||
67 | - return do_zpz_ool(s, a, fns[a->esz]); | ||
68 | + return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
69 | } | ||
70 | |||
71 | static bool trans_SXTB(DisasContext *s, arg_rpr_esz *a) | ||
72 | @@ -XXX,XX +XXX,XX @@ static bool trans_SXTB(DisasContext *s, arg_rpr_esz *a) | ||
73 | gen_helper_sve_sxtb_s, | ||
74 | gen_helper_sve_sxtb_d | ||
75 | }; | ||
76 | - return do_zpz_ool(s, a, fns[a->esz]); | ||
77 | + return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
78 | } | ||
79 | |||
80 | static bool trans_UXTB(DisasContext *s, arg_rpr_esz *a) | ||
81 | @@ -XXX,XX +XXX,XX @@ static bool trans_UXTB(DisasContext *s, arg_rpr_esz *a) | ||
82 | gen_helper_sve_uxtb_s, | ||
83 | gen_helper_sve_uxtb_d | ||
84 | }; | ||
85 | - return do_zpz_ool(s, a, fns[a->esz]); | ||
86 | + return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
87 | } | ||
88 | |||
89 | static bool trans_SXTH(DisasContext *s, arg_rpr_esz *a) | ||
90 | @@ -XXX,XX +XXX,XX @@ static bool trans_SXTH(DisasContext *s, arg_rpr_esz *a) | ||
91 | gen_helper_sve_sxth_s, | ||
92 | gen_helper_sve_sxth_d | ||
93 | }; | ||
94 | - return do_zpz_ool(s, a, fns[a->esz]); | ||
95 | + return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
96 | } | ||
97 | |||
98 | static bool trans_UXTH(DisasContext *s, arg_rpr_esz *a) | ||
99 | @@ -XXX,XX +XXX,XX @@ static bool trans_UXTH(DisasContext *s, arg_rpr_esz *a) | ||
100 | gen_helper_sve_uxth_s, | ||
101 | gen_helper_sve_uxth_d | ||
102 | }; | ||
103 | - return do_zpz_ool(s, a, fns[a->esz]); | ||
104 | + return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
105 | } | ||
106 | |||
107 | static bool trans_SXTW(DisasContext *s, arg_rpr_esz *a) | ||
108 | { | ||
109 | - return do_zpz_ool(s, a, a->esz == 3 ? gen_helper_sve_sxtw_d : NULL); | ||
110 | + return gen_gvec_ool_arg_zpz(s, a->esz == 3 ? gen_helper_sve_sxtw_d | ||
111 | + : NULL, a, 0); | ||
112 | } | ||
113 | |||
114 | static bool trans_UXTW(DisasContext *s, arg_rpr_esz *a) | ||
115 | { | ||
116 | - return do_zpz_ool(s, a, a->esz == 3 ? gen_helper_sve_uxtw_d : NULL); | ||
117 | + return gen_gvec_ool_arg_zpz(s, a->esz == 3 ? gen_helper_sve_uxtw_d | ||
118 | + : NULL, a, 0); | ||
119 | } | ||
120 | |||
121 | #undef DO_ZPZ | ||
122 | @@ -XXX,XX +XXX,XX @@ static bool trans_COMPACT(DisasContext *s, arg_rpr_esz *a) | ||
123 | static gen_helper_gvec_3 * const fns[4] = { | ||
124 | NULL, NULL, gen_helper_sve_compact_s, gen_helper_sve_compact_d | ||
125 | }; | ||
126 | - return do_zpz_ool(s, a, fns[a->esz]); | ||
127 | + return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
128 | } | ||
129 | |||
130 | /* Call the helper that computes the ARM LastActiveElement pseudocode | ||
131 | @@ -XXX,XX +XXX,XX @@ static bool trans_REVB(DisasContext *s, arg_rpr_esz *a) | ||
132 | gen_helper_sve_revb_s, | ||
133 | gen_helper_sve_revb_d, | ||
134 | }; | ||
135 | - return do_zpz_ool(s, a, fns[a->esz]); | ||
136 | + return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
137 | } | ||
138 | |||
139 | static bool trans_REVH(DisasContext *s, arg_rpr_esz *a) | ||
140 | @@ -XXX,XX +XXX,XX @@ static bool trans_REVH(DisasContext *s, arg_rpr_esz *a) | ||
141 | gen_helper_sve_revh_s, | ||
142 | gen_helper_sve_revh_d, | ||
143 | }; | ||
144 | - return do_zpz_ool(s, a, fns[a->esz]); | ||
145 | + return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
146 | } | ||
147 | |||
148 | static bool trans_REVW(DisasContext *s, arg_rpr_esz *a) | ||
149 | { | ||
150 | - return do_zpz_ool(s, a, a->esz == 3 ? gen_helper_sve_revw_d : NULL); | ||
151 | + return gen_gvec_ool_arg_zpz(s, a->esz == 3 ? gen_helper_sve_revw_d | ||
152 | + : NULL, a, 0); | ||
153 | } | ||
154 | |||
155 | static bool trans_RBIT(DisasContext *s, arg_rpr_esz *a) | ||
156 | @@ -XXX,XX +XXX,XX @@ static bool trans_RBIT(DisasContext *s, arg_rpr_esz *a) | ||
157 | gen_helper_sve_rbit_s, | ||
158 | gen_helper_sve_rbit_d, | ||
159 | }; | ||
160 | - return do_zpz_ool(s, a, fns[a->esz]); | ||
161 | + return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
162 | } | ||
163 | |||
164 | static bool trans_SPLICE(DisasContext *s, arg_rprr_esz *a) | ||
165 | @@ -XXX,XX +XXX,XX @@ static bool do_sve2_zpz_ool(DisasContext *s, arg_rpr_esz *a, | ||
166 | if (!dc_isar_feature(aa64_sve2, s)) { | ||
167 | return false; | ||
168 | } | ||
169 | - return do_zpz_ool(s, a, fn); | ||
170 | + return gen_gvec_ool_arg_zpz(s, fn, a, 0); | ||
171 | } | ||
172 | |||
173 | static bool trans_URECPE(DisasContext *s, arg_rpr_esz *a) | ||
62 | -- | 174 | -- |
63 | 2.20.1 | 175 | 2.25.1 |
64 | |||
65 | diff view generated by jsdifflib |
1 | The only "system register" that M-profile floating point exposes | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | via the VMRS/VMRS instructions is FPSCR, and it does not have | ||
3 | the odd special case for rd==15. Add a check to ensure we only | ||
4 | expose FPSCR. | ||
5 | 2 | ||
3 | Convert SVE translation functions directly using | ||
4 | gen_gvec_ool_arg_zpz to TRANS_FEAT. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-22-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20190416125744.27770-5-peter.maydell@linaro.org | ||
9 | --- | 10 | --- |
10 | target/arm/translate.c | 19 +++++++++++++++++-- | 11 | target/arm/translate-sve.c | 189 ++++++++++++------------------------- |
11 | 1 file changed, 17 insertions(+), 2 deletions(-) | 12 | 1 file changed, 60 insertions(+), 129 deletions(-) |
12 | 13 | ||
13 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
14 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/translate.c | 16 | --- a/target/arm/translate-sve.c |
16 | +++ b/target/arm/translate.c | 17 | +++ b/target/arm/translate-sve.c |
17 | @@ -XXX,XX +XXX,XX @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) | 18 | @@ -XXX,XX +XXX,XX @@ static bool trans_SEL_zpzz(DisasContext *s, arg_rprr_esz *a) |
18 | } | 19 | *** SVE Integer Arithmetic - Unary Predicated Group |
19 | } | 20 | */ |
20 | } else { /* !dp */ | 21 | |
21 | + bool is_sysreg; | 22 | -#define DO_ZPZ(NAME, name) \ |
22 | + | 23 | -static bool trans_##NAME(DisasContext *s, arg_rpr_esz *a) \ |
23 | if ((insn & 0x6f) != 0x00) | 24 | -{ \ |
24 | return 1; | 25 | - static gen_helper_gvec_3 * const fns[4] = { \ |
25 | rn = VFP_SREG_N(insn); | 26 | - gen_helper_sve_##name##_b, gen_helper_sve_##name##_h, \ |
26 | + | 27 | - gen_helper_sve_##name##_s, gen_helper_sve_##name##_d, \ |
27 | + is_sysreg = extract32(insn, 21, 1); | 28 | +#define DO_ZPZ(NAME, FEAT, name) \ |
28 | + | 29 | + static gen_helper_gvec_3 * const name##_fns[4] = { \ |
29 | + if (arm_dc_feature(s, ARM_FEATURE_M)) { | 30 | + gen_helper_##name##_b, gen_helper_##name##_h, \ |
30 | + /* | 31 | + gen_helper_##name##_s, gen_helper_##name##_d, \ |
31 | + * The only M-profile VFP vmrs/vmsr sysreg is FPSCR. | 32 | }; \ |
32 | + * Writes to R15 are UNPREDICTABLE; we choose to undef. | 33 | - return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); \ |
33 | + */ | 34 | -} |
34 | + if (is_sysreg && (rd == 15 || (rn >> 1) != ARM_VFP_FPSCR)) { | 35 | + TRANS_FEAT(NAME, FEAT, gen_gvec_ool_arg_zpz, name##_fns[a->esz], a, 0) |
35 | + return 1; | 36 | |
36 | + } | 37 | -DO_ZPZ(CLS, cls) |
37 | + } | 38 | -DO_ZPZ(CLZ, clz) |
38 | + | 39 | -DO_ZPZ(CNT_zpz, cnt_zpz) |
39 | if (insn & ARM_CP_RW_BIT) { | 40 | -DO_ZPZ(CNOT, cnot) |
40 | /* vfp->arm */ | 41 | -DO_ZPZ(NOT_zpz, not_zpz) |
41 | - if (insn & (1 << 21)) { | 42 | -DO_ZPZ(ABS, abs) |
42 | + if (is_sysreg) { | 43 | -DO_ZPZ(NEG, neg) |
43 | /* system register */ | 44 | +DO_ZPZ(CLS, aa64_sve, sve_cls) |
44 | rn >>= 1; | 45 | +DO_ZPZ(CLZ, aa64_sve, sve_clz) |
45 | 46 | +DO_ZPZ(CNT_zpz, aa64_sve, sve_cnt_zpz) | |
46 | @@ -XXX,XX +XXX,XX @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) | 47 | +DO_ZPZ(CNOT, aa64_sve, sve_cnot) |
47 | } | 48 | +DO_ZPZ(NOT_zpz, aa64_sve, sve_not_zpz) |
48 | } else { | 49 | +DO_ZPZ(ABS, aa64_sve, sve_abs) |
49 | /* arm->vfp */ | 50 | +DO_ZPZ(NEG, aa64_sve, sve_neg) |
50 | - if (insn & (1 << 21)) { | 51 | +DO_ZPZ(RBIT, aa64_sve, sve_rbit) |
51 | + if (is_sysreg) { | 52 | |
52 | rn >>= 1; | 53 | -static bool trans_FABS(DisasContext *s, arg_rpr_esz *a) |
53 | /* system register */ | 54 | -{ |
54 | switch (rn) { | 55 | - static gen_helper_gvec_3 * const fns[4] = { |
56 | - NULL, | ||
57 | - gen_helper_sve_fabs_h, | ||
58 | - gen_helper_sve_fabs_s, | ||
59 | - gen_helper_sve_fabs_d | ||
60 | - }; | ||
61 | - return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
62 | -} | ||
63 | +static gen_helper_gvec_3 * const fabs_fns[4] = { | ||
64 | + NULL, gen_helper_sve_fabs_h, | ||
65 | + gen_helper_sve_fabs_s, gen_helper_sve_fabs_d, | ||
66 | +}; | ||
67 | +TRANS_FEAT(FABS, aa64_sve, gen_gvec_ool_arg_zpz, fabs_fns[a->esz], a, 0) | ||
68 | |||
69 | -static bool trans_FNEG(DisasContext *s, arg_rpr_esz *a) | ||
70 | -{ | ||
71 | - static gen_helper_gvec_3 * const fns[4] = { | ||
72 | - NULL, | ||
73 | - gen_helper_sve_fneg_h, | ||
74 | - gen_helper_sve_fneg_s, | ||
75 | - gen_helper_sve_fneg_d | ||
76 | - }; | ||
77 | - return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
78 | -} | ||
79 | +static gen_helper_gvec_3 * const fneg_fns[4] = { | ||
80 | + NULL, gen_helper_sve_fneg_h, | ||
81 | + gen_helper_sve_fneg_s, gen_helper_sve_fneg_d, | ||
82 | +}; | ||
83 | +TRANS_FEAT(FNEG, aa64_sve, gen_gvec_ool_arg_zpz, fneg_fns[a->esz], a, 0) | ||
84 | |||
85 | -static bool trans_SXTB(DisasContext *s, arg_rpr_esz *a) | ||
86 | -{ | ||
87 | - static gen_helper_gvec_3 * const fns[4] = { | ||
88 | - NULL, | ||
89 | - gen_helper_sve_sxtb_h, | ||
90 | - gen_helper_sve_sxtb_s, | ||
91 | - gen_helper_sve_sxtb_d | ||
92 | - }; | ||
93 | - return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
94 | -} | ||
95 | +static gen_helper_gvec_3 * const sxtb_fns[4] = { | ||
96 | + NULL, gen_helper_sve_sxtb_h, | ||
97 | + gen_helper_sve_sxtb_s, gen_helper_sve_sxtb_d, | ||
98 | +}; | ||
99 | +TRANS_FEAT(SXTB, aa64_sve, gen_gvec_ool_arg_zpz, sxtb_fns[a->esz], a, 0) | ||
100 | |||
101 | -static bool trans_UXTB(DisasContext *s, arg_rpr_esz *a) | ||
102 | -{ | ||
103 | - static gen_helper_gvec_3 * const fns[4] = { | ||
104 | - NULL, | ||
105 | - gen_helper_sve_uxtb_h, | ||
106 | - gen_helper_sve_uxtb_s, | ||
107 | - gen_helper_sve_uxtb_d | ||
108 | - }; | ||
109 | - return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
110 | -} | ||
111 | +static gen_helper_gvec_3 * const uxtb_fns[4] = { | ||
112 | + NULL, gen_helper_sve_uxtb_h, | ||
113 | + gen_helper_sve_uxtb_s, gen_helper_sve_uxtb_d, | ||
114 | +}; | ||
115 | +TRANS_FEAT(UXTB, aa64_sve, gen_gvec_ool_arg_zpz, uxtb_fns[a->esz], a, 0) | ||
116 | |||
117 | -static bool trans_SXTH(DisasContext *s, arg_rpr_esz *a) | ||
118 | -{ | ||
119 | - static gen_helper_gvec_3 * const fns[4] = { | ||
120 | - NULL, NULL, | ||
121 | - gen_helper_sve_sxth_s, | ||
122 | - gen_helper_sve_sxth_d | ||
123 | - }; | ||
124 | - return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
125 | -} | ||
126 | +static gen_helper_gvec_3 * const sxth_fns[4] = { | ||
127 | + NULL, NULL, gen_helper_sve_sxth_s, gen_helper_sve_sxth_d | ||
128 | +}; | ||
129 | +TRANS_FEAT(SXTH, aa64_sve, gen_gvec_ool_arg_zpz, sxth_fns[a->esz], a, 0) | ||
130 | |||
131 | -static bool trans_UXTH(DisasContext *s, arg_rpr_esz *a) | ||
132 | -{ | ||
133 | - static gen_helper_gvec_3 * const fns[4] = { | ||
134 | - NULL, NULL, | ||
135 | - gen_helper_sve_uxth_s, | ||
136 | - gen_helper_sve_uxth_d | ||
137 | - }; | ||
138 | - return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
139 | -} | ||
140 | +static gen_helper_gvec_3 * const uxth_fns[4] = { | ||
141 | + NULL, NULL, gen_helper_sve_uxth_s, gen_helper_sve_uxth_d | ||
142 | +}; | ||
143 | +TRANS_FEAT(UXTH, aa64_sve, gen_gvec_ool_arg_zpz, uxth_fns[a->esz], a, 0) | ||
144 | |||
145 | -static bool trans_SXTW(DisasContext *s, arg_rpr_esz *a) | ||
146 | -{ | ||
147 | - return gen_gvec_ool_arg_zpz(s, a->esz == 3 ? gen_helper_sve_sxtw_d | ||
148 | - : NULL, a, 0); | ||
149 | -} | ||
150 | - | ||
151 | -static bool trans_UXTW(DisasContext *s, arg_rpr_esz *a) | ||
152 | -{ | ||
153 | - return gen_gvec_ool_arg_zpz(s, a->esz == 3 ? gen_helper_sve_uxtw_d | ||
154 | - : NULL, a, 0); | ||
155 | -} | ||
156 | - | ||
157 | -#undef DO_ZPZ | ||
158 | +TRANS_FEAT(SXTW, aa64_sve, gen_gvec_ool_arg_zpz, | ||
159 | + a->esz == 3 ? gen_helper_sve_sxtw_d : NULL, a, 0) | ||
160 | +TRANS_FEAT(UXTW, aa64_sve, gen_gvec_ool_arg_zpz, | ||
161 | + a->esz == 3 ? gen_helper_sve_uxtw_d : NULL, a, 0) | ||
162 | |||
163 | /* | ||
164 | *** SVE Integer Reduction Group | ||
165 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(TRN2_q, aa64_sve_f64mm, gen_gvec_ool_arg_zzz, | ||
166 | *** SVE Permute Vector - Predicated Group | ||
167 | */ | ||
168 | |||
169 | -static bool trans_COMPACT(DisasContext *s, arg_rpr_esz *a) | ||
170 | -{ | ||
171 | - static gen_helper_gvec_3 * const fns[4] = { | ||
172 | - NULL, NULL, gen_helper_sve_compact_s, gen_helper_sve_compact_d | ||
173 | - }; | ||
174 | - return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
175 | -} | ||
176 | +static gen_helper_gvec_3 * const compact_fns[4] = { | ||
177 | + NULL, NULL, gen_helper_sve_compact_s, gen_helper_sve_compact_d | ||
178 | +}; | ||
179 | +TRANS_FEAT(COMPACT, aa64_sve, gen_gvec_ool_arg_zpz, compact_fns[a->esz], a, 0) | ||
180 | |||
181 | /* Call the helper that computes the ARM LastActiveElement pseudocode | ||
182 | * function, scaled by the element size. This includes the not found | ||
183 | @@ -XXX,XX +XXX,XX @@ static bool trans_CPY_m_v(DisasContext *s, arg_rpr_esz *a) | ||
184 | return true; | ||
185 | } | ||
186 | |||
187 | -static bool trans_REVB(DisasContext *s, arg_rpr_esz *a) | ||
188 | -{ | ||
189 | - static gen_helper_gvec_3 * const fns[4] = { | ||
190 | - NULL, | ||
191 | - gen_helper_sve_revb_h, | ||
192 | - gen_helper_sve_revb_s, | ||
193 | - gen_helper_sve_revb_d, | ||
194 | - }; | ||
195 | - return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
196 | -} | ||
197 | +static gen_helper_gvec_3 * const revb_fns[4] = { | ||
198 | + NULL, gen_helper_sve_revb_h, | ||
199 | + gen_helper_sve_revb_s, gen_helper_sve_revb_d, | ||
200 | +}; | ||
201 | +TRANS_FEAT(REVB, aa64_sve, gen_gvec_ool_arg_zpz, revb_fns[a->esz], a, 0) | ||
202 | |||
203 | -static bool trans_REVH(DisasContext *s, arg_rpr_esz *a) | ||
204 | -{ | ||
205 | - static gen_helper_gvec_3 * const fns[4] = { | ||
206 | - NULL, | ||
207 | - NULL, | ||
208 | - gen_helper_sve_revh_s, | ||
209 | - gen_helper_sve_revh_d, | ||
210 | - }; | ||
211 | - return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
212 | -} | ||
213 | +static gen_helper_gvec_3 * const revh_fns[4] = { | ||
214 | + NULL, NULL, gen_helper_sve_revh_s, gen_helper_sve_revh_d, | ||
215 | +}; | ||
216 | +TRANS_FEAT(REVH, aa64_sve, gen_gvec_ool_arg_zpz, revh_fns[a->esz], a, 0) | ||
217 | |||
218 | -static bool trans_REVW(DisasContext *s, arg_rpr_esz *a) | ||
219 | -{ | ||
220 | - return gen_gvec_ool_arg_zpz(s, a->esz == 3 ? gen_helper_sve_revw_d | ||
221 | - : NULL, a, 0); | ||
222 | -} | ||
223 | - | ||
224 | -static bool trans_RBIT(DisasContext *s, arg_rpr_esz *a) | ||
225 | -{ | ||
226 | - static gen_helper_gvec_3 * const fns[4] = { | ||
227 | - gen_helper_sve_rbit_b, | ||
228 | - gen_helper_sve_rbit_h, | ||
229 | - gen_helper_sve_rbit_s, | ||
230 | - gen_helper_sve_rbit_d, | ||
231 | - }; | ||
232 | - return gen_gvec_ool_arg_zpz(s, fns[a->esz], a, 0); | ||
233 | -} | ||
234 | +TRANS_FEAT(REVW, aa64_sve, gen_gvec_ool_arg_zpz, | ||
235 | + a->esz == 3 ? gen_helper_sve_revw_d : NULL, a, 0) | ||
236 | |||
237 | static bool trans_SPLICE(DisasContext *s, arg_rprr_esz *a) | ||
238 | { | ||
55 | -- | 239 | -- |
56 | 2.20.1 | 240 | 2.25.1 |
57 | |||
58 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions using do_sve2_zpz_data | ||
4 | to use TRANS_FEAT and gen_gvec_ool_arg_zpz. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-23-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 53 ++++++++++---------------------------- | ||
12 | 1 file changed, 14 insertions(+), 39 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static bool trans_UADALP_zpzz(DisasContext *s, arg_rprr_esz *a) | ||
19 | * SVE2 integer unary operations (predicated) | ||
20 | */ | ||
21 | |||
22 | -static bool do_sve2_zpz_ool(DisasContext *s, arg_rpr_esz *a, | ||
23 | - gen_helper_gvec_3 *fn) | ||
24 | -{ | ||
25 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
26 | - return false; | ||
27 | - } | ||
28 | - return gen_gvec_ool_arg_zpz(s, fn, a, 0); | ||
29 | -} | ||
30 | +TRANS_FEAT(URECPE, aa64_sve2, gen_gvec_ool_arg_zpz, | ||
31 | + a->esz == 2 ? gen_helper_sve2_urecpe_s : NULL, a, 0) | ||
32 | |||
33 | -static bool trans_URECPE(DisasContext *s, arg_rpr_esz *a) | ||
34 | -{ | ||
35 | - if (a->esz != 2) { | ||
36 | - return false; | ||
37 | - } | ||
38 | - return do_sve2_zpz_ool(s, a, gen_helper_sve2_urecpe_s); | ||
39 | -} | ||
40 | +TRANS_FEAT(URSQRTE, aa64_sve2, gen_gvec_ool_arg_zpz, | ||
41 | + a->esz == 2 ? gen_helper_sve2_ursqrte_s : NULL, a, 0) | ||
42 | |||
43 | -static bool trans_URSQRTE(DisasContext *s, arg_rpr_esz *a) | ||
44 | -{ | ||
45 | - if (a->esz != 2) { | ||
46 | - return false; | ||
47 | - } | ||
48 | - return do_sve2_zpz_ool(s, a, gen_helper_sve2_ursqrte_s); | ||
49 | -} | ||
50 | +static gen_helper_gvec_3 * const sqabs_fns[4] = { | ||
51 | + gen_helper_sve2_sqabs_b, gen_helper_sve2_sqabs_h, | ||
52 | + gen_helper_sve2_sqabs_s, gen_helper_sve2_sqabs_d, | ||
53 | +}; | ||
54 | +TRANS_FEAT(SQABS, aa64_sve2, gen_gvec_ool_arg_zpz, sqabs_fns[a->esz], a, 0) | ||
55 | |||
56 | -static bool trans_SQABS(DisasContext *s, arg_rpr_esz *a) | ||
57 | -{ | ||
58 | - static gen_helper_gvec_3 * const fns[4] = { | ||
59 | - gen_helper_sve2_sqabs_b, gen_helper_sve2_sqabs_h, | ||
60 | - gen_helper_sve2_sqabs_s, gen_helper_sve2_sqabs_d, | ||
61 | - }; | ||
62 | - return do_sve2_zpz_ool(s, a, fns[a->esz]); | ||
63 | -} | ||
64 | - | ||
65 | -static bool trans_SQNEG(DisasContext *s, arg_rpr_esz *a) | ||
66 | -{ | ||
67 | - static gen_helper_gvec_3 * const fns[4] = { | ||
68 | - gen_helper_sve2_sqneg_b, gen_helper_sve2_sqneg_h, | ||
69 | - gen_helper_sve2_sqneg_s, gen_helper_sve2_sqneg_d, | ||
70 | - }; | ||
71 | - return do_sve2_zpz_ool(s, a, fns[a->esz]); | ||
72 | -} | ||
73 | +static gen_helper_gvec_3 * const sqneg_fns[4] = { | ||
74 | + gen_helper_sve2_sqneg_b, gen_helper_sve2_sqneg_h, | ||
75 | + gen_helper_sve2_sqneg_s, gen_helper_sve2_sqneg_d, | ||
76 | +}; | ||
77 | +TRANS_FEAT(SQNEG, aa64_sve2, gen_gvec_ool_arg_zpz, sqneg_fns[a->esz], a, 0) | ||
78 | |||
79 | #define DO_SVE2_ZPZZ(NAME, name) \ | ||
80 | static bool trans_##NAME(DisasContext *s, arg_rprr_esz *a) \ | ||
81 | -- | ||
82 | 2.25.1 | diff view generated by jsdifflib |
1 | From: Eric Auger <eric.auger@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | The SMMUNotifierNode struct is not necessary and brings extra | 3 | Rename the function to match gen_gvec_ool_arg_zpz, |
4 | complexity so let's remove it. We now directly track the SMMUDevices | 4 | and move to be adjacent. |
5 | which have registered IOMMU MR notifiers. | ||
6 | 5 | ||
7 | This is inspired from the same transformation on intel-iommu | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | done in commit b4a4ba0d68f50f218ee3957b6638dbee32a5eeef | 7 | Message-id: 20220527181907.189259-24-richard.henderson@linaro.org |
9 | ("intel-iommu: remove IntelIOMMUNotifierNode") | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | |||
11 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | ||
12 | Reviewed-by: Peter Xu <peterx@redhat.com> | ||
13 | Message-id: 20190409160219.19026-1-eric.auger@redhat.com | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
15 | --- | 10 | --- |
16 | include/hw/arm/smmu-common.h | 8 ++------ | 11 | target/arm/translate-sve.c | 29 ++++++++++++++--------------- |
17 | hw/arm/smmu-common.c | 6 +++--- | 12 | 1 file changed, 14 insertions(+), 15 deletions(-) |
18 | hw/arm/smmuv3.c | 28 +++++++--------------------- | ||
19 | 3 files changed, 12 insertions(+), 30 deletions(-) | ||
20 | 13 | ||
21 | diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h | 14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
22 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/include/hw/arm/smmu-common.h | 16 | --- a/target/arm/translate-sve.c |
24 | +++ b/include/hw/arm/smmu-common.h | 17 | +++ b/target/arm/translate-sve.c |
25 | @@ -XXX,XX +XXX,XX @@ typedef struct SMMUDevice { | 18 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_arg_zpz(DisasContext *s, gen_helper_gvec_3 *fn, |
26 | AddressSpace as; | 19 | return gen_gvec_ool_zzp(s, fn, a->rd, a->rn, a->pg, data); |
27 | uint32_t cfg_cache_hits; | 20 | } |
28 | uint32_t cfg_cache_misses; | 21 | |
29 | + QLIST_ENTRY(SMMUDevice) next; | 22 | +static bool gen_gvec_ool_arg_zpzi(DisasContext *s, gen_helper_gvec_3 *fn, |
30 | } SMMUDevice; | 23 | + arg_rpri_esz *a) |
31 | 24 | +{ | |
32 | -typedef struct SMMUNotifierNode { | 25 | + return gen_gvec_ool_zzp(s, fn, a->rd, a->rn, a->pg, a->imm); |
33 | - SMMUDevice *sdev; | 26 | +} |
34 | - QLIST_ENTRY(SMMUNotifierNode) next; | 27 | |
35 | -} SMMUNotifierNode; | 28 | /* Invoke an out-of-line helper on 3 Zregs and a predicate. */ |
29 | static void gen_gvec_ool_zzzp(DisasContext *s, gen_helper_gvec_4 *fn, | ||
30 | @@ -XXX,XX +XXX,XX @@ static bool do_movz_zpz(DisasContext *s, int rd, int rn, int pg, | ||
31 | return gen_gvec_ool_zzp(s, fns[esz], rd, rn, pg, invert); | ||
32 | } | ||
33 | |||
34 | -static bool do_zpzi_ool(DisasContext *s, arg_rpri_esz *a, | ||
35 | - gen_helper_gvec_3 *fn) | ||
36 | -{ | ||
37 | - return gen_gvec_ool_zzp(s, fn, a->rd, a->rn, a->pg, a->imm); | ||
38 | -} | ||
36 | - | 39 | - |
37 | typedef struct SMMUPciBus { | 40 | static bool trans_ASR_zpzi(DisasContext *s, arg_rpri_esz *a) |
38 | PCIBus *bus; | ||
39 | SMMUDevice *pbdev[0]; /* Parent array is sparse, so dynamically alloc */ | ||
40 | @@ -XXX,XX +XXX,XX @@ typedef struct SMMUState { | ||
41 | GHashTable *iotlb; | ||
42 | SMMUPciBus *smmu_pcibus_by_bus_num[SMMU_PCI_BUS_MAX]; | ||
43 | PCIBus *pci_bus; | ||
44 | - QLIST_HEAD(, SMMUNotifierNode) notifiers_list; | ||
45 | + QLIST_HEAD(, SMMUDevice) devices_with_notifiers; | ||
46 | uint8_t bus_num; | ||
47 | PCIBus *primary_bus; | ||
48 | } SMMUState; | ||
49 | diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c | ||
50 | index XXXXXXX..XXXXXXX 100644 | ||
51 | --- a/hw/arm/smmu-common.c | ||
52 | +++ b/hw/arm/smmu-common.c | ||
53 | @@ -XXX,XX +XXX,XX @@ inline void smmu_inv_notifiers_mr(IOMMUMemoryRegion *mr) | ||
54 | /* Unmap all notifiers of all mr's */ | ||
55 | void smmu_inv_notifiers_all(SMMUState *s) | ||
56 | { | 41 | { |
57 | - SMMUNotifierNode *node; | 42 | static gen_helper_gvec_3 * const fns[4] = { |
58 | + SMMUDevice *sdev; | 43 | @@ -XXX,XX +XXX,XX @@ static bool trans_ASR_zpzi(DisasContext *s, arg_rpri_esz *a) |
59 | 44 | /* Shift by element size is architecturally valid. For | |
60 | - QLIST_FOREACH(node, &s->notifiers_list, next) { | 45 | arithmetic right-shift, it's the same as by one less. */ |
61 | - smmu_inv_notifiers_mr(&node->sdev->iommu); | 46 | a->imm = MIN(a->imm, (8 << a->esz) - 1); |
62 | + QLIST_FOREACH(sdev, &s->devices_with_notifiers, next) { | 47 | - return do_zpzi_ool(s, a, fns[a->esz]); |
63 | + smmu_inv_notifiers_mr(&sdev->iommu); | 48 | + return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); |
49 | } | ||
50 | |||
51 | static bool trans_LSR_zpzi(DisasContext *s, arg_rpri_esz *a) | ||
52 | @@ -XXX,XX +XXX,XX @@ static bool trans_LSR_zpzi(DisasContext *s, arg_rpri_esz *a) | ||
53 | if (a->imm >= (8 << a->esz)) { | ||
54 | return do_movz_zpz(s, a->rd, a->rd, a->pg, a->esz, true); | ||
55 | } else { | ||
56 | - return do_zpzi_ool(s, a, fns[a->esz]); | ||
57 | + return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | ||
64 | } | 58 | } |
65 | } | 59 | } |
66 | 60 | ||
67 | diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c | 61 | @@ -XXX,XX +XXX,XX @@ static bool trans_LSL_zpzi(DisasContext *s, arg_rpri_esz *a) |
68 | index XXXXXXX..XXXXXXX 100644 | 62 | if (a->imm >= (8 << a->esz)) { |
69 | --- a/hw/arm/smmuv3.c | 63 | return do_movz_zpz(s, a->rd, a->rd, a->pg, a->esz, true); |
70 | +++ b/hw/arm/smmuv3.c | 64 | } else { |
71 | @@ -XXX,XX +XXX,XX @@ static void smmuv3_notify_iova(IOMMUMemoryRegion *mr, | 65 | - return do_zpzi_ool(s, a, fns[a->esz]); |
72 | /* invalidate an asid/iova tuple in all mr's */ | 66 | + return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); |
73 | static void smmuv3_inv_notifiers_iova(SMMUState *s, int asid, dma_addr_t iova) | ||
74 | { | ||
75 | - SMMUNotifierNode *node; | ||
76 | + SMMUDevice *sdev; | ||
77 | |||
78 | - QLIST_FOREACH(node, &s->notifiers_list, next) { | ||
79 | - IOMMUMemoryRegion *mr = &node->sdev->iommu; | ||
80 | + QLIST_FOREACH(sdev, &s->devices_with_notifiers, next) { | ||
81 | + IOMMUMemoryRegion *mr = &sdev->iommu; | ||
82 | IOMMUNotifier *n; | ||
83 | |||
84 | trace_smmuv3_inv_notifiers_iova(mr->parent_obj.name, asid, iova); | ||
85 | @@ -XXX,XX +XXX,XX @@ static void smmuv3_notify_flag_changed(IOMMUMemoryRegion *iommu, | ||
86 | SMMUDevice *sdev = container_of(iommu, SMMUDevice, iommu); | ||
87 | SMMUv3State *s3 = sdev->smmu; | ||
88 | SMMUState *s = &(s3->smmu_state); | ||
89 | - SMMUNotifierNode *node = NULL; | ||
90 | - SMMUNotifierNode *next_node = NULL; | ||
91 | |||
92 | if (new & IOMMU_NOTIFIER_MAP) { | ||
93 | int bus_num = pci_bus_num(sdev->bus); | ||
94 | @@ -XXX,XX +XXX,XX @@ static void smmuv3_notify_flag_changed(IOMMUMemoryRegion *iommu, | ||
95 | |||
96 | if (old == IOMMU_NOTIFIER_NONE) { | ||
97 | trace_smmuv3_notify_flag_add(iommu->parent_obj.name); | ||
98 | - node = g_malloc0(sizeof(*node)); | ||
99 | - node->sdev = sdev; | ||
100 | - QLIST_INSERT_HEAD(&s->notifiers_list, node, next); | ||
101 | - return; | ||
102 | - } | ||
103 | - | ||
104 | - /* update notifier node with new flags */ | ||
105 | - QLIST_FOREACH_SAFE(node, &s->notifiers_list, next, next_node) { | ||
106 | - if (node->sdev == sdev) { | ||
107 | - if (new == IOMMU_NOTIFIER_NONE) { | ||
108 | - trace_smmuv3_notify_flag_del(iommu->parent_obj.name); | ||
109 | - QLIST_REMOVE(node, next); | ||
110 | - g_free(node); | ||
111 | - } | ||
112 | - return; | ||
113 | - } | ||
114 | + QLIST_INSERT_HEAD(&s->devices_with_notifiers, sdev, next); | ||
115 | + } else if (new == IOMMU_NOTIFIER_NONE) { | ||
116 | + trace_smmuv3_notify_flag_del(iommu->parent_obj.name); | ||
117 | + QLIST_REMOVE(sdev, next); | ||
118 | } | 67 | } |
119 | } | 68 | } |
120 | 69 | ||
70 | @@ -XXX,XX +XXX,XX @@ static bool trans_ASRD(DisasContext *s, arg_rpri_esz *a) | ||
71 | if (a->imm >= (8 << a->esz)) { | ||
72 | return do_movz_zpz(s, a->rd, a->rd, a->pg, a->esz, true); | ||
73 | } else { | ||
74 | - return do_zpzi_ool(s, a, fns[a->esz]); | ||
75 | + return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | ||
76 | } | ||
77 | } | ||
78 | |||
79 | @@ -XXX,XX +XXX,XX @@ static bool trans_SQSHL_zpzi(DisasContext *s, arg_rpri_esz *a) | ||
80 | if (a->esz < 0 || !dc_isar_feature(aa64_sve2, s)) { | ||
81 | return false; | ||
82 | } | ||
83 | - return do_zpzi_ool(s, a, fns[a->esz]); | ||
84 | + return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | ||
85 | } | ||
86 | |||
87 | static bool trans_UQSHL_zpzi(DisasContext *s, arg_rpri_esz *a) | ||
88 | @@ -XXX,XX +XXX,XX @@ static bool trans_UQSHL_zpzi(DisasContext *s, arg_rpri_esz *a) | ||
89 | if (a->esz < 0 || !dc_isar_feature(aa64_sve2, s)) { | ||
90 | return false; | ||
91 | } | ||
92 | - return do_zpzi_ool(s, a, fns[a->esz]); | ||
93 | + return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | ||
94 | } | ||
95 | |||
96 | static bool trans_SRSHR(DisasContext *s, arg_rpri_esz *a) | ||
97 | @@ -XXX,XX +XXX,XX @@ static bool trans_SRSHR(DisasContext *s, arg_rpri_esz *a) | ||
98 | if (a->esz < 0 || !dc_isar_feature(aa64_sve2, s)) { | ||
99 | return false; | ||
100 | } | ||
101 | - return do_zpzi_ool(s, a, fns[a->esz]); | ||
102 | + return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | ||
103 | } | ||
104 | |||
105 | static bool trans_URSHR(DisasContext *s, arg_rpri_esz *a) | ||
106 | @@ -XXX,XX +XXX,XX @@ static bool trans_URSHR(DisasContext *s, arg_rpri_esz *a) | ||
107 | if (a->esz < 0 || !dc_isar_feature(aa64_sve2, s)) { | ||
108 | return false; | ||
109 | } | ||
110 | - return do_zpzi_ool(s, a, fns[a->esz]); | ||
111 | + return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | ||
112 | } | ||
113 | |||
114 | static bool trans_SQSHLU(DisasContext *s, arg_rpri_esz *a) | ||
115 | @@ -XXX,XX +XXX,XX @@ static bool trans_SQSHLU(DisasContext *s, arg_rpri_esz *a) | ||
116 | if (a->esz < 0 || !dc_isar_feature(aa64_sve2, s)) { | ||
117 | return false; | ||
118 | } | ||
119 | - return do_zpzi_ool(s, a, fns[a->esz]); | ||
120 | + return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | ||
121 | } | ||
122 | |||
123 | /* | ||
121 | -- | 124 | -- |
122 | 2.20.1 | 125 | 2.25.1 |
123 | |||
124 | diff view generated by jsdifflib |
1 | Pushing registers to the stack for v7M needs to handle three cases: | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | * the "normal" case where we pend exceptions | ||
3 | * an "ignore faults" case where we set FSR bits but | ||
4 | do not pend exceptions (this is used when we are | ||
5 | handling some kinds of derived exception on exception entry) | ||
6 | * a "lazy FP stacking" case, where different FSR bits | ||
7 | are set and the exception is pended differently | ||
8 | 2 | ||
9 | Implement this by changing the existing flag argument that | 3 | Convert some SVE translation functions using |
10 | tells us whether to ignore faults or not into an enum that | 4 | gen_gvec_ool_arg_zpzi to TRANS_FEAT. |
11 | specifies which of the 3 modes we should handle. | ||
12 | 5 | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-25-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
15 | Message-id: 20190416125744.27770-23-peter.maydell@linaro.org | ||
16 | --- | 10 | --- |
17 | target/arm/helper.c | 118 +++++++++++++++++++++++++++++--------------- | 11 | target/arm/translate-sve.c | 85 ++++++++++++++------------------------ |
18 | 1 file changed, 79 insertions(+), 39 deletions(-) | 12 | 1 file changed, 30 insertions(+), 55 deletions(-) |
19 | 13 | ||
20 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
21 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/target/arm/helper.c | 16 | --- a/target/arm/translate-sve.c |
23 | +++ b/target/arm/helper.c | 17 | +++ b/target/arm/translate-sve.c |
24 | @@ -XXX,XX +XXX,XX @@ static bool v7m_cpacr_pass(CPUARMState *env, bool is_secure, bool is_priv) | 18 | @@ -XXX,XX +XXX,XX @@ static bool trans_ASRD(DisasContext *s, arg_rpri_esz *a) |
25 | } | 19 | } |
26 | } | 20 | } |
27 | 21 | ||
28 | +/* | 22 | -static bool trans_SQSHL_zpzi(DisasContext *s, arg_rpri_esz *a) |
29 | + * What kind of stack write are we doing? This affects how exceptions | 23 | -{ |
30 | + * generated during the stacking are treated. | 24 | - static gen_helper_gvec_3 * const fns[4] = { |
31 | + */ | 25 | - gen_helper_sve2_sqshl_zpzi_b, gen_helper_sve2_sqshl_zpzi_h, |
32 | +typedef enum StackingMode { | 26 | - gen_helper_sve2_sqshl_zpzi_s, gen_helper_sve2_sqshl_zpzi_d, |
33 | + STACK_NORMAL, | 27 | - }; |
34 | + STACK_IGNFAULTS, | 28 | - if (a->esz < 0 || !dc_isar_feature(aa64_sve2, s)) { |
35 | + STACK_LAZYFP, | 29 | - return false; |
36 | +} StackingMode; | 30 | - } |
37 | + | 31 | - return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); |
38 | static bool v7m_stack_write(ARMCPU *cpu, uint32_t addr, uint32_t value, | 32 | -} |
39 | - ARMMMUIdx mmu_idx, bool ignfault) | 33 | +static gen_helper_gvec_3 * const sqshl_zpzi_fns[4] = { |
40 | + ARMMMUIdx mmu_idx, StackingMode mode) | 34 | + gen_helper_sve2_sqshl_zpzi_b, gen_helper_sve2_sqshl_zpzi_h, |
41 | { | 35 | + gen_helper_sve2_sqshl_zpzi_s, gen_helper_sve2_sqshl_zpzi_d, |
42 | CPUState *cs = CPU(cpu); | 36 | +}; |
43 | CPUARMState *env = &cpu->env; | 37 | +TRANS_FEAT(SQSHL_zpzi, aa64_sve2, gen_gvec_ool_arg_zpzi, |
44 | @@ -XXX,XX +XXX,XX @@ static bool v7m_stack_write(ARMCPU *cpu, uint32_t addr, uint32_t value, | 38 | + a->esz < 0 ? NULL : sqshl_zpzi_fns[a->esz], a) |
45 | &attrs, &prot, &page_size, &fi, NULL)) { | 39 | |
46 | /* MPU/SAU lookup failed */ | 40 | -static bool trans_UQSHL_zpzi(DisasContext *s, arg_rpri_esz *a) |
47 | if (fi.type == ARMFault_QEMU_SFault) { | 41 | -{ |
48 | - qemu_log_mask(CPU_LOG_INT, | 42 | - static gen_helper_gvec_3 * const fns[4] = { |
49 | - "...SecureFault with SFSR.AUVIOL during stacking\n"); | 43 | - gen_helper_sve2_uqshl_zpzi_b, gen_helper_sve2_uqshl_zpzi_h, |
50 | - env->v7m.sfsr |= R_V7M_SFSR_AUVIOL_MASK | R_V7M_SFSR_SFARVALID_MASK; | 44 | - gen_helper_sve2_uqshl_zpzi_s, gen_helper_sve2_uqshl_zpzi_d, |
51 | + if (mode == STACK_LAZYFP) { | 45 | - }; |
52 | + qemu_log_mask(CPU_LOG_INT, | 46 | - if (a->esz < 0 || !dc_isar_feature(aa64_sve2, s)) { |
53 | + "...SecureFault with SFSR.LSPERR " | 47 | - return false; |
54 | + "during lazy stacking\n"); | 48 | - } |
55 | + env->v7m.sfsr |= R_V7M_SFSR_LSPERR_MASK; | 49 | - return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); |
56 | + } else { | 50 | -} |
57 | + qemu_log_mask(CPU_LOG_INT, | 51 | +static gen_helper_gvec_3 * const uqshl_zpzi_fns[4] = { |
58 | + "...SecureFault with SFSR.AUVIOL " | 52 | + gen_helper_sve2_uqshl_zpzi_b, gen_helper_sve2_uqshl_zpzi_h, |
59 | + "during stacking\n"); | 53 | + gen_helper_sve2_uqshl_zpzi_s, gen_helper_sve2_uqshl_zpzi_d, |
60 | + env->v7m.sfsr |= R_V7M_SFSR_AUVIOL_MASK; | 54 | +}; |
61 | + } | 55 | +TRANS_FEAT(UQSHL_zpzi, aa64_sve2, gen_gvec_ool_arg_zpzi, |
62 | + env->v7m.sfsr |= R_V7M_SFSR_SFARVALID_MASK; | 56 | + a->esz < 0 ? NULL : uqshl_zpzi_fns[a->esz], a) |
63 | env->v7m.sfar = addr; | 57 | |
64 | exc = ARMV7M_EXCP_SECURE; | 58 | -static bool trans_SRSHR(DisasContext *s, arg_rpri_esz *a) |
65 | exc_secure = false; | 59 | -{ |
66 | } else { | 60 | - static gen_helper_gvec_3 * const fns[4] = { |
67 | - qemu_log_mask(CPU_LOG_INT, "...MemManageFault with CFSR.MSTKERR\n"); | 61 | - gen_helper_sve2_srshr_b, gen_helper_sve2_srshr_h, |
68 | - env->v7m.cfsr[secure] |= R_V7M_CFSR_MSTKERR_MASK; | 62 | - gen_helper_sve2_srshr_s, gen_helper_sve2_srshr_d, |
69 | + if (mode == STACK_LAZYFP) { | 63 | - }; |
70 | + qemu_log_mask(CPU_LOG_INT, | 64 | - if (a->esz < 0 || !dc_isar_feature(aa64_sve2, s)) { |
71 | + "...MemManageFault with CFSR.MLSPERR\n"); | 65 | - return false; |
72 | + env->v7m.cfsr[secure] |= R_V7M_CFSR_MLSPERR_MASK; | 66 | - } |
73 | + } else { | 67 | - return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); |
74 | + qemu_log_mask(CPU_LOG_INT, | 68 | -} |
75 | + "...MemManageFault with CFSR.MSTKERR\n"); | 69 | +static gen_helper_gvec_3 * const srshr_fns[4] = { |
76 | + env->v7m.cfsr[secure] |= R_V7M_CFSR_MSTKERR_MASK; | 70 | + gen_helper_sve2_srshr_b, gen_helper_sve2_srshr_h, |
77 | + } | 71 | + gen_helper_sve2_srshr_s, gen_helper_sve2_srshr_d, |
78 | exc = ARMV7M_EXCP_MEM; | 72 | +}; |
79 | exc_secure = secure; | 73 | +TRANS_FEAT(SRSHR, aa64_sve2, gen_gvec_ool_arg_zpzi, |
80 | } | 74 | + a->esz < 0 ? NULL : srshr_fns[a->esz], a) |
81 | @@ -XXX,XX +XXX,XX @@ static bool v7m_stack_write(ARMCPU *cpu, uint32_t addr, uint32_t value, | 75 | |
82 | attrs, &txres); | 76 | -static bool trans_URSHR(DisasContext *s, arg_rpri_esz *a) |
83 | if (txres != MEMTX_OK) { | 77 | -{ |
84 | /* BusFault trying to write the data */ | 78 | - static gen_helper_gvec_3 * const fns[4] = { |
85 | - qemu_log_mask(CPU_LOG_INT, "...BusFault with BFSR.STKERR\n"); | 79 | - gen_helper_sve2_urshr_b, gen_helper_sve2_urshr_h, |
86 | - env->v7m.cfsr[M_REG_NS] |= R_V7M_CFSR_STKERR_MASK; | 80 | - gen_helper_sve2_urshr_s, gen_helper_sve2_urshr_d, |
87 | + if (mode == STACK_LAZYFP) { | 81 | - }; |
88 | + qemu_log_mask(CPU_LOG_INT, "...BusFault with BFSR.LSPERR\n"); | 82 | - if (a->esz < 0 || !dc_isar_feature(aa64_sve2, s)) { |
89 | + env->v7m.cfsr[M_REG_NS] |= R_V7M_CFSR_LSPERR_MASK; | 83 | - return false; |
90 | + } else { | 84 | - } |
91 | + qemu_log_mask(CPU_LOG_INT, "...BusFault with BFSR.STKERR\n"); | 85 | - return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); |
92 | + env->v7m.cfsr[M_REG_NS] |= R_V7M_CFSR_STKERR_MASK; | 86 | -} |
93 | + } | 87 | +static gen_helper_gvec_3 * const urshr_fns[4] = { |
94 | exc = ARMV7M_EXCP_BUS; | 88 | + gen_helper_sve2_urshr_b, gen_helper_sve2_urshr_h, |
95 | exc_secure = false; | 89 | + gen_helper_sve2_urshr_s, gen_helper_sve2_urshr_d, |
96 | goto pend_fault; | 90 | +}; |
97 | @@ -XXX,XX +XXX,XX @@ pend_fault: | 91 | +TRANS_FEAT(URSHR, aa64_sve2, gen_gvec_ool_arg_zpzi, |
98 | * later if we have two derived exceptions. | 92 | + a->esz < 0 ? NULL : urshr_fns[a->esz], a) |
99 | * The only case when we must not pend the exception but instead | 93 | |
100 | * throw it away is if we are doing the push of the callee registers | 94 | -static bool trans_SQSHLU(DisasContext *s, arg_rpri_esz *a) |
101 | - * and we've already generated a derived exception. Even in this | 95 | -{ |
102 | - * case we will still update the fault status registers. | 96 | - static gen_helper_gvec_3 * const fns[4] = { |
103 | + * and we've already generated a derived exception (this is indicated | 97 | - gen_helper_sve2_sqshlu_b, gen_helper_sve2_sqshlu_h, |
104 | + * by the caller passing STACK_IGNFAULTS). Even in this case we will | 98 | - gen_helper_sve2_sqshlu_s, gen_helper_sve2_sqshlu_d, |
105 | + * still update the fault status registers. | 99 | - }; |
106 | */ | 100 | - if (a->esz < 0 || !dc_isar_feature(aa64_sve2, s)) { |
107 | - if (!ignfault) { | 101 | - return false; |
108 | + switch (mode) { | 102 | - } |
109 | + case STACK_NORMAL: | 103 | - return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); |
110 | armv7m_nvic_set_pending_derived(env->nvic, exc, exc_secure); | 104 | -} |
111 | + break; | 105 | +static gen_helper_gvec_3 * const sqshlu_fns[4] = { |
112 | + case STACK_LAZYFP: | 106 | + gen_helper_sve2_sqshlu_b, gen_helper_sve2_sqshlu_h, |
113 | + armv7m_nvic_set_pending_lazyfp(env->nvic, exc, exc_secure); | 107 | + gen_helper_sve2_sqshlu_s, gen_helper_sve2_sqshlu_d, |
114 | + break; | 108 | +}; |
115 | + case STACK_IGNFAULTS: | 109 | +TRANS_FEAT(SQSHLU, aa64_sve2, gen_gvec_ool_arg_zpzi, |
116 | + break; | 110 | + a->esz < 0 ? NULL : sqshlu_fns[a->esz], a) |
117 | } | 111 | |
118 | return false; | 112 | /* |
119 | } | 113 | *** SVE Bitwise Shift - Predicated Group |
120 | @@ -XXX,XX +XXX,XX @@ static bool v7m_push_callee_stack(ARMCPU *cpu, uint32_t lr, bool dotailchain, | ||
121 | uint32_t limit; | ||
122 | bool want_psp; | ||
123 | uint32_t sig; | ||
124 | + StackingMode smode = ignore_faults ? STACK_IGNFAULTS : STACK_NORMAL; | ||
125 | |||
126 | if (dotailchain) { | ||
127 | bool mode = lr & R_V7M_EXCRET_MODE_MASK; | ||
128 | @@ -XXX,XX +XXX,XX @@ static bool v7m_push_callee_stack(ARMCPU *cpu, uint32_t lr, bool dotailchain, | ||
129 | */ | ||
130 | sig = v7m_integrity_sig(env, lr); | ||
131 | stacked_ok = | ||
132 | - v7m_stack_write(cpu, frameptr, sig, mmu_idx, ignore_faults) && | ||
133 | - v7m_stack_write(cpu, frameptr + 0x8, env->regs[4], mmu_idx, | ||
134 | - ignore_faults) && | ||
135 | - v7m_stack_write(cpu, frameptr + 0xc, env->regs[5], mmu_idx, | ||
136 | - ignore_faults) && | ||
137 | - v7m_stack_write(cpu, frameptr + 0x10, env->regs[6], mmu_idx, | ||
138 | - ignore_faults) && | ||
139 | - v7m_stack_write(cpu, frameptr + 0x14, env->regs[7], mmu_idx, | ||
140 | - ignore_faults) && | ||
141 | - v7m_stack_write(cpu, frameptr + 0x18, env->regs[8], mmu_idx, | ||
142 | - ignore_faults) && | ||
143 | - v7m_stack_write(cpu, frameptr + 0x1c, env->regs[9], mmu_idx, | ||
144 | - ignore_faults) && | ||
145 | - v7m_stack_write(cpu, frameptr + 0x20, env->regs[10], mmu_idx, | ||
146 | - ignore_faults) && | ||
147 | - v7m_stack_write(cpu, frameptr + 0x24, env->regs[11], mmu_idx, | ||
148 | - ignore_faults); | ||
149 | + v7m_stack_write(cpu, frameptr, sig, mmu_idx, smode) && | ||
150 | + v7m_stack_write(cpu, frameptr + 0x8, env->regs[4], mmu_idx, smode) && | ||
151 | + v7m_stack_write(cpu, frameptr + 0xc, env->regs[5], mmu_idx, smode) && | ||
152 | + v7m_stack_write(cpu, frameptr + 0x10, env->regs[6], mmu_idx, smode) && | ||
153 | + v7m_stack_write(cpu, frameptr + 0x14, env->regs[7], mmu_idx, smode) && | ||
154 | + v7m_stack_write(cpu, frameptr + 0x18, env->regs[8], mmu_idx, smode) && | ||
155 | + v7m_stack_write(cpu, frameptr + 0x1c, env->regs[9], mmu_idx, smode) && | ||
156 | + v7m_stack_write(cpu, frameptr + 0x20, env->regs[10], mmu_idx, smode) && | ||
157 | + v7m_stack_write(cpu, frameptr + 0x24, env->regs[11], mmu_idx, smode); | ||
158 | |||
159 | /* Update SP regardless of whether any of the stack accesses failed. */ | ||
160 | *frame_sp_p = frameptr; | ||
161 | @@ -XXX,XX +XXX,XX @@ static bool v7m_push_stack(ARMCPU *cpu) | ||
162 | * if it has higher priority). | ||
163 | */ | ||
164 | stacked_ok = stacked_ok && | ||
165 | - v7m_stack_write(cpu, frameptr, env->regs[0], mmu_idx, false) && | ||
166 | - v7m_stack_write(cpu, frameptr + 4, env->regs[1], mmu_idx, false) && | ||
167 | - v7m_stack_write(cpu, frameptr + 8, env->regs[2], mmu_idx, false) && | ||
168 | - v7m_stack_write(cpu, frameptr + 12, env->regs[3], mmu_idx, false) && | ||
169 | - v7m_stack_write(cpu, frameptr + 16, env->regs[12], mmu_idx, false) && | ||
170 | - v7m_stack_write(cpu, frameptr + 20, env->regs[14], mmu_idx, false) && | ||
171 | - v7m_stack_write(cpu, frameptr + 24, env->regs[15], mmu_idx, false) && | ||
172 | - v7m_stack_write(cpu, frameptr + 28, xpsr, mmu_idx, false); | ||
173 | + v7m_stack_write(cpu, frameptr, env->regs[0], mmu_idx, STACK_NORMAL) && | ||
174 | + v7m_stack_write(cpu, frameptr + 4, env->regs[1], | ||
175 | + mmu_idx, STACK_NORMAL) && | ||
176 | + v7m_stack_write(cpu, frameptr + 8, env->regs[2], | ||
177 | + mmu_idx, STACK_NORMAL) && | ||
178 | + v7m_stack_write(cpu, frameptr + 12, env->regs[3], | ||
179 | + mmu_idx, STACK_NORMAL) && | ||
180 | + v7m_stack_write(cpu, frameptr + 16, env->regs[12], | ||
181 | + mmu_idx, STACK_NORMAL) && | ||
182 | + v7m_stack_write(cpu, frameptr + 20, env->regs[14], | ||
183 | + mmu_idx, STACK_NORMAL) && | ||
184 | + v7m_stack_write(cpu, frameptr + 24, env->regs[15], | ||
185 | + mmu_idx, STACK_NORMAL) && | ||
186 | + v7m_stack_write(cpu, frameptr + 28, xpsr, mmu_idx, STACK_NORMAL); | ||
187 | |||
188 | if (env->v7m.control[M_REG_S] & R_V7M_CONTROL_FPCA_MASK) { | ||
189 | /* FPU is active, try to save its registers */ | ||
190 | @@ -XXX,XX +XXX,XX @@ static bool v7m_push_stack(ARMCPU *cpu) | ||
191 | faddr += 8; /* skip the slot for the FPSCR */ | ||
192 | } | ||
193 | stacked_ok = stacked_ok && | ||
194 | - v7m_stack_write(cpu, faddr, slo, mmu_idx, false) && | ||
195 | - v7m_stack_write(cpu, faddr + 4, shi, mmu_idx, false); | ||
196 | + v7m_stack_write(cpu, faddr, slo, | ||
197 | + mmu_idx, STACK_NORMAL) && | ||
198 | + v7m_stack_write(cpu, faddr + 4, shi, | ||
199 | + mmu_idx, STACK_NORMAL); | ||
200 | } | ||
201 | stacked_ok = stacked_ok && | ||
202 | v7m_stack_write(cpu, frameptr + 0x60, | ||
203 | - vfp_get_fpscr(env), mmu_idx, false); | ||
204 | + vfp_get_fpscr(env), mmu_idx, STACK_NORMAL); | ||
205 | if (cpacr_pass) { | ||
206 | for (i = 0; i < ((framesize == 0xa8) ? 32 : 16); i += 2) { | ||
207 | *aa32_vfp_dreg(env, i / 2) = 0; | ||
208 | -- | 114 | -- |
209 | 2.20.1 | 115 | 2.25.1 |
210 | |||
211 | 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 | Message-id: 20220527181907.189259-26-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 42 ++++++++++++++++---------------------- | ||
9 | 1 file changed, 18 insertions(+), 24 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 gen_gvec_ool_arg_zpzi(DisasContext *s, gen_helper_gvec_3 *fn, | ||
16 | } | ||
17 | |||
18 | /* Invoke an out-of-line helper on 3 Zregs and a predicate. */ | ||
19 | -static void gen_gvec_ool_zzzp(DisasContext *s, gen_helper_gvec_4 *fn, | ||
20 | +static bool gen_gvec_ool_zzzp(DisasContext *s, gen_helper_gvec_4 *fn, | ||
21 | int rd, int rn, int rm, int pg, int data) | ||
22 | { | ||
23 | - unsigned vsz = vec_full_reg_size(s); | ||
24 | - tcg_gen_gvec_4_ool(vec_full_reg_offset(s, rd), | ||
25 | - vec_full_reg_offset(s, rn), | ||
26 | - vec_full_reg_offset(s, rm), | ||
27 | - pred_full_reg_offset(s, pg), | ||
28 | - vsz, vsz, data, fn); | ||
29 | + if (fn == NULL) { | ||
30 | + return false; | ||
31 | + } | ||
32 | + if (sve_access_check(s)) { | ||
33 | + unsigned vsz = vec_full_reg_size(s); | ||
34 | + tcg_gen_gvec_4_ool(vec_full_reg_offset(s, rd), | ||
35 | + vec_full_reg_offset(s, rn), | ||
36 | + vec_full_reg_offset(s, rm), | ||
37 | + pred_full_reg_offset(s, pg), | ||
38 | + vsz, vsz, data, fn); | ||
39 | + } | ||
40 | + return true; | ||
41 | } | ||
42 | |||
43 | /* Invoke a vector expander on two Zregs. */ | ||
44 | @@ -XXX,XX +XXX,XX @@ static bool trans_UQSUB_zzz(DisasContext *s, arg_rrr_esz *a) | ||
45 | |||
46 | static bool do_zpzz_ool(DisasContext *s, arg_rprr_esz *a, gen_helper_gvec_4 *fn) | ||
47 | { | ||
48 | - if (fn == NULL) { | ||
49 | - return false; | ||
50 | - } | ||
51 | - if (sve_access_check(s)) { | ||
52 | - gen_gvec_ool_zzzp(s, fn, a->rd, a->rn, a->rm, a->pg, 0); | ||
53 | - } | ||
54 | - return true; | ||
55 | + return gen_gvec_ool_zzzp(s, fn, a->rd, a->rn, a->rm, a->pg, 0); | ||
56 | } | ||
57 | |||
58 | /* Select active elememnts from Zn and inactive elements from Zm, | ||
59 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(REVW, aa64_sve, gen_gvec_ool_arg_zpz, | ||
60 | |||
61 | static bool trans_SPLICE(DisasContext *s, arg_rprr_esz *a) | ||
62 | { | ||
63 | - if (sve_access_check(s)) { | ||
64 | - gen_gvec_ool_zzzp(s, gen_helper_sve_splice, | ||
65 | - a->rd, a->rn, a->rm, a->pg, a->esz); | ||
66 | - } | ||
67 | - return true; | ||
68 | + return gen_gvec_ool_zzzp(s, gen_helper_sve_splice, | ||
69 | + a->rd, a->rn, a->rm, a->pg, a->esz); | ||
70 | } | ||
71 | |||
72 | static bool trans_SPLICE_sve2(DisasContext *s, arg_rpr_esz *a) | ||
73 | @@ -XXX,XX +XXX,XX @@ static bool trans_SPLICE_sve2(DisasContext *s, arg_rpr_esz *a) | ||
74 | if (!dc_isar_feature(aa64_sve2, s)) { | ||
75 | return false; | ||
76 | } | ||
77 | - if (sve_access_check(s)) { | ||
78 | - gen_gvec_ool_zzzp(s, gen_helper_sve_splice, | ||
79 | - a->rd, a->rn, (a->rn + 1) % 32, a->pg, a->esz); | ||
80 | - } | ||
81 | - return true; | ||
82 | + return gen_gvec_ool_zzzp(s, gen_helper_sve_splice, | ||
83 | + a->rd, a->rn, (a->rn + 1) % 32, a->pg, a->esz); | ||
84 | } | ||
85 | |||
86 | /* | ||
87 | -- | ||
88 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Use gen_gvec_ool_arg_zpzz instead of gen_gvec_ool_zzzp | ||
4 | when the arguments come from arg_rprr_esz. | ||
5 | Replaces do_zpzz_ool. | ||
6 | |||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20220527181907.189259-27-richard.henderson@linaro.org | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | target/arm/translate-sve.c | 21 +++++++++++---------- | ||
13 | 1 file changed, 11 insertions(+), 10 deletions(-) | ||
14 | |||
15 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/target/arm/translate-sve.c | ||
18 | +++ b/target/arm/translate-sve.c | ||
19 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_zzzp(DisasContext *s, gen_helper_gvec_4 *fn, | ||
20 | return true; | ||
21 | } | ||
22 | |||
23 | +static bool gen_gvec_ool_arg_zpzz(DisasContext *s, gen_helper_gvec_4 *fn, | ||
24 | + arg_rprr_esz *a, int data) | ||
25 | +{ | ||
26 | + return gen_gvec_ool_zzzp(s, fn, a->rd, a->rn, a->rm, a->pg, data); | ||
27 | +} | ||
28 | + | ||
29 | /* Invoke a vector expander on two Zregs. */ | ||
30 | static void gen_gvec_fn_zz(DisasContext *s, GVecGen2Fn *gvec_fn, | ||
31 | int esz, int rd, int rn) | ||
32 | @@ -XXX,XX +XXX,XX @@ static bool trans_UQSUB_zzz(DisasContext *s, arg_rrr_esz *a) | ||
33 | *** SVE Integer Arithmetic - Binary Predicated Group | ||
34 | */ | ||
35 | |||
36 | -static bool do_zpzz_ool(DisasContext *s, arg_rprr_esz *a, gen_helper_gvec_4 *fn) | ||
37 | -{ | ||
38 | - return gen_gvec_ool_zzzp(s, fn, a->rd, a->rn, a->rm, a->pg, 0); | ||
39 | -} | ||
40 | - | ||
41 | /* Select active elememnts from Zn and inactive elements from Zm, | ||
42 | * storing the result in Zd. | ||
43 | */ | ||
44 | @@ -XXX,XX +XXX,XX @@ static bool trans_##NAME##_zpzz(DisasContext *s, arg_rprr_esz *a) \ | ||
45 | gen_helper_sve_##name##_zpzz_b, gen_helper_sve_##name##_zpzz_h, \ | ||
46 | gen_helper_sve_##name##_zpzz_s, gen_helper_sve_##name##_zpzz_d, \ | ||
47 | }; \ | ||
48 | - return do_zpzz_ool(s, a, fns[a->esz]); \ | ||
49 | + return gen_gvec_ool_arg_zpzz(s, fns[a->esz], a, 0); \ | ||
50 | } | ||
51 | |||
52 | DO_ZPZZ(AND, and) | ||
53 | @@ -XXX,XX +XXX,XX @@ static bool trans_SDIV_zpzz(DisasContext *s, arg_rprr_esz *a) | ||
54 | static gen_helper_gvec_4 * const fns[4] = { | ||
55 | NULL, NULL, gen_helper_sve_sdiv_zpzz_s, gen_helper_sve_sdiv_zpzz_d | ||
56 | }; | ||
57 | - return do_zpzz_ool(s, a, fns[a->esz]); | ||
58 | + return gen_gvec_ool_arg_zpzz(s, fns[a->esz], a, 0); | ||
59 | } | ||
60 | |||
61 | static bool trans_UDIV_zpzz(DisasContext *s, arg_rprr_esz *a) | ||
62 | @@ -XXX,XX +XXX,XX @@ static bool trans_UDIV_zpzz(DisasContext *s, arg_rprr_esz *a) | ||
63 | static gen_helper_gvec_4 * const fns[4] = { | ||
64 | NULL, NULL, gen_helper_sve_udiv_zpzz_s, gen_helper_sve_udiv_zpzz_d | ||
65 | }; | ||
66 | - return do_zpzz_ool(s, a, fns[a->esz]); | ||
67 | + return gen_gvec_ool_arg_zpzz(s, fns[a->esz], a, 0); | ||
68 | } | ||
69 | |||
70 | static bool trans_SEL_zpzz(DisasContext *s, arg_rprr_esz *a) | ||
71 | @@ -XXX,XX +XXX,XX @@ static bool trans_##NAME##_zpzw(DisasContext *s, arg_rprr_esz *a) \ | ||
72 | if (a->esz < 0 || a->esz >= 3) { \ | ||
73 | return false; \ | ||
74 | } \ | ||
75 | - return do_zpzz_ool(s, a, fns[a->esz]); \ | ||
76 | + return gen_gvec_ool_arg_zpzz(s, fns[a->esz], a, 0); \ | ||
77 | } | ||
78 | |||
79 | DO_ZPZW(ASR, asr) | ||
80 | @@ -XXX,XX +XXX,XX @@ static bool do_sve2_zpzz_ool(DisasContext *s, arg_rprr_esz *a, | ||
81 | if (!dc_isar_feature(aa64_sve2, s)) { | ||
82 | return false; | ||
83 | } | ||
84 | - return do_zpzz_ool(s, a, fn); | ||
85 | + return gen_gvec_ool_arg_zpzz(s, fn, a, 0); | ||
86 | } | ||
87 | |||
88 | static bool trans_SADALP_zpzz(DisasContext *s, arg_rprr_esz *a) | ||
89 | -- | ||
90 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions directly using | ||
4 | gen_gvec_ool_arg_zpzz to TRANS_FEAT. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-28-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 85 ++++++++++++++++---------------------- | ||
12 | 1 file changed, 36 insertions(+), 49 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static void do_sel_z(DisasContext *s, int rd, int rn, int rm, int pg, int esz) | ||
19 | gen_gvec_ool_zzzp(s, fns[esz], rd, rn, rm, pg, 0); | ||
20 | } | ||
21 | |||
22 | -#define DO_ZPZZ(NAME, name) \ | ||
23 | -static bool trans_##NAME##_zpzz(DisasContext *s, arg_rprr_esz *a) \ | ||
24 | -{ \ | ||
25 | - static gen_helper_gvec_4 * const fns[4] = { \ | ||
26 | - gen_helper_sve_##name##_zpzz_b, gen_helper_sve_##name##_zpzz_h, \ | ||
27 | - gen_helper_sve_##name##_zpzz_s, gen_helper_sve_##name##_zpzz_d, \ | ||
28 | +#define DO_ZPZZ(NAME, FEAT, name) \ | ||
29 | + static gen_helper_gvec_4 * const name##_zpzz_fns[4] = { \ | ||
30 | + gen_helper_##name##_zpzz_b, gen_helper_##name##_zpzz_h, \ | ||
31 | + gen_helper_##name##_zpzz_s, gen_helper_##name##_zpzz_d, \ | ||
32 | }; \ | ||
33 | - return gen_gvec_ool_arg_zpzz(s, fns[a->esz], a, 0); \ | ||
34 | -} | ||
35 | + TRANS_FEAT(NAME, FEAT, gen_gvec_ool_arg_zpzz, \ | ||
36 | + name##_zpzz_fns[a->esz], a, 0) | ||
37 | |||
38 | -DO_ZPZZ(AND, and) | ||
39 | -DO_ZPZZ(EOR, eor) | ||
40 | -DO_ZPZZ(ORR, orr) | ||
41 | -DO_ZPZZ(BIC, bic) | ||
42 | +DO_ZPZZ(AND_zpzz, aa64_sve, sve_and) | ||
43 | +DO_ZPZZ(EOR_zpzz, aa64_sve, sve_eor) | ||
44 | +DO_ZPZZ(ORR_zpzz, aa64_sve, sve_orr) | ||
45 | +DO_ZPZZ(BIC_zpzz, aa64_sve, sve_bic) | ||
46 | |||
47 | -DO_ZPZZ(ADD, add) | ||
48 | -DO_ZPZZ(SUB, sub) | ||
49 | +DO_ZPZZ(ADD_zpzz, aa64_sve, sve_add) | ||
50 | +DO_ZPZZ(SUB_zpzz, aa64_sve, sve_sub) | ||
51 | |||
52 | -DO_ZPZZ(SMAX, smax) | ||
53 | -DO_ZPZZ(UMAX, umax) | ||
54 | -DO_ZPZZ(SMIN, smin) | ||
55 | -DO_ZPZZ(UMIN, umin) | ||
56 | -DO_ZPZZ(SABD, sabd) | ||
57 | -DO_ZPZZ(UABD, uabd) | ||
58 | +DO_ZPZZ(SMAX_zpzz, aa64_sve, sve_smax) | ||
59 | +DO_ZPZZ(UMAX_zpzz, aa64_sve, sve_umax) | ||
60 | +DO_ZPZZ(SMIN_zpzz, aa64_sve, sve_smin) | ||
61 | +DO_ZPZZ(UMIN_zpzz, aa64_sve, sve_umin) | ||
62 | +DO_ZPZZ(SABD_zpzz, aa64_sve, sve_sabd) | ||
63 | +DO_ZPZZ(UABD_zpzz, aa64_sve, sve_uabd) | ||
64 | |||
65 | -DO_ZPZZ(MUL, mul) | ||
66 | -DO_ZPZZ(SMULH, smulh) | ||
67 | -DO_ZPZZ(UMULH, umulh) | ||
68 | +DO_ZPZZ(MUL_zpzz, aa64_sve, sve_mul) | ||
69 | +DO_ZPZZ(SMULH_zpzz, aa64_sve, sve_smulh) | ||
70 | +DO_ZPZZ(UMULH_zpzz, aa64_sve, sve_umulh) | ||
71 | |||
72 | -DO_ZPZZ(ASR, asr) | ||
73 | -DO_ZPZZ(LSR, lsr) | ||
74 | -DO_ZPZZ(LSL, lsl) | ||
75 | +DO_ZPZZ(ASR_zpzz, aa64_sve, sve_asr) | ||
76 | +DO_ZPZZ(LSR_zpzz, aa64_sve, sve_lsr) | ||
77 | +DO_ZPZZ(LSL_zpzz, aa64_sve, sve_lsl) | ||
78 | |||
79 | -static bool trans_SDIV_zpzz(DisasContext *s, arg_rprr_esz *a) | ||
80 | -{ | ||
81 | - static gen_helper_gvec_4 * const fns[4] = { | ||
82 | - NULL, NULL, gen_helper_sve_sdiv_zpzz_s, gen_helper_sve_sdiv_zpzz_d | ||
83 | - }; | ||
84 | - return gen_gvec_ool_arg_zpzz(s, fns[a->esz], a, 0); | ||
85 | -} | ||
86 | +static gen_helper_gvec_4 * const sdiv_fns[4] = { | ||
87 | + NULL, NULL, gen_helper_sve_sdiv_zpzz_s, gen_helper_sve_sdiv_zpzz_d | ||
88 | +}; | ||
89 | +TRANS_FEAT(SDIV_zpzz, aa64_sve, gen_gvec_ool_arg_zpzz, sdiv_fns[a->esz], a, 0) | ||
90 | |||
91 | -static bool trans_UDIV_zpzz(DisasContext *s, arg_rprr_esz *a) | ||
92 | -{ | ||
93 | - static gen_helper_gvec_4 * const fns[4] = { | ||
94 | - NULL, NULL, gen_helper_sve_udiv_zpzz_s, gen_helper_sve_udiv_zpzz_d | ||
95 | - }; | ||
96 | - return gen_gvec_ool_arg_zpzz(s, fns[a->esz], a, 0); | ||
97 | -} | ||
98 | +static gen_helper_gvec_4 * const udiv_fns[4] = { | ||
99 | + NULL, NULL, gen_helper_sve_udiv_zpzz_s, gen_helper_sve_udiv_zpzz_d | ||
100 | +}; | ||
101 | +TRANS_FEAT(UDIV_zpzz, aa64_sve, gen_gvec_ool_arg_zpzz, udiv_fns[a->esz], a, 0) | ||
102 | |||
103 | static bool trans_SEL_zpzz(DisasContext *s, arg_rprr_esz *a) | ||
104 | { | ||
105 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(SQSHLU, aa64_sve2, gen_gvec_ool_arg_zpzi, | ||
106 | */ | ||
107 | |||
108 | #define DO_ZPZW(NAME, name) \ | ||
109 | -static bool trans_##NAME##_zpzw(DisasContext *s, arg_rprr_esz *a) \ | ||
110 | -{ \ | ||
111 | - static gen_helper_gvec_4 * const fns[3] = { \ | ||
112 | + static gen_helper_gvec_4 * const name##_zpzw_fns[4] = { \ | ||
113 | gen_helper_sve_##name##_zpzw_b, gen_helper_sve_##name##_zpzw_h, \ | ||
114 | - gen_helper_sve_##name##_zpzw_s, \ | ||
115 | + gen_helper_sve_##name##_zpzw_s, NULL \ | ||
116 | }; \ | ||
117 | - if (a->esz < 0 || a->esz >= 3) { \ | ||
118 | - return false; \ | ||
119 | - } \ | ||
120 | - return gen_gvec_ool_arg_zpzz(s, fns[a->esz], a, 0); \ | ||
121 | -} | ||
122 | + TRANS_FEAT(NAME##_zpzw, aa64_sve, gen_gvec_ool_arg_zpzz, \ | ||
123 | + a->esz < 0 ? NULL : name##_zpzw_fns[a->esz], a, 0) | ||
124 | |||
125 | DO_ZPZW(ASR, asr) | ||
126 | DO_ZPZW(LSR, lsr) | ||
127 | -- | ||
128 | 2.25.1 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | This commit finally deletes "hw/devices.h". | 3 | Convert SVE translation functions using do_sve2_zpzz_ool |
4 | to use TRANS_FEAT and gen_gvec_ool_arg_zpzz. | ||
4 | 5 | ||
5 | Reviewed-by: Markus Armbruster <armbru@redhat.com> | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 7 | Message-id: 20220527181907.189259-29-richard.henderson@linaro.org |
7 | Message-id: 20190412165416.7977-13-philmd@redhat.com | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 10 | --- |
10 | include/hw/devices.h | 11 ----------- | 11 | target/arm/translate-sve.c | 118 +++++++++++++------------------------ |
11 | include/hw/net/smc91c111.h | 19 +++++++++++++++++++ | 12 | 1 file changed, 40 insertions(+), 78 deletions(-) |
12 | hw/arm/gumstix.c | 2 +- | ||
13 | hw/arm/integratorcp.c | 2 +- | ||
14 | hw/arm/mainstone.c | 2 +- | ||
15 | hw/arm/realview.c | 2 +- | ||
16 | hw/arm/versatilepb.c | 2 +- | ||
17 | hw/net/smc91c111.c | 2 +- | ||
18 | 8 files changed, 25 insertions(+), 17 deletions(-) | ||
19 | delete mode 100644 include/hw/devices.h | ||
20 | create mode 100644 include/hw/net/smc91c111.h | ||
21 | 13 | ||
22 | diff --git a/include/hw/devices.h b/include/hw/devices.h | 14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
23 | deleted file mode 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
24 | index XXXXXXX..XXXXXXX | 16 | --- a/target/arm/translate-sve.c |
25 | --- a/include/hw/devices.h | 17 | +++ b/target/arm/translate-sve.c |
26 | +++ /dev/null | 18 | @@ -XXX,XX +XXX,XX @@ static bool trans_SEL_zpzz(DisasContext *s, arg_rprr_esz *a) |
27 | @@ -XXX,XX +XXX,XX @@ | 19 | return true; |
28 | -#ifndef QEMU_DEVICES_H | 20 | } |
29 | -#define QEMU_DEVICES_H | 21 | |
22 | -#undef DO_ZPZZ | ||
30 | - | 23 | - |
31 | -/* Devices that have nowhere better to go. */ | 24 | /* |
25 | *** SVE Integer Arithmetic - Unary Predicated Group | ||
26 | */ | ||
27 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(SQRDMULH_zzz, aa64_sve2, gen_gvec_ool_arg_zzz, | ||
28 | * SVE2 Integer - Predicated | ||
29 | */ | ||
30 | |||
31 | -static bool do_sve2_zpzz_ool(DisasContext *s, arg_rprr_esz *a, | ||
32 | - gen_helper_gvec_4 *fn) | ||
33 | -{ | ||
34 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
35 | - return false; | ||
36 | - } | ||
37 | - return gen_gvec_ool_arg_zpzz(s, fn, a, 0); | ||
38 | -} | ||
39 | +static gen_helper_gvec_4 * const sadlp_fns[4] = { | ||
40 | + NULL, gen_helper_sve2_sadalp_zpzz_h, | ||
41 | + gen_helper_sve2_sadalp_zpzz_s, gen_helper_sve2_sadalp_zpzz_d, | ||
42 | +}; | ||
43 | +TRANS_FEAT(SADALP_zpzz, aa64_sve2, gen_gvec_ool_arg_zpzz, | ||
44 | + sadlp_fns[a->esz], a, 0) | ||
45 | |||
46 | -static bool trans_SADALP_zpzz(DisasContext *s, arg_rprr_esz *a) | ||
47 | -{ | ||
48 | - static gen_helper_gvec_4 * const fns[3] = { | ||
49 | - gen_helper_sve2_sadalp_zpzz_h, | ||
50 | - gen_helper_sve2_sadalp_zpzz_s, | ||
51 | - gen_helper_sve2_sadalp_zpzz_d, | ||
52 | - }; | ||
53 | - if (a->esz == 0) { | ||
54 | - return false; | ||
55 | - } | ||
56 | - return do_sve2_zpzz_ool(s, a, fns[a->esz - 1]); | ||
57 | -} | ||
32 | - | 58 | - |
33 | -#include "hw/hw.h" | 59 | -static bool trans_UADALP_zpzz(DisasContext *s, arg_rprr_esz *a) |
60 | -{ | ||
61 | - static gen_helper_gvec_4 * const fns[3] = { | ||
62 | - gen_helper_sve2_uadalp_zpzz_h, | ||
63 | - gen_helper_sve2_uadalp_zpzz_s, | ||
64 | - gen_helper_sve2_uadalp_zpzz_d, | ||
65 | - }; | ||
66 | - if (a->esz == 0) { | ||
67 | - return false; | ||
68 | - } | ||
69 | - return do_sve2_zpzz_ool(s, a, fns[a->esz - 1]); | ||
70 | -} | ||
71 | +static gen_helper_gvec_4 * const uadlp_fns[4] = { | ||
72 | + NULL, gen_helper_sve2_uadalp_zpzz_h, | ||
73 | + gen_helper_sve2_uadalp_zpzz_s, gen_helper_sve2_uadalp_zpzz_d, | ||
74 | +}; | ||
75 | +TRANS_FEAT(UADALP_zpzz, aa64_sve2, gen_gvec_ool_arg_zpzz, | ||
76 | + uadlp_fns[a->esz], a, 0) | ||
77 | |||
78 | /* | ||
79 | * SVE2 integer unary operations (predicated) | ||
80 | @@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_3 * const sqneg_fns[4] = { | ||
81 | }; | ||
82 | TRANS_FEAT(SQNEG, aa64_sve2, gen_gvec_ool_arg_zpz, sqneg_fns[a->esz], a, 0) | ||
83 | |||
84 | -#define DO_SVE2_ZPZZ(NAME, name) \ | ||
85 | -static bool trans_##NAME(DisasContext *s, arg_rprr_esz *a) \ | ||
86 | -{ \ | ||
87 | - static gen_helper_gvec_4 * const fns[4] = { \ | ||
88 | - gen_helper_sve2_##name##_zpzz_b, gen_helper_sve2_##name##_zpzz_h, \ | ||
89 | - gen_helper_sve2_##name##_zpzz_s, gen_helper_sve2_##name##_zpzz_d, \ | ||
90 | - }; \ | ||
91 | - return do_sve2_zpzz_ool(s, a, fns[a->esz]); \ | ||
92 | -} | ||
93 | +DO_ZPZZ(SQSHL, aa64_sve2, sve2_sqshl) | ||
94 | +DO_ZPZZ(SQRSHL, aa64_sve2, sve2_sqrshl) | ||
95 | +DO_ZPZZ(SRSHL, aa64_sve2, sve2_srshl) | ||
96 | |||
97 | -DO_SVE2_ZPZZ(SQSHL, sqshl) | ||
98 | -DO_SVE2_ZPZZ(SQRSHL, sqrshl) | ||
99 | -DO_SVE2_ZPZZ(SRSHL, srshl) | ||
100 | +DO_ZPZZ(UQSHL, aa64_sve2, sve2_uqshl) | ||
101 | +DO_ZPZZ(UQRSHL, aa64_sve2, sve2_uqrshl) | ||
102 | +DO_ZPZZ(URSHL, aa64_sve2, sve2_urshl) | ||
103 | |||
104 | -DO_SVE2_ZPZZ(UQSHL, uqshl) | ||
105 | -DO_SVE2_ZPZZ(UQRSHL, uqrshl) | ||
106 | -DO_SVE2_ZPZZ(URSHL, urshl) | ||
107 | +DO_ZPZZ(SHADD, aa64_sve2, sve2_shadd) | ||
108 | +DO_ZPZZ(SRHADD, aa64_sve2, sve2_srhadd) | ||
109 | +DO_ZPZZ(SHSUB, aa64_sve2, sve2_shsub) | ||
110 | |||
111 | -DO_SVE2_ZPZZ(SHADD, shadd) | ||
112 | -DO_SVE2_ZPZZ(SRHADD, srhadd) | ||
113 | -DO_SVE2_ZPZZ(SHSUB, shsub) | ||
114 | +DO_ZPZZ(UHADD, aa64_sve2, sve2_uhadd) | ||
115 | +DO_ZPZZ(URHADD, aa64_sve2, sve2_urhadd) | ||
116 | +DO_ZPZZ(UHSUB, aa64_sve2, sve2_uhsub) | ||
117 | |||
118 | -DO_SVE2_ZPZZ(UHADD, uhadd) | ||
119 | -DO_SVE2_ZPZZ(URHADD, urhadd) | ||
120 | -DO_SVE2_ZPZZ(UHSUB, uhsub) | ||
121 | +DO_ZPZZ(ADDP, aa64_sve2, sve2_addp) | ||
122 | +DO_ZPZZ(SMAXP, aa64_sve2, sve2_smaxp) | ||
123 | +DO_ZPZZ(UMAXP, aa64_sve2, sve2_umaxp) | ||
124 | +DO_ZPZZ(SMINP, aa64_sve2, sve2_sminp) | ||
125 | +DO_ZPZZ(UMINP, aa64_sve2, sve2_uminp) | ||
126 | |||
127 | -DO_SVE2_ZPZZ(ADDP, addp) | ||
128 | -DO_SVE2_ZPZZ(SMAXP, smaxp) | ||
129 | -DO_SVE2_ZPZZ(UMAXP, umaxp) | ||
130 | -DO_SVE2_ZPZZ(SMINP, sminp) | ||
131 | -DO_SVE2_ZPZZ(UMINP, uminp) | ||
34 | - | 132 | - |
35 | -/* smc91c111.c */ | 133 | -DO_SVE2_ZPZZ(SQADD_zpzz, sqadd) |
36 | -void smc91c111_init(NICInfo *, uint32_t, qemu_irq); | 134 | -DO_SVE2_ZPZZ(UQADD_zpzz, uqadd) |
37 | - | 135 | -DO_SVE2_ZPZZ(SQSUB_zpzz, sqsub) |
38 | -#endif | 136 | -DO_SVE2_ZPZZ(UQSUB_zpzz, uqsub) |
39 | diff --git a/include/hw/net/smc91c111.h b/include/hw/net/smc91c111.h | 137 | -DO_SVE2_ZPZZ(SUQADD, suqadd) |
40 | new file mode 100644 | 138 | -DO_SVE2_ZPZZ(USQADD, usqadd) |
41 | index XXXXXXX..XXXXXXX | 139 | +DO_ZPZZ(SQADD_zpzz, aa64_sve2, sve2_sqadd) |
42 | --- /dev/null | 140 | +DO_ZPZZ(UQADD_zpzz, aa64_sve2, sve2_uqadd) |
43 | +++ b/include/hw/net/smc91c111.h | 141 | +DO_ZPZZ(SQSUB_zpzz, aa64_sve2, sve2_sqsub) |
44 | @@ -XXX,XX +XXX,XX @@ | 142 | +DO_ZPZZ(UQSUB_zpzz, aa64_sve2, sve2_uqsub) |
45 | +/* | 143 | +DO_ZPZZ(SUQADD, aa64_sve2, sve2_suqadd) |
46 | + * SMSC 91C111 Ethernet interface emulation | 144 | +DO_ZPZZ(USQADD, aa64_sve2, sve2_usqadd) |
47 | + * | 145 | |
48 | + * Copyright (c) 2005 CodeSourcery, LLC. | 146 | /* |
49 | + * Written by Paul Brook | 147 | * SVE2 Widening Integer Arithmetic |
50 | + * | 148 | @@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_rprr_esz *a) \ |
51 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | 149 | DO_SVE2_PPZZ_MATCH(MATCH, match) |
52 | + * See the COPYING file in the top-level directory. | 150 | DO_SVE2_PPZZ_MATCH(NMATCH, nmatch) |
53 | + */ | 151 | |
54 | + | 152 | -static bool trans_HISTCNT(DisasContext *s, arg_rprr_esz *a) |
55 | +#ifndef HW_NET_SMC91C111_H | 153 | -{ |
56 | +#define HW_NET_SMC91C111_H | 154 | - static gen_helper_gvec_4 * const fns[2] = { |
57 | + | 155 | - gen_helper_sve2_histcnt_s, gen_helper_sve2_histcnt_d |
58 | +#include "hw/irq.h" | 156 | - }; |
59 | +#include "net/net.h" | 157 | - if (a->esz < 2) { |
60 | + | 158 | - return false; |
61 | +void smc91c111_init(NICInfo *, uint32_t, qemu_irq); | 159 | - } |
62 | + | 160 | - return do_sve2_zpzz_ool(s, a, fns[a->esz - 2]); |
63 | +#endif | 161 | -} |
64 | diff --git a/hw/arm/gumstix.c b/hw/arm/gumstix.c | 162 | +static gen_helper_gvec_4 * const histcnt_fns[4] = { |
65 | index XXXXXXX..XXXXXXX 100644 | 163 | + NULL, NULL, gen_helper_sve2_histcnt_s, gen_helper_sve2_histcnt_d |
66 | --- a/hw/arm/gumstix.c | 164 | +}; |
67 | +++ b/hw/arm/gumstix.c | 165 | +TRANS_FEAT(HISTCNT, aa64_sve2, gen_gvec_ool_arg_zpzz, |
68 | @@ -XXX,XX +XXX,XX @@ | 166 | + histcnt_fns[a->esz], a, 0) |
69 | #include "hw/arm/pxa.h" | 167 | |
70 | #include "net/net.h" | 168 | TRANS_FEAT(HISTSEG, aa64_sve2, gen_gvec_ool_arg_zzz, |
71 | #include "hw/block/flash.h" | 169 | a->esz == 0 ? gen_helper_sve2_histseg : NULL, a, 0) |
72 | -#include "hw/devices.h" | ||
73 | +#include "hw/net/smc91c111.h" | ||
74 | #include "hw/boards.h" | ||
75 | #include "exec/address-spaces.h" | ||
76 | #include "sysemu/qtest.h" | ||
77 | diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c | ||
78 | index XXXXXXX..XXXXXXX 100644 | ||
79 | --- a/hw/arm/integratorcp.c | ||
80 | +++ b/hw/arm/integratorcp.c | ||
81 | @@ -XXX,XX +XXX,XX @@ | ||
82 | #include "qemu-common.h" | ||
83 | #include "cpu.h" | ||
84 | #include "hw/sysbus.h" | ||
85 | -#include "hw/devices.h" | ||
86 | #include "hw/boards.h" | ||
87 | #include "hw/arm/arm.h" | ||
88 | #include "hw/misc/arm_integrator_debug.h" | ||
89 | +#include "hw/net/smc91c111.h" | ||
90 | #include "net/net.h" | ||
91 | #include "exec/address-spaces.h" | ||
92 | #include "sysemu/sysemu.h" | ||
93 | diff --git a/hw/arm/mainstone.c b/hw/arm/mainstone.c | ||
94 | index XXXXXXX..XXXXXXX 100644 | ||
95 | --- a/hw/arm/mainstone.c | ||
96 | +++ b/hw/arm/mainstone.c | ||
97 | @@ -XXX,XX +XXX,XX @@ | ||
98 | #include "hw/arm/pxa.h" | ||
99 | #include "hw/arm/arm.h" | ||
100 | #include "net/net.h" | ||
101 | -#include "hw/devices.h" | ||
102 | +#include "hw/net/smc91c111.h" | ||
103 | #include "hw/boards.h" | ||
104 | #include "hw/block/flash.h" | ||
105 | #include "hw/sysbus.h" | ||
106 | diff --git a/hw/arm/realview.c b/hw/arm/realview.c | ||
107 | index XXXXXXX..XXXXXXX 100644 | ||
108 | --- a/hw/arm/realview.c | ||
109 | +++ b/hw/arm/realview.c | ||
110 | @@ -XXX,XX +XXX,XX @@ | ||
111 | #include "hw/sysbus.h" | ||
112 | #include "hw/arm/arm.h" | ||
113 | #include "hw/arm/primecell.h" | ||
114 | -#include "hw/devices.h" | ||
115 | #include "hw/net/lan9118.h" | ||
116 | +#include "hw/net/smc91c111.h" | ||
117 | #include "hw/pci/pci.h" | ||
118 | #include "net/net.h" | ||
119 | #include "sysemu/sysemu.h" | ||
120 | diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c | ||
121 | index XXXXXXX..XXXXXXX 100644 | ||
122 | --- a/hw/arm/versatilepb.c | ||
123 | +++ b/hw/arm/versatilepb.c | ||
124 | @@ -XXX,XX +XXX,XX @@ | ||
125 | #include "cpu.h" | ||
126 | #include "hw/sysbus.h" | ||
127 | #include "hw/arm/arm.h" | ||
128 | -#include "hw/devices.h" | ||
129 | +#include "hw/net/smc91c111.h" | ||
130 | #include "net/net.h" | ||
131 | #include "sysemu/sysemu.h" | ||
132 | #include "hw/pci/pci.h" | ||
133 | diff --git a/hw/net/smc91c111.c b/hw/net/smc91c111.c | ||
134 | index XXXXXXX..XXXXXXX 100644 | ||
135 | --- a/hw/net/smc91c111.c | ||
136 | +++ b/hw/net/smc91c111.c | ||
137 | @@ -XXX,XX +XXX,XX @@ | ||
138 | #include "qemu/osdep.h" | ||
139 | #include "hw/sysbus.h" | ||
140 | #include "net/net.h" | ||
141 | -#include "hw/devices.h" | ||
142 | +#include "hw/net/smc91c111.h" | ||
143 | #include "qemu/log.h" | ||
144 | /* For crc32 */ | ||
145 | #include <zlib.h> | ||
146 | -- | 170 | -- |
147 | 2.20.1 | 171 | 2.25.1 |
148 | |||
149 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | There is only one caller for gen_gvec_fn_zz; inline it. | ||
4 | |||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20220527181907.189259-30-richard.henderson@linaro.org | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | target/arm/translate-sve.c | 13 +++---------- | ||
11 | 1 file changed, 3 insertions(+), 10 deletions(-) | ||
12 | |||
13 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/arm/translate-sve.c | ||
16 | +++ b/target/arm/translate-sve.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_arg_zpzz(DisasContext *s, gen_helper_gvec_4 *fn, | ||
18 | return gen_gvec_ool_zzzp(s, fn, a->rd, a->rn, a->rm, a->pg, data); | ||
19 | } | ||
20 | |||
21 | -/* Invoke a vector expander on two Zregs. */ | ||
22 | -static void gen_gvec_fn_zz(DisasContext *s, GVecGen2Fn *gvec_fn, | ||
23 | - int esz, int rd, int rn) | ||
24 | -{ | ||
25 | - unsigned vsz = vec_full_reg_size(s); | ||
26 | - gvec_fn(esz, vec_full_reg_offset(s, rd), | ||
27 | - vec_full_reg_offset(s, rn), vsz, vsz); | ||
28 | -} | ||
29 | - | ||
30 | /* Invoke a vector expander on three Zregs. */ | ||
31 | static void gen_gvec_fn_zzz(DisasContext *s, GVecGen3Fn *gvec_fn, | ||
32 | int esz, int rd, int rn, int rm) | ||
33 | @@ -XXX,XX +XXX,XX @@ static void gen_gvec_fn_zzzz(DisasContext *s, GVecGen4Fn *gvec_fn, | ||
34 | static bool do_mov_z(DisasContext *s, int rd, int rn) | ||
35 | { | ||
36 | if (sve_access_check(s)) { | ||
37 | - gen_gvec_fn_zz(s, tcg_gen_gvec_mov, MO_8, rd, rn); | ||
38 | + unsigned vsz = vec_full_reg_size(s); | ||
39 | + tcg_gen_gvec_mov(MO_8, vec_full_reg_offset(s, rd), | ||
40 | + vec_full_reg_offset(s, rn), vsz, vsz); | ||
41 | } | ||
42 | return true; | ||
43 | } | ||
44 | -- | ||
45 | 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 | Message-id: 20220527181907.189259-31-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 36 +++++++++++++++--------------------- | ||
9 | 1 file changed, 15 insertions(+), 21 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 gen_gvec_ool_arg_zpzz(DisasContext *s, gen_helper_gvec_4 *fn, | ||
16 | } | ||
17 | |||
18 | /* Invoke a vector expander on three Zregs. */ | ||
19 | -static void gen_gvec_fn_zzz(DisasContext *s, GVecGen3Fn *gvec_fn, | ||
20 | +static bool gen_gvec_fn_zzz(DisasContext *s, GVecGen3Fn *gvec_fn, | ||
21 | int esz, int rd, int rn, int rm) | ||
22 | { | ||
23 | - unsigned vsz = vec_full_reg_size(s); | ||
24 | - gvec_fn(esz, vec_full_reg_offset(s, rd), | ||
25 | - vec_full_reg_offset(s, rn), | ||
26 | - vec_full_reg_offset(s, rm), vsz, vsz); | ||
27 | + if (gvec_fn == NULL) { | ||
28 | + return false; | ||
29 | + } | ||
30 | + if (sve_access_check(s)) { | ||
31 | + unsigned vsz = vec_full_reg_size(s); | ||
32 | + gvec_fn(esz, vec_full_reg_offset(s, rd), | ||
33 | + vec_full_reg_offset(s, rn), | ||
34 | + vec_full_reg_offset(s, rm), vsz, vsz); | ||
35 | + } | ||
36 | + return true; | ||
37 | } | ||
38 | |||
39 | /* Invoke a vector expander on four Zregs. */ | ||
40 | @@ -XXX,XX +XXX,XX @@ const uint64_t pred_esz_masks[4] = { | ||
41 | |||
42 | static bool do_zzz_fn(DisasContext *s, arg_rrr_esz *a, GVecGen3Fn *gvec_fn) | ||
43 | { | ||
44 | - if (sve_access_check(s)) { | ||
45 | - gen_gvec_fn_zzz(s, gvec_fn, a->esz, a->rd, a->rn, a->rm); | ||
46 | - } | ||
47 | - return true; | ||
48 | + return gen_gvec_fn_zzz(s, gvec_fn, a->esz, a->rd, a->rn, a->rm); | ||
49 | } | ||
50 | |||
51 | static bool trans_AND_zzz(DisasContext *s, arg_rrr_esz *a) | ||
52 | @@ -XXX,XX +XXX,XX @@ static bool trans_MUL_zzz(DisasContext *s, arg_rrr_esz *a) | ||
53 | if (!dc_isar_feature(aa64_sve2, s)) { | ||
54 | return false; | ||
55 | } | ||
56 | - if (sve_access_check(s)) { | ||
57 | - gen_gvec_fn_zzz(s, tcg_gen_gvec_mul, a->esz, a->rd, a->rn, a->rm); | ||
58 | - } | ||
59 | - return true; | ||
60 | + return gen_gvec_fn_zzz(s, tcg_gen_gvec_mul, a->esz, a->rd, a->rn, a->rm); | ||
61 | } | ||
62 | |||
63 | static gen_helper_gvec_3 * const smulh_zzz_fns[4] = { | ||
64 | @@ -XXX,XX +XXX,XX @@ static bool do_sve2_fn_zzz(DisasContext *s, arg_rrr_esz *a, GVecGen3Fn *fn) | ||
65 | if (!dc_isar_feature(aa64_sve2, s)) { | ||
66 | return false; | ||
67 | } | ||
68 | - if (sve_access_check(s)) { | ||
69 | - gen_gvec_fn_zzz(s, fn, a->esz, a->rd, a->rn, a->rm); | ||
70 | - } | ||
71 | - return true; | ||
72 | + return gen_gvec_fn_zzz(s, fn, a->esz, a->rd, a->rn, a->rm); | ||
73 | } | ||
74 | |||
75 | static bool trans_SABA(DisasContext *s, arg_rrr_esz *a) | ||
76 | @@ -XXX,XX +XXX,XX @@ static bool trans_RAX1(DisasContext *s, arg_rrr_esz *a) | ||
77 | if (!dc_isar_feature(aa64_sve2_sha3, s)) { | ||
78 | return false; | ||
79 | } | ||
80 | - if (sve_access_check(s)) { | ||
81 | - gen_gvec_fn_zzz(s, gen_gvec_rax1, MO_64, a->rd, a->rn, a->rm); | ||
82 | - } | ||
83 | - return true; | ||
84 | + return gen_gvec_fn_zzz(s, gen_gvec_rax1, MO_64, a->rd, a->rn, a->rm); | ||
85 | } | ||
86 | |||
87 | static bool trans_FCVTNT_sh(DisasContext *s, arg_rpr_esz *a) | ||
88 | -- | ||
89 | 2.25.1 | diff view generated by jsdifflib |
1 | Implement the VLLDM instruction for v7M for the FPU present cas. | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Rename the function to match gen_gvec_fn_zzz, | ||
4 | and move to be adjacent. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-32-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | Message-id: 20190416125744.27770-26-peter.maydell@linaro.org | ||
6 | --- | 10 | --- |
7 | target/arm/helper.h | 1 + | 11 | target/arm/translate-sve.c | 31 ++++++++++++++++--------------- |
8 | target/arm/helper.c | 54 ++++++++++++++++++++++++++++++++++++++++++ | 12 | 1 file changed, 16 insertions(+), 15 deletions(-) |
9 | target/arm/translate.c | 2 +- | ||
10 | 3 files changed, 56 insertions(+), 1 deletion(-) | ||
11 | 13 | ||
12 | diff --git a/target/arm/helper.h b/target/arm/helper.h | 14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
13 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/target/arm/helper.h | 16 | --- a/target/arm/translate-sve.c |
15 | +++ b/target/arm/helper.h | 17 | +++ b/target/arm/translate-sve.c |
16 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_3(v7m_tt, i32, env, i32, i32) | 18 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_fn_zzz(DisasContext *s, GVecGen3Fn *gvec_fn, |
17 | DEF_HELPER_1(v7m_preserve_fp_state, void, env) | 19 | return true; |
18 | |||
19 | DEF_HELPER_2(v7m_vlstm, void, env, i32) | ||
20 | +DEF_HELPER_2(v7m_vlldm, void, env, i32) | ||
21 | |||
22 | DEF_HELPER_2(v8m_stackcheck, void, env, i32) | ||
23 | |||
24 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
25 | index XXXXXXX..XXXXXXX 100644 | ||
26 | --- a/target/arm/helper.c | ||
27 | +++ b/target/arm/helper.c | ||
28 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_vlstm)(CPUARMState *env, uint32_t fptr) | ||
29 | g_assert_not_reached(); | ||
30 | } | 20 | } |
31 | 21 | ||
32 | +void HELPER(v7m_vlldm)(CPUARMState *env, uint32_t fptr) | 22 | +static bool gen_gvec_fn_arg_zzz(DisasContext *s, GVecGen3Fn *fn, |
23 | + arg_rrr_esz *a) | ||
33 | +{ | 24 | +{ |
34 | + /* translate.c should never generate calls here in user-only mode */ | 25 | + return gen_gvec_fn_zzz(s, fn, a->esz, a->rd, a->rn, a->rm); |
35 | + g_assert_not_reached(); | ||
36 | +} | 26 | +} |
37 | + | 27 | + |
38 | uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr, uint32_t op) | 28 | /* Invoke a vector expander on four Zregs. */ |
29 | static void gen_gvec_fn_zzzz(DisasContext *s, GVecGen4Fn *gvec_fn, | ||
30 | int esz, int rd, int rn, int rm, int ra) | ||
31 | @@ -XXX,XX +XXX,XX @@ const uint64_t pred_esz_masks[4] = { | ||
32 | *** SVE Logical - Unpredicated Group | ||
33 | */ | ||
34 | |||
35 | -static bool do_zzz_fn(DisasContext *s, arg_rrr_esz *a, GVecGen3Fn *gvec_fn) | ||
36 | -{ | ||
37 | - return gen_gvec_fn_zzz(s, gvec_fn, a->esz, a->rd, a->rn, a->rm); | ||
38 | -} | ||
39 | - | ||
40 | static bool trans_AND_zzz(DisasContext *s, arg_rrr_esz *a) | ||
39 | { | 41 | { |
40 | /* The TT instructions can be used by unprivileged code, but in | 42 | - return do_zzz_fn(s, a, tcg_gen_gvec_and); |
41 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_vlstm)(CPUARMState *env, uint32_t fptr) | 43 | + return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_and, a); |
42 | env->v7m.control[M_REG_S] &= ~R_V7M_CONTROL_FPCA_MASK; | ||
43 | } | 44 | } |
44 | 45 | ||
45 | +void HELPER(v7m_vlldm)(CPUARMState *env, uint32_t fptr) | 46 | static bool trans_ORR_zzz(DisasContext *s, arg_rrr_esz *a) |
46 | +{ | ||
47 | + /* fptr is the value of Rn, the frame pointer we load the FP regs from */ | ||
48 | + assert(env->v7m.secure); | ||
49 | + | ||
50 | + if (!(env->v7m.control[M_REG_S] & R_V7M_CONTROL_SFPA_MASK)) { | ||
51 | + return; | ||
52 | + } | ||
53 | + | ||
54 | + /* Check access to the coprocessor is permitted */ | ||
55 | + if (!v7m_cpacr_pass(env, true, arm_current_el(env) != 0)) { | ||
56 | + raise_exception_ra(env, EXCP_NOCP, 0, 1, GETPC()); | ||
57 | + } | ||
58 | + | ||
59 | + if (env->v7m.fpccr[M_REG_S] & R_V7M_FPCCR_LSPACT_MASK) { | ||
60 | + /* State in FP is still valid */ | ||
61 | + env->v7m.fpccr[M_REG_S] &= ~R_V7M_FPCCR_LSPACT_MASK; | ||
62 | + } else { | ||
63 | + bool ts = env->v7m.fpccr[M_REG_S] & R_V7M_FPCCR_TS_MASK; | ||
64 | + int i; | ||
65 | + uint32_t fpscr; | ||
66 | + | ||
67 | + if (fptr & 7) { | ||
68 | + raise_exception_ra(env, EXCP_UNALIGNED, 0, 1, GETPC()); | ||
69 | + } | ||
70 | + | ||
71 | + for (i = 0; i < (ts ? 32 : 16); i += 2) { | ||
72 | + uint32_t slo, shi; | ||
73 | + uint64_t dn; | ||
74 | + uint32_t faddr = fptr + 4 * i; | ||
75 | + | ||
76 | + if (i >= 16) { | ||
77 | + faddr += 8; /* skip the slot for the FPSCR */ | ||
78 | + } | ||
79 | + | ||
80 | + slo = cpu_ldl_data(env, faddr); | ||
81 | + shi = cpu_ldl_data(env, faddr + 4); | ||
82 | + | ||
83 | + dn = (uint64_t) shi << 32 | slo; | ||
84 | + *aa32_vfp_dreg(env, i / 2) = dn; | ||
85 | + } | ||
86 | + fpscr = cpu_ldl_data(env, fptr + 0x40); | ||
87 | + vfp_set_fpscr(env, fpscr); | ||
88 | + } | ||
89 | + | ||
90 | + env->v7m.control[M_REG_S] |= R_V7M_CONTROL_FPCA_MASK; | ||
91 | +} | ||
92 | + | ||
93 | static bool v7m_push_stack(ARMCPU *cpu) | ||
94 | { | 47 | { |
95 | /* Do the "set up stack frame" part of exception entry, | 48 | - return do_zzz_fn(s, a, tcg_gen_gvec_or); |
96 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 49 | + return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_or, a); |
97 | index XXXXXXX..XXXXXXX 100644 | 50 | } |
98 | --- a/target/arm/translate.c | 51 | |
99 | +++ b/target/arm/translate.c | 52 | static bool trans_EOR_zzz(DisasContext *s, arg_rrr_esz *a) |
100 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | 53 | { |
101 | TCGv_i32 fptr = load_reg(s, rn); | 54 | - return do_zzz_fn(s, a, tcg_gen_gvec_xor); |
102 | 55 | + return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_xor, a); | |
103 | if (extract32(insn, 20, 1)) { | 56 | } |
104 | - /* VLLDM */ | 57 | |
105 | + gen_helper_v7m_vlldm(cpu_env, fptr); | 58 | static bool trans_BIC_zzz(DisasContext *s, arg_rrr_esz *a) |
106 | } else { | 59 | { |
107 | gen_helper_v7m_vlstm(cpu_env, fptr); | 60 | - return do_zzz_fn(s, a, tcg_gen_gvec_andc); |
108 | } | 61 | + return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_andc, a); |
62 | } | ||
63 | |||
64 | static void gen_xar8_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, int64_t sh) | ||
65 | @@ -XXX,XX +XXX,XX @@ static bool trans_NBSL(DisasContext *s, arg_rrrr_esz *a) | ||
66 | |||
67 | static bool trans_ADD_zzz(DisasContext *s, arg_rrr_esz *a) | ||
68 | { | ||
69 | - return do_zzz_fn(s, a, tcg_gen_gvec_add); | ||
70 | + return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_add, a); | ||
71 | } | ||
72 | |||
73 | static bool trans_SUB_zzz(DisasContext *s, arg_rrr_esz *a) | ||
74 | { | ||
75 | - return do_zzz_fn(s, a, tcg_gen_gvec_sub); | ||
76 | + return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_sub, a); | ||
77 | } | ||
78 | |||
79 | static bool trans_SQADD_zzz(DisasContext *s, arg_rrr_esz *a) | ||
80 | { | ||
81 | - return do_zzz_fn(s, a, tcg_gen_gvec_ssadd); | ||
82 | + return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_ssadd, a); | ||
83 | } | ||
84 | |||
85 | static bool trans_SQSUB_zzz(DisasContext *s, arg_rrr_esz *a) | ||
86 | { | ||
87 | - return do_zzz_fn(s, a, tcg_gen_gvec_sssub); | ||
88 | + return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_sssub, a); | ||
89 | } | ||
90 | |||
91 | static bool trans_UQADD_zzz(DisasContext *s, arg_rrr_esz *a) | ||
92 | { | ||
93 | - return do_zzz_fn(s, a, tcg_gen_gvec_usadd); | ||
94 | + return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_usadd, a); | ||
95 | } | ||
96 | |||
97 | static bool trans_UQSUB_zzz(DisasContext *s, arg_rrr_esz *a) | ||
98 | { | ||
99 | - return do_zzz_fn(s, a, tcg_gen_gvec_ussub); | ||
100 | + return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_ussub, a); | ||
101 | } | ||
102 | |||
103 | /* | ||
109 | -- | 104 | -- |
110 | 2.20.1 | 105 | 2.25.1 |
111 | |||
112 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Two uses of gen_gvec_fn_zzz can pass on arg_rrr_esz instead. | ||
4 | |||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20220527181907.189259-33-richard.henderson@linaro.org | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | target/arm/translate-sve.c | 4 ++-- | ||
11 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
12 | |||
13 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/arm/translate-sve.c | ||
16 | +++ b/target/arm/translate-sve.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static bool trans_MUL_zzz(DisasContext *s, arg_rrr_esz *a) | ||
18 | if (!dc_isar_feature(aa64_sve2, s)) { | ||
19 | return false; | ||
20 | } | ||
21 | - return gen_gvec_fn_zzz(s, tcg_gen_gvec_mul, a->esz, a->rd, a->rn, a->rm); | ||
22 | + return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_mul, a); | ||
23 | } | ||
24 | |||
25 | static gen_helper_gvec_3 * const smulh_zzz_fns[4] = { | ||
26 | @@ -XXX,XX +XXX,XX @@ static bool do_sve2_fn_zzz(DisasContext *s, arg_rrr_esz *a, GVecGen3Fn *fn) | ||
27 | if (!dc_isar_feature(aa64_sve2, s)) { | ||
28 | return false; | ||
29 | } | ||
30 | - return gen_gvec_fn_zzz(s, fn, a->esz, a->rd, a->rn, a->rm); | ||
31 | + return gen_gvec_fn_arg_zzz(s, fn, a); | ||
32 | } | ||
33 | |||
34 | static bool trans_SABA(DisasContext *s, arg_rrr_esz *a) | ||
35 | -- | ||
36 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions directly using | ||
4 | gen_gvec_fn_arg_zzz to TRANS_FEAT. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-34-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 66 +++++++------------------------------- | ||
12 | 1 file changed, 11 insertions(+), 55 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ const uint64_t pred_esz_masks[4] = { | ||
19 | *** SVE Logical - Unpredicated Group | ||
20 | */ | ||
21 | |||
22 | -static bool trans_AND_zzz(DisasContext *s, arg_rrr_esz *a) | ||
23 | -{ | ||
24 | - return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_and, a); | ||
25 | -} | ||
26 | - | ||
27 | -static bool trans_ORR_zzz(DisasContext *s, arg_rrr_esz *a) | ||
28 | -{ | ||
29 | - return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_or, a); | ||
30 | -} | ||
31 | - | ||
32 | -static bool trans_EOR_zzz(DisasContext *s, arg_rrr_esz *a) | ||
33 | -{ | ||
34 | - return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_xor, a); | ||
35 | -} | ||
36 | - | ||
37 | -static bool trans_BIC_zzz(DisasContext *s, arg_rrr_esz *a) | ||
38 | -{ | ||
39 | - return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_andc, a); | ||
40 | -} | ||
41 | +TRANS_FEAT(AND_zzz, aa64_sve, gen_gvec_fn_arg_zzz, tcg_gen_gvec_and, a) | ||
42 | +TRANS_FEAT(ORR_zzz, aa64_sve, gen_gvec_fn_arg_zzz, tcg_gen_gvec_or, a) | ||
43 | +TRANS_FEAT(EOR_zzz, aa64_sve, gen_gvec_fn_arg_zzz, tcg_gen_gvec_xor, a) | ||
44 | +TRANS_FEAT(BIC_zzz, aa64_sve, gen_gvec_fn_arg_zzz, tcg_gen_gvec_andc, a) | ||
45 | |||
46 | static void gen_xar8_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, int64_t sh) | ||
47 | { | ||
48 | @@ -XXX,XX +XXX,XX @@ static bool trans_NBSL(DisasContext *s, arg_rrrr_esz *a) | ||
49 | *** SVE Integer Arithmetic - Unpredicated Group | ||
50 | */ | ||
51 | |||
52 | -static bool trans_ADD_zzz(DisasContext *s, arg_rrr_esz *a) | ||
53 | -{ | ||
54 | - return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_add, a); | ||
55 | -} | ||
56 | - | ||
57 | -static bool trans_SUB_zzz(DisasContext *s, arg_rrr_esz *a) | ||
58 | -{ | ||
59 | - return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_sub, a); | ||
60 | -} | ||
61 | - | ||
62 | -static bool trans_SQADD_zzz(DisasContext *s, arg_rrr_esz *a) | ||
63 | -{ | ||
64 | - return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_ssadd, a); | ||
65 | -} | ||
66 | - | ||
67 | -static bool trans_SQSUB_zzz(DisasContext *s, arg_rrr_esz *a) | ||
68 | -{ | ||
69 | - return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_sssub, a); | ||
70 | -} | ||
71 | - | ||
72 | -static bool trans_UQADD_zzz(DisasContext *s, arg_rrr_esz *a) | ||
73 | -{ | ||
74 | - return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_usadd, a); | ||
75 | -} | ||
76 | - | ||
77 | -static bool trans_UQSUB_zzz(DisasContext *s, arg_rrr_esz *a) | ||
78 | -{ | ||
79 | - return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_ussub, a); | ||
80 | -} | ||
81 | +TRANS_FEAT(ADD_zzz, aa64_sve, gen_gvec_fn_arg_zzz, tcg_gen_gvec_add, a) | ||
82 | +TRANS_FEAT(SUB_zzz, aa64_sve, gen_gvec_fn_arg_zzz, tcg_gen_gvec_sub, a) | ||
83 | +TRANS_FEAT(SQADD_zzz, aa64_sve, gen_gvec_fn_arg_zzz, tcg_gen_gvec_ssadd, a) | ||
84 | +TRANS_FEAT(SQSUB_zzz, aa64_sve, gen_gvec_fn_arg_zzz, tcg_gen_gvec_sssub, a) | ||
85 | +TRANS_FEAT(UQADD_zzz, aa64_sve, gen_gvec_fn_arg_zzz, tcg_gen_gvec_usadd, a) | ||
86 | +TRANS_FEAT(UQSUB_zzz, aa64_sve, gen_gvec_fn_arg_zzz, tcg_gen_gvec_ussub, a) | ||
87 | |||
88 | /* | ||
89 | *** SVE Integer Arithmetic - Binary Predicated Group | ||
90 | @@ -XXX,XX +XXX,XX @@ static bool trans_MOVPRFX_z(DisasContext *s, arg_rpr_esz *a) | ||
91 | * SVE2 Integer Multiply - Unpredicated | ||
92 | */ | ||
93 | |||
94 | -static bool trans_MUL_zzz(DisasContext *s, arg_rrr_esz *a) | ||
95 | -{ | ||
96 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
97 | - return false; | ||
98 | - } | ||
99 | - return gen_gvec_fn_arg_zzz(s, tcg_gen_gvec_mul, a); | ||
100 | -} | ||
101 | +TRANS_FEAT(MUL_zzz, aa64_sve2, gen_gvec_fn_arg_zzz, tcg_gen_gvec_mul, a) | ||
102 | |||
103 | static gen_helper_gvec_3 * const smulh_zzz_fns[4] = { | ||
104 | gen_helper_gvec_smulh_b, gen_helper_gvec_smulh_h, | ||
105 | -- | ||
106 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions using do_sve2_fn_zzz | ||
4 | to use TRANS_FEAT and gen_gvec_fn_arg_zzz. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-35-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 19 ++----------------- | ||
12 | 1 file changed, 2 insertions(+), 17 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static bool trans_SLI(DisasContext *s, arg_rri_esz *a) | ||
19 | return do_sve2_fn2i(s, a, gen_gvec_sli); | ||
20 | } | ||
21 | |||
22 | -static bool do_sve2_fn_zzz(DisasContext *s, arg_rrr_esz *a, GVecGen3Fn *fn) | ||
23 | -{ | ||
24 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
25 | - return false; | ||
26 | - } | ||
27 | - return gen_gvec_fn_arg_zzz(s, fn, a); | ||
28 | -} | ||
29 | - | ||
30 | -static bool trans_SABA(DisasContext *s, arg_rrr_esz *a) | ||
31 | -{ | ||
32 | - return do_sve2_fn_zzz(s, a, gen_gvec_saba); | ||
33 | -} | ||
34 | - | ||
35 | -static bool trans_UABA(DisasContext *s, arg_rrr_esz *a) | ||
36 | -{ | ||
37 | - return do_sve2_fn_zzz(s, a, gen_gvec_uaba); | ||
38 | -} | ||
39 | +TRANS_FEAT(SABA, aa64_sve2, gen_gvec_fn_arg_zzz, gen_gvec_saba, a) | ||
40 | +TRANS_FEAT(UABA, aa64_sve2, gen_gvec_fn_arg_zzz, gen_gvec_uaba, a) | ||
41 | |||
42 | static bool do_sve2_narrow_extract(DisasContext *s, arg_rri_esz *a, | ||
43 | const GVecGen2 ops[3]) | ||
44 | -- | ||
45 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | The decode for RAX1 sets esz to MO_8, because that's what | ||
4 | we use by default for "no esz present". We changed that | ||
5 | to MO_64 during translation because it is more logical for | ||
6 | the operation. However, the esz argument to gen_gvec_rax1 | ||
7 | is unused and forces MO_64 within that function, so there | ||
8 | is no need to do it here as well. | ||
9 | |||
10 | Simplify to use gen_gvec_fn_arg_zzz and TRANS_FEAT. | ||
11 | |||
12 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | Message-id: 20220527181907.189259-36-richard.henderson@linaro.org | ||
14 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
16 | --- | ||
17 | target/arm/translate-sve.c | 8 +------- | ||
18 | 1 file changed, 1 insertion(+), 7 deletions(-) | ||
19 | |||
20 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/target/arm/translate-sve.c | ||
23 | +++ b/target/arm/translate-sve.c | ||
24 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(SM4E, aa64_sve2_sm4, gen_gvec_ool_arg_zzz, | ||
25 | TRANS_FEAT(SM4EKEY, aa64_sve2_sm4, gen_gvec_ool_arg_zzz, | ||
26 | gen_helper_crypto_sm4ekey, a, 0) | ||
27 | |||
28 | -static bool trans_RAX1(DisasContext *s, arg_rrr_esz *a) | ||
29 | -{ | ||
30 | - if (!dc_isar_feature(aa64_sve2_sha3, s)) { | ||
31 | - return false; | ||
32 | - } | ||
33 | - return gen_gvec_fn_zzz(s, gen_gvec_rax1, MO_64, a->rd, a->rn, a->rm); | ||
34 | -} | ||
35 | +TRANS_FEAT(RAX1, aa64_sve2_sha3, gen_gvec_fn_arg_zzz, gen_gvec_rax1, a) | ||
36 | |||
37 | static bool trans_FCVTNT_sh(DisasContext *s, arg_rpr_esz *a) | ||
38 | { | ||
39 | -- | ||
40 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Merge gen_gvec_fn_zzzz with the sve access check and the | ||
4 | dereference of arg_rrrr_esz. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-37-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 25 ++++++++++++++----------- | ||
12 | 1 file changed, 14 insertions(+), 11 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_fn_arg_zzz(DisasContext *s, GVecGen3Fn *fn, | ||
19 | } | ||
20 | |||
21 | /* Invoke a vector expander on four Zregs. */ | ||
22 | -static void gen_gvec_fn_zzzz(DisasContext *s, GVecGen4Fn *gvec_fn, | ||
23 | - int esz, int rd, int rn, int rm, int ra) | ||
24 | +static bool gen_gvec_fn_arg_zzzz(DisasContext *s, GVecGen4Fn *gvec_fn, | ||
25 | + arg_rrrr_esz *a) | ||
26 | { | ||
27 | - unsigned vsz = vec_full_reg_size(s); | ||
28 | - gvec_fn(esz, vec_full_reg_offset(s, rd), | ||
29 | - vec_full_reg_offset(s, rn), | ||
30 | - vec_full_reg_offset(s, rm), | ||
31 | - vec_full_reg_offset(s, ra), vsz, vsz); | ||
32 | + if (gvec_fn == NULL) { | ||
33 | + return false; | ||
34 | + } | ||
35 | + if (sve_access_check(s)) { | ||
36 | + unsigned vsz = vec_full_reg_size(s); | ||
37 | + gvec_fn(a->esz, vec_full_reg_offset(s, a->rd), | ||
38 | + vec_full_reg_offset(s, a->rn), | ||
39 | + vec_full_reg_offset(s, a->rm), | ||
40 | + vec_full_reg_offset(s, a->ra), vsz, vsz); | ||
41 | + } | ||
42 | + return true; | ||
43 | } | ||
44 | |||
45 | /* Invoke a vector move on two Zregs. */ | ||
46 | @@ -XXX,XX +XXX,XX @@ static bool do_sve2_zzzz_fn(DisasContext *s, arg_rrrr_esz *a, GVecGen4Fn *fn) | ||
47 | if (!dc_isar_feature(aa64_sve2, s)) { | ||
48 | return false; | ||
49 | } | ||
50 | - if (sve_access_check(s)) { | ||
51 | - gen_gvec_fn_zzzz(s, fn, a->esz, a->rd, a->rn, a->rm, a->ra); | ||
52 | - } | ||
53 | - return true; | ||
54 | + return gen_gvec_fn_arg_zzzz(s, fn, a); | ||
55 | } | ||
56 | |||
57 | static void gen_eor3_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_i64 k) | ||
58 | -- | ||
59 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions using do_sve2_zzzz_fn | ||
4 | to use TRANS_FEAT and gen_gvec_fn_arg_zzzz. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-38-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 38 ++++++-------------------------------- | ||
12 | 1 file changed, 6 insertions(+), 32 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static bool trans_XAR(DisasContext *s, arg_rrri_esz *a) | ||
19 | return true; | ||
20 | } | ||
21 | |||
22 | -static bool do_sve2_zzzz_fn(DisasContext *s, arg_rrrr_esz *a, GVecGen4Fn *fn) | ||
23 | -{ | ||
24 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
25 | - return false; | ||
26 | - } | ||
27 | - return gen_gvec_fn_arg_zzzz(s, fn, a); | ||
28 | -} | ||
29 | - | ||
30 | static void gen_eor3_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_i64 k) | ||
31 | { | ||
32 | tcg_gen_xor_i64(d, n, m); | ||
33 | @@ -XXX,XX +XXX,XX @@ static void gen_eor3(unsigned vece, uint32_t d, uint32_t n, uint32_t m, | ||
34 | tcg_gen_gvec_4(d, n, m, a, oprsz, maxsz, &op); | ||
35 | } | ||
36 | |||
37 | -static bool trans_EOR3(DisasContext *s, arg_rrrr_esz *a) | ||
38 | -{ | ||
39 | - return do_sve2_zzzz_fn(s, a, gen_eor3); | ||
40 | -} | ||
41 | +TRANS_FEAT(EOR3, aa64_sve2, gen_gvec_fn_arg_zzzz, gen_eor3, a) | ||
42 | |||
43 | static void gen_bcax_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_i64 k) | ||
44 | { | ||
45 | @@ -XXX,XX +XXX,XX @@ static void gen_bcax(unsigned vece, uint32_t d, uint32_t n, uint32_t m, | ||
46 | tcg_gen_gvec_4(d, n, m, a, oprsz, maxsz, &op); | ||
47 | } | ||
48 | |||
49 | -static bool trans_BCAX(DisasContext *s, arg_rrrr_esz *a) | ||
50 | -{ | ||
51 | - return do_sve2_zzzz_fn(s, a, gen_bcax); | ||
52 | -} | ||
53 | +TRANS_FEAT(BCAX, aa64_sve2, gen_gvec_fn_arg_zzzz, gen_bcax, a) | ||
54 | |||
55 | static void gen_bsl(unsigned vece, uint32_t d, uint32_t n, uint32_t m, | ||
56 | uint32_t a, uint32_t oprsz, uint32_t maxsz) | ||
57 | @@ -XXX,XX +XXX,XX @@ static void gen_bsl(unsigned vece, uint32_t d, uint32_t n, uint32_t m, | ||
58 | tcg_gen_gvec_bitsel(vece, d, a, n, m, oprsz, maxsz); | ||
59 | } | ||
60 | |||
61 | -static bool trans_BSL(DisasContext *s, arg_rrrr_esz *a) | ||
62 | -{ | ||
63 | - return do_sve2_zzzz_fn(s, a, gen_bsl); | ||
64 | -} | ||
65 | +TRANS_FEAT(BSL, aa64_sve2, gen_gvec_fn_arg_zzzz, gen_bsl, a) | ||
66 | |||
67 | static void gen_bsl1n_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_i64 k) | ||
68 | { | ||
69 | @@ -XXX,XX +XXX,XX @@ static void gen_bsl1n(unsigned vece, uint32_t d, uint32_t n, uint32_t m, | ||
70 | tcg_gen_gvec_4(d, n, m, a, oprsz, maxsz, &op); | ||
71 | } | ||
72 | |||
73 | -static bool trans_BSL1N(DisasContext *s, arg_rrrr_esz *a) | ||
74 | -{ | ||
75 | - return do_sve2_zzzz_fn(s, a, gen_bsl1n); | ||
76 | -} | ||
77 | +TRANS_FEAT(BSL1N, aa64_sve2, gen_gvec_fn_arg_zzzz, gen_bsl1n, a) | ||
78 | |||
79 | static void gen_bsl2n_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_i64 k) | ||
80 | { | ||
81 | @@ -XXX,XX +XXX,XX @@ static void gen_bsl2n(unsigned vece, uint32_t d, uint32_t n, uint32_t m, | ||
82 | tcg_gen_gvec_4(d, n, m, a, oprsz, maxsz, &op); | ||
83 | } | ||
84 | |||
85 | -static bool trans_BSL2N(DisasContext *s, arg_rrrr_esz *a) | ||
86 | -{ | ||
87 | - return do_sve2_zzzz_fn(s, a, gen_bsl2n); | ||
88 | -} | ||
89 | +TRANS_FEAT(BSL2N, aa64_sve2, gen_gvec_fn_arg_zzzz, gen_bsl2n, a) | ||
90 | |||
91 | static void gen_nbsl_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_i64 k) | ||
92 | { | ||
93 | @@ -XXX,XX +XXX,XX @@ static void gen_nbsl(unsigned vece, uint32_t d, uint32_t n, uint32_t m, | ||
94 | tcg_gen_gvec_4(d, n, m, a, oprsz, maxsz, &op); | ||
95 | } | ||
96 | |||
97 | -static bool trans_NBSL(DisasContext *s, arg_rrrr_esz *a) | ||
98 | -{ | ||
99 | - return do_sve2_zzzz_fn(s, a, gen_nbsl); | ||
100 | -} | ||
101 | +TRANS_FEAT(NBSL, aa64_sve2, gen_gvec_fn_arg_zzzz, gen_nbsl, a) | ||
102 | |||
103 | /* | ||
104 | *** SVE Integer Arithmetic - Unpredicated Group | ||
105 | -- | ||
106 | 2.25.1 | diff view generated by jsdifflib |
1 | The M-profile architecture floating point system supports | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | lazy FP state preservation, where FP registers are not | ||
3 | pushed to the stack when an exception occurs but are instead | ||
4 | only saved if and when the first FP instruction in the exception | ||
5 | handler is executed. Implement this in QEMU, corresponding | ||
6 | to the check of LSPACT in the pseudocode ExecuteFPCheck(). | ||
7 | 2 | ||
3 | We have two places that perform this particular operation. | ||
4 | |||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20220527181907.189259-39-richard.henderson@linaro.org | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Message-id: 20190416125744.27770-24-peter.maydell@linaro.org | ||
11 | --- | 9 | --- |
12 | target/arm/cpu.h | 3 ++ | 10 | target/arm/translate-sve.c | 30 +++++++++++++++++------------- |
13 | target/arm/helper.h | 2 + | 11 | 1 file changed, 17 insertions(+), 13 deletions(-) |
14 | target/arm/translate.h | 1 + | ||
15 | target/arm/helper.c | 112 +++++++++++++++++++++++++++++++++++++++++ | ||
16 | target/arm/translate.c | 22 ++++++++ | ||
17 | 5 files changed, 140 insertions(+) | ||
18 | 12 | ||
19 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 13 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
20 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/target/arm/cpu.h | 15 | --- a/target/arm/translate-sve.c |
22 | +++ b/target/arm/cpu.h | 16 | +++ b/target/arm/translate-sve.c |
23 | @@ -XXX,XX +XXX,XX @@ | 17 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_arg_zpzz(DisasContext *s, gen_helper_gvec_4 *fn, |
24 | #define EXCP_NOCP 17 /* v7M NOCP UsageFault */ | 18 | return gen_gvec_ool_zzzp(s, fn, a->rd, a->rn, a->rm, a->pg, data); |
25 | #define EXCP_INVSTATE 18 /* v7M INVSTATE UsageFault */ | ||
26 | #define EXCP_STKOF 19 /* v8M STKOF UsageFault */ | ||
27 | +#define EXCP_LAZYFP 20 /* v7M fault during lazy FP stacking */ | ||
28 | /* NB: add new EXCP_ defines to the array in arm_log_exception() too */ | ||
29 | |||
30 | #define ARMV7M_EXCP_RESET 1 | ||
31 | @@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_A32, NS, 6, 1) | ||
32 | FIELD(TBFLAG_A32, VFPEN, 7, 1) | ||
33 | FIELD(TBFLAG_A32, CONDEXEC, 8, 8) | ||
34 | FIELD(TBFLAG_A32, SCTLR_B, 16, 1) | ||
35 | +/* For M profile only, set if FPCCR.LSPACT is set */ | ||
36 | +FIELD(TBFLAG_A32, LSPACT, 18, 1) | ||
37 | /* For M profile only, set if we must create a new FP context */ | ||
38 | FIELD(TBFLAG_A32, NEW_FP_CTXT_NEEDED, 19, 1) | ||
39 | /* For M profile only, set if FPCCR.S does not match current security state */ | ||
40 | diff --git a/target/arm/helper.h b/target/arm/helper.h | ||
41 | index XXXXXXX..XXXXXXX 100644 | ||
42 | --- a/target/arm/helper.h | ||
43 | +++ b/target/arm/helper.h | ||
44 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_2(v7m_blxns, void, env, i32) | ||
45 | |||
46 | DEF_HELPER_3(v7m_tt, i32, env, i32, i32) | ||
47 | |||
48 | +DEF_HELPER_1(v7m_preserve_fp_state, void, env) | ||
49 | + | ||
50 | DEF_HELPER_2(v8m_stackcheck, void, env, i32) | ||
51 | |||
52 | DEF_HELPER_4(access_check_cp_reg, void, env, ptr, i32, i32) | ||
53 | diff --git a/target/arm/translate.h b/target/arm/translate.h | ||
54 | index XXXXXXX..XXXXXXX 100644 | ||
55 | --- a/target/arm/translate.h | ||
56 | +++ b/target/arm/translate.h | ||
57 | @@ -XXX,XX +XXX,XX @@ typedef struct DisasContext { | ||
58 | bool v8m_stackcheck; /* true if we need to perform v8M stack limit checks */ | ||
59 | bool v8m_fpccr_s_wrong; /* true if v8M FPCCR.S != v8m_secure */ | ||
60 | bool v7m_new_fp_ctxt_needed; /* ASPEN set but no active FP context */ | ||
61 | + bool v7m_lspact; /* FPCCR.LSPACT set */ | ||
62 | /* Immediate value in AArch32 SVC insn; must be set if is_jmp == DISAS_SWI | ||
63 | * so that top level loop can generate correct syndrome information. | ||
64 | */ | ||
65 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
66 | index XXXXXXX..XXXXXXX 100644 | ||
67 | --- a/target/arm/helper.c | ||
68 | +++ b/target/arm/helper.c | ||
69 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_blxns)(CPUARMState *env, uint32_t dest) | ||
70 | g_assert_not_reached(); | ||
71 | } | 19 | } |
72 | 20 | ||
73 | +void HELPER(v7m_preserve_fp_state)(CPUARMState *env) | 21 | +/* Invoke a vector expander on two Zregs and an immediate. */ |
22 | +static bool gen_gvec_fn_zzi(DisasContext *s, GVecGen2iFn *gvec_fn, | ||
23 | + int esz, int rd, int rn, uint64_t imm) | ||
74 | +{ | 24 | +{ |
75 | + /* translate.c should never generate calls here in user-only mode */ | 25 | + if (gvec_fn == NULL) { |
76 | + g_assert_not_reached(); | 26 | + return false; |
27 | + } | ||
28 | + if (sve_access_check(s)) { | ||
29 | + unsigned vsz = vec_full_reg_size(s); | ||
30 | + gvec_fn(esz, vec_full_reg_offset(s, rd), | ||
31 | + vec_full_reg_offset(s, rn), imm, vsz, vsz); | ||
32 | + } | ||
33 | + return true; | ||
77 | +} | 34 | +} |
78 | + | 35 | + |
79 | uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr, uint32_t op) | 36 | /* Invoke a vector expander on three Zregs. */ |
80 | { | 37 | static bool gen_gvec_fn_zzz(DisasContext *s, GVecGen3Fn *gvec_fn, |
81 | /* The TT instructions can be used by unprivileged code, but in | 38 | int esz, int rd, int rn, int rm) |
82 | @@ -XXX,XX +XXX,XX @@ pend_fault: | 39 | @@ -XXX,XX +XXX,XX @@ static bool do_zz_dbm(DisasContext *s, arg_rr_dbm *a, GVecGen2iFn *gvec_fn) |
83 | return false; | 40 | extract32(a->dbm, 6, 6))) { |
41 | return false; | ||
42 | } | ||
43 | - if (sve_access_check(s)) { | ||
44 | - unsigned vsz = vec_full_reg_size(s); | ||
45 | - gvec_fn(MO_64, vec_full_reg_offset(s, a->rd), | ||
46 | - vec_full_reg_offset(s, a->rn), imm, vsz, vsz); | ||
47 | - } | ||
48 | - return true; | ||
49 | + return gen_gvec_fn_zzi(s, gvec_fn, MO_64, a->rd, a->rn, imm); | ||
84 | } | 50 | } |
85 | 51 | ||
86 | +void HELPER(v7m_preserve_fp_state)(CPUARMState *env) | 52 | static bool trans_AND_zzi(DisasContext *s, arg_rr_dbm *a) |
87 | +{ | 53 | @@ -XXX,XX +XXX,XX @@ static bool do_sve2_fn2i(DisasContext *s, arg_rri_esz *a, GVecGen2iFn *fn) |
88 | + /* | 54 | if (a->esz < 0 || !dc_isar_feature(aa64_sve2, s)) { |
89 | + * Preserve FP state (because LSPACT was set and we are about | 55 | return false; |
90 | + * to execute an FP instruction). This corresponds to the | ||
91 | + * PreserveFPState() pseudocode. | ||
92 | + * We may throw an exception if the stacking fails. | ||
93 | + */ | ||
94 | + ARMCPU *cpu = arm_env_get_cpu(env); | ||
95 | + bool is_secure = env->v7m.fpccr[M_REG_S] & R_V7M_FPCCR_S_MASK; | ||
96 | + bool negpri = !(env->v7m.fpccr[M_REG_S] & R_V7M_FPCCR_HFRDY_MASK); | ||
97 | + bool is_priv = !(env->v7m.fpccr[is_secure] & R_V7M_FPCCR_USER_MASK); | ||
98 | + bool splimviol = env->v7m.fpccr[is_secure] & R_V7M_FPCCR_SPLIMVIOL_MASK; | ||
99 | + uint32_t fpcar = env->v7m.fpcar[is_secure]; | ||
100 | + bool stacked_ok = true; | ||
101 | + bool ts = is_secure && (env->v7m.fpccr[M_REG_S] & R_V7M_FPCCR_TS_MASK); | ||
102 | + bool take_exception; | ||
103 | + | ||
104 | + /* Take the iothread lock as we are going to touch the NVIC */ | ||
105 | + qemu_mutex_lock_iothread(); | ||
106 | + | ||
107 | + /* Check the background context had access to the FPU */ | ||
108 | + if (!v7m_cpacr_pass(env, is_secure, is_priv)) { | ||
109 | + armv7m_nvic_set_pending_lazyfp(env->nvic, ARMV7M_EXCP_USAGE, is_secure); | ||
110 | + env->v7m.cfsr[is_secure] |= R_V7M_CFSR_NOCP_MASK; | ||
111 | + stacked_ok = false; | ||
112 | + } else if (!is_secure && !extract32(env->v7m.nsacr, 10, 1)) { | ||
113 | + armv7m_nvic_set_pending_lazyfp(env->nvic, ARMV7M_EXCP_USAGE, M_REG_S); | ||
114 | + env->v7m.cfsr[M_REG_S] |= R_V7M_CFSR_NOCP_MASK; | ||
115 | + stacked_ok = false; | ||
116 | + } | ||
117 | + | ||
118 | + if (!splimviol && stacked_ok) { | ||
119 | + /* We only stack if the stack limit wasn't violated */ | ||
120 | + int i; | ||
121 | + ARMMMUIdx mmu_idx; | ||
122 | + | ||
123 | + mmu_idx = arm_v7m_mmu_idx_all(env, is_secure, is_priv, negpri); | ||
124 | + for (i = 0; i < (ts ? 32 : 16); i += 2) { | ||
125 | + uint64_t dn = *aa32_vfp_dreg(env, i / 2); | ||
126 | + uint32_t faddr = fpcar + 4 * i; | ||
127 | + uint32_t slo = extract64(dn, 0, 32); | ||
128 | + uint32_t shi = extract64(dn, 32, 32); | ||
129 | + | ||
130 | + if (i >= 16) { | ||
131 | + faddr += 8; /* skip the slot for the FPSCR */ | ||
132 | + } | ||
133 | + stacked_ok = stacked_ok && | ||
134 | + v7m_stack_write(cpu, faddr, slo, mmu_idx, STACK_LAZYFP) && | ||
135 | + v7m_stack_write(cpu, faddr + 4, shi, mmu_idx, STACK_LAZYFP); | ||
136 | + } | ||
137 | + | ||
138 | + stacked_ok = stacked_ok && | ||
139 | + v7m_stack_write(cpu, fpcar + 0x40, | ||
140 | + vfp_get_fpscr(env), mmu_idx, STACK_LAZYFP); | ||
141 | + } | ||
142 | + | ||
143 | + /* | ||
144 | + * We definitely pended an exception, but it's possible that it | ||
145 | + * might not be able to be taken now. If its priority permits us | ||
146 | + * to take it now, then we must not update the LSPACT or FP regs, | ||
147 | + * but instead jump out to take the exception immediately. | ||
148 | + * If it's just pending and won't be taken until the current | ||
149 | + * handler exits, then we do update LSPACT and the FP regs. | ||
150 | + */ | ||
151 | + take_exception = !stacked_ok && | ||
152 | + armv7m_nvic_can_take_pending_exception(env->nvic); | ||
153 | + | ||
154 | + qemu_mutex_unlock_iothread(); | ||
155 | + | ||
156 | + if (take_exception) { | ||
157 | + raise_exception_ra(env, EXCP_LAZYFP, 0, 1, GETPC()); | ||
158 | + } | ||
159 | + | ||
160 | + env->v7m.fpccr[is_secure] &= ~R_V7M_FPCCR_LSPACT_MASK; | ||
161 | + | ||
162 | + if (ts) { | ||
163 | + /* Clear s0 to s31 and the FPSCR */ | ||
164 | + int i; | ||
165 | + | ||
166 | + for (i = 0; i < 32; i += 2) { | ||
167 | + *aa32_vfp_dreg(env, i / 2) = 0; | ||
168 | + } | ||
169 | + vfp_set_fpscr(env, 0); | ||
170 | + } | ||
171 | + /* | ||
172 | + * Otherwise s0 to s15 and FPSCR are UNKNOWN; we choose to leave them | ||
173 | + * unchanged. | ||
174 | + */ | ||
175 | +} | ||
176 | + | ||
177 | /* Write to v7M CONTROL.SPSEL bit for the specified security bank. | ||
178 | * This may change the current stack pointer between Main and Process | ||
179 | * stack pointers if it is done for the CONTROL register for the current | ||
180 | @@ -XXX,XX +XXX,XX @@ static void arm_log_exception(int idx) | ||
181 | [EXCP_NOCP] = "v7M NOCP UsageFault", | ||
182 | [EXCP_INVSTATE] = "v7M INVSTATE UsageFault", | ||
183 | [EXCP_STKOF] = "v8M STKOF UsageFault", | ||
184 | + [EXCP_LAZYFP] = "v7M exception during lazy FP stacking", | ||
185 | }; | ||
186 | |||
187 | if (idx >= 0 && idx < ARRAY_SIZE(excnames)) { | ||
188 | @@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs) | ||
189 | return; | ||
190 | } | ||
191 | break; | ||
192 | + case EXCP_LAZYFP: | ||
193 | + /* | ||
194 | + * We already pended the specific exception in the NVIC in the | ||
195 | + * v7m_preserve_fp_state() helper function. | ||
196 | + */ | ||
197 | + break; | ||
198 | default: | ||
199 | cpu_abort(cs, "Unhandled exception 0x%x\n", cs->exception_index); | ||
200 | return; /* Never happens. Keep compiler happy. */ | ||
201 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
202 | flags = FIELD_DP32(flags, TBFLAG_A32, NEW_FP_CTXT_NEEDED, 1); | ||
203 | } | 56 | } |
204 | 57 | - if (sve_access_check(s)) { | |
205 | + if (arm_feature(env, ARM_FEATURE_M)) { | 58 | - unsigned vsz = vec_full_reg_size(s); |
206 | + bool is_secure = env->v7m.fpccr[M_REG_S] & R_V7M_FPCCR_S_MASK; | 59 | - unsigned rd_ofs = vec_full_reg_offset(s, a->rd); |
207 | + | 60 | - unsigned rn_ofs = vec_full_reg_offset(s, a->rn); |
208 | + if (env->v7m.fpccr[is_secure] & R_V7M_FPCCR_LSPACT_MASK) { | 61 | - fn(a->esz, rd_ofs, rn_ofs, a->imm, vsz, vsz); |
209 | + flags = FIELD_DP32(flags, TBFLAG_A32, LSPACT, 1); | 62 | - } |
210 | + } | 63 | - return true; |
211 | + } | 64 | + return gen_gvec_fn_zzi(s, fn, a->esz, a->rd, a->rn, a->imm); |
212 | + | ||
213 | *pflags = flags; | ||
214 | *cs_base = 0; | ||
215 | } | 65 | } |
216 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 66 | |
217 | index XXXXXXX..XXXXXXX 100644 | 67 | static bool trans_SSRA(DisasContext *s, arg_rri_esz *a) |
218 | --- a/target/arm/translate.c | ||
219 | +++ b/target/arm/translate.c | ||
220 | @@ -XXX,XX +XXX,XX @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) | ||
221 | if (arm_dc_feature(s, ARM_FEATURE_M)) { | ||
222 | /* Handle M-profile lazy FP state mechanics */ | ||
223 | |||
224 | + /* Trigger lazy-state preservation if necessary */ | ||
225 | + if (s->v7m_lspact) { | ||
226 | + /* | ||
227 | + * Lazy state saving affects external memory and also the NVIC, | ||
228 | + * so we must mark it as an IO operation for icount. | ||
229 | + */ | ||
230 | + if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { | ||
231 | + gen_io_start(); | ||
232 | + } | ||
233 | + gen_helper_v7m_preserve_fp_state(cpu_env); | ||
234 | + if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { | ||
235 | + gen_io_end(); | ||
236 | + } | ||
237 | + /* | ||
238 | + * If the preserve_fp_state helper doesn't throw an exception | ||
239 | + * then it will clear LSPACT; we don't need to repeat this for | ||
240 | + * any further FP insns in this TB. | ||
241 | + */ | ||
242 | + s->v7m_lspact = false; | ||
243 | + } | ||
244 | + | ||
245 | /* Update ownership of FP context: set FPCCR.S to match current state */ | ||
246 | if (s->v8m_fpccr_s_wrong) { | ||
247 | TCGv_i32 tmp; | ||
248 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) | ||
249 | dc->v8m_fpccr_s_wrong = FIELD_EX32(tb_flags, TBFLAG_A32, FPCCR_S_WRONG); | ||
250 | dc->v7m_new_fp_ctxt_needed = | ||
251 | FIELD_EX32(tb_flags, TBFLAG_A32, NEW_FP_CTXT_NEEDED); | ||
252 | + dc->v7m_lspact = FIELD_EX32(tb_flags, TBFLAG_A32, LSPACT); | ||
253 | dc->cp_regs = cpu->cp_regs; | ||
254 | dc->features = env->features; | ||
255 | |||
256 | -- | 68 | -- |
257 | 2.20.1 | 69 | 2.25.1 |
258 | |||
259 | 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 | Message-id: 20220527181907.189259-40-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 17 +++-------------- | ||
9 | 1 file changed, 3 insertions(+), 14 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 do_zz_dbm(DisasContext *s, arg_rr_dbm *a, GVecGen2iFn *gvec_fn) | ||
16 | return gen_gvec_fn_zzi(s, gvec_fn, MO_64, a->rd, a->rn, imm); | ||
17 | } | ||
18 | |||
19 | -static bool trans_AND_zzi(DisasContext *s, arg_rr_dbm *a) | ||
20 | -{ | ||
21 | - return do_zz_dbm(s, a, tcg_gen_gvec_andi); | ||
22 | -} | ||
23 | - | ||
24 | -static bool trans_ORR_zzi(DisasContext *s, arg_rr_dbm *a) | ||
25 | -{ | ||
26 | - return do_zz_dbm(s, a, tcg_gen_gvec_ori); | ||
27 | -} | ||
28 | - | ||
29 | -static bool trans_EOR_zzi(DisasContext *s, arg_rr_dbm *a) | ||
30 | -{ | ||
31 | - return do_zz_dbm(s, a, tcg_gen_gvec_xori); | ||
32 | -} | ||
33 | +TRANS_FEAT(AND_zzi, aa64_sve, do_zz_dbm, a, tcg_gen_gvec_andi) | ||
34 | +TRANS_FEAT(ORR_zzi, aa64_sve, do_zz_dbm, a, tcg_gen_gvec_ori) | ||
35 | +TRANS_FEAT(EOR_zzi, aa64_sve, do_zz_dbm, a, tcg_gen_gvec_xori) | ||
36 | |||
37 | static bool trans_DUPM(DisasContext *s, arg_DUPM *a) | ||
38 | { | ||
39 | -- | ||
40 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | The check is already done in gen_gvec_ool_zzzp, | ||
4 | which is called by do_sel_z; remove from callers. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-41-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 14 ++++---------- | ||
12 | 1 file changed, 4 insertions(+), 10 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(UQSUB_zzz, aa64_sve, gen_gvec_fn_arg_zzz, tcg_gen_gvec_ussub, a) | ||
19 | /* Select active elememnts from Zn and inactive elements from Zm, | ||
20 | * storing the result in Zd. | ||
21 | */ | ||
22 | -static void do_sel_z(DisasContext *s, int rd, int rn, int rm, int pg, int esz) | ||
23 | +static bool do_sel_z(DisasContext *s, int rd, int rn, int rm, int pg, int esz) | ||
24 | { | ||
25 | static gen_helper_gvec_4 * const fns[4] = { | ||
26 | gen_helper_sve_sel_zpzz_b, gen_helper_sve_sel_zpzz_h, | ||
27 | gen_helper_sve_sel_zpzz_s, gen_helper_sve_sel_zpzz_d | ||
28 | }; | ||
29 | - gen_gvec_ool_zzzp(s, fns[esz], rd, rn, rm, pg, 0); | ||
30 | + return gen_gvec_ool_zzzp(s, fns[esz], rd, rn, rm, pg, 0); | ||
31 | } | ||
32 | |||
33 | #define DO_ZPZZ(NAME, FEAT, name) \ | ||
34 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(UDIV_zpzz, aa64_sve, gen_gvec_ool_arg_zpzz, udiv_fns[a->esz], a, 0) | ||
35 | |||
36 | static bool trans_SEL_zpzz(DisasContext *s, arg_rprr_esz *a) | ||
37 | { | ||
38 | - if (sve_access_check(s)) { | ||
39 | - do_sel_z(s, a->rd, a->rn, a->rm, a->pg, a->esz); | ||
40 | - } | ||
41 | - return true; | ||
42 | + return do_sel_z(s, a->rd, a->rn, a->rm, a->pg, a->esz); | ||
43 | } | ||
44 | |||
45 | /* | ||
46 | @@ -XXX,XX +XXX,XX @@ static bool trans_MOVPRFX(DisasContext *s, arg_MOVPRFX *a) | ||
47 | |||
48 | static bool trans_MOVPRFX_m(DisasContext *s, arg_rpr_esz *a) | ||
49 | { | ||
50 | - if (sve_access_check(s)) { | ||
51 | - do_sel_z(s, a->rd, a->rn, a->rd, a->pg, a->esz); | ||
52 | - } | ||
53 | - return true; | ||
54 | + return do_sel_z(s, a->rd, a->rn, a->rd, a->pg, a->esz); | ||
55 | } | ||
56 | |||
57 | static bool trans_MOVPRFX_z(DisasContext *s, arg_rpr_esz *a) | ||
58 | -- | ||
59 | 2.25.1 | diff view generated by jsdifflib |
1 | Implement the VLSTM instruction for v7M for the FPU present case. | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | We have two places that perform this particular operation. | ||
4 | |||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20220527181907.189259-42-richard.henderson@linaro.org | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | Message-id: 20190416125744.27770-25-peter.maydell@linaro.org | ||
6 | --- | 9 | --- |
7 | target/arm/cpu.h | 2 + | 10 | target/arm/translate-sve.c | 21 +++++++++++++-------- |
8 | target/arm/helper.h | 2 + | 11 | 1 file changed, 13 insertions(+), 8 deletions(-) |
9 | target/arm/helper.c | 84 ++++++++++++++++++++++++++++++++++++++++++ | ||
10 | target/arm/translate.c | 15 +++++++- | ||
11 | 4 files changed, 102 insertions(+), 1 deletion(-) | ||
12 | 12 | ||
13 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 13 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
14 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/cpu.h | 15 | --- a/target/arm/translate-sve.c |
16 | +++ b/target/arm/cpu.h | 16 | +++ b/target/arm/translate-sve.c |
17 | @@ -XXX,XX +XXX,XX @@ | 17 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_fn_zzi(DisasContext *s, GVecGen2iFn *gvec_fn, |
18 | #define EXCP_INVSTATE 18 /* v7M INVSTATE UsageFault */ | 18 | return true; |
19 | #define EXCP_STKOF 19 /* v8M STKOF UsageFault */ | ||
20 | #define EXCP_LAZYFP 20 /* v7M fault during lazy FP stacking */ | ||
21 | +#define EXCP_LSERR 21 /* v8M LSERR SecureFault */ | ||
22 | +#define EXCP_UNALIGNED 22 /* v7M UNALIGNED UsageFault */ | ||
23 | /* NB: add new EXCP_ defines to the array in arm_log_exception() too */ | ||
24 | |||
25 | #define ARMV7M_EXCP_RESET 1 | ||
26 | diff --git a/target/arm/helper.h b/target/arm/helper.h | ||
27 | index XXXXXXX..XXXXXXX 100644 | ||
28 | --- a/target/arm/helper.h | ||
29 | +++ b/target/arm/helper.h | ||
30 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_3(v7m_tt, i32, env, i32, i32) | ||
31 | |||
32 | DEF_HELPER_1(v7m_preserve_fp_state, void, env) | ||
33 | |||
34 | +DEF_HELPER_2(v7m_vlstm, void, env, i32) | ||
35 | + | ||
36 | DEF_HELPER_2(v8m_stackcheck, void, env, i32) | ||
37 | |||
38 | DEF_HELPER_4(access_check_cp_reg, void, env, ptr, i32, i32) | ||
39 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/target/arm/helper.c | ||
42 | +++ b/target/arm/helper.c | ||
43 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_preserve_fp_state)(CPUARMState *env) | ||
44 | g_assert_not_reached(); | ||
45 | } | 19 | } |
46 | 20 | ||
47 | +void HELPER(v7m_vlstm)(CPUARMState *env, uint32_t fptr) | 21 | +static bool gen_gvec_fn_arg_zzi(DisasContext *s, GVecGen2iFn *gvec_fn, |
22 | + arg_rri_esz *a) | ||
48 | +{ | 23 | +{ |
49 | + /* translate.c should never generate calls here in user-only mode */ | 24 | + if (a->esz < 0) { |
50 | + g_assert_not_reached(); | 25 | + /* Invalid tsz encoding -- see tszimm_esz. */ |
26 | + return false; | ||
27 | + } | ||
28 | + return gen_gvec_fn_zzi(s, gvec_fn, a->esz, a->rd, a->rn, a->imm); | ||
51 | +} | 29 | +} |
52 | + | 30 | + |
53 | uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr, uint32_t op) | 31 | /* Invoke a vector expander on three Zregs. */ |
32 | static bool gen_gvec_fn_zzz(DisasContext *s, GVecGen3Fn *gvec_fn, | ||
33 | int esz, int rd, int rn, int rm) | ||
34 | @@ -XXX,XX +XXX,XX @@ static bool trans_ADD_zzi(DisasContext *s, arg_rri_esz *a) | ||
35 | if (a->esz == 0 && extract32(s->insn, 13, 1)) { | ||
36 | return false; | ||
37 | } | ||
38 | - if (sve_access_check(s)) { | ||
39 | - unsigned vsz = vec_full_reg_size(s); | ||
40 | - tcg_gen_gvec_addi(a->esz, vec_full_reg_offset(s, a->rd), | ||
41 | - vec_full_reg_offset(s, a->rn), a->imm, vsz, vsz); | ||
42 | - } | ||
43 | - return true; | ||
44 | + return gen_gvec_fn_arg_zzi(s, tcg_gen_gvec_addi, a); | ||
45 | } | ||
46 | |||
47 | static bool trans_SUB_zzi(DisasContext *s, arg_rri_esz *a) | ||
48 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(ADCLT, aa64_sve2, do_adcl, a, true) | ||
49 | |||
50 | static bool do_sve2_fn2i(DisasContext *s, arg_rri_esz *a, GVecGen2iFn *fn) | ||
54 | { | 51 | { |
55 | /* The TT instructions can be used by unprivileged code, but in | 52 | - if (a->esz < 0 || !dc_isar_feature(aa64_sve2, s)) { |
56 | @@ -XXX,XX +XXX,XX @@ static void v7m_update_fpccr(CPUARMState *env, uint32_t frameptr, | 53 | + if (!dc_isar_feature(aa64_sve2, s)) { |
54 | return false; | ||
57 | } | 55 | } |
56 | - return gen_gvec_fn_zzi(s, fn, a->esz, a->rd, a->rn, a->imm); | ||
57 | + return gen_gvec_fn_arg_zzi(s, fn, a); | ||
58 | } | 58 | } |
59 | 59 | ||
60 | +void HELPER(v7m_vlstm)(CPUARMState *env, uint32_t fptr) | 60 | static bool trans_SSRA(DisasContext *s, arg_rri_esz *a) |
61 | +{ | ||
62 | + /* fptr is the value of Rn, the frame pointer we store the FP regs to */ | ||
63 | + bool s = env->v7m.fpccr[M_REG_S] & R_V7M_FPCCR_S_MASK; | ||
64 | + bool lspact = env->v7m.fpccr[s] & R_V7M_FPCCR_LSPACT_MASK; | ||
65 | + | ||
66 | + assert(env->v7m.secure); | ||
67 | + | ||
68 | + if (!(env->v7m.control[M_REG_S] & R_V7M_CONTROL_SFPA_MASK)) { | ||
69 | + return; | ||
70 | + } | ||
71 | + | ||
72 | + /* Check access to the coprocessor is permitted */ | ||
73 | + if (!v7m_cpacr_pass(env, true, arm_current_el(env) != 0)) { | ||
74 | + raise_exception_ra(env, EXCP_NOCP, 0, 1, GETPC()); | ||
75 | + } | ||
76 | + | ||
77 | + if (lspact) { | ||
78 | + /* LSPACT should not be active when there is active FP state */ | ||
79 | + raise_exception_ra(env, EXCP_LSERR, 0, 1, GETPC()); | ||
80 | + } | ||
81 | + | ||
82 | + if (fptr & 7) { | ||
83 | + raise_exception_ra(env, EXCP_UNALIGNED, 0, 1, GETPC()); | ||
84 | + } | ||
85 | + | ||
86 | + /* | ||
87 | + * Note that we do not use v7m_stack_write() here, because the | ||
88 | + * accesses should not set the FSR bits for stacking errors if they | ||
89 | + * fail. (In pseudocode terms, they are AccType_NORMAL, not AccType_STACK | ||
90 | + * or AccType_LAZYFP). Faults in cpu_stl_data() will throw exceptions | ||
91 | + * and longjmp out. | ||
92 | + */ | ||
93 | + if (!(env->v7m.fpccr[M_REG_S] & R_V7M_FPCCR_LSPEN_MASK)) { | ||
94 | + bool ts = env->v7m.fpccr[M_REG_S] & R_V7M_FPCCR_TS_MASK; | ||
95 | + int i; | ||
96 | + | ||
97 | + for (i = 0; i < (ts ? 32 : 16); i += 2) { | ||
98 | + uint64_t dn = *aa32_vfp_dreg(env, i / 2); | ||
99 | + uint32_t faddr = fptr + 4 * i; | ||
100 | + uint32_t slo = extract64(dn, 0, 32); | ||
101 | + uint32_t shi = extract64(dn, 32, 32); | ||
102 | + | ||
103 | + if (i >= 16) { | ||
104 | + faddr += 8; /* skip the slot for the FPSCR */ | ||
105 | + } | ||
106 | + cpu_stl_data(env, faddr, slo); | ||
107 | + cpu_stl_data(env, faddr + 4, shi); | ||
108 | + } | ||
109 | + cpu_stl_data(env, fptr + 0x40, vfp_get_fpscr(env)); | ||
110 | + | ||
111 | + /* | ||
112 | + * If TS is 0 then s0 to s15 and FPSCR are UNKNOWN; we choose to | ||
113 | + * leave them unchanged, matching our choice in v7m_preserve_fp_state. | ||
114 | + */ | ||
115 | + if (ts) { | ||
116 | + for (i = 0; i < 32; i += 2) { | ||
117 | + *aa32_vfp_dreg(env, i / 2) = 0; | ||
118 | + } | ||
119 | + vfp_set_fpscr(env, 0); | ||
120 | + } | ||
121 | + } else { | ||
122 | + v7m_update_fpccr(env, fptr, false); | ||
123 | + } | ||
124 | + | ||
125 | + env->v7m.control[M_REG_S] &= ~R_V7M_CONTROL_FPCA_MASK; | ||
126 | +} | ||
127 | + | ||
128 | static bool v7m_push_stack(ARMCPU *cpu) | ||
129 | { | ||
130 | /* Do the "set up stack frame" part of exception entry, | ||
131 | @@ -XXX,XX +XXX,XX @@ static void arm_log_exception(int idx) | ||
132 | [EXCP_INVSTATE] = "v7M INVSTATE UsageFault", | ||
133 | [EXCP_STKOF] = "v8M STKOF UsageFault", | ||
134 | [EXCP_LAZYFP] = "v7M exception during lazy FP stacking", | ||
135 | + [EXCP_LSERR] = "v8M LSERR UsageFault", | ||
136 | + [EXCP_UNALIGNED] = "v7M UNALIGNED UsageFault", | ||
137 | }; | ||
138 | |||
139 | if (idx >= 0 && idx < ARRAY_SIZE(excnames)) { | ||
140 | @@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs) | ||
141 | armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE, env->v7m.secure); | ||
142 | env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_STKOF_MASK; | ||
143 | break; | ||
144 | + case EXCP_LSERR: | ||
145 | + armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_SECURE, false); | ||
146 | + env->v7m.sfsr |= R_V7M_SFSR_LSERR_MASK; | ||
147 | + break; | ||
148 | + case EXCP_UNALIGNED: | ||
149 | + armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE, env->v7m.secure); | ||
150 | + env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_UNALIGNED_MASK; | ||
151 | + break; | ||
152 | case EXCP_SWI: | ||
153 | /* The PC already points to the next instruction. */ | ||
154 | armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_SVC, env->v7m.secure); | ||
155 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
156 | index XXXXXXX..XXXXXXX 100644 | ||
157 | --- a/target/arm/translate.c | ||
158 | +++ b/target/arm/translate.c | ||
159 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
160 | if (!s->v8m_secure || (insn & 0x0040f0ff)) { | ||
161 | goto illegal_op; | ||
162 | } | ||
163 | - /* Just NOP since FP support is not implemented */ | ||
164 | + | ||
165 | + if (arm_dc_feature(s, ARM_FEATURE_VFP)) { | ||
166 | + TCGv_i32 fptr = load_reg(s, rn); | ||
167 | + | ||
168 | + if (extract32(insn, 20, 1)) { | ||
169 | + /* VLLDM */ | ||
170 | + } else { | ||
171 | + gen_helper_v7m_vlstm(cpu_env, fptr); | ||
172 | + } | ||
173 | + tcg_temp_free_i32(fptr); | ||
174 | + | ||
175 | + /* End the TB, because we have updated FP control bits */ | ||
176 | + s->base.is_jmp = DISAS_UPDATE; | ||
177 | + } | ||
178 | break; | ||
179 | } | ||
180 | if (arm_dc_feature(s, ARM_FEATURE_VFP) && | ||
181 | -- | 61 | -- |
182 | 2.20.1 | 62 | 2.25.1 |
183 | |||
184 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions using do_sve2_fn2i | ||
4 | to use TRANS_FEAT and gen_gvec_fn_arg_zzi. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-43-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 43 ++++++-------------------------------- | ||
12 | 1 file changed, 6 insertions(+), 37 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static bool do_adcl(DisasContext *s, arg_rrrr_esz *a, bool sel) | ||
19 | TRANS_FEAT(ADCLB, aa64_sve2, do_adcl, a, false) | ||
20 | TRANS_FEAT(ADCLT, aa64_sve2, do_adcl, a, true) | ||
21 | |||
22 | -static bool do_sve2_fn2i(DisasContext *s, arg_rri_esz *a, GVecGen2iFn *fn) | ||
23 | -{ | ||
24 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
25 | - return false; | ||
26 | - } | ||
27 | - return gen_gvec_fn_arg_zzi(s, fn, a); | ||
28 | -} | ||
29 | - | ||
30 | -static bool trans_SSRA(DisasContext *s, arg_rri_esz *a) | ||
31 | -{ | ||
32 | - return do_sve2_fn2i(s, a, gen_gvec_ssra); | ||
33 | -} | ||
34 | - | ||
35 | -static bool trans_USRA(DisasContext *s, arg_rri_esz *a) | ||
36 | -{ | ||
37 | - return do_sve2_fn2i(s, a, gen_gvec_usra); | ||
38 | -} | ||
39 | - | ||
40 | -static bool trans_SRSRA(DisasContext *s, arg_rri_esz *a) | ||
41 | -{ | ||
42 | - return do_sve2_fn2i(s, a, gen_gvec_srsra); | ||
43 | -} | ||
44 | - | ||
45 | -static bool trans_URSRA(DisasContext *s, arg_rri_esz *a) | ||
46 | -{ | ||
47 | - return do_sve2_fn2i(s, a, gen_gvec_ursra); | ||
48 | -} | ||
49 | - | ||
50 | -static bool trans_SRI(DisasContext *s, arg_rri_esz *a) | ||
51 | -{ | ||
52 | - return do_sve2_fn2i(s, a, gen_gvec_sri); | ||
53 | -} | ||
54 | - | ||
55 | -static bool trans_SLI(DisasContext *s, arg_rri_esz *a) | ||
56 | -{ | ||
57 | - return do_sve2_fn2i(s, a, gen_gvec_sli); | ||
58 | -} | ||
59 | +TRANS_FEAT(SSRA, aa64_sve2, gen_gvec_fn_arg_zzi, gen_gvec_ssra, a) | ||
60 | +TRANS_FEAT(USRA, aa64_sve2, gen_gvec_fn_arg_zzi, gen_gvec_usra, a) | ||
61 | +TRANS_FEAT(SRSRA, aa64_sve2, gen_gvec_fn_arg_zzi, gen_gvec_srsra, a) | ||
62 | +TRANS_FEAT(URSRA, aa64_sve2, gen_gvec_fn_arg_zzi, gen_gvec_ursra, a) | ||
63 | +TRANS_FEAT(SRI, aa64_sve2, gen_gvec_fn_arg_zzi, gen_gvec_sri, a) | ||
64 | +TRANS_FEAT(SLI, aa64_sve2, gen_gvec_fn_arg_zzi, gen_gvec_sli, a) | ||
65 | |||
66 | TRANS_FEAT(SABA, aa64_sve2, gen_gvec_fn_arg_zzz, gen_gvec_saba, a) | ||
67 | TRANS_FEAT(UABA, aa64_sve2, gen_gvec_fn_arg_zzz, gen_gvec_uaba, a) | ||
68 | -- | ||
69 | 2.25.1 | diff view generated by jsdifflib |
1 | Like AArch64, M-profile floating point has no FPEXC enable | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | bit to gate floating point; so always set the VFPEN TB flag. | ||
3 | 2 | ||
4 | M-profile also has CPACR and NSACR similar to A-profile; | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
5 | they behave slightly differently: | 4 | Message-id: 20220527181907.189259-44-richard.henderson@linaro.org |
6 | * the CPACR is banked between Secure and Non-Secure | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
7 | * if the NSACR forces a trap then this is taken to | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | the Secure state, not the Non-Secure state | 7 | --- |
8 | target/arm/translate-sve.c | 20 +++++++------------- | ||
9 | 1 file changed, 7 insertions(+), 13 deletions(-) | ||
9 | 10 | ||
10 | Honour the CPACR and NSACR settings. The NSACR handling | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
11 | requires us to borrow the exception.target_el field | ||
12 | (usually meaningless for M profile) to distinguish the | ||
13 | NOCP UsageFault taken to Secure state from the more | ||
14 | usual fault taken to the current security state. | ||
15 | |||
16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
17 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
18 | Message-id: 20190416125744.27770-6-peter.maydell@linaro.org | ||
19 | --- | ||
20 | target/arm/helper.c | 55 +++++++++++++++++++++++++++++++++++++++--- | ||
21 | target/arm/translate.c | 10 ++++++-- | ||
22 | 2 files changed, 60 insertions(+), 5 deletions(-) | ||
23 | |||
24 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
25 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/target/arm/helper.c | 13 | --- a/target/arm/translate-sve.c |
27 | +++ b/target/arm/helper.c | 14 | +++ b/target/arm/translate-sve.c |
28 | @@ -XXX,XX +XXX,XX @@ uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx, | 15 | @@ -XXX,XX +XXX,XX @@ static bool do_vpz_ool(DisasContext *s, arg_rpr_esz *a, |
29 | return target_el; | ||
30 | } | 16 | } |
31 | 17 | ||
32 | +/* | 18 | #define DO_VPZ(NAME, name) \ |
33 | + * Return true if the v7M CPACR permits access to the FPU for the specified | 19 | -static bool trans_##NAME(DisasContext *s, arg_rpr_esz *a) \ |
34 | + * security state and privilege level. | 20 | -{ \ |
35 | + */ | 21 | - static gen_helper_gvec_reduc * const fns[4] = { \ |
36 | +static bool v7m_cpacr_pass(CPUARMState *env, bool is_secure, bool is_priv) | 22 | + static gen_helper_gvec_reduc * const name##_fns[4] = { \ |
37 | +{ | 23 | gen_helper_sve_##name##_b, gen_helper_sve_##name##_h, \ |
38 | + switch (extract32(env->v7m.cpacr[is_secure], 20, 2)) { | 24 | gen_helper_sve_##name##_s, gen_helper_sve_##name##_d, \ |
39 | + case 0: | 25 | }; \ |
40 | + case 2: /* UNPREDICTABLE: we treat like 0 */ | 26 | - return do_vpz_ool(s, a, fns[a->esz]); \ |
41 | + return false; | 27 | -} |
42 | + case 1: | 28 | + TRANS_FEAT(NAME, aa64_sve, do_vpz_ool, a, name##_fns[a->esz]) |
43 | + return is_priv; | 29 | |
44 | + case 3: | 30 | DO_VPZ(ORV, orv) |
45 | + return true; | 31 | DO_VPZ(ANDV, andv) |
46 | + default: | 32 | @@ -XXX,XX +XXX,XX @@ DO_VPZ(UMAXV, umaxv) |
47 | + g_assert_not_reached(); | 33 | DO_VPZ(SMINV, sminv) |
48 | + } | 34 | DO_VPZ(UMINV, uminv) |
49 | +} | 35 | |
50 | + | 36 | -static bool trans_SADDV(DisasContext *s, arg_rpr_esz *a) |
51 | static bool v7m_stack_write(ARMCPU *cpu, uint32_t addr, uint32_t value, | 37 | -{ |
52 | ARMMMUIdx mmu_idx, bool ignfault) | 38 | - static gen_helper_gvec_reduc * const fns[4] = { |
53 | { | 39 | - gen_helper_sve_saddv_b, gen_helper_sve_saddv_h, |
54 | @@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs) | 40 | - gen_helper_sve_saddv_s, NULL |
55 | env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_UNDEFINSTR_MASK; | 41 | - }; |
56 | break; | 42 | - return do_vpz_ool(s, a, fns[a->esz]); |
57 | case EXCP_NOCP: | 43 | -} |
58 | - armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE, env->v7m.secure); | 44 | +static gen_helper_gvec_reduc * const saddv_fns[4] = { |
59 | - env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_NOCP_MASK; | 45 | + gen_helper_sve_saddv_b, gen_helper_sve_saddv_h, |
60 | + { | 46 | + gen_helper_sve_saddv_s, NULL |
61 | + /* | 47 | +}; |
62 | + * NOCP might be directed to something other than the current | 48 | +TRANS_FEAT(SADDV, aa64_sve, do_vpz_ool, a, saddv_fns[a->esz]) |
63 | + * security state if this fault is because of NSACR; we indicate | 49 | |
64 | + * the target security state using exception.target_el. | 50 | #undef DO_VPZ |
65 | + */ | ||
66 | + int target_secstate; | ||
67 | + | ||
68 | + if (env->exception.target_el == 3) { | ||
69 | + target_secstate = M_REG_S; | ||
70 | + } else { | ||
71 | + target_secstate = env->v7m.secure; | ||
72 | + } | ||
73 | + armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE, target_secstate); | ||
74 | + env->v7m.cfsr[target_secstate] |= R_V7M_CFSR_NOCP_MASK; | ||
75 | break; | ||
76 | + } | ||
77 | case EXCP_INVSTATE: | ||
78 | armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE, env->v7m.secure); | ||
79 | env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_INVSTATE_MASK; | ||
80 | @@ -XXX,XX +XXX,XX @@ int fp_exception_el(CPUARMState *env, int cur_el) | ||
81 | return 0; | ||
82 | } | ||
83 | |||
84 | + if (arm_feature(env, ARM_FEATURE_M)) { | ||
85 | + /* CPACR can cause a NOCP UsageFault taken to current security state */ | ||
86 | + if (!v7m_cpacr_pass(env, env->v7m.secure, cur_el != 0)) { | ||
87 | + return 1; | ||
88 | + } | ||
89 | + | ||
90 | + if (arm_feature(env, ARM_FEATURE_M_SECURITY) && !env->v7m.secure) { | ||
91 | + if (!extract32(env->v7m.nsacr, 10, 1)) { | ||
92 | + /* FP insns cause a NOCP UsageFault taken to Secure */ | ||
93 | + return 3; | ||
94 | + } | ||
95 | + } | ||
96 | + | ||
97 | + return 0; | ||
98 | + } | ||
99 | + | ||
100 | /* The CPACR controls traps to EL1, or PL1 if we're 32 bit: | ||
101 | * 0, 2 : trap EL0 and EL1/PL1 accesses | ||
102 | * 1 : trap only EL0 accesses | ||
103 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
104 | flags = FIELD_DP32(flags, TBFLAG_A32, SCTLR_B, arm_sctlr_b(env)); | ||
105 | flags = FIELD_DP32(flags, TBFLAG_A32, NS, !access_secure_reg(env)); | ||
106 | if (env->vfp.xregs[ARM_VFP_FPEXC] & (1 << 30) | ||
107 | - || arm_el_is_aa64(env, 1)) { | ||
108 | + || arm_el_is_aa64(env, 1) || arm_feature(env, ARM_FEATURE_M)) { | ||
109 | flags = FIELD_DP32(flags, TBFLAG_A32, VFPEN, 1); | ||
110 | } | ||
111 | flags = FIELD_DP32(flags, TBFLAG_A32, XSCALE_CPAR, env->cp15.c15_cpar); | ||
112 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
113 | index XXXXXXX..XXXXXXX 100644 | ||
114 | --- a/target/arm/translate.c | ||
115 | +++ b/target/arm/translate.c | ||
116 | @@ -XXX,XX +XXX,XX @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) | ||
117 | * for attempts to execute invalid vfp/neon encodings with FP disabled. | ||
118 | */ | ||
119 | if (s->fp_excp_el) { | ||
120 | - gen_exception_insn(s, 4, EXCP_UDEF, | ||
121 | - syn_fp_access_trap(1, 0xe, false), s->fp_excp_el); | ||
122 | + if (arm_dc_feature(s, ARM_FEATURE_M)) { | ||
123 | + gen_exception_insn(s, 4, EXCP_NOCP, syn_uncategorized(), | ||
124 | + s->fp_excp_el); | ||
125 | + } else { | ||
126 | + gen_exception_insn(s, 4, EXCP_UDEF, | ||
127 | + syn_fp_access_trap(1, 0xe, false), | ||
128 | + s->fp_excp_el); | ||
129 | + } | ||
130 | return 0; | ||
131 | } | ||
132 | 51 | ||
133 | -- | 52 | -- |
134 | 2.20.1 | 53 | 2.25.1 |
135 | |||
136 | 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 | Message-id: 20220527181907.189259-45-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 17 +++-------------- | ||
9 | 1 file changed, 3 insertions(+), 14 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 do_shift_imm(DisasContext *s, arg_rri_esz *a, bool asr, | ||
16 | return true; | ||
17 | } | ||
18 | |||
19 | -static bool trans_ASR_zzi(DisasContext *s, arg_rri_esz *a) | ||
20 | -{ | ||
21 | - return do_shift_imm(s, a, true, tcg_gen_gvec_sari); | ||
22 | -} | ||
23 | - | ||
24 | -static bool trans_LSR_zzi(DisasContext *s, arg_rri_esz *a) | ||
25 | -{ | ||
26 | - return do_shift_imm(s, a, false, tcg_gen_gvec_shri); | ||
27 | -} | ||
28 | - | ||
29 | -static bool trans_LSL_zzi(DisasContext *s, arg_rri_esz *a) | ||
30 | -{ | ||
31 | - return do_shift_imm(s, a, false, tcg_gen_gvec_shli); | ||
32 | -} | ||
33 | +TRANS_FEAT(ASR_zzi, aa64_sve, do_shift_imm, a, true, tcg_gen_gvec_sari) | ||
34 | +TRANS_FEAT(LSR_zzi, aa64_sve, do_shift_imm, a, false, tcg_gen_gvec_shri) | ||
35 | +TRANS_FEAT(LSL_zzi, aa64_sve, do_shift_imm, a, false, tcg_gen_gvec_shli) | ||
36 | |||
37 | #define DO_ZZW(NAME, name) \ | ||
38 | static gen_helper_gvec_3 * const name##_zzw_fns[4] = { \ | ||
39 | -- | ||
40 | 2.25.1 | diff view generated by jsdifflib |
1 | Handle floating point registers in exception entry. | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | This corresponds to the FP-specific parts of the pseudocode | ||
3 | functions ActivateException() and PushStack(). | ||
4 | 2 | ||
5 | We defer the code corresponding to UpdateFPCCR() to a later patch. | 3 | Share code between the various shifts using arg_rpri_esz. |
6 | 4 | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20220527181907.189259-46-richard.henderson@linaro.org | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20190416125744.27770-11-peter.maydell@linaro.org | ||
10 | --- | 9 | --- |
11 | target/arm/helper.c | 98 +++++++++++++++++++++++++++++++++++++++++++-- | 10 | target/arm/translate-sve.c | 68 +++++++++++++++++--------------------- |
12 | 1 file changed, 95 insertions(+), 3 deletions(-) | 11 | 1 file changed, 30 insertions(+), 38 deletions(-) |
13 | 12 | ||
14 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 13 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
15 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/helper.c | 15 | --- a/target/arm/translate-sve.c |
17 | +++ b/target/arm/helper.c | 16 | +++ b/target/arm/translate-sve.c |
18 | @@ -XXX,XX +XXX,XX @@ static void v7m_exception_taken(ARMCPU *cpu, uint32_t lr, bool dotailchain, | 17 | @@ -XXX,XX +XXX,XX @@ static bool do_movz_zpz(DisasContext *s, int rd, int rn, int pg, |
19 | switch_v7m_security_state(env, targets_secure); | 18 | return gen_gvec_ool_zzp(s, fns[esz], rd, rn, pg, invert); |
20 | write_v7m_control_spsel(env, 0); | 19 | } |
21 | arm_clear_exclusive(env); | 20 | |
22 | + /* Clear SFPA and FPCA (has no effect if no FPU) */ | 21 | +static bool do_shift_zpzi(DisasContext *s, arg_rpri_esz *a, bool asr, |
23 | + env->v7m.control[M_REG_S] &= | 22 | + gen_helper_gvec_3 * const fns[4]) |
24 | + ~(R_V7M_CONTROL_FPCA_MASK | R_V7M_CONTROL_SFPA_MASK); | 23 | +{ |
25 | /* Clear IT bits */ | 24 | + int max; |
26 | env->condexec_bits = 0; | ||
27 | env->regs[14] = lr; | ||
28 | @@ -XXX,XX +XXX,XX @@ static bool v7m_push_stack(ARMCPU *cpu) | ||
29 | uint32_t xpsr = xpsr_read(env); | ||
30 | uint32_t frameptr = env->regs[13]; | ||
31 | ARMMMUIdx mmu_idx = arm_mmu_idx(env); | ||
32 | + uint32_t framesize; | ||
33 | + bool nsacr_cp10 = extract32(env->v7m.nsacr, 10, 1); | ||
34 | + | 25 | + |
35 | + if ((env->v7m.control[M_REG_S] & R_V7M_CONTROL_FPCA_MASK) && | 26 | + if (a->esz < 0) { |
36 | + (env->v7m.secure || nsacr_cp10)) { | 27 | + /* Invalid tsz encoding -- see tszimm_esz. */ |
37 | + if (env->v7m.secure && | 28 | + return false; |
38 | + env->v7m.fpccr[M_REG_S] & R_V7M_FPCCR_TS_MASK) { | ||
39 | + framesize = 0xa8; | ||
40 | + } else { | ||
41 | + framesize = 0x68; | ||
42 | + } | ||
43 | + } else { | ||
44 | + framesize = 0x20; | ||
45 | + } | ||
46 | |||
47 | /* Align stack pointer if the guest wants that */ | ||
48 | if ((frameptr & 4) && | ||
49 | @@ -XXX,XX +XXX,XX @@ static bool v7m_push_stack(ARMCPU *cpu) | ||
50 | xpsr |= XPSR_SPREALIGN; | ||
51 | } | ||
52 | |||
53 | - frameptr -= 0x20; | ||
54 | + xpsr &= ~XPSR_SFPA; | ||
55 | + if (env->v7m.secure && | ||
56 | + (env->v7m.control[M_REG_S] & R_V7M_CONTROL_SFPA_MASK)) { | ||
57 | + xpsr |= XPSR_SFPA; | ||
58 | + } | 29 | + } |
59 | + | 30 | + |
60 | + frameptr -= framesize; | 31 | + /* |
61 | 32 | + * Shift by element size is architecturally valid. | |
62 | if (arm_feature(env, ARM_FEATURE_V8)) { | 33 | + * For arithmetic right-shift, it's the same as by one less. |
63 | uint32_t limit = v7m_sp_limit(env); | 34 | + * For logical shifts and ASRD, it is a zeroing operation. |
64 | @@ -XXX,XX +XXX,XX @@ static bool v7m_push_stack(ARMCPU *cpu) | 35 | + */ |
65 | v7m_stack_write(cpu, frameptr + 24, env->regs[15], mmu_idx, false) && | 36 | + max = 8 << a->esz; |
66 | v7m_stack_write(cpu, frameptr + 28, xpsr, mmu_idx, false); | 37 | + if (a->imm >= max) { |
67 | 38 | + if (asr) { | |
68 | + if (env->v7m.control[M_REG_S] & R_V7M_CONTROL_FPCA_MASK) { | 39 | + a->imm = max - 1; |
69 | + /* FPU is active, try to save its registers */ | ||
70 | + bool fpccr_s = env->v7m.fpccr[M_REG_S] & R_V7M_FPCCR_S_MASK; | ||
71 | + bool lspact = env->v7m.fpccr[fpccr_s] & R_V7M_FPCCR_LSPACT_MASK; | ||
72 | + | ||
73 | + if (lspact && arm_feature(env, ARM_FEATURE_M_SECURITY)) { | ||
74 | + qemu_log_mask(CPU_LOG_INT, | ||
75 | + "...SecureFault because LSPACT and FPCA both set\n"); | ||
76 | + env->v7m.sfsr |= R_V7M_SFSR_LSERR_MASK; | ||
77 | + armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_SECURE, false); | ||
78 | + } else if (!env->v7m.secure && !nsacr_cp10) { | ||
79 | + qemu_log_mask(CPU_LOG_INT, | ||
80 | + "...Secure UsageFault with CFSR.NOCP because " | ||
81 | + "NSACR.CP10 prevents stacking FP regs\n"); | ||
82 | + armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE, M_REG_S); | ||
83 | + env->v7m.cfsr[M_REG_S] |= R_V7M_CFSR_NOCP_MASK; | ||
84 | + } else { | 40 | + } else { |
85 | + if (!(env->v7m.fpccr[M_REG_S] & R_V7M_FPCCR_LSPEN_MASK)) { | 41 | + return do_movz_zpz(s, a->rd, a->rd, a->pg, a->esz, true); |
86 | + /* Lazy stacking disabled, save registers now */ | ||
87 | + int i; | ||
88 | + bool cpacr_pass = v7m_cpacr_pass(env, env->v7m.secure, | ||
89 | + arm_current_el(env) != 0); | ||
90 | + | ||
91 | + if (stacked_ok && !cpacr_pass) { | ||
92 | + /* | ||
93 | + * Take UsageFault if CPACR forbids access. The pseudocode | ||
94 | + * here does a full CheckCPEnabled() but we know the NSACR | ||
95 | + * check can never fail as we have already handled that. | ||
96 | + */ | ||
97 | + qemu_log_mask(CPU_LOG_INT, | ||
98 | + "...UsageFault with CFSR.NOCP because " | ||
99 | + "CPACR.CP10 prevents stacking FP regs\n"); | ||
100 | + armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE, | ||
101 | + env->v7m.secure); | ||
102 | + env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_NOCP_MASK; | ||
103 | + stacked_ok = false; | ||
104 | + } | ||
105 | + | ||
106 | + for (i = 0; i < ((framesize == 0xa8) ? 32 : 16); i += 2) { | ||
107 | + uint64_t dn = *aa32_vfp_dreg(env, i / 2); | ||
108 | + uint32_t faddr = frameptr + 0x20 + 4 * i; | ||
109 | + uint32_t slo = extract64(dn, 0, 32); | ||
110 | + uint32_t shi = extract64(dn, 32, 32); | ||
111 | + | ||
112 | + if (i >= 16) { | ||
113 | + faddr += 8; /* skip the slot for the FPSCR */ | ||
114 | + } | ||
115 | + stacked_ok = stacked_ok && | ||
116 | + v7m_stack_write(cpu, faddr, slo, mmu_idx, false) && | ||
117 | + v7m_stack_write(cpu, faddr + 4, shi, mmu_idx, false); | ||
118 | + } | ||
119 | + stacked_ok = stacked_ok && | ||
120 | + v7m_stack_write(cpu, frameptr + 0x60, | ||
121 | + vfp_get_fpscr(env), mmu_idx, false); | ||
122 | + if (cpacr_pass) { | ||
123 | + for (i = 0; i < ((framesize == 0xa8) ? 32 : 16); i += 2) { | ||
124 | + *aa32_vfp_dreg(env, i / 2) = 0; | ||
125 | + } | ||
126 | + vfp_set_fpscr(env, 0); | ||
127 | + } | ||
128 | + } else { | ||
129 | + /* Lazy stacking enabled, save necessary info to stack later */ | ||
130 | + /* TODO : equivalent of UpdateFPCCR() pseudocode */ | ||
131 | + } | ||
132 | + } | 42 | + } |
133 | + } | 43 | + } |
44 | + return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | ||
45 | +} | ||
134 | + | 46 | + |
135 | /* | 47 | static bool trans_ASR_zpzi(DisasContext *s, arg_rpri_esz *a) |
136 | * If we broke a stack limit then SP was already updated earlier; | 48 | { |
137 | * otherwise we update SP regardless of whether any of the stack | 49 | static gen_helper_gvec_3 * const fns[4] = { |
138 | @@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs) | 50 | gen_helper_sve_asr_zpzi_b, gen_helper_sve_asr_zpzi_h, |
139 | 51 | gen_helper_sve_asr_zpzi_s, gen_helper_sve_asr_zpzi_d, | |
140 | if (arm_feature(env, ARM_FEATURE_V8)) { | 52 | }; |
141 | lr = R_V7M_EXCRET_RES1_MASK | | 53 | - if (a->esz < 0) { |
142 | - R_V7M_EXCRET_DCRS_MASK | | 54 | - /* Invalid tsz encoding -- see tszimm_esz. */ |
143 | - R_V7M_EXCRET_FTYPE_MASK; | 55 | - return false; |
144 | + R_V7M_EXCRET_DCRS_MASK; | 56 | - } |
145 | /* The S bit indicates whether we should return to Secure | 57 | - /* Shift by element size is architecturally valid. For |
146 | * or NonSecure (ie our current state). | 58 | - arithmetic right-shift, it's the same as by one less. */ |
147 | * The ES bit indicates whether we're taking this exception | 59 | - a->imm = MIN(a->imm, (8 << a->esz) - 1); |
148 | @@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs) | 60 | - return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); |
149 | if (env->v7m.secure) { | 61 | + return do_shift_zpzi(s, a, true, fns); |
150 | lr |= R_V7M_EXCRET_S_MASK; | 62 | } |
151 | } | 63 | |
152 | + if (!(env->v7m.control[M_REG_S] & R_V7M_CONTROL_FPCA_MASK)) { | 64 | static bool trans_LSR_zpzi(DisasContext *s, arg_rpri_esz *a) |
153 | + lr |= R_V7M_EXCRET_FTYPE_MASK; | 65 | @@ -XXX,XX +XXX,XX @@ static bool trans_LSR_zpzi(DisasContext *s, arg_rpri_esz *a) |
154 | + } | 66 | gen_helper_sve_lsr_zpzi_b, gen_helper_sve_lsr_zpzi_h, |
155 | } else { | 67 | gen_helper_sve_lsr_zpzi_s, gen_helper_sve_lsr_zpzi_d, |
156 | lr = R_V7M_EXCRET_RES1_MASK | | 68 | }; |
157 | R_V7M_EXCRET_S_MASK | | 69 | - if (a->esz < 0) { |
70 | - return false; | ||
71 | - } | ||
72 | - /* Shift by element size is architecturally valid. | ||
73 | - For logical shifts, it is a zeroing operation. */ | ||
74 | - if (a->imm >= (8 << a->esz)) { | ||
75 | - return do_movz_zpz(s, a->rd, a->rd, a->pg, a->esz, true); | ||
76 | - } else { | ||
77 | - return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | ||
78 | - } | ||
79 | + return do_shift_zpzi(s, a, false, fns); | ||
80 | } | ||
81 | |||
82 | static bool trans_LSL_zpzi(DisasContext *s, arg_rpri_esz *a) | ||
83 | @@ -XXX,XX +XXX,XX @@ static bool trans_LSL_zpzi(DisasContext *s, arg_rpri_esz *a) | ||
84 | gen_helper_sve_lsl_zpzi_b, gen_helper_sve_lsl_zpzi_h, | ||
85 | gen_helper_sve_lsl_zpzi_s, gen_helper_sve_lsl_zpzi_d, | ||
86 | }; | ||
87 | - if (a->esz < 0) { | ||
88 | - return false; | ||
89 | - } | ||
90 | - /* Shift by element size is architecturally valid. | ||
91 | - For logical shifts, it is a zeroing operation. */ | ||
92 | - if (a->imm >= (8 << a->esz)) { | ||
93 | - return do_movz_zpz(s, a->rd, a->rd, a->pg, a->esz, true); | ||
94 | - } else { | ||
95 | - return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | ||
96 | - } | ||
97 | + return do_shift_zpzi(s, a, false, fns); | ||
98 | } | ||
99 | |||
100 | static bool trans_ASRD(DisasContext *s, arg_rpri_esz *a) | ||
101 | @@ -XXX,XX +XXX,XX @@ static bool trans_ASRD(DisasContext *s, arg_rpri_esz *a) | ||
102 | gen_helper_sve_asrd_b, gen_helper_sve_asrd_h, | ||
103 | gen_helper_sve_asrd_s, gen_helper_sve_asrd_d, | ||
104 | }; | ||
105 | - if (a->esz < 0) { | ||
106 | - return false; | ||
107 | - } | ||
108 | - /* Shift by element size is architecturally valid. For arithmetic | ||
109 | - right shift for division, it is a zeroing operation. */ | ||
110 | - if (a->imm >= (8 << a->esz)) { | ||
111 | - return do_movz_zpz(s, a->rd, a->rd, a->pg, a->esz, true); | ||
112 | - } else { | ||
113 | - return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | ||
114 | - } | ||
115 | + return do_shift_zpzi(s, a, false, fns); | ||
116 | } | ||
117 | |||
118 | static gen_helper_gvec_3 * const sqshl_zpzi_fns[4] = { | ||
158 | -- | 119 | -- |
159 | 2.20.1 | 120 | 2.25.1 |
160 | |||
161 | 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 | Message-id: 20220527181907.189259-47-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 52 +++++++++++++++----------------------- | ||
9 | 1 file changed, 20 insertions(+), 32 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 do_shift_zpzi(DisasContext *s, arg_rpri_esz *a, bool asr, | ||
16 | return gen_gvec_ool_arg_zpzi(s, fns[a->esz], a); | ||
17 | } | ||
18 | |||
19 | -static bool trans_ASR_zpzi(DisasContext *s, arg_rpri_esz *a) | ||
20 | -{ | ||
21 | - static gen_helper_gvec_3 * const fns[4] = { | ||
22 | - gen_helper_sve_asr_zpzi_b, gen_helper_sve_asr_zpzi_h, | ||
23 | - gen_helper_sve_asr_zpzi_s, gen_helper_sve_asr_zpzi_d, | ||
24 | - }; | ||
25 | - return do_shift_zpzi(s, a, true, fns); | ||
26 | -} | ||
27 | +static gen_helper_gvec_3 * const asr_zpzi_fns[4] = { | ||
28 | + gen_helper_sve_asr_zpzi_b, gen_helper_sve_asr_zpzi_h, | ||
29 | + gen_helper_sve_asr_zpzi_s, gen_helper_sve_asr_zpzi_d, | ||
30 | +}; | ||
31 | +TRANS_FEAT(ASR_zpzi, aa64_sve, do_shift_zpzi, a, true, asr_zpzi_fns) | ||
32 | |||
33 | -static bool trans_LSR_zpzi(DisasContext *s, arg_rpri_esz *a) | ||
34 | -{ | ||
35 | - static gen_helper_gvec_3 * const fns[4] = { | ||
36 | - gen_helper_sve_lsr_zpzi_b, gen_helper_sve_lsr_zpzi_h, | ||
37 | - gen_helper_sve_lsr_zpzi_s, gen_helper_sve_lsr_zpzi_d, | ||
38 | - }; | ||
39 | - return do_shift_zpzi(s, a, false, fns); | ||
40 | -} | ||
41 | +static gen_helper_gvec_3 * const lsr_zpzi_fns[4] = { | ||
42 | + gen_helper_sve_lsr_zpzi_b, gen_helper_sve_lsr_zpzi_h, | ||
43 | + gen_helper_sve_lsr_zpzi_s, gen_helper_sve_lsr_zpzi_d, | ||
44 | +}; | ||
45 | +TRANS_FEAT(LSR_zpzi, aa64_sve, do_shift_zpzi, a, false, lsr_zpzi_fns) | ||
46 | |||
47 | -static bool trans_LSL_zpzi(DisasContext *s, arg_rpri_esz *a) | ||
48 | -{ | ||
49 | - static gen_helper_gvec_3 * const fns[4] = { | ||
50 | - gen_helper_sve_lsl_zpzi_b, gen_helper_sve_lsl_zpzi_h, | ||
51 | - gen_helper_sve_lsl_zpzi_s, gen_helper_sve_lsl_zpzi_d, | ||
52 | - }; | ||
53 | - return do_shift_zpzi(s, a, false, fns); | ||
54 | -} | ||
55 | +static gen_helper_gvec_3 * const lsl_zpzi_fns[4] = { | ||
56 | + gen_helper_sve_lsl_zpzi_b, gen_helper_sve_lsl_zpzi_h, | ||
57 | + gen_helper_sve_lsl_zpzi_s, gen_helper_sve_lsl_zpzi_d, | ||
58 | +}; | ||
59 | +TRANS_FEAT(LSL_zpzi, aa64_sve, do_shift_zpzi, a, false, lsl_zpzi_fns) | ||
60 | |||
61 | -static bool trans_ASRD(DisasContext *s, arg_rpri_esz *a) | ||
62 | -{ | ||
63 | - static gen_helper_gvec_3 * const fns[4] = { | ||
64 | - gen_helper_sve_asrd_b, gen_helper_sve_asrd_h, | ||
65 | - gen_helper_sve_asrd_s, gen_helper_sve_asrd_d, | ||
66 | - }; | ||
67 | - return do_shift_zpzi(s, a, false, fns); | ||
68 | -} | ||
69 | +static gen_helper_gvec_3 * const asrd_fns[4] = { | ||
70 | + gen_helper_sve_asrd_b, gen_helper_sve_asrd_h, | ||
71 | + gen_helper_sve_asrd_s, gen_helper_sve_asrd_d, | ||
72 | +}; | ||
73 | +TRANS_FEAT(ASRD, aa64_sve, do_shift_zpzi, a, false, asrd_fns) | ||
74 | |||
75 | static gen_helper_gvec_3 * const sqshl_zpzi_fns[4] = { | ||
76 | gen_helper_sve2_sqshl_zpzi_b, gen_helper_sve2_sqshl_zpzi_h, | ||
77 | -- | ||
78 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Remove the DO_ZPZZZ macro, as it had just the two uses. | ||
4 | |||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20220527181907.189259-48-richard.henderson@linaro.org | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | target/arm/translate-sve.c | 23 ++++++++++------------- | ||
11 | 1 file changed, 10 insertions(+), 13 deletions(-) | ||
12 | |||
13 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/arm/translate-sve.c | ||
16 | +++ b/target/arm/translate-sve.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static bool do_zpzzz_ool(DisasContext *s, arg_rprrr_esz *a, | ||
18 | return true; | ||
19 | } | ||
20 | |||
21 | -#define DO_ZPZZZ(NAME, name) \ | ||
22 | -static bool trans_##NAME(DisasContext *s, arg_rprrr_esz *a) \ | ||
23 | -{ \ | ||
24 | - static gen_helper_gvec_5 * const fns[4] = { \ | ||
25 | - gen_helper_sve_##name##_b, gen_helper_sve_##name##_h, \ | ||
26 | - gen_helper_sve_##name##_s, gen_helper_sve_##name##_d, \ | ||
27 | - }; \ | ||
28 | - return do_zpzzz_ool(s, a, fns[a->esz]); \ | ||
29 | -} | ||
30 | +static gen_helper_gvec_5 * const mla_fns[4] = { | ||
31 | + gen_helper_sve_mla_b, gen_helper_sve_mla_h, | ||
32 | + gen_helper_sve_mla_s, gen_helper_sve_mla_d, | ||
33 | +}; | ||
34 | +TRANS_FEAT(MLA, aa64_sve, do_zpzzz_ool, a, mla_fns[a->esz]) | ||
35 | |||
36 | -DO_ZPZZZ(MLA, mla) | ||
37 | -DO_ZPZZZ(MLS, mls) | ||
38 | - | ||
39 | -#undef DO_ZPZZZ | ||
40 | +static gen_helper_gvec_5 * const mls_fns[4] = { | ||
41 | + gen_helper_sve_mls_b, gen_helper_sve_mls_h, | ||
42 | + gen_helper_sve_mls_s, gen_helper_sve_mls_d, | ||
43 | +}; | ||
44 | +TRANS_FEAT(MLS, aa64_sve, do_zpzzz_ool, a, mls_fns[a->esz]) | ||
45 | |||
46 | /* | ||
47 | *** SVE Index Generation Group | ||
48 | -- | ||
49 | 2.25.1 | diff view generated by jsdifflib |
1 | The TailChain() pseudocode specifies that a tail chaining | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | exception should sanitize the excReturn all-ones bits and | ||
3 | (if there is no FPU) the excReturn FType bits; we weren't | ||
4 | doing this. | ||
5 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-49-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@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: 20190416125744.27770-14-peter.maydell@linaro.org | ||
9 | --- | 7 | --- |
10 | target/arm/helper.c | 8 ++++++++ | 8 | target/arm/translate-sve.c | 53 ++++++++++++++++++-------------------- |
11 | 1 file changed, 8 insertions(+) | 9 | 1 file changed, 25 insertions(+), 28 deletions(-) |
12 | 10 | ||
13 | diff --git a/target/arm/helper.c b/target/arm/helper.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/helper.c | 13 | --- a/target/arm/translate-sve.c |
16 | +++ b/target/arm/helper.c | 14 | +++ b/target/arm/translate-sve.c |
17 | @@ -XXX,XX +XXX,XX @@ static void v7m_exception_taken(ARMCPU *cpu, uint32_t lr, bool dotailchain, | 15 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(MLS, aa64_sve, do_zpzzz_ool, a, mls_fns[a->esz]) |
18 | qemu_log_mask(CPU_LOG_INT, "...taking pending %s exception %d\n", | 16 | *** SVE Index Generation Group |
19 | targets_secure ? "secure" : "nonsecure", exc); | 17 | */ |
20 | 18 | ||
21 | + if (dotailchain) { | 19 | -static void do_index(DisasContext *s, int esz, int rd, |
22 | + /* Sanitize LR FType and PREFIX bits */ | 20 | +static bool do_index(DisasContext *s, int esz, int rd, |
23 | + if (!arm_feature(env, ARM_FEATURE_VFP)) { | 21 | TCGv_i64 start, TCGv_i64 incr) |
24 | + lr |= R_V7M_EXCRET_FTYPE_MASK; | 22 | { |
25 | + } | 23 | - unsigned vsz = vec_full_reg_size(s); |
26 | + lr = deposit32(lr, 24, 8, 0xff); | 24 | - TCGv_i32 desc = tcg_constant_i32(simd_desc(vsz, vsz, 0)); |
25 | - TCGv_ptr t_zd = tcg_temp_new_ptr(); | ||
26 | + unsigned vsz; | ||
27 | + TCGv_i32 desc; | ||
28 | + TCGv_ptr t_zd; | ||
29 | + | ||
30 | + if (!sve_access_check(s)) { | ||
31 | + return true; | ||
27 | + } | 32 | + } |
28 | + | 33 | + |
29 | if (arm_feature(env, ARM_FEATURE_V8)) { | 34 | + vsz = vec_full_reg_size(s); |
30 | if (arm_feature(env, ARM_FEATURE_M_SECURITY) && | 35 | + desc = tcg_constant_i32(simd_desc(vsz, vsz, 0)); |
31 | (lr & R_V7M_EXCRET_S_MASK)) { | 36 | + t_zd = tcg_temp_new_ptr(); |
37 | |||
38 | tcg_gen_addi_ptr(t_zd, cpu_env, vec_full_reg_offset(s, rd)); | ||
39 | if (esz == 3) { | ||
40 | @@ -XXX,XX +XXX,XX @@ static void do_index(DisasContext *s, int esz, int rd, | ||
41 | tcg_temp_free_i32(i32); | ||
42 | } | ||
43 | tcg_temp_free_ptr(t_zd); | ||
44 | + return true; | ||
45 | } | ||
46 | |||
47 | static bool trans_INDEX_ii(DisasContext *s, arg_INDEX_ii *a) | ||
48 | { | ||
49 | - if (sve_access_check(s)) { | ||
50 | - TCGv_i64 start = tcg_constant_i64(a->imm1); | ||
51 | - TCGv_i64 incr = tcg_constant_i64(a->imm2); | ||
52 | - do_index(s, a->esz, a->rd, start, incr); | ||
53 | - } | ||
54 | - return true; | ||
55 | + TCGv_i64 start = tcg_constant_i64(a->imm1); | ||
56 | + TCGv_i64 incr = tcg_constant_i64(a->imm2); | ||
57 | + return do_index(s, a->esz, a->rd, start, incr); | ||
58 | } | ||
59 | |||
60 | static bool trans_INDEX_ir(DisasContext *s, arg_INDEX_ir *a) | ||
61 | { | ||
62 | - if (sve_access_check(s)) { | ||
63 | - TCGv_i64 start = tcg_constant_i64(a->imm); | ||
64 | - TCGv_i64 incr = cpu_reg(s, a->rm); | ||
65 | - do_index(s, a->esz, a->rd, start, incr); | ||
66 | - } | ||
67 | - return true; | ||
68 | + TCGv_i64 start = tcg_constant_i64(a->imm); | ||
69 | + TCGv_i64 incr = cpu_reg(s, a->rm); | ||
70 | + return do_index(s, a->esz, a->rd, start, incr); | ||
71 | } | ||
72 | |||
73 | static bool trans_INDEX_ri(DisasContext *s, arg_INDEX_ri *a) | ||
74 | { | ||
75 | - if (sve_access_check(s)) { | ||
76 | - TCGv_i64 start = cpu_reg(s, a->rn); | ||
77 | - TCGv_i64 incr = tcg_constant_i64(a->imm); | ||
78 | - do_index(s, a->esz, a->rd, start, incr); | ||
79 | - } | ||
80 | - return true; | ||
81 | + TCGv_i64 start = cpu_reg(s, a->rn); | ||
82 | + TCGv_i64 incr = tcg_constant_i64(a->imm); | ||
83 | + return do_index(s, a->esz, a->rd, start, incr); | ||
84 | } | ||
85 | |||
86 | static bool trans_INDEX_rr(DisasContext *s, arg_INDEX_rr *a) | ||
87 | { | ||
88 | - if (sve_access_check(s)) { | ||
89 | - TCGv_i64 start = cpu_reg(s, a->rn); | ||
90 | - TCGv_i64 incr = cpu_reg(s, a->rm); | ||
91 | - do_index(s, a->esz, a->rd, start, incr); | ||
92 | - } | ||
93 | - return true; | ||
94 | + TCGv_i64 start = cpu_reg(s, a->rn); | ||
95 | + TCGv_i64 incr = cpu_reg(s, a->rm); | ||
96 | + return do_index(s, a->esz, a->rd, start, incr); | ||
97 | } | ||
98 | |||
99 | /* | ||
32 | -- | 100 | -- |
33 | 2.20.1 | 101 | 2.25.1 |
34 | |||
35 | 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 | Message-id: 20220527181907.189259-50-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 35 ++++++++--------------------------- | ||
9 | 1 file changed, 8 insertions(+), 27 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 do_index(DisasContext *s, int esz, int rd, | ||
16 | return true; | ||
17 | } | ||
18 | |||
19 | -static bool trans_INDEX_ii(DisasContext *s, arg_INDEX_ii *a) | ||
20 | -{ | ||
21 | - TCGv_i64 start = tcg_constant_i64(a->imm1); | ||
22 | - TCGv_i64 incr = tcg_constant_i64(a->imm2); | ||
23 | - return do_index(s, a->esz, a->rd, start, incr); | ||
24 | -} | ||
25 | - | ||
26 | -static bool trans_INDEX_ir(DisasContext *s, arg_INDEX_ir *a) | ||
27 | -{ | ||
28 | - TCGv_i64 start = tcg_constant_i64(a->imm); | ||
29 | - TCGv_i64 incr = cpu_reg(s, a->rm); | ||
30 | - return do_index(s, a->esz, a->rd, start, incr); | ||
31 | -} | ||
32 | - | ||
33 | -static bool trans_INDEX_ri(DisasContext *s, arg_INDEX_ri *a) | ||
34 | -{ | ||
35 | - TCGv_i64 start = cpu_reg(s, a->rn); | ||
36 | - TCGv_i64 incr = tcg_constant_i64(a->imm); | ||
37 | - return do_index(s, a->esz, a->rd, start, incr); | ||
38 | -} | ||
39 | - | ||
40 | -static bool trans_INDEX_rr(DisasContext *s, arg_INDEX_rr *a) | ||
41 | -{ | ||
42 | - TCGv_i64 start = cpu_reg(s, a->rn); | ||
43 | - TCGv_i64 incr = cpu_reg(s, a->rm); | ||
44 | - return do_index(s, a->esz, a->rd, start, incr); | ||
45 | -} | ||
46 | +TRANS_FEAT(INDEX_ii, aa64_sve, do_index, a->esz, a->rd, | ||
47 | + tcg_constant_i64(a->imm1), tcg_constant_i64(a->imm2)) | ||
48 | +TRANS_FEAT(INDEX_ir, aa64_sve, do_index, a->esz, a->rd, | ||
49 | + tcg_constant_i64(a->imm), cpu_reg(s, a->rm)) | ||
50 | +TRANS_FEAT(INDEX_ri, aa64_sve, do_index, a->esz, a->rd, | ||
51 | + cpu_reg(s, a->rn), tcg_constant_i64(a->imm)) | ||
52 | +TRANS_FEAT(INDEX_rr, aa64_sve, do_index, a->esz, a->rd, | ||
53 | + cpu_reg(s, a->rn), cpu_reg(s, a->rm)) | ||
54 | |||
55 | /* | ||
56 | *** SVE Stack Allocation Group | ||
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 | Message-id: 20220527181907.189259-51-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 23 ++++------------------- | ||
9 | 1 file changed, 4 insertions(+), 19 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 do_adr(DisasContext *s, arg_rrri *a, gen_helper_gvec_3 *fn) | ||
16 | return gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, a->imm); | ||
17 | } | ||
18 | |||
19 | -static bool trans_ADR_p32(DisasContext *s, arg_rrri *a) | ||
20 | -{ | ||
21 | - return do_adr(s, a, gen_helper_sve_adr_p32); | ||
22 | -} | ||
23 | - | ||
24 | -static bool trans_ADR_p64(DisasContext *s, arg_rrri *a) | ||
25 | -{ | ||
26 | - return do_adr(s, a, gen_helper_sve_adr_p64); | ||
27 | -} | ||
28 | - | ||
29 | -static bool trans_ADR_s32(DisasContext *s, arg_rrri *a) | ||
30 | -{ | ||
31 | - return do_adr(s, a, gen_helper_sve_adr_s32); | ||
32 | -} | ||
33 | - | ||
34 | -static bool trans_ADR_u32(DisasContext *s, arg_rrri *a) | ||
35 | -{ | ||
36 | - return do_adr(s, a, gen_helper_sve_adr_u32); | ||
37 | -} | ||
38 | +TRANS_FEAT(ADR_p32, aa64_sve, do_adr, a, gen_helper_sve_adr_p32) | ||
39 | +TRANS_FEAT(ADR_p64, aa64_sve, do_adr, a, gen_helper_sve_adr_p64) | ||
40 | +TRANS_FEAT(ADR_s32, aa64_sve, do_adr, a, gen_helper_sve_adr_s32) | ||
41 | +TRANS_FEAT(ADR_u32, aa64_sve, do_adr, a, gen_helper_sve_adr_u32) | ||
42 | |||
43 | /* | ||
44 | *** SVE Integer Misc - Unpredicated Group | ||
45 | -- | ||
46 | 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 | Message-id: 20220527181907.189259-52-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 19 +++++-------------- | ||
9 | 1 file changed, 5 insertions(+), 14 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 do_predset(DisasContext *s, int esz, int rd, int pat, bool setflag) | ||
16 | return true; | ||
17 | } | ||
18 | |||
19 | -static bool trans_PTRUE(DisasContext *s, arg_PTRUE *a) | ||
20 | -{ | ||
21 | - return do_predset(s, a->esz, a->rd, a->pat, a->s); | ||
22 | -} | ||
23 | +TRANS_FEAT(PTRUE, aa64_sve, do_predset, a->esz, a->rd, a->pat, a->s) | ||
24 | |||
25 | -static bool trans_SETFFR(DisasContext *s, arg_SETFFR *a) | ||
26 | -{ | ||
27 | - /* Note pat == 31 is #all, to set all elements. */ | ||
28 | - return do_predset(s, 0, FFR_PRED_NUM, 31, false); | ||
29 | -} | ||
30 | +/* Note pat == 31 is #all, to set all elements. */ | ||
31 | +TRANS_FEAT(SETFFR, aa64_sve, do_predset, 0, FFR_PRED_NUM, 31, false) | ||
32 | |||
33 | -static bool trans_PFALSE(DisasContext *s, arg_PFALSE *a) | ||
34 | -{ | ||
35 | - /* Note pat == 32 is #unimp, to set no elements. */ | ||
36 | - return do_predset(s, 0, a->rd, 32, false); | ||
37 | -} | ||
38 | +/* Note pat == 32 is #unimp, to set no elements. */ | ||
39 | +TRANS_FEAT(PFALSE, aa64_sve, do_predset, 0, a->rd, 32, false) | ||
40 | |||
41 | static bool trans_RDFFR_p(DisasContext *s, arg_RDFFR_p *a) | ||
42 | { | ||
43 | -- | ||
44 | 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 | Message-id: 20220527181907.189259-53-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 11 ++--------- | ||
9 | 1 file changed, 2 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_RDFFR_p(DisasContext *s, arg_RDFFR_p *a) | ||
16 | return trans_AND_pppp(s, &alt_a); | ||
17 | } | ||
18 | |||
19 | -static bool trans_RDFFR(DisasContext *s, arg_RDFFR *a) | ||
20 | -{ | ||
21 | - return do_mov_p(s, a->rd, FFR_PRED_NUM); | ||
22 | -} | ||
23 | - | ||
24 | -static bool trans_WRFFR(DisasContext *s, arg_WRFFR *a) | ||
25 | -{ | ||
26 | - return do_mov_p(s, FFR_PRED_NUM, a->rn); | ||
27 | -} | ||
28 | +TRANS_FEAT(RDFFR, aa64_sve, do_mov_p, a->rd, FFR_PRED_NUM) | ||
29 | +TRANS_FEAT(WRFFR, aa64_sve, do_mov_p, FFR_PRED_NUM, a->rn) | ||
30 | |||
31 | static bool do_pfirst_pnext(DisasContext *s, arg_rr_esz *a, | ||
32 | void (*gen_fn)(TCGv_i32, TCGv_ptr, | ||
33 | -- | ||
34 | 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 | Message-id: 20220527181907.189259-54-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 11 ++--------- | ||
9 | 1 file changed, 2 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 do_pfirst_pnext(DisasContext *s, arg_rr_esz *a, | ||
16 | return true; | ||
17 | } | ||
18 | |||
19 | -static bool trans_PFIRST(DisasContext *s, arg_rr_esz *a) | ||
20 | -{ | ||
21 | - return do_pfirst_pnext(s, a, gen_helper_sve_pfirst); | ||
22 | -} | ||
23 | - | ||
24 | -static bool trans_PNEXT(DisasContext *s, arg_rr_esz *a) | ||
25 | -{ | ||
26 | - return do_pfirst_pnext(s, a, gen_helper_sve_pnext); | ||
27 | -} | ||
28 | +TRANS_FEAT(PFIRST, aa64_sve, do_pfirst_pnext, a, gen_helper_sve_pfirst) | ||
29 | +TRANS_FEAT(PNEXT, aa64_sve, do_pfirst_pnext, a, gen_helper_sve_pnext) | ||
30 | |||
31 | /* | ||
32 | *** SVE Element Count Group | ||
33 | -- | ||
34 | 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 | Message-id: 20220527181907.189259-55-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 14 ++------------ | ||
9 | 1 file changed, 2 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 do_EXT(DisasContext *s, int rd, int rn, int rm, int imm) | ||
16 | return true; | ||
17 | } | ||
18 | |||
19 | -static bool trans_EXT(DisasContext *s, arg_EXT *a) | ||
20 | -{ | ||
21 | - return do_EXT(s, a->rd, a->rn, a->rm, a->imm); | ||
22 | -} | ||
23 | - | ||
24 | -static bool trans_EXT_sve2(DisasContext *s, arg_rri *a) | ||
25 | -{ | ||
26 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
27 | - return false; | ||
28 | - } | ||
29 | - return do_EXT(s, a->rd, a->rn, (a->rn + 1) % 32, a->imm); | ||
30 | -} | ||
31 | +TRANS_FEAT(EXT, aa64_sve, do_EXT, a->rd, a->rn, a->rm, a->imm) | ||
32 | +TRANS_FEAT(EXT_sve2, aa64_sve2, do_EXT, a->rd, a->rn, (a->rn + 1) % 32, a->imm) | ||
33 | |||
34 | /* | ||
35 | *** SVE Permute - Unpredicated Group | ||
36 | -- | ||
37 | 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 | Message-id: 20220527181907.189259-56-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 35 ++++++----------------------------- | ||
9 | 1 file changed, 6 insertions(+), 29 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 do_perm_pred2(DisasContext *s, arg_rr_esz *a, bool high_odd, | ||
16 | return true; | ||
17 | } | ||
18 | |||
19 | -static bool trans_ZIP1_p(DisasContext *s, arg_rrr_esz *a) | ||
20 | -{ | ||
21 | - return do_perm_pred3(s, a, 0, gen_helper_sve_zip_p); | ||
22 | -} | ||
23 | - | ||
24 | -static bool trans_ZIP2_p(DisasContext *s, arg_rrr_esz *a) | ||
25 | -{ | ||
26 | - return do_perm_pred3(s, a, 1, gen_helper_sve_zip_p); | ||
27 | -} | ||
28 | - | ||
29 | -static bool trans_UZP1_p(DisasContext *s, arg_rrr_esz *a) | ||
30 | -{ | ||
31 | - return do_perm_pred3(s, a, 0, gen_helper_sve_uzp_p); | ||
32 | -} | ||
33 | - | ||
34 | -static bool trans_UZP2_p(DisasContext *s, arg_rrr_esz *a) | ||
35 | -{ | ||
36 | - return do_perm_pred3(s, a, 1, gen_helper_sve_uzp_p); | ||
37 | -} | ||
38 | - | ||
39 | -static bool trans_TRN1_p(DisasContext *s, arg_rrr_esz *a) | ||
40 | -{ | ||
41 | - return do_perm_pred3(s, a, 0, gen_helper_sve_trn_p); | ||
42 | -} | ||
43 | - | ||
44 | -static bool trans_TRN2_p(DisasContext *s, arg_rrr_esz *a) | ||
45 | -{ | ||
46 | - return do_perm_pred3(s, a, 1, gen_helper_sve_trn_p); | ||
47 | -} | ||
48 | +TRANS_FEAT(ZIP1_p, aa64_sve, do_perm_pred3, a, 0, gen_helper_sve_zip_p) | ||
49 | +TRANS_FEAT(ZIP2_p, aa64_sve, do_perm_pred3, a, 1, gen_helper_sve_zip_p) | ||
50 | +TRANS_FEAT(UZP1_p, aa64_sve, do_perm_pred3, a, 0, gen_helper_sve_uzp_p) | ||
51 | +TRANS_FEAT(UZP2_p, aa64_sve, do_perm_pred3, a, 1, gen_helper_sve_uzp_p) | ||
52 | +TRANS_FEAT(TRN1_p, aa64_sve, do_perm_pred3, a, 0, gen_helper_sve_trn_p) | ||
53 | +TRANS_FEAT(TRN2_p, aa64_sve, do_perm_pred3, a, 1, gen_helper_sve_trn_p) | ||
54 | |||
55 | static bool trans_REV_p(DisasContext *s, arg_rr_esz *a) | ||
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 | Message-id: 20220527181907.189259-57-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 17 +++-------------- | ||
9 | 1 file changed, 3 insertions(+), 14 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 @@ TRANS_FEAT(UZP2_p, aa64_sve, do_perm_pred3, a, 1, gen_helper_sve_uzp_p) | ||
16 | TRANS_FEAT(TRN1_p, aa64_sve, do_perm_pred3, a, 0, gen_helper_sve_trn_p) | ||
17 | TRANS_FEAT(TRN2_p, aa64_sve, do_perm_pred3, a, 1, gen_helper_sve_trn_p) | ||
18 | |||
19 | -static bool trans_REV_p(DisasContext *s, arg_rr_esz *a) | ||
20 | -{ | ||
21 | - return do_perm_pred2(s, a, 0, gen_helper_sve_rev_p); | ||
22 | -} | ||
23 | - | ||
24 | -static bool trans_PUNPKLO(DisasContext *s, arg_PUNPKLO *a) | ||
25 | -{ | ||
26 | - return do_perm_pred2(s, a, 0, gen_helper_sve_punpk_p); | ||
27 | -} | ||
28 | - | ||
29 | -static bool trans_PUNPKHI(DisasContext *s, arg_PUNPKHI *a) | ||
30 | -{ | ||
31 | - return do_perm_pred2(s, a, 1, gen_helper_sve_punpk_p); | ||
32 | -} | ||
33 | +TRANS_FEAT(REV_p, aa64_sve, do_perm_pred2, a, 0, gen_helper_sve_rev_p) | ||
34 | +TRANS_FEAT(PUNPKLO, aa64_sve, do_perm_pred2, a, 0, gen_helper_sve_punpk_p) | ||
35 | +TRANS_FEAT(PUNPKHI, aa64_sve, do_perm_pred2, a, 1, gen_helper_sve_punpk_p) | ||
36 | |||
37 | /* | ||
38 | *** SVE Permute - Interleaving Group | ||
39 | -- | ||
40 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | This is in line with how we treat uzp, and will | ||
4 | eliminate the special case code during translation. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-58-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/sve_helper.c | 6 ++++-- | ||
12 | target/arm/translate-sve.c | 12 ++++++------ | ||
13 | 2 files changed, 10 insertions(+), 8 deletions(-) | ||
14 | |||
15 | diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/target/arm/sve_helper.c | ||
18 | +++ b/target/arm/sve_helper.c | ||
19 | @@ -XXX,XX +XXX,XX @@ void HELPER(sve_punpk_p)(void *vd, void *vn, uint32_t pred_desc) | ||
20 | void HELPER(NAME)(void *vd, void *vn, void *vm, uint32_t desc) \ | ||
21 | { \ | ||
22 | intptr_t oprsz = simd_oprsz(desc); \ | ||
23 | + intptr_t odd_ofs = simd_data(desc); \ | ||
24 | intptr_t i, oprsz_2 = oprsz / 2; \ | ||
25 | ARMVectorReg tmp_n, tmp_m; \ | ||
26 | /* We produce output faster than we consume input. \ | ||
27 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vn, void *vm, uint32_t desc) \ | ||
28 | vm = memcpy(&tmp_m, vm, oprsz_2); \ | ||
29 | } \ | ||
30 | for (i = 0; i < oprsz_2; i += sizeof(TYPE)) { \ | ||
31 | - *(TYPE *)(vd + H(2 * i + 0)) = *(TYPE *)(vn + H(i)); \ | ||
32 | - *(TYPE *)(vd + H(2 * i + sizeof(TYPE))) = *(TYPE *)(vm + H(i)); \ | ||
33 | + *(TYPE *)(vd + H(2 * i + 0)) = *(TYPE *)(vn + odd_ofs + H(i)); \ | ||
34 | + *(TYPE *)(vd + H(2 * i + sizeof(TYPE))) = \ | ||
35 | + *(TYPE *)(vm + odd_ofs + H(i)); \ | ||
36 | } \ | ||
37 | if (sizeof(TYPE) == 16 && unlikely(oprsz & 16)) { \ | ||
38 | memset(vd + oprsz - 16, 0, 16); \ | ||
39 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/target/arm/translate-sve.c | ||
42 | +++ b/target/arm/translate-sve.c | ||
43 | @@ -XXX,XX +XXX,XX @@ static bool do_zip(DisasContext *s, arg_rrr_esz *a, bool high) | ||
44 | unsigned vsz = vec_full_reg_size(s); | ||
45 | unsigned high_ofs = high ? vsz / 2 : 0; | ||
46 | tcg_gen_gvec_3_ool(vec_full_reg_offset(s, a->rd), | ||
47 | - vec_full_reg_offset(s, a->rn) + high_ofs, | ||
48 | - vec_full_reg_offset(s, a->rm) + high_ofs, | ||
49 | - vsz, vsz, 0, fns[a->esz]); | ||
50 | + vec_full_reg_offset(s, a->rn), | ||
51 | + vec_full_reg_offset(s, a->rm), | ||
52 | + vsz, vsz, high_ofs, fns[a->esz]); | ||
53 | } | ||
54 | return true; | ||
55 | } | ||
56 | @@ -XXX,XX +XXX,XX @@ static bool do_zip_q(DisasContext *s, arg_rrr_esz *a, bool high) | ||
57 | unsigned vsz = vec_full_reg_size(s); | ||
58 | unsigned high_ofs = high ? QEMU_ALIGN_DOWN(vsz, 32) / 2 : 0; | ||
59 | tcg_gen_gvec_3_ool(vec_full_reg_offset(s, a->rd), | ||
60 | - vec_full_reg_offset(s, a->rn) + high_ofs, | ||
61 | - vec_full_reg_offset(s, a->rm) + high_ofs, | ||
62 | - vsz, vsz, 0, gen_helper_sve2_zip_q); | ||
63 | + vec_full_reg_offset(s, a->rn), | ||
64 | + vec_full_reg_offset(s, a->rm), | ||
65 | + vsz, vsz, high_ofs, gen_helper_sve2_zip_q); | ||
66 | } | ||
67 | return true; | ||
68 | } | ||
69 | -- | ||
70 | 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 | Message-id: 20220527181907.189259-59-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 25 +++++++------------------ | ||
9 | 1 file changed, 7 insertions(+), 18 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 do_zip(DisasContext *s, arg_rrr_esz *a, bool high) | ||
16 | gen_helper_sve_zip_b, gen_helper_sve_zip_h, | ||
17 | gen_helper_sve_zip_s, gen_helper_sve_zip_d, | ||
18 | }; | ||
19 | + unsigned vsz = vec_full_reg_size(s); | ||
20 | + unsigned high_ofs = high ? vsz / 2 : 0; | ||
21 | |||
22 | - if (sve_access_check(s)) { | ||
23 | - unsigned vsz = vec_full_reg_size(s); | ||
24 | - unsigned high_ofs = high ? vsz / 2 : 0; | ||
25 | - tcg_gen_gvec_3_ool(vec_full_reg_offset(s, a->rd), | ||
26 | - vec_full_reg_offset(s, a->rn), | ||
27 | - vec_full_reg_offset(s, a->rm), | ||
28 | - vsz, vsz, high_ofs, fns[a->esz]); | ||
29 | - } | ||
30 | - return true; | ||
31 | + return gen_gvec_ool_arg_zzz(s, fns[a->esz], a, high_ofs); | ||
32 | } | ||
33 | |||
34 | static bool trans_ZIP1_z(DisasContext *s, arg_rrr_esz *a) | ||
35 | @@ -XXX,XX +XXX,XX @@ static bool trans_ZIP2_z(DisasContext *s, arg_rrr_esz *a) | ||
36 | |||
37 | static bool do_zip_q(DisasContext *s, arg_rrr_esz *a, bool high) | ||
38 | { | ||
39 | + unsigned vsz = vec_full_reg_size(s); | ||
40 | + unsigned high_ofs = high ? QEMU_ALIGN_DOWN(vsz, 32) / 2 : 0; | ||
41 | + | ||
42 | if (!dc_isar_feature(aa64_sve_f64mm, s)) { | ||
43 | return false; | ||
44 | } | ||
45 | - if (sve_access_check(s)) { | ||
46 | - unsigned vsz = vec_full_reg_size(s); | ||
47 | - unsigned high_ofs = high ? QEMU_ALIGN_DOWN(vsz, 32) / 2 : 0; | ||
48 | - tcg_gen_gvec_3_ool(vec_full_reg_offset(s, a->rd), | ||
49 | - vec_full_reg_offset(s, a->rn), | ||
50 | - vec_full_reg_offset(s, a->rm), | ||
51 | - vsz, vsz, high_ofs, gen_helper_sve2_zip_q); | ||
52 | - } | ||
53 | - return true; | ||
54 | + return gen_gvec_ool_arg_zzz(s, gen_helper_sve2_zip_q, a, high_ofs); | ||
55 | } | ||
56 | |||
57 | static bool trans_ZIP1_q(DisasContext *s, arg_rrr_esz *a) | ||
58 | -- | ||
59 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Convert SVE translation functions using do_zip* | ||
4 | to use TRANS_FEAT and gen_gvec_ool_arg_zzz. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-60-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate-sve.c | 54 +++++++++----------------------------- | ||
12 | 1 file changed, 13 insertions(+), 41 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate-sve.c | ||
17 | +++ b/target/arm/translate-sve.c | ||
18 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(PUNPKHI, aa64_sve, do_perm_pred2, a, 1, gen_helper_sve_punpk_p) | ||
19 | *** SVE Permute - Interleaving Group | ||
20 | */ | ||
21 | |||
22 | -static bool do_zip(DisasContext *s, arg_rrr_esz *a, bool high) | ||
23 | -{ | ||
24 | - static gen_helper_gvec_3 * const fns[4] = { | ||
25 | - gen_helper_sve_zip_b, gen_helper_sve_zip_h, | ||
26 | - gen_helper_sve_zip_s, gen_helper_sve_zip_d, | ||
27 | - }; | ||
28 | - unsigned vsz = vec_full_reg_size(s); | ||
29 | - unsigned high_ofs = high ? vsz / 2 : 0; | ||
30 | +static gen_helper_gvec_3 * const zip_fns[4] = { | ||
31 | + gen_helper_sve_zip_b, gen_helper_sve_zip_h, | ||
32 | + gen_helper_sve_zip_s, gen_helper_sve_zip_d, | ||
33 | +}; | ||
34 | +TRANS_FEAT(ZIP1_z, aa64_sve, gen_gvec_ool_arg_zzz, | ||
35 | + zip_fns[a->esz], a, 0) | ||
36 | +TRANS_FEAT(ZIP2_z, aa64_sve, gen_gvec_ool_arg_zzz, | ||
37 | + zip_fns[a->esz], a, vec_full_reg_size(s) / 2) | ||
38 | |||
39 | - return gen_gvec_ool_arg_zzz(s, fns[a->esz], a, high_ofs); | ||
40 | -} | ||
41 | - | ||
42 | -static bool trans_ZIP1_z(DisasContext *s, arg_rrr_esz *a) | ||
43 | -{ | ||
44 | - return do_zip(s, a, false); | ||
45 | -} | ||
46 | - | ||
47 | -static bool trans_ZIP2_z(DisasContext *s, arg_rrr_esz *a) | ||
48 | -{ | ||
49 | - return do_zip(s, a, true); | ||
50 | -} | ||
51 | - | ||
52 | -static bool do_zip_q(DisasContext *s, arg_rrr_esz *a, bool high) | ||
53 | -{ | ||
54 | - unsigned vsz = vec_full_reg_size(s); | ||
55 | - unsigned high_ofs = high ? QEMU_ALIGN_DOWN(vsz, 32) / 2 : 0; | ||
56 | - | ||
57 | - if (!dc_isar_feature(aa64_sve_f64mm, s)) { | ||
58 | - return false; | ||
59 | - } | ||
60 | - return gen_gvec_ool_arg_zzz(s, gen_helper_sve2_zip_q, a, high_ofs); | ||
61 | -} | ||
62 | - | ||
63 | -static bool trans_ZIP1_q(DisasContext *s, arg_rrr_esz *a) | ||
64 | -{ | ||
65 | - return do_zip_q(s, a, false); | ||
66 | -} | ||
67 | - | ||
68 | -static bool trans_ZIP2_q(DisasContext *s, arg_rrr_esz *a) | ||
69 | -{ | ||
70 | - return do_zip_q(s, a, true); | ||
71 | -} | ||
72 | +TRANS_FEAT(ZIP1_q, aa64_sve_f64mm, gen_gvec_ool_arg_zzz, | ||
73 | + gen_helper_sve2_zip_q, a, 0) | ||
74 | +TRANS_FEAT(ZIP2_q, aa64_sve_f64mm, gen_gvec_ool_arg_zzz, | ||
75 | + gen_helper_sve2_zip_q, a, | ||
76 | + QEMU_ALIGN_DOWN(vec_full_reg_size(s), 32) / 2) | ||
77 | |||
78 | static gen_helper_gvec_3 * const uzp_fns[4] = { | ||
79 | gen_helper_sve_uzp_b, gen_helper_sve_uzp_h, | ||
80 | -- | ||
81 | 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 | Message-id: 20220527181907.189259-61-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 11 ++--------- | ||
9 | 1 file changed, 2 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 do_clast_vector(DisasContext *s, arg_rprr_esz *a, bool before) | ||
16 | return true; | ||
17 | } | ||
18 | |||
19 | -static bool trans_CLASTA_z(DisasContext *s, arg_rprr_esz *a) | ||
20 | -{ | ||
21 | - return do_clast_vector(s, a, false); | ||
22 | -} | ||
23 | - | ||
24 | -static bool trans_CLASTB_z(DisasContext *s, arg_rprr_esz *a) | ||
25 | -{ | ||
26 | - return do_clast_vector(s, a, true); | ||
27 | -} | ||
28 | +TRANS_FEAT(CLASTA_z, aa64_sve, do_clast_vector, a, false) | ||
29 | +TRANS_FEAT(CLASTB_z, aa64_sve, do_clast_vector, a, true) | ||
30 | |||
31 | /* Compute CLAST for a scalar. */ | ||
32 | static void do_clast_scalar(DisasContext *s, int esz, int pg, int rm, | ||
33 | -- | ||
34 | 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 | Message-id: 20220527181907.189259-62-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 11 ++--------- | ||
9 | 1 file changed, 2 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 do_clast_fp(DisasContext *s, arg_rpr_esz *a, bool before) | ||
16 | return true; | ||
17 | } | ||
18 | |||
19 | -static bool trans_CLASTA_v(DisasContext *s, arg_rpr_esz *a) | ||
20 | -{ | ||
21 | - return do_clast_fp(s, a, false); | ||
22 | -} | ||
23 | - | ||
24 | -static bool trans_CLASTB_v(DisasContext *s, arg_rpr_esz *a) | ||
25 | -{ | ||
26 | - return do_clast_fp(s, a, true); | ||
27 | -} | ||
28 | +TRANS_FEAT(CLASTA_v, aa64_sve, do_clast_fp, a, false) | ||
29 | +TRANS_FEAT(CLASTB_v, aa64_sve, do_clast_fp, a, true) | ||
30 | |||
31 | /* Compute CLAST for a Xreg. */ | ||
32 | static bool do_clast_general(DisasContext *s, arg_rpr_esz *a, bool before) | ||
33 | -- | ||
34 | 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 | Message-id: 20220527181907.189259-63-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 11 ++--------- | ||
9 | 1 file changed, 2 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 do_clast_general(DisasContext *s, arg_rpr_esz *a, bool before) | ||
16 | return true; | ||
17 | } | ||
18 | |||
19 | -static bool trans_CLASTA_r(DisasContext *s, arg_rpr_esz *a) | ||
20 | -{ | ||
21 | - return do_clast_general(s, a, false); | ||
22 | -} | ||
23 | - | ||
24 | -static bool trans_CLASTB_r(DisasContext *s, arg_rpr_esz *a) | ||
25 | -{ | ||
26 | - return do_clast_general(s, a, true); | ||
27 | -} | ||
28 | +TRANS_FEAT(CLASTA_r, aa64_sve, do_clast_general, a, false) | ||
29 | +TRANS_FEAT(CLASTB_r, aa64_sve, do_clast_general, a, true) | ||
30 | |||
31 | /* Compute LAST for a scalar. */ | ||
32 | static TCGv_i64 do_last_scalar(DisasContext *s, int esz, | ||
33 | -- | ||
34 | 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 | Message-id: 20220527181907.189259-64-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 11 ++--------- | ||
9 | 1 file changed, 2 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 do_last_fp(DisasContext *s, arg_rpr_esz *a, bool before) | ||
16 | return true; | ||
17 | } | ||
18 | |||
19 | -static bool trans_LASTA_v(DisasContext *s, arg_rpr_esz *a) | ||
20 | -{ | ||
21 | - return do_last_fp(s, a, false); | ||
22 | -} | ||
23 | - | ||
24 | -static bool trans_LASTB_v(DisasContext *s, arg_rpr_esz *a) | ||
25 | -{ | ||
26 | - return do_last_fp(s, a, true); | ||
27 | -} | ||
28 | +TRANS_FEAT(LASTA_v, aa64_sve, do_last_fp, a, false) | ||
29 | +TRANS_FEAT(LASTB_v, aa64_sve, do_last_fp, a, true) | ||
30 | |||
31 | /* Compute LAST for a Xreg. */ | ||
32 | static bool do_last_general(DisasContext *s, arg_rpr_esz *a, bool before) | ||
33 | -- | ||
34 | 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 | Message-id: 20220527181907.189259-65-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 11 ++--------- | ||
9 | 1 file changed, 2 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 do_last_general(DisasContext *s, arg_rpr_esz *a, bool before) | ||
16 | return true; | ||
17 | } | ||
18 | |||
19 | -static bool trans_LASTA_r(DisasContext *s, arg_rpr_esz *a) | ||
20 | -{ | ||
21 | - return do_last_general(s, a, false); | ||
22 | -} | ||
23 | - | ||
24 | -static bool trans_LASTB_r(DisasContext *s, arg_rpr_esz *a) | ||
25 | -{ | ||
26 | - return do_last_general(s, a, true); | ||
27 | -} | ||
28 | +TRANS_FEAT(LASTA_r, aa64_sve, do_last_general, a, false) | ||
29 | +TRANS_FEAT(LASTB_r, aa64_sve, do_last_general, a, true) | ||
30 | |||
31 | static bool trans_CPY_m_r(DisasContext *s, arg_rpr_esz *a) | ||
32 | { | ||
33 | -- | ||
34 | 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 | Message-id: 20220527181907.189259-66-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 17 ++++------------- | ||
9 | 1 file changed, 4 insertions(+), 13 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 @@ TRANS_FEAT(REVH, aa64_sve, gen_gvec_ool_arg_zpz, revh_fns[a->esz], a, 0) | ||
16 | TRANS_FEAT(REVW, aa64_sve, gen_gvec_ool_arg_zpz, | ||
17 | a->esz == 3 ? gen_helper_sve_revw_d : NULL, a, 0) | ||
18 | |||
19 | -static bool trans_SPLICE(DisasContext *s, arg_rprr_esz *a) | ||
20 | -{ | ||
21 | - return gen_gvec_ool_zzzp(s, gen_helper_sve_splice, | ||
22 | - a->rd, a->rn, a->rm, a->pg, a->esz); | ||
23 | -} | ||
24 | +TRANS_FEAT(SPLICE, aa64_sve, gen_gvec_ool_arg_zpzz, | ||
25 | + gen_helper_sve_splice, a, a->esz) | ||
26 | |||
27 | -static bool trans_SPLICE_sve2(DisasContext *s, arg_rpr_esz *a) | ||
28 | -{ | ||
29 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
30 | - return false; | ||
31 | - } | ||
32 | - return gen_gvec_ool_zzzp(s, gen_helper_sve_splice, | ||
33 | - a->rd, a->rn, (a->rn + 1) % 32, a->pg, a->esz); | ||
34 | -} | ||
35 | +TRANS_FEAT(SPLICE_sve2, aa64_sve2, gen_gvec_ool_zzzp, gen_helper_sve_splice, | ||
36 | + a->rd, a->rn, (a->rn + 1) % 32, a->pg, a->esz) | ||
37 | |||
38 | /* | ||
39 | *** SVE Integer Compare - Vectors Group | ||
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 | Message-id: 20220527181907.189259-67-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 28 ++++++++++++---------------- | ||
9 | 1 file changed, 12 insertions(+), 16 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 do_ppzz_flags(DisasContext *s, arg_rprr_esz *a, | ||
16 | } | ||
17 | |||
18 | #define DO_PPZZ(NAME, name) \ | ||
19 | -static bool trans_##NAME##_ppzz(DisasContext *s, arg_rprr_esz *a) \ | ||
20 | -{ \ | ||
21 | - static gen_helper_gvec_flags_4 * const fns[4] = { \ | ||
22 | - gen_helper_sve_##name##_ppzz_b, gen_helper_sve_##name##_ppzz_h, \ | ||
23 | - gen_helper_sve_##name##_ppzz_s, gen_helper_sve_##name##_ppzz_d, \ | ||
24 | - }; \ | ||
25 | - return do_ppzz_flags(s, a, fns[a->esz]); \ | ||
26 | -} | ||
27 | + static gen_helper_gvec_flags_4 * const name##_ppzz_fns[4] = { \ | ||
28 | + gen_helper_sve_##name##_ppzz_b, gen_helper_sve_##name##_ppzz_h, \ | ||
29 | + gen_helper_sve_##name##_ppzz_s, gen_helper_sve_##name##_ppzz_d, \ | ||
30 | + }; \ | ||
31 | + TRANS_FEAT(NAME##_ppzz, aa64_sve, do_ppzz_flags, \ | ||
32 | + a, name##_ppzz_fns[a->esz]) | ||
33 | |||
34 | DO_PPZZ(CMPEQ, cmpeq) | ||
35 | DO_PPZZ(CMPNE, cmpne) | ||
36 | @@ -XXX,XX +XXX,XX @@ DO_PPZZ(CMPHS, cmphs) | ||
37 | #undef DO_PPZZ | ||
38 | |||
39 | #define DO_PPZW(NAME, name) \ | ||
40 | -static bool trans_##NAME##_ppzw(DisasContext *s, arg_rprr_esz *a) \ | ||
41 | -{ \ | ||
42 | - static gen_helper_gvec_flags_4 * const fns[4] = { \ | ||
43 | - gen_helper_sve_##name##_ppzw_b, gen_helper_sve_##name##_ppzw_h, \ | ||
44 | - gen_helper_sve_##name##_ppzw_s, NULL \ | ||
45 | - }; \ | ||
46 | - return do_ppzz_flags(s, a, fns[a->esz]); \ | ||
47 | -} | ||
48 | + static gen_helper_gvec_flags_4 * const name##_ppzw_fns[4] = { \ | ||
49 | + gen_helper_sve_##name##_ppzw_b, gen_helper_sve_##name##_ppzw_h, \ | ||
50 | + gen_helper_sve_##name##_ppzw_s, NULL \ | ||
51 | + }; \ | ||
52 | + TRANS_FEAT(NAME##_ppzw, aa64_sve, do_ppzz_flags, \ | ||
53 | + a, name##_ppzw_fns[a->esz]) | ||
54 | |||
55 | DO_PPZW(CMPEQ, cmpeq) | ||
56 | DO_PPZW(CMPNE, cmpne) | ||
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 | Message-id: 20220527181907.189259-68-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 28 ++++++++-------------------- | ||
9 | 1 file changed, 8 insertions(+), 20 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 @@ DO_SVE2_ZZZ_NARROW(SUBHNT, subhnt) | ||
16 | DO_SVE2_ZZZ_NARROW(RSUBHNB, rsubhnb) | ||
17 | DO_SVE2_ZZZ_NARROW(RSUBHNT, rsubhnt) | ||
18 | |||
19 | -static bool do_sve2_ppzz_flags(DisasContext *s, arg_rprr_esz *a, | ||
20 | - gen_helper_gvec_flags_4 *fn) | ||
21 | -{ | ||
22 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
23 | - return false; | ||
24 | - } | ||
25 | - return do_ppzz_flags(s, a, fn); | ||
26 | -} | ||
27 | +static gen_helper_gvec_flags_4 * const match_fns[4] = { | ||
28 | + gen_helper_sve2_match_ppzz_b, gen_helper_sve2_match_ppzz_h, NULL, NULL | ||
29 | +}; | ||
30 | +TRANS_FEAT(MATCH, aa64_sve2, do_ppzz_flags, a, match_fns[a->esz]) | ||
31 | |||
32 | -#define DO_SVE2_PPZZ_MATCH(NAME, name) \ | ||
33 | -static bool trans_##NAME(DisasContext *s, arg_rprr_esz *a) \ | ||
34 | -{ \ | ||
35 | - static gen_helper_gvec_flags_4 * const fns[4] = { \ | ||
36 | - gen_helper_sve2_##name##_ppzz_b, gen_helper_sve2_##name##_ppzz_h, \ | ||
37 | - NULL, NULL \ | ||
38 | - }; \ | ||
39 | - return do_sve2_ppzz_flags(s, a, fns[a->esz]); \ | ||
40 | -} | ||
41 | - | ||
42 | -DO_SVE2_PPZZ_MATCH(MATCH, match) | ||
43 | -DO_SVE2_PPZZ_MATCH(NMATCH, nmatch) | ||
44 | +static gen_helper_gvec_flags_4 * const nmatch_fns[4] = { | ||
45 | + gen_helper_sve2_nmatch_ppzz_b, gen_helper_sve2_nmatch_ppzz_h, NULL, NULL | ||
46 | +}; | ||
47 | +TRANS_FEAT(NMATCH, aa64_sve2, do_ppzz_flags, a, nmatch_fns[a->esz]) | ||
48 | |||
49 | static gen_helper_gvec_4 * const histcnt_fns[4] = { | ||
50 | NULL, NULL, gen_helper_sve2_histcnt_s, gen_helper_sve2_histcnt_d | ||
51 | -- | ||
52 | 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 | Message-id: 20220527181907.189259-69-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 8 +++----- | ||
9 | 1 file changed, 3 insertions(+), 5 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 do_ppzi_flags(DisasContext *s, arg_rpri_esz *a, | ||
16 | } | ||
17 | |||
18 | #define DO_PPZI(NAME, name) \ | ||
19 | -static bool trans_##NAME##_ppzi(DisasContext *s, arg_rpri_esz *a) \ | ||
20 | -{ \ | ||
21 | - static gen_helper_gvec_flags_3 * const fns[4] = { \ | ||
22 | + static gen_helper_gvec_flags_3 * const name##_ppzi_fns[4] = { \ | ||
23 | gen_helper_sve_##name##_ppzi_b, gen_helper_sve_##name##_ppzi_h, \ | ||
24 | gen_helper_sve_##name##_ppzi_s, gen_helper_sve_##name##_ppzi_d, \ | ||
25 | }; \ | ||
26 | - return do_ppzi_flags(s, a, fns[a->esz]); \ | ||
27 | -} | ||
28 | + TRANS_FEAT(NAME##_ppzi, aa64_sve, do_ppzi_flags, a, \ | ||
29 | + name##_ppzi_fns[a->esz]) | ||
30 | |||
31 | DO_PPZI(CMPEQ, cmpeq) | ||
32 | DO_PPZI(CMPNE, cmpne) | ||
33 | -- | ||
34 | 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 | Message-id: 20220527181907.189259-70-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 45 ++++++++++++-------------------------- | ||
9 | 1 file changed, 14 insertions(+), 31 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 do_brk2(DisasContext *s, arg_rpr_s *a, | ||
16 | return true; | ||
17 | } | ||
18 | |||
19 | -static bool trans_BRKPA(DisasContext *s, arg_rprr_s *a) | ||
20 | -{ | ||
21 | - return do_brk3(s, a, gen_helper_sve_brkpa, gen_helper_sve_brkpas); | ||
22 | -} | ||
23 | +TRANS_FEAT(BRKPA, aa64_sve, do_brk3, a, | ||
24 | + gen_helper_sve_brkpa, gen_helper_sve_brkpas) | ||
25 | +TRANS_FEAT(BRKPB, aa64_sve, do_brk3, a, | ||
26 | + gen_helper_sve_brkpb, gen_helper_sve_brkpbs) | ||
27 | |||
28 | -static bool trans_BRKPB(DisasContext *s, arg_rprr_s *a) | ||
29 | -{ | ||
30 | - return do_brk3(s, a, gen_helper_sve_brkpb, gen_helper_sve_brkpbs); | ||
31 | -} | ||
32 | +TRANS_FEAT(BRKA_m, aa64_sve, do_brk2, a, | ||
33 | + gen_helper_sve_brka_m, gen_helper_sve_brkas_m) | ||
34 | +TRANS_FEAT(BRKB_m, aa64_sve, do_brk2, a, | ||
35 | + gen_helper_sve_brkb_m, gen_helper_sve_brkbs_m) | ||
36 | |||
37 | -static bool trans_BRKA_m(DisasContext *s, arg_rpr_s *a) | ||
38 | -{ | ||
39 | - return do_brk2(s, a, gen_helper_sve_brka_m, gen_helper_sve_brkas_m); | ||
40 | -} | ||
41 | +TRANS_FEAT(BRKA_z, aa64_sve, do_brk2, a, | ||
42 | + gen_helper_sve_brka_z, gen_helper_sve_brkas_z) | ||
43 | +TRANS_FEAT(BRKB_z, aa64_sve, do_brk2, a, | ||
44 | + gen_helper_sve_brkb_z, gen_helper_sve_brkbs_z) | ||
45 | |||
46 | -static bool trans_BRKB_m(DisasContext *s, arg_rpr_s *a) | ||
47 | -{ | ||
48 | - return do_brk2(s, a, gen_helper_sve_brkb_m, gen_helper_sve_brkbs_m); | ||
49 | -} | ||
50 | - | ||
51 | -static bool trans_BRKA_z(DisasContext *s, arg_rpr_s *a) | ||
52 | -{ | ||
53 | - return do_brk2(s, a, gen_helper_sve_brka_z, gen_helper_sve_brkas_z); | ||
54 | -} | ||
55 | - | ||
56 | -static bool trans_BRKB_z(DisasContext *s, arg_rpr_s *a) | ||
57 | -{ | ||
58 | - return do_brk2(s, a, gen_helper_sve_brkb_z, gen_helper_sve_brkbs_z); | ||
59 | -} | ||
60 | - | ||
61 | -static bool trans_BRKN(DisasContext *s, arg_rpr_s *a) | ||
62 | -{ | ||
63 | - return do_brk2(s, a, gen_helper_sve_brkn, gen_helper_sve_brkns); | ||
64 | -} | ||
65 | +TRANS_FEAT(BRKN, aa64_sve, do_brk2, a, | ||
66 | + gen_helper_sve_brkn, gen_helper_sve_brkns) | ||
67 | |||
68 | /* | ||
69 | *** SVE Predicate Count Group | ||
70 | -- | ||
71 | 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 | Message-id: 20220527181907.189259-71-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 10 +--------- | ||
9 | 1 file changed, 1 insertion(+), 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_SUBR_zzi(DisasContext *s, arg_rri_esz *a) | ||
16 | return true; | ||
17 | } | ||
18 | |||
19 | -static bool trans_MUL_zzi(DisasContext *s, arg_rri_esz *a) | ||
20 | -{ | ||
21 | - if (sve_access_check(s)) { | ||
22 | - unsigned vsz = vec_full_reg_size(s); | ||
23 | - tcg_gen_gvec_muli(a->esz, vec_full_reg_offset(s, a->rd), | ||
24 | - vec_full_reg_offset(s, a->rn), a->imm, vsz, vsz); | ||
25 | - } | ||
26 | - return true; | ||
27 | -} | ||
28 | +TRANS_FEAT(MUL_zzi, aa64_sve, gen_gvec_fn_arg_zzi, tcg_gen_gvec_muli, a) | ||
29 | |||
30 | static bool do_zzi_sat(DisasContext *s, arg_rri_esz *a, bool u, bool d) | ||
31 | { | ||
32 | -- | ||
33 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Remove the unparsed extraction in trans_DUP_i, | ||
4 | which is intended to reject an 8-bit shift of | ||
5 | an 8-bit constant for 8-bit element. | ||
6 | |||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20220527181907.189259-72-richard.henderson@linaro.org | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | target/arm/sve.decode | 5 ++++- | ||
13 | target/arm/translate-sve.c | 10 ++++++---- | ||
14 | 2 files changed, 10 insertions(+), 5 deletions(-) | ||
15 | |||
16 | diff --git a/target/arm/sve.decode b/target/arm/sve.decode | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/target/arm/sve.decode | ||
19 | +++ b/target/arm/sve.decode | ||
20 | @@ -XXX,XX +XXX,XX @@ WHILE_ptr 00100101 esz:2 1 rm:5 001 100 rn:5 rw:1 rd:4 | ||
21 | FDUP 00100101 esz:2 111 00 1110 imm:8 rd:5 | ||
22 | |||
23 | # SVE broadcast integer immediate (unpredicated) | ||
24 | -DUP_i 00100101 esz:2 111 00 011 . ........ rd:5 imm=%sh8_i8s | ||
25 | +{ | ||
26 | + INVALID 00100101 00 111 00 011 1 -------- ----- | ||
27 | + DUP_i 00100101 esz:2 111 00 011 . ........ rd:5 imm=%sh8_i8s | ||
28 | +} | ||
29 | |||
30 | # SVE integer add/subtract immediate (unpredicated) | ||
31 | ADD_zzi 00100101 .. 100 000 11 . ........ ..... @rdn_sh_i8u | ||
32 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
33 | index XXXXXXX..XXXXXXX 100644 | ||
34 | --- a/target/arm/translate-sve.c | ||
35 | +++ b/target/arm/translate-sve.c | ||
36 | @@ -XXX,XX +XXX,XX @@ const uint64_t pred_esz_masks[4] = { | ||
37 | 0x1111111111111111ull, 0x0101010101010101ull | ||
38 | }; | ||
39 | |||
40 | +static bool trans_INVALID(DisasContext *s, arg_INVALID *a) | ||
41 | +{ | ||
42 | + unallocated_encoding(s); | ||
43 | + return true; | ||
44 | +} | ||
45 | + | ||
46 | /* | ||
47 | *** SVE Logical - Unpredicated Group | ||
48 | */ | ||
49 | @@ -XXX,XX +XXX,XX @@ static bool trans_FDUP(DisasContext *s, arg_FDUP *a) | ||
50 | |||
51 | static bool trans_DUP_i(DisasContext *s, arg_DUP_i *a) | ||
52 | { | ||
53 | - if (a->esz == 0 && extract32(s->insn, 13, 1)) { | ||
54 | - return false; | ||
55 | - } | ||
56 | if (sve_access_check(s)) { | ||
57 | unsigned vsz = vec_full_reg_size(s); | ||
58 | int dofs = vec_full_reg_offset(s, a->rd); | ||
59 | - | ||
60 | tcg_gen_gvec_dup_imm(a->esz, dofs, vsz, vsz, a->imm); | ||
61 | } | ||
62 | return true; | ||
63 | -- | ||
64 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Remove the unparsed extractions in trans_ADD_zzi, trans_SUBR_zzi, | ||
4 | and do_zzi_sat which are intended to reject an 8-bit shift of an | ||
5 | 8-bit constant for 8-bit element. | ||
6 | |||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20220527181907.189259-73-richard.henderson@linaro.org | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | target/arm/sve.decode | 35 ++++++++++++++++++++++++++++------- | ||
13 | target/arm/translate-sve.c | 9 --------- | ||
14 | 2 files changed, 28 insertions(+), 16 deletions(-) | ||
15 | |||
16 | diff --git a/target/arm/sve.decode b/target/arm/sve.decode | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/target/arm/sve.decode | ||
19 | +++ b/target/arm/sve.decode | ||
20 | @@ -XXX,XX +XXX,XX @@ FDUP 00100101 esz:2 111 00 1110 imm:8 rd:5 | ||
21 | } | ||
22 | |||
23 | # SVE integer add/subtract immediate (unpredicated) | ||
24 | -ADD_zzi 00100101 .. 100 000 11 . ........ ..... @rdn_sh_i8u | ||
25 | -SUB_zzi 00100101 .. 100 001 11 . ........ ..... @rdn_sh_i8u | ||
26 | -SUBR_zzi 00100101 .. 100 011 11 . ........ ..... @rdn_sh_i8u | ||
27 | -SQADD_zzi 00100101 .. 100 100 11 . ........ ..... @rdn_sh_i8u | ||
28 | -UQADD_zzi 00100101 .. 100 101 11 . ........ ..... @rdn_sh_i8u | ||
29 | -SQSUB_zzi 00100101 .. 100 110 11 . ........ ..... @rdn_sh_i8u | ||
30 | -UQSUB_zzi 00100101 .. 100 111 11 . ........ ..... @rdn_sh_i8u | ||
31 | +{ | ||
32 | + INVALID 00100101 00 100 000 11 1 -------- ----- | ||
33 | + ADD_zzi 00100101 .. 100 000 11 . ........ ..... @rdn_sh_i8u | ||
34 | +} | ||
35 | +{ | ||
36 | + INVALID 00100101 00 100 001 11 1 -------- ----- | ||
37 | + SUB_zzi 00100101 .. 100 001 11 . ........ ..... @rdn_sh_i8u | ||
38 | +} | ||
39 | +{ | ||
40 | + INVALID 00100101 00 100 011 11 1 -------- ----- | ||
41 | + SUBR_zzi 00100101 .. 100 011 11 . ........ ..... @rdn_sh_i8u | ||
42 | +} | ||
43 | +{ | ||
44 | + INVALID 00100101 00 100 100 11 1 -------- ----- | ||
45 | + SQADD_zzi 00100101 .. 100 100 11 . ........ ..... @rdn_sh_i8u | ||
46 | +} | ||
47 | +{ | ||
48 | + INVALID 00100101 00 100 101 11 1 -------- ----- | ||
49 | + UQADD_zzi 00100101 .. 100 101 11 . ........ ..... @rdn_sh_i8u | ||
50 | +} | ||
51 | +{ | ||
52 | + INVALID 00100101 00 100 110 11 1 -------- ----- | ||
53 | + SQSUB_zzi 00100101 .. 100 110 11 . ........ ..... @rdn_sh_i8u | ||
54 | +} | ||
55 | +{ | ||
56 | + INVALID 00100101 00 100 111 11 1 -------- ----- | ||
57 | + UQSUB_zzi 00100101 .. 100 111 11 . ........ ..... @rdn_sh_i8u | ||
58 | +} | ||
59 | |||
60 | # SVE integer min/max immediate (unpredicated) | ||
61 | SMAX_zzi 00100101 .. 101 000 110 ........ ..... @rdn_i8s | ||
62 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
63 | index XXXXXXX..XXXXXXX 100644 | ||
64 | --- a/target/arm/translate-sve.c | ||
65 | +++ b/target/arm/translate-sve.c | ||
66 | @@ -XXX,XX +XXX,XX @@ static bool trans_DUP_i(DisasContext *s, arg_DUP_i *a) | ||
67 | |||
68 | static bool trans_ADD_zzi(DisasContext *s, arg_rri_esz *a) | ||
69 | { | ||
70 | - if (a->esz == 0 && extract32(s->insn, 13, 1)) { | ||
71 | - return false; | ||
72 | - } | ||
73 | return gen_gvec_fn_arg_zzi(s, tcg_gen_gvec_addi, a); | ||
74 | } | ||
75 | |||
76 | @@ -XXX,XX +XXX,XX @@ static bool trans_SUBR_zzi(DisasContext *s, arg_rri_esz *a) | ||
77 | .scalar_first = true } | ||
78 | }; | ||
79 | |||
80 | - if (a->esz == 0 && extract32(s->insn, 13, 1)) { | ||
81 | - return false; | ||
82 | - } | ||
83 | if (sve_access_check(s)) { | ||
84 | unsigned vsz = vec_full_reg_size(s); | ||
85 | tcg_gen_gvec_2s(vec_full_reg_offset(s, a->rd), | ||
86 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(MUL_zzi, aa64_sve, gen_gvec_fn_arg_zzi, tcg_gen_gvec_muli, a) | ||
87 | |||
88 | static bool do_zzi_sat(DisasContext *s, arg_rri_esz *a, bool u, bool d) | ||
89 | { | ||
90 | - if (a->esz == 0 && extract32(s->insn, 13, 1)) { | ||
91 | - return false; | ||
92 | - } | ||
93 | if (sve_access_check(s)) { | ||
94 | do_sat_addsub_vec(s, a->esz, a->rd, a->rn, | ||
95 | tcg_constant_i64(a->imm), u, d); | ||
96 | -- | ||
97 | 2.25.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Remove the unparsed extractions in trans_CPY_{m,z}_i which are intended | ||
4 | to reject an 8-bit shift of an 8-bit constant for 8-bit element. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-74-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/sve.decode | 10 ++++++++-- | ||
12 | target/arm/translate-sve.c | 6 ------ | ||
13 | 2 files changed, 8 insertions(+), 8 deletions(-) | ||
14 | |||
15 | diff --git a/target/arm/sve.decode b/target/arm/sve.decode | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/target/arm/sve.decode | ||
18 | +++ b/target/arm/sve.decode | ||
19 | @@ -XXX,XX +XXX,XX @@ DUPM 00000101 11 0000 dbm:13 rd:5 | ||
20 | FCPY 00000101 .. 01 .... 110 imm:8 ..... @rdn_pg4 | ||
21 | |||
22 | # SVE copy integer immediate (predicated) | ||
23 | -CPY_m_i 00000101 .. 01 .... 01 . ........ ..... @rdn_pg4 imm=%sh8_i8s | ||
24 | -CPY_z_i 00000101 .. 01 .... 00 . ........ ..... @rdn_pg4 imm=%sh8_i8s | ||
25 | +{ | ||
26 | + INVALID 00000101 00 01 ---- 01 1 -------- ----- | ||
27 | + CPY_m_i 00000101 .. 01 .... 01 . ........ ..... @rdn_pg4 imm=%sh8_i8s | ||
28 | +} | ||
29 | +{ | ||
30 | + INVALID 00000101 00 01 ---- 00 1 -------- ----- | ||
31 | + CPY_z_i 00000101 .. 01 .... 00 . ........ ..... @rdn_pg4 imm=%sh8_i8s | ||
32 | +} | ||
33 | |||
34 | ### SVE Permute - Extract Group | ||
35 | |||
36 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
37 | index XXXXXXX..XXXXXXX 100644 | ||
38 | --- a/target/arm/translate-sve.c | ||
39 | +++ b/target/arm/translate-sve.c | ||
40 | @@ -XXX,XX +XXX,XX @@ static bool trans_FCPY(DisasContext *s, arg_FCPY *a) | ||
41 | |||
42 | static bool trans_CPY_m_i(DisasContext *s, arg_rpri_esz *a) | ||
43 | { | ||
44 | - if (a->esz == 0 && extract32(s->insn, 13, 1)) { | ||
45 | - return false; | ||
46 | - } | ||
47 | if (sve_access_check(s)) { | ||
48 | do_cpy_m(s, a->esz, a->rd, a->rn, a->pg, tcg_constant_i64(a->imm)); | ||
49 | } | ||
50 | @@ -XXX,XX +XXX,XX @@ static bool trans_CPY_z_i(DisasContext *s, arg_CPY_z_i *a) | ||
51 | gen_helper_sve_cpy_z_s, gen_helper_sve_cpy_z_d, | ||
52 | }; | ||
53 | |||
54 | - if (a->esz == 0 && extract32(s->insn, 13, 1)) { | ||
55 | - return false; | ||
56 | - } | ||
57 | if (sve_access_check(s)) { | ||
58 | unsigned vsz = vec_full_reg_size(s); | ||
59 | tcg_gen_gvec_2i_ool(vec_full_reg_offset(s, a->rd), | ||
60 | -- | ||
61 | 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 | Message-id: 20220527181907.189259-75-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 5 +---- | ||
9 | 1 file changed, 1 insertion(+), 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 bool trans_DUP_i(DisasContext *s, arg_DUP_i *a) | ||
16 | return true; | ||
17 | } | ||
18 | |||
19 | -static bool trans_ADD_zzi(DisasContext *s, arg_rri_esz *a) | ||
20 | -{ | ||
21 | - return gen_gvec_fn_arg_zzi(s, tcg_gen_gvec_addi, a); | ||
22 | -} | ||
23 | +TRANS_FEAT(ADD_zzi, aa64_sve, gen_gvec_fn_arg_zzi, tcg_gen_gvec_addi, a) | ||
24 | |||
25 | static bool trans_SUB_zzi(DisasContext *s, arg_rri_esz *a) | ||
26 | { | ||
27 | -- | ||
28 | 2.25.1 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Thomas Huth <thuth@redhat.com> | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
4 | Reviewed-by: Markus Armbruster <armbru@redhat.com> | 4 | Message-id: 20220527181907.189259-76-richard.henderson@linaro.org |
5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Message-id: 20190412165416.7977-11-philmd@redhat.com | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | --- | 7 | --- |
9 | include/hw/net/ne2000-isa.h | 6 ++++++ | 8 | target/arm/translate-sve.c | 23 ++++------------------- |
10 | 1 file changed, 6 insertions(+) | 9 | 1 file changed, 4 insertions(+), 19 deletions(-) |
11 | 10 | ||
12 | diff --git a/include/hw/net/ne2000-isa.h b/include/hw/net/ne2000-isa.h | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
13 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/include/hw/net/ne2000-isa.h | 13 | --- a/target/arm/translate-sve.c |
15 | +++ b/include/hw/net/ne2000-isa.h | 14 | +++ b/target/arm/translate-sve.c |
16 | @@ -XXX,XX +XXX,XX @@ | 15 | @@ -XXX,XX +XXX,XX @@ static bool do_zzi_sat(DisasContext *s, arg_rri_esz *a, bool u, bool d) |
17 | * This work is licensed under the terms of the GNU GPL, version 2 or later. | 16 | return true; |
18 | * See the COPYING file in the top-level directory. | ||
19 | */ | ||
20 | + | ||
21 | +#ifndef HW_NET_NE2K_ISA_H | ||
22 | +#define HW_NET_NE2K_ISA_H | ||
23 | + | ||
24 | #include "hw/hw.h" | ||
25 | #include "hw/qdev.h" | ||
26 | #include "hw/isa/isa.h" | ||
27 | @@ -XXX,XX +XXX,XX @@ static inline ISADevice *isa_ne2000_init(ISABus *bus, int base, int irq, | ||
28 | } | ||
29 | return d; | ||
30 | } | 17 | } |
31 | + | 18 | |
32 | +#endif | 19 | -static bool trans_SQADD_zzi(DisasContext *s, arg_rri_esz *a) |
20 | -{ | ||
21 | - return do_zzi_sat(s, a, false, false); | ||
22 | -} | ||
23 | - | ||
24 | -static bool trans_UQADD_zzi(DisasContext *s, arg_rri_esz *a) | ||
25 | -{ | ||
26 | - return do_zzi_sat(s, a, true, false); | ||
27 | -} | ||
28 | - | ||
29 | -static bool trans_SQSUB_zzi(DisasContext *s, arg_rri_esz *a) | ||
30 | -{ | ||
31 | - return do_zzi_sat(s, a, false, true); | ||
32 | -} | ||
33 | - | ||
34 | -static bool trans_UQSUB_zzi(DisasContext *s, arg_rri_esz *a) | ||
35 | -{ | ||
36 | - return do_zzi_sat(s, a, true, true); | ||
37 | -} | ||
38 | +TRANS_FEAT(SQADD_zzi, aa64_sve, do_zzi_sat, a, false, false) | ||
39 | +TRANS_FEAT(UQADD_zzi, aa64_sve, do_zzi_sat, a, true, false) | ||
40 | +TRANS_FEAT(SQSUB_zzi, aa64_sve, do_zzi_sat, a, false, true) | ||
41 | +TRANS_FEAT(UQSUB_zzi, aa64_sve, do_zzi_sat, a, true, true) | ||
42 | |||
43 | static bool do_zzi_ool(DisasContext *s, arg_rri_esz *a, gen_helper_gvec_2i *fn) | ||
44 | { | ||
33 | -- | 45 | -- |
34 | 2.20.1 | 46 | 2.25.1 |
35 | |||
36 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Markus Armbruster <armbru@redhat.com> | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
4 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 4 | Message-id: 20220527181907.189259-77-richard.henderson@linaro.org |
5 | Message-id: 20190412165416.7977-10-philmd@redhat.com | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 7 | --- |
8 | include/hw/devices.h | 3 --- | 8 | target/arm/translate-sve.c | 7 ++----- |
9 | include/hw/net/lan9118.h | 19 +++++++++++++++++++ | 9 | 1 file changed, 2 insertions(+), 5 deletions(-) |
10 | hw/arm/kzm.c | 2 +- | ||
11 | hw/arm/mps2.c | 2 +- | ||
12 | hw/arm/realview.c | 1 + | ||
13 | hw/arm/vexpress.c | 2 +- | ||
14 | hw/net/lan9118.c | 2 +- | ||
15 | 7 files changed, 24 insertions(+), 7 deletions(-) | ||
16 | create mode 100644 include/hw/net/lan9118.h | ||
17 | 10 | ||
18 | diff --git a/include/hw/devices.h b/include/hw/devices.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/include/hw/devices.h | 13 | --- a/target/arm/translate-sve.c |
21 | +++ b/include/hw/devices.h | 14 | +++ b/target/arm/translate-sve.c |
22 | @@ -XXX,XX +XXX,XX @@ | 15 | @@ -XXX,XX +XXX,XX @@ static bool do_zzi_ool(DisasContext *s, arg_rri_esz *a, gen_helper_gvec_2i *fn) |
23 | /* smc91c111.c */ | 16 | } |
24 | void smc91c111_init(NICInfo *, uint32_t, qemu_irq); | 17 | |
25 | 18 | #define DO_ZZI(NAME, name) \ | |
26 | -/* lan9118.c */ | 19 | -static bool trans_##NAME##_zzi(DisasContext *s, arg_rri_esz *a) \ |
27 | -void lan9118_init(NICInfo *, uint32_t, qemu_irq); | 20 | -{ \ |
28 | - | 21 | - static gen_helper_gvec_2i * const fns[4] = { \ |
29 | #endif | 22 | + static gen_helper_gvec_2i * const name##i_fns[4] = { \ |
30 | diff --git a/include/hw/net/lan9118.h b/include/hw/net/lan9118.h | 23 | gen_helper_sve_##name##i_b, gen_helper_sve_##name##i_h, \ |
31 | new file mode 100644 | 24 | gen_helper_sve_##name##i_s, gen_helper_sve_##name##i_d, \ |
32 | index XXXXXXX..XXXXXXX | 25 | }; \ |
33 | --- /dev/null | 26 | - return do_zzi_ool(s, a, fns[a->esz]); \ |
34 | +++ b/include/hw/net/lan9118.h | 27 | -} |
35 | @@ -XXX,XX +XXX,XX @@ | 28 | + TRANS_FEAT(NAME##_zzi, aa64_sve, do_zzi_ool, a, name##i_fns[a->esz]) |
36 | +/* | 29 | |
37 | + * SMSC LAN9118 Ethernet interface emulation | 30 | DO_ZZI(SMAX, smax) |
38 | + * | 31 | DO_ZZI(UMAX, umax) |
39 | + * Copyright (c) 2009 CodeSourcery, LLC. | ||
40 | + * Written by Paul Brook | ||
41 | + * | ||
42 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
43 | + * See the COPYING file in the top-level directory. | ||
44 | + */ | ||
45 | + | ||
46 | +#ifndef HW_NET_LAN9118_H | ||
47 | +#define HW_NET_LAN9118_H | ||
48 | + | ||
49 | +#include "hw/irq.h" | ||
50 | +#include "net/net.h" | ||
51 | + | ||
52 | +void lan9118_init(NICInfo *, uint32_t, qemu_irq); | ||
53 | + | ||
54 | +#endif | ||
55 | diff --git a/hw/arm/kzm.c b/hw/arm/kzm.c | ||
56 | index XXXXXXX..XXXXXXX 100644 | ||
57 | --- a/hw/arm/kzm.c | ||
58 | +++ b/hw/arm/kzm.c | ||
59 | @@ -XXX,XX +XXX,XX @@ | ||
60 | #include "qemu/error-report.h" | ||
61 | #include "exec/address-spaces.h" | ||
62 | #include "net/net.h" | ||
63 | -#include "hw/devices.h" | ||
64 | +#include "hw/net/lan9118.h" | ||
65 | #include "hw/char/serial.h" | ||
66 | #include "sysemu/qtest.h" | ||
67 | |||
68 | diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c | ||
69 | index XXXXXXX..XXXXXXX 100644 | ||
70 | --- a/hw/arm/mps2.c | ||
71 | +++ b/hw/arm/mps2.c | ||
72 | @@ -XXX,XX +XXX,XX @@ | ||
73 | #include "hw/timer/cmsdk-apb-timer.h" | ||
74 | #include "hw/timer/cmsdk-apb-dualtimer.h" | ||
75 | #include "hw/misc/mps2-scc.h" | ||
76 | -#include "hw/devices.h" | ||
77 | +#include "hw/net/lan9118.h" | ||
78 | #include "net/net.h" | ||
79 | |||
80 | typedef enum MPS2FPGAType { | ||
81 | diff --git a/hw/arm/realview.c b/hw/arm/realview.c | ||
82 | index XXXXXXX..XXXXXXX 100644 | ||
83 | --- a/hw/arm/realview.c | ||
84 | +++ b/hw/arm/realview.c | ||
85 | @@ -XXX,XX +XXX,XX @@ | ||
86 | #include "hw/arm/arm.h" | ||
87 | #include "hw/arm/primecell.h" | ||
88 | #include "hw/devices.h" | ||
89 | +#include "hw/net/lan9118.h" | ||
90 | #include "hw/pci/pci.h" | ||
91 | #include "net/net.h" | ||
92 | #include "sysemu/sysemu.h" | ||
93 | diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c | ||
94 | index XXXXXXX..XXXXXXX 100644 | ||
95 | --- a/hw/arm/vexpress.c | ||
96 | +++ b/hw/arm/vexpress.c | ||
97 | @@ -XXX,XX +XXX,XX @@ | ||
98 | #include "hw/sysbus.h" | ||
99 | #include "hw/arm/arm.h" | ||
100 | #include "hw/arm/primecell.h" | ||
101 | -#include "hw/devices.h" | ||
102 | +#include "hw/net/lan9118.h" | ||
103 | #include "hw/i2c/i2c.h" | ||
104 | #include "net/net.h" | ||
105 | #include "sysemu/sysemu.h" | ||
106 | diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c | ||
107 | index XXXXXXX..XXXXXXX 100644 | ||
108 | --- a/hw/net/lan9118.c | ||
109 | +++ b/hw/net/lan9118.c | ||
110 | @@ -XXX,XX +XXX,XX @@ | ||
111 | #include "hw/sysbus.h" | ||
112 | #include "net/net.h" | ||
113 | #include "net/eth.h" | ||
114 | -#include "hw/devices.h" | ||
115 | +#include "hw/net/lan9118.h" | ||
116 | #include "sysemu/sysemu.h" | ||
117 | #include "hw/ptimer.h" | ||
118 | #include "qemu/log.h" | ||
119 | -- | 32 | -- |
120 | 2.20.1 | 33 | 2.25.1 |
121 | |||
122 | diff view generated by jsdifflib |
1 | For M-profile the MVFR* ID registers are memory mapped, in the | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | range we implement via the NVIC. Allow them to be read. | ||
3 | (If the CPU has no FPU, these registers are defined to be RAZ.) | ||
4 | 2 | ||
3 | Use these for the several varieties of floating-point | ||
4 | multiply-add instructions. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-78-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@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: 20190416125744.27770-3-peter.maydell@linaro.org | ||
8 | --- | 10 | --- |
9 | hw/intc/armv7m_nvic.c | 6 ++++++ | 11 | target/arm/translate-sve.c | 140 ++++++++++++++----------------------- |
10 | 1 file changed, 6 insertions(+) | 12 | 1 file changed, 53 insertions(+), 87 deletions(-) |
11 | 13 | ||
12 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c | 14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
13 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/hw/intc/armv7m_nvic.c | 16 | --- a/target/arm/translate-sve.c |
15 | +++ b/hw/intc/armv7m_nvic.c | 17 | +++ b/target/arm/translate-sve.c |
16 | @@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs) | 18 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_arg_zzxz(DisasContext *s, gen_helper_gvec_4 *fn, |
17 | return 0; | 19 | return gen_gvec_ool_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, a->index); |
18 | } | 20 | } |
19 | return cpu->env.v7m.sfar; | 21 | |
20 | + case 0xf40: /* MVFR0 */ | 22 | +/* Invoke an out-of-line helper on 4 Zregs, plus a pointer. */ |
21 | + return cpu->isar.mvfr0; | 23 | +static bool gen_gvec_ptr_zzzz(DisasContext *s, gen_helper_gvec_4_ptr *fn, |
22 | + case 0xf44: /* MVFR1 */ | 24 | + int rd, int rn, int rm, int ra, |
23 | + return cpu->isar.mvfr1; | 25 | + int data, TCGv_ptr ptr) |
24 | + case 0xf48: /* MVFR2 */ | 26 | +{ |
25 | + return cpu->isar.mvfr2; | 27 | + if (fn == NULL) { |
26 | default: | 28 | + return false; |
27 | bad_offset: | 29 | + } |
28 | qemu_log_mask(LOG_GUEST_ERROR, "NVIC: Bad read offset 0x%x\n", offset); | 30 | + if (sve_access_check(s)) { |
31 | + unsigned vsz = vec_full_reg_size(s); | ||
32 | + tcg_gen_gvec_4_ptr(vec_full_reg_offset(s, rd), | ||
33 | + vec_full_reg_offset(s, rn), | ||
34 | + vec_full_reg_offset(s, rm), | ||
35 | + vec_full_reg_offset(s, ra), | ||
36 | + ptr, vsz, vsz, data, fn); | ||
37 | + } | ||
38 | + return true; | ||
39 | +} | ||
40 | + | ||
41 | +static bool gen_gvec_fpst_zzzz(DisasContext *s, gen_helper_gvec_4_ptr *fn, | ||
42 | + int rd, int rn, int rm, int ra, | ||
43 | + int data, ARMFPStatusFlavour flavour) | ||
44 | +{ | ||
45 | + TCGv_ptr status = fpstatus_ptr(flavour); | ||
46 | + bool ret = gen_gvec_ptr_zzzz(s, fn, rd, rn, rm, ra, data, status); | ||
47 | + tcg_temp_free_ptr(status); | ||
48 | + return ret; | ||
49 | +} | ||
50 | + | ||
51 | /* Invoke an out-of-line helper on 2 Zregs and a predicate. */ | ||
52 | static bool gen_gvec_ool_zzp(DisasContext *s, gen_helper_gvec_3 *fn, | ||
53 | int rd, int rn, int pg, int data) | ||
54 | @@ -XXX,XX +XXX,XX @@ DO_SVE2_RRXR_ROT(CDOT_zzxw_d, gen_helper_sve2_cdot_idx_d) | ||
55 | |||
56 | static bool do_FMLA_zzxz(DisasContext *s, arg_rrxr_esz *a, bool sub) | ||
57 | { | ||
58 | - static gen_helper_gvec_4_ptr * const fns[3] = { | ||
59 | + static gen_helper_gvec_4_ptr * const fns[4] = { | ||
60 | + NULL, | ||
61 | gen_helper_gvec_fmla_idx_h, | ||
62 | gen_helper_gvec_fmla_idx_s, | ||
63 | gen_helper_gvec_fmla_idx_d, | ||
64 | }; | ||
65 | - | ||
66 | - if (sve_access_check(s)) { | ||
67 | - unsigned vsz = vec_full_reg_size(s); | ||
68 | - TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); | ||
69 | - tcg_gen_gvec_4_ptr(vec_full_reg_offset(s, a->rd), | ||
70 | - vec_full_reg_offset(s, a->rn), | ||
71 | - vec_full_reg_offset(s, a->rm), | ||
72 | - vec_full_reg_offset(s, a->ra), | ||
73 | - status, vsz, vsz, (a->index << 1) | sub, | ||
74 | - fns[a->esz - 1]); | ||
75 | - tcg_temp_free_ptr(status); | ||
76 | - } | ||
77 | - return true; | ||
78 | + return gen_gvec_fpst_zzzz(s, fns[a->esz], a->rd, a->rn, a->rm, a->ra, | ||
79 | + (a->index << 1) | sub, | ||
80 | + a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); | ||
81 | } | ||
82 | |||
83 | static bool trans_FMLA_zzxz(DisasContext *s, arg_FMLA_zzxz *a) | ||
84 | @@ -XXX,XX +XXX,XX @@ static bool trans_FCMLA_zpzzz(DisasContext *s, arg_FCMLA_zpzzz *a) | ||
85 | |||
86 | static bool trans_FCMLA_zzxz(DisasContext *s, arg_FCMLA_zzxz *a) | ||
87 | { | ||
88 | - static gen_helper_gvec_4_ptr * const fns[2] = { | ||
89 | + static gen_helper_gvec_4_ptr * const fns[4] = { | ||
90 | + NULL, | ||
91 | gen_helper_gvec_fcmlah_idx, | ||
92 | gen_helper_gvec_fcmlas_idx, | ||
93 | + NULL, | ||
94 | }; | ||
95 | |||
96 | - tcg_debug_assert(a->esz == 1 || a->esz == 2); | ||
97 | tcg_debug_assert(a->rd == a->ra); | ||
98 | - if (sve_access_check(s)) { | ||
99 | - unsigned vsz = vec_full_reg_size(s); | ||
100 | - TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); | ||
101 | - tcg_gen_gvec_4_ptr(vec_full_reg_offset(s, a->rd), | ||
102 | - vec_full_reg_offset(s, a->rn), | ||
103 | - vec_full_reg_offset(s, a->rm), | ||
104 | - vec_full_reg_offset(s, a->ra), | ||
105 | - status, vsz, vsz, | ||
106 | - a->index * 4 + a->rot, | ||
107 | - fns[a->esz - 1]); | ||
108 | - tcg_temp_free_ptr(status); | ||
109 | - } | ||
110 | - return true; | ||
111 | + | ||
112 | + return gen_gvec_fpst_zzzz(s, fns[a->esz], a->rd, a->rn, a->rm, a->ra, | ||
113 | + a->index * 4 + a->rot, | ||
114 | + a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); | ||
115 | } | ||
116 | |||
117 | /* | ||
118 | @@ -XXX,XX +XXX,XX @@ static bool trans_FMMLA(DisasContext *s, arg_rrrr_esz *a) | ||
119 | return false; | ||
120 | } | ||
121 | |||
122 | - if (sve_access_check(s)) { | ||
123 | - unsigned vsz = vec_full_reg_size(s); | ||
124 | - TCGv_ptr status = fpstatus_ptr(FPST_FPCR); | ||
125 | - tcg_gen_gvec_4_ptr(vec_full_reg_offset(s, a->rd), | ||
126 | - vec_full_reg_offset(s, a->rn), | ||
127 | - vec_full_reg_offset(s, a->rm), | ||
128 | - vec_full_reg_offset(s, a->ra), | ||
129 | - status, vsz, vsz, 0, fn); | ||
130 | - tcg_temp_free_ptr(status); | ||
131 | - } | ||
132 | - return true; | ||
133 | + return gen_gvec_fpst_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, 0, FPST_FPCR); | ||
134 | } | ||
135 | |||
136 | static gen_helper_gvec_4 * const sqdmlal_zzzw_fns[] = { | ||
137 | @@ -XXX,XX +XXX,XX @@ static bool do_FMLAL_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sub, bool sel) | ||
138 | if (!dc_isar_feature(aa64_sve2, s)) { | ||
139 | return false; | ||
140 | } | ||
141 | - if (sve_access_check(s)) { | ||
142 | - unsigned vsz = vec_full_reg_size(s); | ||
143 | - tcg_gen_gvec_4_ptr(vec_full_reg_offset(s, a->rd), | ||
144 | - vec_full_reg_offset(s, a->rn), | ||
145 | - vec_full_reg_offset(s, a->rm), | ||
146 | - vec_full_reg_offset(s, a->ra), | ||
147 | - cpu_env, vsz, vsz, (sel << 1) | sub, | ||
148 | - gen_helper_sve2_fmlal_zzzw_s); | ||
149 | - } | ||
150 | - return true; | ||
151 | + return gen_gvec_ptr_zzzz(s, gen_helper_sve2_fmlal_zzzw_s, | ||
152 | + a->rd, a->rn, a->rm, a->ra, | ||
153 | + (sel << 1) | sub, cpu_env); | ||
154 | } | ||
155 | |||
156 | static bool trans_FMLALB_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
157 | @@ -XXX,XX +XXX,XX @@ static bool do_FMLAL_zzxw(DisasContext *s, arg_rrxr_esz *a, bool sub, bool sel) | ||
158 | if (!dc_isar_feature(aa64_sve2, s)) { | ||
159 | return false; | ||
160 | } | ||
161 | - if (sve_access_check(s)) { | ||
162 | - unsigned vsz = vec_full_reg_size(s); | ||
163 | - tcg_gen_gvec_4_ptr(vec_full_reg_offset(s, a->rd), | ||
164 | - vec_full_reg_offset(s, a->rn), | ||
165 | - vec_full_reg_offset(s, a->rm), | ||
166 | - vec_full_reg_offset(s, a->ra), | ||
167 | - cpu_env, vsz, vsz, | ||
168 | - (a->index << 2) | (sel << 1) | sub, | ||
169 | - gen_helper_sve2_fmlal_zzxw_s); | ||
170 | - } | ||
171 | - return true; | ||
172 | + return gen_gvec_ptr_zzzz(s, gen_helper_sve2_fmlal_zzxw_s, | ||
173 | + a->rd, a->rn, a->rm, a->ra, | ||
174 | + (a->index << 2) | (sel << 1) | sub, cpu_env); | ||
175 | } | ||
176 | |||
177 | static bool trans_FMLALB_zzxw(DisasContext *s, arg_rrxr_esz *a) | ||
178 | @@ -XXX,XX +XXX,XX @@ static bool do_BFMLAL_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sel) | ||
179 | if (!dc_isar_feature(aa64_sve_bf16, s)) { | ||
180 | return false; | ||
181 | } | ||
182 | - if (sve_access_check(s)) { | ||
183 | - TCGv_ptr status = fpstatus_ptr(FPST_FPCR); | ||
184 | - unsigned vsz = vec_full_reg_size(s); | ||
185 | - | ||
186 | - tcg_gen_gvec_4_ptr(vec_full_reg_offset(s, a->rd), | ||
187 | - vec_full_reg_offset(s, a->rn), | ||
188 | - vec_full_reg_offset(s, a->rm), | ||
189 | - vec_full_reg_offset(s, a->ra), | ||
190 | - status, vsz, vsz, sel, | ||
191 | - gen_helper_gvec_bfmlal); | ||
192 | - tcg_temp_free_ptr(status); | ||
193 | - } | ||
194 | - return true; | ||
195 | + return gen_gvec_fpst_zzzz(s, gen_helper_gvec_bfmlal, | ||
196 | + a->rd, a->rn, a->rm, a->ra, sel, FPST_FPCR); | ||
197 | } | ||
198 | |||
199 | static bool trans_BFMLALB_zzzw(DisasContext *s, arg_rrrr_esz *a) | ||
200 | @@ -XXX,XX +XXX,XX @@ static bool do_BFMLAL_zzxw(DisasContext *s, arg_rrxr_esz *a, bool sel) | ||
201 | if (!dc_isar_feature(aa64_sve_bf16, s)) { | ||
202 | return false; | ||
203 | } | ||
204 | - if (sve_access_check(s)) { | ||
205 | - TCGv_ptr status = fpstatus_ptr(FPST_FPCR); | ||
206 | - unsigned vsz = vec_full_reg_size(s); | ||
207 | - | ||
208 | - tcg_gen_gvec_4_ptr(vec_full_reg_offset(s, a->rd), | ||
209 | - vec_full_reg_offset(s, a->rn), | ||
210 | - vec_full_reg_offset(s, a->rm), | ||
211 | - vec_full_reg_offset(s, a->ra), | ||
212 | - status, vsz, vsz, (a->index << 1) | sel, | ||
213 | - gen_helper_gvec_bfmlal_idx); | ||
214 | - tcg_temp_free_ptr(status); | ||
215 | - } | ||
216 | - return true; | ||
217 | + return gen_gvec_fpst_zzzz(s, gen_helper_gvec_bfmlal_idx, | ||
218 | + a->rd, a->rn, a->rm, a->ra, | ||
219 | + (a->index << 1) | sel, FPST_FPCR); | ||
220 | } | ||
221 | |||
222 | static bool trans_BFMLALB_zzxw(DisasContext *s, arg_rrxr_esz *a) | ||
29 | -- | 223 | -- |
30 | 2.20.1 | 224 | 2.25.1 |
31 | |||
32 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Since uWireSlave is only used in this new header, there is no | 3 | Being able to specify the feature predicate in TRANS_FEAT |
4 | need to expose it via "qemu/typedefs.h". | 4 | makes it easier to split trans_FMMLA by element size, |
5 | which also happens to simplify the decode. | ||
5 | 6 | ||
6 | Reviewed-by: Markus Armbruster <armbru@redhat.com> | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 8 | Message-id: 20220527181907.189259-79-richard.henderson@linaro.org |
8 | Message-id: 20190412165416.7977-9-philmd@redhat.com | 9 | Reviewed-by: Peter Maydell <peter.maydell@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 | include/hw/arm/omap.h | 6 +----- | 12 | target/arm/sve.decode | 7 +++---- |
12 | include/hw/devices.h | 15 --------------- | 13 | target/arm/translate-sve.c | 27 ++++----------------------- |
13 | include/hw/input/tsc2xxx.h | 36 ++++++++++++++++++++++++++++++++++++ | 14 | 2 files changed, 7 insertions(+), 27 deletions(-) |
14 | include/qemu/typedefs.h | 1 - | ||
15 | hw/arm/nseries.c | 2 +- | ||
16 | hw/arm/palm.c | 2 +- | ||
17 | hw/input/tsc2005.c | 2 +- | ||
18 | hw/input/tsc210x.c | 4 ++-- | ||
19 | MAINTAINERS | 2 ++ | ||
20 | 9 files changed, 44 insertions(+), 26 deletions(-) | ||
21 | create mode 100644 include/hw/input/tsc2xxx.h | ||
22 | 15 | ||
23 | diff --git a/include/hw/arm/omap.h b/include/hw/arm/omap.h | 16 | diff --git a/target/arm/sve.decode b/target/arm/sve.decode |
24 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/include/hw/arm/omap.h | 18 | --- a/target/arm/sve.decode |
26 | +++ b/include/hw/arm/omap.h | 19 | +++ b/target/arm/sve.decode |
27 | @@ -XXX,XX +XXX,XX @@ | 20 | @@ -XXX,XX +XXX,XX @@ SQRDCMLAH_zzzz 01000100 esz:2 0 rm:5 0011 rot:2 rn:5 rd:5 ra=%reg_movprfx |
28 | #include "exec/memory.h" | 21 | USDOT_zzzz 01000100 .. 0 ..... 011 110 ..... ..... @rda_rn_rm |
29 | # define hw_omap_h "omap.h" | 22 | |
30 | #include "hw/irq.h" | 23 | ### SVE2 floating point matrix multiply accumulate |
31 | +#include "hw/input/tsc2xxx.h" | 24 | -{ |
32 | #include "target/arm/cpu-qom.h" | 25 | - BFMMLA 01100100 01 1 ..... 111 001 ..... ..... @rda_rn_rm_e0 |
33 | #include "qemu/log.h" | 26 | - FMMLA 01100100 .. 1 ..... 111 001 ..... ..... @rda_rn_rm |
34 | 27 | -} | |
35 | @@ -XXX,XX +XXX,XX @@ qemu_irq *omap_mpuio_in_get(struct omap_mpuio_s *s); | 28 | +BFMMLA 01100100 01 1 ..... 111 001 ..... ..... @rda_rn_rm_e0 |
36 | void omap_mpuio_out_set(struct omap_mpuio_s *s, int line, qemu_irq handler); | 29 | +FMMLA_s 01100100 10 1 ..... 111 001 ..... ..... @rda_rn_rm_e0 |
37 | void omap_mpuio_key(struct omap_mpuio_s *s, int row, int col, int down); | 30 | +FMMLA_d 01100100 11 1 ..... 111 001 ..... ..... @rda_rn_rm_e0 |
38 | 31 | ||
39 | -struct uWireSlave { | 32 | ### SVE2 Memory Gather Load Group |
40 | - uint16_t (*receive)(void *opaque); | 33 | |
41 | - void (*send)(void *opaque, uint16_t data); | 34 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
42 | - void *opaque; | ||
43 | -}; | ||
44 | struct omap_uwire_s; | ||
45 | void omap_uwire_attach(struct omap_uwire_s *s, | ||
46 | uWireSlave *slave, int chipselect); | ||
47 | diff --git a/include/hw/devices.h b/include/hw/devices.h | ||
48 | index XXXXXXX..XXXXXXX 100644 | 35 | index XXXXXXX..XXXXXXX 100644 |
49 | --- a/include/hw/devices.h | 36 | --- a/target/arm/translate-sve.c |
50 | +++ b/include/hw/devices.h | 37 | +++ b/target/arm/translate-sve.c |
51 | @@ -XXX,XX +XXX,XX @@ | 38 | @@ -XXX,XX +XXX,XX @@ DO_SVE2_ZPZZ_FP(FMINP, fminp) |
52 | /* Devices that have nowhere better to go. */ | 39 | * SVE Integer Multiply-Add (unpredicated) |
53 | 40 | */ | |
54 | #include "hw/hw.h" | 41 | |
55 | -#include "ui/console.h" | 42 | -static bool trans_FMMLA(DisasContext *s, arg_rrrr_esz *a) |
56 | 43 | -{ | |
57 | /* smc91c111.c */ | 44 | - gen_helper_gvec_4_ptr *fn; |
58 | void smc91c111_init(NICInfo *, uint32_t, qemu_irq); | ||
59 | @@ -XXX,XX +XXX,XX @@ void smc91c111_init(NICInfo *, uint32_t, qemu_irq); | ||
60 | /* lan9118.c */ | ||
61 | void lan9118_init(NICInfo *, uint32_t, qemu_irq); | ||
62 | |||
63 | -/* tsc210x.c */ | ||
64 | -uWireSlave *tsc2102_init(qemu_irq pint); | ||
65 | -uWireSlave *tsc2301_init(qemu_irq penirq, qemu_irq kbirq, qemu_irq dav); | ||
66 | -I2SCodec *tsc210x_codec(uWireSlave *chip); | ||
67 | -uint32_t tsc210x_txrx(void *opaque, uint32_t value, int len); | ||
68 | -void tsc210x_set_transform(uWireSlave *chip, | ||
69 | - MouseTransformInfo *info); | ||
70 | -void tsc210x_key_event(uWireSlave *chip, int key, int down); | ||
71 | - | 45 | - |
72 | -/* tsc2005.c */ | 46 | - switch (a->esz) { |
73 | -void *tsc2005_init(qemu_irq pintdav); | 47 | - case MO_32: |
74 | -uint32_t tsc2005_txrx(void *opaque, uint32_t value, int len); | 48 | - if (!dc_isar_feature(aa64_sve_f32mm, s)) { |
75 | -void tsc2005_set_transform(void *opaque, MouseTransformInfo *info); | 49 | - return false; |
50 | - } | ||
51 | - fn = gen_helper_fmmla_s; | ||
52 | - break; | ||
53 | - case MO_64: | ||
54 | - if (!dc_isar_feature(aa64_sve_f64mm, s)) { | ||
55 | - return false; | ||
56 | - } | ||
57 | - fn = gen_helper_fmmla_d; | ||
58 | - break; | ||
59 | - default: | ||
60 | - return false; | ||
61 | - } | ||
76 | - | 62 | - |
77 | #endif | 63 | - return gen_gvec_fpst_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, 0, FPST_FPCR); |
78 | diff --git a/include/hw/input/tsc2xxx.h b/include/hw/input/tsc2xxx.h | 64 | -} |
79 | new file mode 100644 | 65 | +TRANS_FEAT(FMMLA_s, aa64_sve_f32mm, gen_gvec_fpst_zzzz, gen_helper_fmmla_s, |
80 | index XXXXXXX..XXXXXXX | 66 | + a->rd, a->rn, a->rm, a->ra, 0, FPST_FPCR) |
81 | --- /dev/null | 67 | +TRANS_FEAT(FMMLA_d, aa64_sve_f64mm, gen_gvec_fpst_zzzz, gen_helper_fmmla_d, |
82 | +++ b/include/hw/input/tsc2xxx.h | 68 | + a->rd, a->rn, a->rm, a->ra, 0, FPST_FPCR) |
83 | @@ -XXX,XX +XXX,XX @@ | 69 | |
84 | +/* | 70 | static gen_helper_gvec_4 * const sqdmlal_zzzw_fns[] = { |
85 | + * TI touchscreen controller | 71 | NULL, gen_helper_sve2_sqdmlal_zzzw_h, |
86 | + * | ||
87 | + * Copyright (c) 2006 Andrzej Zaborowski | ||
88 | + * Copyright (C) 2008 Nokia Corporation | ||
89 | + * | ||
90 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
91 | + * See the COPYING file in the top-level directory. | ||
92 | + */ | ||
93 | + | ||
94 | +#ifndef HW_INPUT_TSC2XXX_H | ||
95 | +#define HW_INPUT_TSC2XXX_H | ||
96 | + | ||
97 | +#include "hw/irq.h" | ||
98 | +#include "ui/console.h" | ||
99 | + | ||
100 | +typedef struct uWireSlave { | ||
101 | + uint16_t (*receive)(void *opaque); | ||
102 | + void (*send)(void *opaque, uint16_t data); | ||
103 | + void *opaque; | ||
104 | +} uWireSlave; | ||
105 | + | ||
106 | +/* tsc210x.c */ | ||
107 | +uWireSlave *tsc2102_init(qemu_irq pint); | ||
108 | +uWireSlave *tsc2301_init(qemu_irq penirq, qemu_irq kbirq, qemu_irq dav); | ||
109 | +I2SCodec *tsc210x_codec(uWireSlave *chip); | ||
110 | +uint32_t tsc210x_txrx(void *opaque, uint32_t value, int len); | ||
111 | +void tsc210x_set_transform(uWireSlave *chip, MouseTransformInfo *info); | ||
112 | +void tsc210x_key_event(uWireSlave *chip, int key, int down); | ||
113 | + | ||
114 | +/* tsc2005.c */ | ||
115 | +void *tsc2005_init(qemu_irq pintdav); | ||
116 | +uint32_t tsc2005_txrx(void *opaque, uint32_t value, int len); | ||
117 | +void tsc2005_set_transform(void *opaque, MouseTransformInfo *info); | ||
118 | + | ||
119 | +#endif | ||
120 | diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h | ||
121 | index XXXXXXX..XXXXXXX 100644 | ||
122 | --- a/include/qemu/typedefs.h | ||
123 | +++ b/include/qemu/typedefs.h | ||
124 | @@ -XXX,XX +XXX,XX @@ typedef struct RAMBlock RAMBlock; | ||
125 | typedef struct Range Range; | ||
126 | typedef struct SHPCDevice SHPCDevice; | ||
127 | typedef struct SSIBus SSIBus; | ||
128 | -typedef struct uWireSlave uWireSlave; | ||
129 | typedef struct VirtIODevice VirtIODevice; | ||
130 | typedef struct Visitor Visitor; | ||
131 | typedef void SaveStateHandler(QEMUFile *f, void *opaque); | ||
132 | diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c | ||
133 | index XXXXXXX..XXXXXXX 100644 | ||
134 | --- a/hw/arm/nseries.c | ||
135 | +++ b/hw/arm/nseries.c | ||
136 | @@ -XXX,XX +XXX,XX @@ | ||
137 | #include "ui/console.h" | ||
138 | #include "hw/boards.h" | ||
139 | #include "hw/i2c/i2c.h" | ||
140 | -#include "hw/devices.h" | ||
141 | #include "hw/display/blizzard.h" | ||
142 | +#include "hw/input/tsc2xxx.h" | ||
143 | #include "hw/misc/cbus.h" | ||
144 | #include "hw/misc/tmp105.h" | ||
145 | #include "hw/block/flash.h" | ||
146 | diff --git a/hw/arm/palm.c b/hw/arm/palm.c | ||
147 | index XXXXXXX..XXXXXXX 100644 | ||
148 | --- a/hw/arm/palm.c | ||
149 | +++ b/hw/arm/palm.c | ||
150 | @@ -XXX,XX +XXX,XX @@ | ||
151 | #include "hw/arm/omap.h" | ||
152 | #include "hw/boards.h" | ||
153 | #include "hw/arm/arm.h" | ||
154 | -#include "hw/devices.h" | ||
155 | +#include "hw/input/tsc2xxx.h" | ||
156 | #include "hw/loader.h" | ||
157 | #include "exec/address-spaces.h" | ||
158 | #include "cpu.h" | ||
159 | diff --git a/hw/input/tsc2005.c b/hw/input/tsc2005.c | ||
160 | index XXXXXXX..XXXXXXX 100644 | ||
161 | --- a/hw/input/tsc2005.c | ||
162 | +++ b/hw/input/tsc2005.c | ||
163 | @@ -XXX,XX +XXX,XX @@ | ||
164 | #include "hw/hw.h" | ||
165 | #include "qemu/timer.h" | ||
166 | #include "ui/console.h" | ||
167 | -#include "hw/devices.h" | ||
168 | +#include "hw/input/tsc2xxx.h" | ||
169 | #include "trace.h" | ||
170 | |||
171 | #define TSC_CUT_RESOLUTION(value, p) ((value) >> (16 - (p ? 12 : 10))) | ||
172 | diff --git a/hw/input/tsc210x.c b/hw/input/tsc210x.c | ||
173 | index XXXXXXX..XXXXXXX 100644 | ||
174 | --- a/hw/input/tsc210x.c | ||
175 | +++ b/hw/input/tsc210x.c | ||
176 | @@ -XXX,XX +XXX,XX @@ | ||
177 | #include "audio/audio.h" | ||
178 | #include "qemu/timer.h" | ||
179 | #include "ui/console.h" | ||
180 | -#include "hw/arm/omap.h" /* For I2SCodec and uWireSlave */ | ||
181 | -#include "hw/devices.h" | ||
182 | +#include "hw/arm/omap.h" /* For I2SCodec */ | ||
183 | +#include "hw/input/tsc2xxx.h" | ||
184 | |||
185 | #define TSC_DATA_REGISTERS_PAGE 0x0 | ||
186 | #define TSC_CONTROL_REGISTERS_PAGE 0x1 | ||
187 | diff --git a/MAINTAINERS b/MAINTAINERS | ||
188 | index XXXXXXX..XXXXXXX 100644 | ||
189 | --- a/MAINTAINERS | ||
190 | +++ b/MAINTAINERS | ||
191 | @@ -XXX,XX +XXX,XX @@ F: hw/input/tsc2005.c | ||
192 | F: hw/misc/cbus.c | ||
193 | F: hw/timer/twl92230.c | ||
194 | F: include/hw/display/blizzard.h | ||
195 | +F: include/hw/input/tsc2xxx.h | ||
196 | F: include/hw/misc/cbus.h | ||
197 | |||
198 | Palm | ||
199 | @@ -XXX,XX +XXX,XX @@ L: qemu-arm@nongnu.org | ||
200 | S: Odd Fixes | ||
201 | F: hw/arm/palm.c | ||
202 | F: hw/input/tsc210x.c | ||
203 | +F: include/hw/input/tsc2xxx.h | ||
204 | |||
205 | Raspberry Pi | ||
206 | M: Peter Maydell <peter.maydell@linaro.org> | ||
207 | -- | 72 | -- |
208 | 2.20.1 | 73 | 2.25.1 |
209 | |||
210 | diff view generated by jsdifflib |
1 | Currently the code in v7m_push_stack() which detects a violation | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | of the v8M stack limit simply returns early if it does so. This | ||
3 | is OK for the current integer-only code, but won't work for the | ||
4 | floating point handling we're about to add. We need to continue | ||
5 | executing the rest of the function so that we check for other | ||
6 | exceptions like not having permission to use the FPU and so | ||
7 | that we correctly set the FPCCR state if we are doing lazy | ||
8 | stacking. Refactor to avoid the early return. | ||
9 | 2 | ||
3 | Combined with the check already present in gen_mov_p, | ||
4 | we can simplify some special cases in trans_AND_pppp | ||
5 | and trans_BIC_pppp. | ||
6 | |||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20220527181907.189259-80-richard.henderson@linaro.org | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
12 | Message-id: 20190416125744.27770-10-peter.maydell@linaro.org | ||
13 | --- | 11 | --- |
14 | target/arm/helper.c | 23 ++++++++++++++++++----- | 12 | target/arm/translate-sve.c | 30 ++++++++++++------------------ |
15 | 1 file changed, 18 insertions(+), 5 deletions(-) | 13 | 1 file changed, 12 insertions(+), 18 deletions(-) |
16 | 14 | ||
17 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 15 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
18 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/target/arm/helper.c | 17 | --- a/target/arm/translate-sve.c |
20 | +++ b/target/arm/helper.c | 18 | +++ b/target/arm/translate-sve.c |
21 | @@ -XXX,XX +XXX,XX @@ static bool v7m_push_stack(ARMCPU *cpu) | 19 | @@ -XXX,XX +XXX,XX @@ static void do_dupi_z(DisasContext *s, int rd, uint64_t word) |
22 | * should ignore further stack faults trying to process | 20 | } |
23 | * that derived exception.) | 21 | |
24 | */ | 22 | /* Invoke a vector expander on three Pregs. */ |
25 | - bool stacked_ok; | 23 | -static void gen_gvec_fn_ppp(DisasContext *s, GVecGen3Fn *gvec_fn, |
26 | + bool stacked_ok = true, limitviol = false; | 24 | +static bool gen_gvec_fn_ppp(DisasContext *s, GVecGen3Fn *gvec_fn, |
27 | CPUARMState *env = &cpu->env; | 25 | int rd, int rn, int rm) |
28 | uint32_t xpsr = xpsr_read(env); | 26 | { |
29 | uint32_t frameptr = env->regs[13]; | 27 | - unsigned psz = pred_gvec_reg_size(s); |
30 | @@ -XXX,XX +XXX,XX @@ static bool v7m_push_stack(ARMCPU *cpu) | 28 | - gvec_fn(MO_64, pred_full_reg_offset(s, rd), |
31 | armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE, | 29 | - pred_full_reg_offset(s, rn), |
32 | env->v7m.secure); | 30 | - pred_full_reg_offset(s, rm), psz, psz); |
33 | env->regs[13] = limit; | 31 | + if (sve_access_check(s)) { |
32 | + unsigned psz = pred_gvec_reg_size(s); | ||
33 | + gvec_fn(MO_64, pred_full_reg_offset(s, rd), | ||
34 | + pred_full_reg_offset(s, rn), | ||
35 | + pred_full_reg_offset(s, rm), psz, psz); | ||
36 | + } | ||
37 | + return true; | ||
38 | } | ||
39 | |||
40 | /* Invoke a vector move on two Pregs. */ | ||
41 | @@ -XXX,XX +XXX,XX @@ static bool trans_AND_pppp(DisasContext *s, arg_rprr_s *a) | ||
42 | }; | ||
43 | |||
44 | if (!a->s) { | ||
45 | - if (!sve_access_check(s)) { | ||
34 | - return true; | 46 | - return true; |
35 | + /* | 47 | - } |
36 | + * We won't try to perform any further memory accesses but | 48 | if (a->rn == a->rm) { |
37 | + * we must continue through the following code to check for | 49 | if (a->pg == a->rn) { |
38 | + * permission faults during FPU state preservation, and we | 50 | - do_mov_p(s, a->rd, a->rn); |
39 | + * must update FPCCR if lazy stacking is enabled. | 51 | - } else { |
40 | + */ | 52 | - gen_gvec_fn_ppp(s, tcg_gen_gvec_and, a->rd, a->rn, a->pg); |
41 | + limitviol = true; | 53 | + return do_mov_p(s, a->rd, a->rn); |
42 | + stacked_ok = false; | 54 | } |
55 | - return true; | ||
56 | + return gen_gvec_fn_ppp(s, tcg_gen_gvec_and, a->rd, a->rn, a->pg); | ||
57 | } else if (a->pg == a->rn || a->pg == a->rm) { | ||
58 | - gen_gvec_fn_ppp(s, tcg_gen_gvec_and, a->rd, a->rn, a->rm); | ||
59 | - return true; | ||
60 | + return gen_gvec_fn_ppp(s, tcg_gen_gvec_and, a->rd, a->rn, a->rm); | ||
43 | } | 61 | } |
44 | } | 62 | } |
45 | 63 | return do_pppp_flags(s, a, &op); | |
46 | @@ -XXX,XX +XXX,XX @@ static bool v7m_push_stack(ARMCPU *cpu) | 64 | @@ -XXX,XX +XXX,XX @@ static bool trans_BIC_pppp(DisasContext *s, arg_rprr_s *a) |
47 | * (which may be taken in preference to the one we started with | 65 | }; |
48 | * if it has higher priority). | 66 | |
49 | */ | 67 | if (!a->s && a->pg == a->rn) { |
50 | - stacked_ok = | 68 | - if (sve_access_check(s)) { |
51 | + stacked_ok = stacked_ok && | 69 | - gen_gvec_fn_ppp(s, tcg_gen_gvec_andc, a->rd, a->rn, a->rm); |
52 | v7m_stack_write(cpu, frameptr, env->regs[0], mmu_idx, false) && | 70 | - } |
53 | v7m_stack_write(cpu, frameptr + 4, env->regs[1], mmu_idx, false) && | 71 | - return true; |
54 | v7m_stack_write(cpu, frameptr + 8, env->regs[2], mmu_idx, false) && | 72 | + return gen_gvec_fn_ppp(s, tcg_gen_gvec_andc, a->rd, a->rn, a->rm); |
55 | @@ -XXX,XX +XXX,XX @@ static bool v7m_push_stack(ARMCPU *cpu) | 73 | } |
56 | v7m_stack_write(cpu, frameptr + 24, env->regs[15], mmu_idx, false) && | 74 | return do_pppp_flags(s, a, &op); |
57 | v7m_stack_write(cpu, frameptr + 28, xpsr, mmu_idx, false); | ||
58 | |||
59 | - /* Update SP regardless of whether any of the stack accesses failed. */ | ||
60 | - env->regs[13] = frameptr; | ||
61 | + /* | ||
62 | + * If we broke a stack limit then SP was already updated earlier; | ||
63 | + * otherwise we update SP regardless of whether any of the stack | ||
64 | + * accesses failed or we took some other kind of fault. | ||
65 | + */ | ||
66 | + if (!limitviol) { | ||
67 | + env->regs[13] = frameptr; | ||
68 | + } | ||
69 | |||
70 | return !stacked_ok; | ||
71 | } | 75 | } |
72 | -- | 76 | -- |
73 | 2.20.1 | 77 | 2.25.1 |
74 | |||
75 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Suggested-by: Markus Armbruster <armbru@redhat.com> | 3 | This alias is defined on EOR (prediates). While the |
4 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 4 | same operation could be performed with NAND or NOR, |
5 | Message-id: 20190412165416.7977-3-philmd@redhat.com | 5 | only bother with the official alias. |
6 | |||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20220527181907.189259-81-richard.henderson@linaro.org | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | --- | 11 | --- |
9 | hw/arm/nseries.c | 3 ++- | 12 | target/arm/translate-sve.c | 5 +++++ |
10 | 1 file changed, 2 insertions(+), 1 deletion(-) | 13 | 1 file changed, 5 insertions(+) |
11 | 14 | ||
12 | diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c | 15 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
13 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/hw/arm/nseries.c | 17 | --- a/target/arm/translate-sve.c |
15 | +++ b/hw/arm/nseries.c | 18 | +++ b/target/arm/translate-sve.c |
16 | @@ -XXX,XX +XXX,XX @@ | 19 | @@ -XXX,XX +XXX,XX @@ static bool trans_EOR_pppp(DisasContext *s, arg_rprr_s *a) |
17 | #include "hw/boards.h" | 20 | .fno = gen_helper_sve_eor_pppp, |
18 | #include "hw/i2c/i2c.h" | 21 | .prefer_i64 = TCG_TARGET_REG_BITS == 64, |
19 | #include "hw/devices.h" | 22 | }; |
20 | +#include "hw/misc/tmp105.h" | 23 | + |
21 | #include "hw/block/flash.h" | 24 | + /* Alias NOT (predicate) is EOR Pd.B, Pg/Z, Pn.B, Pg.B */ |
22 | #include "hw/hw.h" | 25 | + if (!a->s && a->pg == a->rm) { |
23 | #include "hw/bt.h" | 26 | + return gen_gvec_fn_ppp(s, tcg_gen_gvec_andc, a->rd, a->pg, a->rn); |
24 | @@ -XXX,XX +XXX,XX @@ static void n8x0_i2c_setup(struct n800_s *s) | 27 | + } |
25 | qemu_register_powerdown_notifier(&n8x0_system_powerdown_notifier); | 28 | return do_pppp_flags(s, a, &op); |
26 | |||
27 | /* Attach a TMP105 PM chip (A0 wired to ground) */ | ||
28 | - dev = i2c_create_slave(i2c, "tmp105", N8X0_TMP105_ADDR); | ||
29 | + dev = i2c_create_slave(i2c, TYPE_TMP105, N8X0_TMP105_ADDR); | ||
30 | qdev_connect_gpio_out(dev, 0, tmp_irq); | ||
31 | } | 29 | } |
32 | 30 | ||
33 | -- | 31 | -- |
34 | 2.20.1 | 32 | 2.25.1 |
35 | |||
36 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Markus Armbruster <armbru@redhat.com> | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
4 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 4 | Message-id: 20220527181907.189259-82-richard.henderson@linaro.org |
5 | Message-id: 20190412165416.7977-8-philmd@redhat.com | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 7 | --- |
8 | include/hw/devices.h | 3 --- | 8 | target/arm/translate-sve.c | 5 +---- |
9 | include/hw/input/gamepad.h | 19 +++++++++++++++++++ | 9 | 1 file changed, 1 insertion(+), 4 deletions(-) |
10 | hw/arm/stellaris.c | 2 +- | ||
11 | hw/input/stellaris_input.c | 2 +- | ||
12 | MAINTAINERS | 1 + | ||
13 | 5 files changed, 22 insertions(+), 5 deletions(-) | ||
14 | create mode 100644 include/hw/input/gamepad.h | ||
15 | 10 | ||
16 | diff --git a/include/hw/devices.h b/include/hw/devices.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/include/hw/devices.h | 13 | --- a/target/arm/translate-sve.c |
19 | +++ b/include/hw/devices.h | 14 | +++ b/target/arm/translate-sve.c |
20 | @@ -XXX,XX +XXX,XX @@ void *tsc2005_init(qemu_irq pintdav); | 15 | @@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_4 * const udiv_fns[4] = { |
21 | uint32_t tsc2005_txrx(void *opaque, uint32_t value, int len); | 16 | }; |
22 | void tsc2005_set_transform(void *opaque, MouseTransformInfo *info); | 17 | TRANS_FEAT(UDIV_zpzz, aa64_sve, gen_gvec_ool_arg_zpzz, udiv_fns[a->esz], a, 0) |
23 | 18 | ||
24 | -/* stellaris_input.c */ | 19 | -static bool trans_SEL_zpzz(DisasContext *s, arg_rprr_esz *a) |
25 | -void stellaris_gamepad_init(int n, qemu_irq *irq, const int *keycode); | 20 | -{ |
26 | - | 21 | - return do_sel_z(s, a->rd, a->rn, a->rm, a->pg, a->esz); |
27 | #endif | 22 | -} |
28 | diff --git a/include/hw/input/gamepad.h b/include/hw/input/gamepad.h | 23 | +TRANS_FEAT(SEL_zpzz, aa64_sve, do_sel_z, a->rd, a->rn, a->rm, a->pg, a->esz) |
29 | new file mode 100644 | 24 | |
30 | index XXXXXXX..XXXXXXX | 25 | /* |
31 | --- /dev/null | 26 | *** SVE Integer Arithmetic - Unary Predicated Group |
32 | +++ b/include/hw/input/gamepad.h | ||
33 | @@ -XXX,XX +XXX,XX @@ | ||
34 | +/* | ||
35 | + * Gamepad style buttons connected to IRQ/GPIO lines | ||
36 | + * | ||
37 | + * Copyright (c) 2007 CodeSourcery. | ||
38 | + * Written by Paul Brook | ||
39 | + * | ||
40 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
41 | + * See the COPYING file in the top-level directory. | ||
42 | + */ | ||
43 | + | ||
44 | +#ifndef HW_INPUT_GAMEPAD_H | ||
45 | +#define HW_INPUT_GAMEPAD_H | ||
46 | + | ||
47 | +#include "hw/irq.h" | ||
48 | + | ||
49 | +/* stellaris_input.c */ | ||
50 | +void stellaris_gamepad_init(int n, qemu_irq *irq, const int *keycode); | ||
51 | + | ||
52 | +#endif | ||
53 | diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c | ||
54 | index XXXXXXX..XXXXXXX 100644 | ||
55 | --- a/hw/arm/stellaris.c | ||
56 | +++ b/hw/arm/stellaris.c | ||
57 | @@ -XXX,XX +XXX,XX @@ | ||
58 | #include "hw/sysbus.h" | ||
59 | #include "hw/ssi/ssi.h" | ||
60 | #include "hw/arm/arm.h" | ||
61 | -#include "hw/devices.h" | ||
62 | #include "qemu/timer.h" | ||
63 | #include "hw/i2c/i2c.h" | ||
64 | #include "net/net.h" | ||
65 | @@ -XXX,XX +XXX,XX @@ | ||
66 | #include "sysemu/sysemu.h" | ||
67 | #include "hw/arm/armv7m.h" | ||
68 | #include "hw/char/pl011.h" | ||
69 | +#include "hw/input/gamepad.h" | ||
70 | #include "hw/watchdog/cmsdk-apb-watchdog.h" | ||
71 | #include "hw/misc/unimp.h" | ||
72 | #include "cpu.h" | ||
73 | diff --git a/hw/input/stellaris_input.c b/hw/input/stellaris_input.c | ||
74 | index XXXXXXX..XXXXXXX 100644 | ||
75 | --- a/hw/input/stellaris_input.c | ||
76 | +++ b/hw/input/stellaris_input.c | ||
77 | @@ -XXX,XX +XXX,XX @@ | ||
78 | */ | ||
79 | #include "qemu/osdep.h" | ||
80 | #include "hw/hw.h" | ||
81 | -#include "hw/devices.h" | ||
82 | +#include "hw/input/gamepad.h" | ||
83 | #include "ui/console.h" | ||
84 | |||
85 | typedef struct { | ||
86 | diff --git a/MAINTAINERS b/MAINTAINERS | ||
87 | index XXXXXXX..XXXXXXX 100644 | ||
88 | --- a/MAINTAINERS | ||
89 | +++ b/MAINTAINERS | ||
90 | @@ -XXX,XX +XXX,XX @@ M: Peter Maydell <peter.maydell@linaro.org> | ||
91 | L: qemu-arm@nongnu.org | ||
92 | S: Maintained | ||
93 | F: hw/*/stellaris* | ||
94 | +F: include/hw/input/gamepad.h | ||
95 | |||
96 | Versatile Express | ||
97 | M: Peter Maydell <peter.maydell@linaro.org> | ||
98 | -- | 27 | -- |
99 | 2.20.1 | 28 | 2.25.1 |
100 | |||
101 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Thomas Huth <thuth@redhat.com> | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
4 | Reviewed-by: Markus Armbruster <armbru@redhat.com> | 4 | Message-id: 20220527181907.189259-83-richard.henderson@linaro.org |
5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Message-id: 20190412165416.7977-7-philmd@redhat.com | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | --- | 7 | --- |
9 | include/hw/devices.h | 14 -------------- | 8 | target/arm/translate-sve.c | 17 +++-------------- |
10 | include/hw/misc/cbus.h | 32 ++++++++++++++++++++++++++++++++ | 9 | 1 file changed, 3 insertions(+), 14 deletions(-) |
11 | hw/arm/nseries.c | 1 + | ||
12 | hw/misc/cbus.c | 2 +- | ||
13 | MAINTAINERS | 1 + | ||
14 | 5 files changed, 35 insertions(+), 15 deletions(-) | ||
15 | create mode 100644 include/hw/misc/cbus.h | ||
16 | 10 | ||
17 | diff --git a/include/hw/devices.h b/include/hw/devices.h | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
18 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/include/hw/devices.h | 13 | --- a/target/arm/translate-sve.c |
20 | +++ b/include/hw/devices.h | 14 | +++ b/target/arm/translate-sve.c |
21 | @@ -XXX,XX +XXX,XX @@ void tsc2005_set_transform(void *opaque, MouseTransformInfo *info); | 15 | @@ -XXX,XX +XXX,XX @@ static bool trans_PRF_rr(DisasContext *s, arg_PRF_rr *a) |
22 | /* stellaris_input.c */ | 16 | * In the meantime, just emit the moves. |
23 | void stellaris_gamepad_init(int n, qemu_irq *irq, const int *keycode); | 17 | */ |
24 | 18 | ||
25 | -/* cbus.c */ | 19 | -static bool trans_MOVPRFX(DisasContext *s, arg_MOVPRFX *a) |
26 | -typedef struct { | 20 | -{ |
27 | - qemu_irq clk; | 21 | - return do_mov_z(s, a->rd, a->rn); |
28 | - qemu_irq dat; | 22 | -} |
29 | - qemu_irq sel; | ||
30 | -} CBus; | ||
31 | -CBus *cbus_init(qemu_irq dat_out); | ||
32 | -void cbus_attach(CBus *bus, void *slave_opaque); | ||
33 | - | 23 | - |
34 | -void *retu_init(qemu_irq irq, int vilma); | 24 | -static bool trans_MOVPRFX_m(DisasContext *s, arg_rpr_esz *a) |
35 | -void *tahvo_init(qemu_irq irq, int betty); | 25 | -{ |
26 | - return do_sel_z(s, a->rd, a->rn, a->rd, a->pg, a->esz); | ||
27 | -} | ||
36 | - | 28 | - |
37 | -void retu_key_event(void *retu, int state); | 29 | -static bool trans_MOVPRFX_z(DisasContext *s, arg_rpr_esz *a) |
38 | - | 30 | -{ |
39 | #endif | 31 | - return do_movz_zpz(s, a->rd, a->rn, a->pg, a->esz, false); |
40 | diff --git a/include/hw/misc/cbus.h b/include/hw/misc/cbus.h | 32 | -} |
41 | new file mode 100644 | 33 | +TRANS_FEAT(MOVPRFX, aa64_sve, do_mov_z, a->rd, a->rn) |
42 | index XXXXXXX..XXXXXXX | 34 | +TRANS_FEAT(MOVPRFX_m, aa64_sve, do_sel_z, a->rd, a->rn, a->rd, a->pg, a->esz) |
43 | --- /dev/null | 35 | +TRANS_FEAT(MOVPRFX_z, aa64_sve, do_movz_zpz, a->rd, a->rn, a->pg, a->esz, false) |
44 | +++ b/include/hw/misc/cbus.h | 36 | |
45 | @@ -XXX,XX +XXX,XX @@ | 37 | /* |
46 | +/* | 38 | * SVE2 Integer Multiply - Unpredicated |
47 | + * CBUS three-pin bus and the Retu / Betty / Tahvo / Vilma / Avilma / | ||
48 | + * Hinku / Vinku / Ahne / Pihi chips used in various Nokia platforms. | ||
49 | + * Based on reverse-engineering of a linux driver. | ||
50 | + * | ||
51 | + * Copyright (C) 2008 Nokia Corporation | ||
52 | + * Written by Andrzej Zaborowski | ||
53 | + * | ||
54 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
55 | + * See the COPYING file in the top-level directory. | ||
56 | + */ | ||
57 | + | ||
58 | +#ifndef HW_MISC_CBUS_H | ||
59 | +#define HW_MISC_CBUS_H | ||
60 | + | ||
61 | +#include "hw/irq.h" | ||
62 | + | ||
63 | +typedef struct { | ||
64 | + qemu_irq clk; | ||
65 | + qemu_irq dat; | ||
66 | + qemu_irq sel; | ||
67 | +} CBus; | ||
68 | + | ||
69 | +CBus *cbus_init(qemu_irq dat_out); | ||
70 | +void cbus_attach(CBus *bus, void *slave_opaque); | ||
71 | + | ||
72 | +void *retu_init(qemu_irq irq, int vilma); | ||
73 | +void *tahvo_init(qemu_irq irq, int betty); | ||
74 | + | ||
75 | +void retu_key_event(void *retu, int state); | ||
76 | + | ||
77 | +#endif | ||
78 | diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c | ||
79 | index XXXXXXX..XXXXXXX 100644 | ||
80 | --- a/hw/arm/nseries.c | ||
81 | +++ b/hw/arm/nseries.c | ||
82 | @@ -XXX,XX +XXX,XX @@ | ||
83 | #include "hw/i2c/i2c.h" | ||
84 | #include "hw/devices.h" | ||
85 | #include "hw/display/blizzard.h" | ||
86 | +#include "hw/misc/cbus.h" | ||
87 | #include "hw/misc/tmp105.h" | ||
88 | #include "hw/block/flash.h" | ||
89 | #include "hw/hw.h" | ||
90 | diff --git a/hw/misc/cbus.c b/hw/misc/cbus.c | ||
91 | index XXXXXXX..XXXXXXX 100644 | ||
92 | --- a/hw/misc/cbus.c | ||
93 | +++ b/hw/misc/cbus.c | ||
94 | @@ -XXX,XX +XXX,XX @@ | ||
95 | #include "qemu/osdep.h" | ||
96 | #include "hw/hw.h" | ||
97 | #include "hw/irq.h" | ||
98 | -#include "hw/devices.h" | ||
99 | +#include "hw/misc/cbus.h" | ||
100 | #include "sysemu/sysemu.h" | ||
101 | |||
102 | //#define DEBUG | ||
103 | diff --git a/MAINTAINERS b/MAINTAINERS | ||
104 | index XXXXXXX..XXXXXXX 100644 | ||
105 | --- a/MAINTAINERS | ||
106 | +++ b/MAINTAINERS | ||
107 | @@ -XXX,XX +XXX,XX @@ F: hw/input/tsc2005.c | ||
108 | F: hw/misc/cbus.c | ||
109 | F: hw/timer/twl92230.c | ||
110 | F: include/hw/display/blizzard.h | ||
111 | +F: include/hw/misc/cbus.h | ||
112 | |||
113 | Palm | ||
114 | M: Andrzej Zaborowski <balrogg@gmail.com> | ||
115 | -- | 39 | -- |
116 | 2.20.1 | 40 | 2.25.1 |
117 | |||
118 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Add an entries the Blizzard device in MAINTAINERS. | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
4 | 4 | Message-id: 20220527181907.189259-84-richard.henderson@linaro.org | |
5 | Reviewed-by: Thomas Huth <thuth@redhat.com> | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Markus Armbruster <armbru@redhat.com> | ||
7 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
8 | Message-id: 20190412165416.7977-6-philmd@redhat.com | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 7 | --- |
11 | include/hw/devices.h | 7 ------- | 8 | target/arm/translate-sve.c | 11 ++--------- |
12 | include/hw/display/blizzard.h | 22 ++++++++++++++++++++++ | 9 | 1 file changed, 2 insertions(+), 9 deletions(-) |
13 | hw/arm/nseries.c | 1 + | ||
14 | hw/display/blizzard.c | 2 +- | ||
15 | MAINTAINERS | 2 ++ | ||
16 | 5 files changed, 26 insertions(+), 8 deletions(-) | ||
17 | create mode 100644 include/hw/display/blizzard.h | ||
18 | 10 | ||
19 | diff --git a/include/hw/devices.h b/include/hw/devices.h | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
20 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/include/hw/devices.h | 13 | --- a/target/arm/translate-sve.c |
22 | +++ b/include/hw/devices.h | 14 | +++ b/target/arm/translate-sve.c |
23 | @@ -XXX,XX +XXX,XX @@ void tsc2005_set_transform(void *opaque, MouseTransformInfo *info); | 15 | @@ -XXX,XX +XXX,XX @@ static bool do_FMLA_zzxz(DisasContext *s, arg_rrxr_esz *a, bool sub) |
24 | /* stellaris_input.c */ | 16 | a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); |
25 | void stellaris_gamepad_init(int n, qemu_irq *irq, const int *keycode); | 17 | } |
26 | 18 | ||
27 | -/* blizzard.c */ | 19 | -static bool trans_FMLA_zzxz(DisasContext *s, arg_FMLA_zzxz *a) |
28 | -void *s1d13745_init(qemu_irq gpio_int); | 20 | -{ |
29 | -void s1d13745_write(void *opaque, int dc, uint16_t value); | 21 | - return do_FMLA_zzxz(s, a, false); |
30 | -void s1d13745_write_block(void *opaque, int dc, | 22 | -} |
31 | - void *buf, size_t len, int pitch); | ||
32 | -uint16_t s1d13745_read(void *opaque, int dc); | ||
33 | - | 23 | - |
34 | /* cbus.c */ | 24 | -static bool trans_FMLS_zzxz(DisasContext *s, arg_FMLA_zzxz *a) |
35 | typedef struct { | 25 | -{ |
36 | qemu_irq clk; | 26 | - return do_FMLA_zzxz(s, a, true); |
37 | diff --git a/include/hw/display/blizzard.h b/include/hw/display/blizzard.h | 27 | -} |
38 | new file mode 100644 | 28 | +TRANS_FEAT(FMLA_zzxz, aa64_sve, do_FMLA_zzxz, a, false) |
39 | index XXXXXXX..XXXXXXX | 29 | +TRANS_FEAT(FMLS_zzxz, aa64_sve, do_FMLA_zzxz, a, true) |
40 | --- /dev/null | 30 | |
41 | +++ b/include/hw/display/blizzard.h | 31 | /* |
42 | @@ -XXX,XX +XXX,XX @@ | 32 | *** SVE Floating Point Multiply Indexed Group |
43 | +/* | ||
44 | + * Epson S1D13744/S1D13745 (Blizzard/Hailstorm/Tornado) LCD/TV controller. | ||
45 | + * | ||
46 | + * Copyright (C) 2008 Nokia Corporation | ||
47 | + * Written by Andrzej Zaborowski | ||
48 | + * | ||
49 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
50 | + * See the COPYING file in the top-level directory. | ||
51 | + */ | ||
52 | + | ||
53 | +#ifndef HW_DISPLAY_BLIZZARD_H | ||
54 | +#define HW_DISPLAY_BLIZZARD_H | ||
55 | + | ||
56 | +#include "hw/irq.h" | ||
57 | + | ||
58 | +void *s1d13745_init(qemu_irq gpio_int); | ||
59 | +void s1d13745_write(void *opaque, int dc, uint16_t value); | ||
60 | +void s1d13745_write_block(void *opaque, int dc, | ||
61 | + void *buf, size_t len, int pitch); | ||
62 | +uint16_t s1d13745_read(void *opaque, int dc); | ||
63 | + | ||
64 | +#endif | ||
65 | diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c | ||
66 | index XXXXXXX..XXXXXXX 100644 | ||
67 | --- a/hw/arm/nseries.c | ||
68 | +++ b/hw/arm/nseries.c | ||
69 | @@ -XXX,XX +XXX,XX @@ | ||
70 | #include "hw/boards.h" | ||
71 | #include "hw/i2c/i2c.h" | ||
72 | #include "hw/devices.h" | ||
73 | +#include "hw/display/blizzard.h" | ||
74 | #include "hw/misc/tmp105.h" | ||
75 | #include "hw/block/flash.h" | ||
76 | #include "hw/hw.h" | ||
77 | diff --git a/hw/display/blizzard.c b/hw/display/blizzard.c | ||
78 | index XXXXXXX..XXXXXXX 100644 | ||
79 | --- a/hw/display/blizzard.c | ||
80 | +++ b/hw/display/blizzard.c | ||
81 | @@ -XXX,XX +XXX,XX @@ | ||
82 | #include "qemu/osdep.h" | ||
83 | #include "qemu-common.h" | ||
84 | #include "ui/console.h" | ||
85 | -#include "hw/devices.h" | ||
86 | +#include "hw/display/blizzard.h" | ||
87 | #include "ui/pixel_ops.h" | ||
88 | |||
89 | typedef void (*blizzard_fn_t)(uint8_t *, const uint8_t *, unsigned int); | ||
90 | diff --git a/MAINTAINERS b/MAINTAINERS | ||
91 | index XXXXXXX..XXXXXXX 100644 | ||
92 | --- a/MAINTAINERS | ||
93 | +++ b/MAINTAINERS | ||
94 | @@ -XXX,XX +XXX,XX @@ M: Peter Maydell <peter.maydell@linaro.org> | ||
95 | L: qemu-arm@nongnu.org | ||
96 | S: Odd Fixes | ||
97 | F: hw/arm/nseries.c | ||
98 | +F: hw/display/blizzard.c | ||
99 | F: hw/input/lm832x.c | ||
100 | F: hw/input/tsc2005.c | ||
101 | F: hw/misc/cbus.c | ||
102 | F: hw/timer/twl92230.c | ||
103 | +F: include/hw/display/blizzard.h | ||
104 | |||
105 | Palm | ||
106 | M: Andrzej Zaborowski <balrogg@gmail.com> | ||
107 | -- | 33 | -- |
108 | 2.20.1 | 34 | 2.25.1 |
109 | |||
110 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | No code used the tc6393xb_gpio_in_get() and tc6393xb_gpio_out_set() | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
4 | functions since their introduction in commit 88d2c950b002. Time to | 4 | Message-id: 20220527181907.189259-85-richard.henderson@linaro.org |
5 | remove them. | ||
6 | |||
7 | Suggested-by: Markus Armbruster <armbru@redhat.com> | ||
8 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
9 | Message-id: 20190412165416.7977-4-philmd@redhat.com | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 7 | --- |
13 | include/hw/devices.h | 3 --- | 8 | target/arm/translate-sve.c | 28 ++++------------------------ |
14 | hw/display/tc6393xb.c | 16 ---------------- | 9 | 1 file changed, 4 insertions(+), 24 deletions(-) |
15 | 2 files changed, 19 deletions(-) | ||
16 | 10 | ||
17 | diff --git a/include/hw/devices.h b/include/hw/devices.h | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
18 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/include/hw/devices.h | 13 | --- a/target/arm/translate-sve.c |
20 | +++ b/include/hw/devices.h | 14 | +++ b/target/arm/translate-sve.c |
21 | @@ -XXX,XX +XXX,XX @@ void retu_key_event(void *retu, int state); | 15 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(BFMMLA, aa64_sve_bf16, gen_gvec_ool_arg_zzzz, |
22 | typedef struct TC6393xbState TC6393xbState; | 16 | |
23 | TC6393xbState *tc6393xb_init(struct MemoryRegion *sysmem, | 17 | static bool do_BFMLAL_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sel) |
24 | uint32_t base, qemu_irq irq); | 18 | { |
25 | -void tc6393xb_gpio_out_set(TC6393xbState *s, int line, | 19 | - if (!dc_isar_feature(aa64_sve_bf16, s)) { |
26 | - qemu_irq handler); | 20 | - return false; |
27 | -qemu_irq *tc6393xb_gpio_in_get(TC6393xbState *s); | 21 | - } |
28 | qemu_irq tc6393xb_l3v_get(TC6393xbState *s); | 22 | return gen_gvec_fpst_zzzz(s, gen_helper_gvec_bfmlal, |
29 | 23 | a->rd, a->rn, a->rm, a->ra, sel, FPST_FPCR); | |
30 | #endif | 24 | } |
31 | diff --git a/hw/display/tc6393xb.c b/hw/display/tc6393xb.c | 25 | |
32 | index XXXXXXX..XXXXXXX 100644 | 26 | -static bool trans_BFMLALB_zzzw(DisasContext *s, arg_rrrr_esz *a) |
33 | --- a/hw/display/tc6393xb.c | ||
34 | +++ b/hw/display/tc6393xb.c | ||
35 | @@ -XXX,XX +XXX,XX @@ struct TC6393xbState { | ||
36 | blanked : 1; | ||
37 | }; | ||
38 | |||
39 | -qemu_irq *tc6393xb_gpio_in_get(TC6393xbState *s) | ||
40 | -{ | 27 | -{ |
41 | - return s->gpio_in; | 28 | - return do_BFMLAL_zzzw(s, a, false); |
42 | -} | 29 | -} |
43 | - | 30 | - |
44 | static void tc6393xb_gpio_set(void *opaque, int line, int level) | 31 | -static bool trans_BFMLALT_zzzw(DisasContext *s, arg_rrrr_esz *a) |
32 | -{ | ||
33 | - return do_BFMLAL_zzzw(s, a, true); | ||
34 | -} | ||
35 | +TRANS_FEAT(BFMLALB_zzzw, aa64_sve_bf16, do_BFMLAL_zzzw, a, false) | ||
36 | +TRANS_FEAT(BFMLALT_zzzw, aa64_sve_bf16, do_BFMLAL_zzzw, a, true) | ||
37 | |||
38 | static bool do_BFMLAL_zzxw(DisasContext *s, arg_rrxr_esz *a, bool sel) | ||
45 | { | 39 | { |
46 | // TC6393xbState *s = opaque; | 40 | - if (!dc_isar_feature(aa64_sve_bf16, s)) { |
47 | @@ -XXX,XX +XXX,XX @@ static void tc6393xb_gpio_set(void *opaque, int line, int level) | 41 | - return false; |
48 | // FIXME: how does the chip reflect the GPIO input level change? | 42 | - } |
43 | return gen_gvec_fpst_zzzz(s, gen_helper_gvec_bfmlal_idx, | ||
44 | a->rd, a->rn, a->rm, a->ra, | ||
45 | (a->index << 1) | sel, FPST_FPCR); | ||
49 | } | 46 | } |
50 | 47 | ||
51 | -void tc6393xb_gpio_out_set(TC6393xbState *s, int line, | 48 | -static bool trans_BFMLALB_zzxw(DisasContext *s, arg_rrxr_esz *a) |
52 | - qemu_irq handler) | ||
53 | -{ | 49 | -{ |
54 | - if (line >= TC6393XB_GPIOS) { | 50 | - return do_BFMLAL_zzxw(s, a, false); |
55 | - fprintf(stderr, "TC6393xb: no GPIO pin %d\n", line); | ||
56 | - return; | ||
57 | - } | ||
58 | - | ||
59 | - s->handler[line] = handler; | ||
60 | -} | 51 | -} |
61 | - | 52 | - |
62 | static void tc6393xb_gpio_handler_update(TC6393xbState *s) | 53 | -static bool trans_BFMLALT_zzxw(DisasContext *s, arg_rrxr_esz *a) |
63 | { | 54 | -{ |
64 | uint32_t level, diff; | 55 | - return do_BFMLAL_zzxw(s, a, true); |
56 | -} | ||
57 | +TRANS_FEAT(BFMLALB_zzxw, aa64_sve_bf16, do_BFMLAL_zzxw, a, false) | ||
58 | +TRANS_FEAT(BFMLALT_zzxw, aa64_sve_bf16, do_BFMLAL_zzxw, a, true) | ||
65 | -- | 59 | -- |
66 | 2.20.1 | 60 | 2.25.1 |
67 | |||
68 | diff view generated by jsdifflib |
1 | The magic value pushed onto the callee stack as an integrity | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | check is different if floating point is present. | ||
3 | 2 | ||
3 | Rename the function to match gen_gvec_ool_arg_zzz, | ||
4 | and move to be adjacent. Split out gen_gvec_fpst_zzz | ||
5 | as a helper while we're at it. | ||
6 | |||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20220527181907.189259-86-richard.henderson@linaro.org | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20190416125744.27770-15-peter.maydell@linaro.org | ||
7 | --- | 11 | --- |
8 | target/arm/helper.c | 22 +++++++++++++++++++--- | 12 | target/arm/translate-sve.c | 50 +++++++++++++++++++++++--------------- |
9 | 1 file changed, 19 insertions(+), 3 deletions(-) | 13 | 1 file changed, 30 insertions(+), 20 deletions(-) |
10 | 14 | ||
11 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 15 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
12 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/target/arm/helper.c | 17 | --- a/target/arm/translate-sve.c |
14 | +++ b/target/arm/helper.c | 18 | +++ b/target/arm/translate-sve.c |
15 | @@ -XXX,XX +XXX,XX @@ load_fail: | 19 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_arg_zzz(DisasContext *s, gen_helper_gvec_3 *fn, |
16 | return false; | 20 | return gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, data); |
17 | } | 21 | } |
18 | 22 | ||
19 | +static uint32_t v7m_integrity_sig(CPUARMState *env, uint32_t lr) | 23 | +/* Invoke an out-of-line helper on 3 Zregs, plus float_status. */ |
24 | +static bool gen_gvec_fpst_zzz(DisasContext *s, gen_helper_gvec_3_ptr *fn, | ||
25 | + int rd, int rn, int rm, | ||
26 | + int data, ARMFPStatusFlavour flavour) | ||
20 | +{ | 27 | +{ |
21 | + /* | 28 | + if (fn == NULL) { |
22 | + * Return the integrity signature value for the callee-saves | 29 | + return false; |
23 | + * stack frame section. @lr is the exception return payload/LR value | 30 | + } |
24 | + * whose FType bit forms bit 0 of the signature if FP is present. | 31 | + if (sve_access_check(s)) { |
25 | + */ | 32 | + unsigned vsz = vec_full_reg_size(s); |
26 | + uint32_t sig = 0xfefa125a; | 33 | + TCGv_ptr status = fpstatus_ptr(flavour); |
27 | + | 34 | + |
28 | + if (!arm_feature(env, ARM_FEATURE_VFP) || (lr & R_V7M_EXCRET_FTYPE_MASK)) { | 35 | + tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, rd), |
29 | + sig |= 1; | 36 | + vec_full_reg_offset(s, rn), |
37 | + vec_full_reg_offset(s, rm), | ||
38 | + status, vsz, vsz, data, fn); | ||
39 | + | ||
40 | + tcg_temp_free_ptr(status); | ||
30 | + } | 41 | + } |
31 | + return sig; | 42 | + return true; |
32 | +} | 43 | +} |
33 | + | 44 | + |
34 | static bool v7m_push_callee_stack(ARMCPU *cpu, uint32_t lr, bool dotailchain, | 45 | +static bool gen_gvec_fpst_arg_zzz(DisasContext *s, gen_helper_gvec_3_ptr *fn, |
35 | bool ignore_faults) | 46 | + arg_rrr_esz *a, int data) |
36 | { | 47 | +{ |
37 | @@ -XXX,XX +XXX,XX @@ static bool v7m_push_callee_stack(ARMCPU *cpu, uint32_t lr, bool dotailchain, | 48 | + return gen_gvec_fpst_zzz(s, fn, a->rd, a->rn, a->rm, data, |
38 | bool stacked_ok; | 49 | + a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); |
39 | uint32_t limit; | 50 | +} |
40 | bool want_psp; | 51 | + |
41 | + uint32_t sig; | 52 | /* Invoke an out-of-line helper on 4 Zregs. */ |
42 | 53 | static bool gen_gvec_ool_zzzz(DisasContext *s, gen_helper_gvec_4 *fn, | |
43 | if (dotailchain) { | 54 | int rd, int rn, int rm, int ra, int data) |
44 | bool mode = lr & R_V7M_EXCRET_MODE_MASK; | 55 | @@ -XXX,XX +XXX,XX @@ static bool trans_FADDA(DisasContext *s, arg_rprr_esz *a) |
45 | @@ -XXX,XX +XXX,XX @@ static bool v7m_push_callee_stack(ARMCPU *cpu, uint32_t lr, bool dotailchain, | 56 | *** SVE Floating Point Arithmetic - Unpredicated Group |
46 | /* Write as much of the stack frame as we can. A write failure may | 57 | */ |
47 | * cause us to pend a derived exception. | 58 | |
48 | */ | 59 | -static bool do_zzz_fp(DisasContext *s, arg_rrr_esz *a, |
49 | + sig = v7m_integrity_sig(env, lr); | 60 | - gen_helper_gvec_3_ptr *fn) |
50 | stacked_ok = | 61 | -{ |
51 | - v7m_stack_write(cpu, frameptr, 0xfefa125b, mmu_idx, ignore_faults) && | 62 | - if (fn == NULL) { |
52 | + v7m_stack_write(cpu, frameptr, sig, mmu_idx, ignore_faults) && | 63 | - return false; |
53 | v7m_stack_write(cpu, frameptr + 0x8, env->regs[4], mmu_idx, | 64 | - } |
54 | ignore_faults) && | 65 | - if (sve_access_check(s)) { |
55 | v7m_stack_write(cpu, frameptr + 0xc, env->regs[5], mmu_idx, | 66 | - unsigned vsz = vec_full_reg_size(s); |
56 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) | 67 | - TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); |
57 | if (return_to_secure && | 68 | - tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, a->rd), |
58 | ((excret & R_V7M_EXCRET_ES_MASK) == 0 || | 69 | - vec_full_reg_offset(s, a->rn), |
59 | (excret & R_V7M_EXCRET_DCRS_MASK) == 0)) { | 70 | - vec_full_reg_offset(s, a->rm), |
60 | - uint32_t expected_sig = 0xfefa125b; | 71 | - status, vsz, vsz, 0, fn); |
61 | uint32_t actual_sig; | 72 | - tcg_temp_free_ptr(status); |
62 | 73 | - } | |
63 | pop_ok = v7m_stack_read(cpu, &actual_sig, frameptr, mmu_idx); | 74 | - return true; |
64 | 75 | -} | |
65 | - if (pop_ok && expected_sig != actual_sig) { | 76 | - |
66 | + if (pop_ok && v7m_integrity_sig(env, excret) != actual_sig) { | 77 | - |
67 | /* Take a SecureFault on the current stack */ | 78 | #define DO_FP3(NAME, name) \ |
68 | env->v7m.sfsr |= R_V7M_SFSR_INVIS_MASK; | 79 | static bool trans_##NAME(DisasContext *s, arg_rrr_esz *a) \ |
69 | armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_SECURE, false); | 80 | { \ |
81 | @@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_rrr_esz *a) \ | ||
82 | NULL, gen_helper_gvec_##name##_h, \ | ||
83 | gen_helper_gvec_##name##_s, gen_helper_gvec_##name##_d \ | ||
84 | }; \ | ||
85 | - return do_zzz_fp(s, a, fns[a->esz]); \ | ||
86 | + return gen_gvec_fpst_arg_zzz(s, fns[a->esz], a, 0); \ | ||
87 | } | ||
88 | |||
89 | DO_FP3(FADD_zzz, fadd) | ||
70 | -- | 90 | -- |
71 | 2.20.1 | 91 | 2.25.1 |
72 | |||
73 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Markus Armbruster <armbru@redhat.com> | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
4 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 4 | Message-id: 20220527181907.189259-87-richard.henderson@linaro.org |
5 | Message-id: 20190412165416.7977-5-philmd@redhat.com | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 7 | --- |
8 | include/hw/devices.h | 6 ------ | 8 | target/arm/translate-sve.c | 7 ++----- |
9 | include/hw/display/tc6393xb.h | 24 ++++++++++++++++++++++++ | 9 | 1 file changed, 2 insertions(+), 5 deletions(-) |
10 | hw/arm/tosa.c | 2 +- | ||
11 | hw/display/tc6393xb.c | 2 +- | ||
12 | MAINTAINERS | 1 + | ||
13 | 5 files changed, 27 insertions(+), 8 deletions(-) | ||
14 | create mode 100644 include/hw/display/tc6393xb.h | ||
15 | 10 | ||
16 | diff --git a/include/hw/devices.h b/include/hw/devices.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/include/hw/devices.h | 13 | --- a/target/arm/translate-sve.c |
19 | +++ b/include/hw/devices.h | 14 | +++ b/target/arm/translate-sve.c |
20 | @@ -XXX,XX +XXX,XX @@ void *tahvo_init(qemu_irq irq, int betty); | 15 | @@ -XXX,XX +XXX,XX @@ static bool trans_FADDA(DisasContext *s, arg_rprr_esz *a) |
21 | 16 | */ | |
22 | void retu_key_event(void *retu, int state); | 17 | |
23 | 18 | #define DO_FP3(NAME, name) \ | |
24 | -/* tc6393xb.c */ | 19 | -static bool trans_##NAME(DisasContext *s, arg_rrr_esz *a) \ |
25 | -typedef struct TC6393xbState TC6393xbState; | 20 | -{ \ |
26 | -TC6393xbState *tc6393xb_init(struct MemoryRegion *sysmem, | 21 | - static gen_helper_gvec_3_ptr * const fns[4] = { \ |
27 | - uint32_t base, qemu_irq irq); | 22 | + static gen_helper_gvec_3_ptr * const name##_fns[4] = { \ |
28 | -qemu_irq tc6393xb_l3v_get(TC6393xbState *s); | 23 | NULL, gen_helper_gvec_##name##_h, \ |
29 | - | 24 | gen_helper_gvec_##name##_s, gen_helper_gvec_##name##_d \ |
30 | #endif | 25 | }; \ |
31 | diff --git a/include/hw/display/tc6393xb.h b/include/hw/display/tc6393xb.h | 26 | - return gen_gvec_fpst_arg_zzz(s, fns[a->esz], a, 0); \ |
32 | new file mode 100644 | 27 | -} |
33 | index XXXXXXX..XXXXXXX | 28 | + TRANS_FEAT(NAME, aa64_sve, gen_gvec_fpst_arg_zzz, name##_fns[a->esz], a, 0) |
34 | --- /dev/null | 29 | |
35 | +++ b/include/hw/display/tc6393xb.h | 30 | DO_FP3(FADD_zzz, fadd) |
36 | @@ -XXX,XX +XXX,XX @@ | 31 | DO_FP3(FSUB_zzz, fsub) |
37 | +/* | ||
38 | + * Toshiba TC6393XB I/O Controller. | ||
39 | + * Found in Sharp Zaurus SL-6000 (tosa) or some | ||
40 | + * Toshiba e-Series PDAs. | ||
41 | + * | ||
42 | + * Copyright (c) 2007 Hervé Poussineau | ||
43 | + * | ||
44 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
45 | + * See the COPYING file in the top-level directory. | ||
46 | + */ | ||
47 | + | ||
48 | +#ifndef HW_DISPLAY_TC6393XB_H | ||
49 | +#define HW_DISPLAY_TC6393XB_H | ||
50 | + | ||
51 | +#include "exec/memory.h" | ||
52 | +#include "hw/irq.h" | ||
53 | + | ||
54 | +typedef struct TC6393xbState TC6393xbState; | ||
55 | + | ||
56 | +TC6393xbState *tc6393xb_init(struct MemoryRegion *sysmem, | ||
57 | + uint32_t base, qemu_irq irq); | ||
58 | +qemu_irq tc6393xb_l3v_get(TC6393xbState *s); | ||
59 | + | ||
60 | +#endif | ||
61 | diff --git a/hw/arm/tosa.c b/hw/arm/tosa.c | ||
62 | index XXXXXXX..XXXXXXX 100644 | ||
63 | --- a/hw/arm/tosa.c | ||
64 | +++ b/hw/arm/tosa.c | ||
65 | @@ -XXX,XX +XXX,XX @@ | ||
66 | #include "hw/hw.h" | ||
67 | #include "hw/arm/pxa.h" | ||
68 | #include "hw/arm/arm.h" | ||
69 | -#include "hw/devices.h" | ||
70 | #include "hw/arm/sharpsl.h" | ||
71 | #include "hw/pcmcia.h" | ||
72 | #include "hw/boards.h" | ||
73 | +#include "hw/display/tc6393xb.h" | ||
74 | #include "hw/i2c/i2c.h" | ||
75 | #include "hw/ssi/ssi.h" | ||
76 | #include "hw/sysbus.h" | ||
77 | diff --git a/hw/display/tc6393xb.c b/hw/display/tc6393xb.c | ||
78 | index XXXXXXX..XXXXXXX 100644 | ||
79 | --- a/hw/display/tc6393xb.c | ||
80 | +++ b/hw/display/tc6393xb.c | ||
81 | @@ -XXX,XX +XXX,XX @@ | ||
82 | #include "qapi/error.h" | ||
83 | #include "qemu/host-utils.h" | ||
84 | #include "hw/hw.h" | ||
85 | -#include "hw/devices.h" | ||
86 | +#include "hw/display/tc6393xb.h" | ||
87 | #include "hw/block/flash.h" | ||
88 | #include "ui/console.h" | ||
89 | #include "ui/pixel_ops.h" | ||
90 | diff --git a/MAINTAINERS b/MAINTAINERS | ||
91 | index XXXXXXX..XXXXXXX 100644 | ||
92 | --- a/MAINTAINERS | ||
93 | +++ b/MAINTAINERS | ||
94 | @@ -XXX,XX +XXX,XX @@ F: hw/misc/mst_fpga.c | ||
95 | F: hw/misc/max111x.c | ||
96 | F: include/hw/arm/pxa.h | ||
97 | F: include/hw/arm/sharpsl.h | ||
98 | +F: include/hw/display/tc6393xb.h | ||
99 | |||
100 | SABRELITE / i.MX6 | ||
101 | M: Peter Maydell <peter.maydell@linaro.org> | ||
102 | -- | 32 | -- |
103 | 2.20.1 | 33 | 2.25.1 |
104 | |||
105 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | This device is used by both ARM (BCM2836, for raspi2) and AArch64 | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
4 | (BCM2837, for raspi3) targets, and is not CPU-specific. | 4 | Message-id: 20220527181907.189259-88-richard.henderson@linaro.org |
5 | Move it to common object, so we build it once for all targets. | ||
6 | |||
7 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
8 | Message-id: 20190427133028.12874-1-philmd@redhat.com | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 7 | --- |
12 | hw/dma/Makefile.objs | 2 +- | 8 | target/arm/translate-sve.c | 26 +++++++------------------- |
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | 9 | 1 file changed, 7 insertions(+), 19 deletions(-) |
14 | 10 | ||
15 | diff --git a/hw/dma/Makefile.objs b/hw/dma/Makefile.objs | 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/hw/dma/Makefile.objs | 13 | --- a/target/arm/translate-sve.c |
18 | +++ b/hw/dma/Makefile.objs | 14 | +++ b/target/arm/translate-sve.c |
19 | @@ -XXX,XX +XXX,XX @@ common-obj-$(CONFIG_XLNX_ZYNQMP_ARM) += xlnx-zdma.o | 15 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(FMLS_zzxz, aa64_sve, do_FMLA_zzxz, a, true) |
20 | 16 | *** SVE Floating Point Multiply Indexed Group | |
21 | obj-$(CONFIG_OMAP) += omap_dma.o soc_dma.o | 17 | */ |
22 | obj-$(CONFIG_PXA2XX) += pxa2xx_dma.o | 18 | |
23 | -obj-$(CONFIG_RASPI) += bcm2835_dma.o | 19 | -static bool trans_FMUL_zzx(DisasContext *s, arg_FMUL_zzx *a) |
24 | +common-obj-$(CONFIG_RASPI) += bcm2835_dma.o | 20 | -{ |
21 | - static gen_helper_gvec_3_ptr * const fns[3] = { | ||
22 | - gen_helper_gvec_fmul_idx_h, | ||
23 | - gen_helper_gvec_fmul_idx_s, | ||
24 | - gen_helper_gvec_fmul_idx_d, | ||
25 | - }; | ||
26 | - | ||
27 | - if (sve_access_check(s)) { | ||
28 | - unsigned vsz = vec_full_reg_size(s); | ||
29 | - TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); | ||
30 | - tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, a->rd), | ||
31 | - vec_full_reg_offset(s, a->rn), | ||
32 | - vec_full_reg_offset(s, a->rm), | ||
33 | - status, vsz, vsz, a->index, fns[a->esz - 1]); | ||
34 | - tcg_temp_free_ptr(status); | ||
35 | - } | ||
36 | - return true; | ||
37 | -} | ||
38 | +static gen_helper_gvec_3_ptr * const fmul_idx_fns[4] = { | ||
39 | + NULL, gen_helper_gvec_fmul_idx_h, | ||
40 | + gen_helper_gvec_fmul_idx_s, gen_helper_gvec_fmul_idx_d, | ||
41 | +}; | ||
42 | +TRANS_FEAT(FMUL_zzx, aa64_sve, gen_gvec_fpst_zzz, | ||
43 | + fmul_idx_fns[a->esz], a->rd, a->rn, a->rm, a->index, | ||
44 | + a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR) | ||
45 | |||
46 | /* | ||
47 | *** SVE Floating Point Fast Reduction Group | ||
25 | -- | 48 | -- |
26 | 2.20.1 | 49 | 2.25.1 |
27 | |||
28 | diff view generated by jsdifflib |
1 | Normally configure identifies the source path by looking | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | at the location where the configure script itself exists. | ||
3 | We also provide a --source-path option which lets the user | ||
4 | manually override this. | ||
5 | 2 | ||
6 | There isn't really an obvious use case for the --source-path | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | option, and in commit 927128222b0a91f56c13a in 2017 we | 4 | Message-id: 20220527181907.189259-89-richard.henderson@linaro.org |
8 | accidentally added some logic that looks at $source_path | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | before the command line option that overrides it has been | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | processed. | 7 | --- |
8 | target/arm/translate-sve.c | 29 +++++++---------------------- | ||
9 | 1 file changed, 7 insertions(+), 22 deletions(-) | ||
11 | 10 | ||
12 | The fact that nobody complained suggests that there isn't | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
13 | any use of this option and we aren't testing it either; | 12 | index XXXXXXX..XXXXXXX 100644 |
14 | remove it. This allows us to move the "make $source_path | 13 | --- a/target/arm/translate-sve.c |
15 | absolute" logic up so that there is no window in the script | 14 | +++ b/target/arm/translate-sve.c |
16 | where $source_path is set but not yet absolute. | 15 | @@ -XXX,XX +XXX,XX @@ DO_PPZ(FCMNE_ppz0, fcmne0) |
17 | 16 | *** SVE floating-point trig multiply-add coefficient | |
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 17 | */ |
19 | Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> | 18 | |
20 | Message-id: 20190318134019.23729-1-peter.maydell@linaro.org | 19 | -static bool trans_FTMAD(DisasContext *s, arg_FTMAD *a) |
21 | --- | 20 | -{ |
22 | configure | 10 ++-------- | 21 | - static gen_helper_gvec_3_ptr * const fns[3] = { |
23 | 1 file changed, 2 insertions(+), 8 deletions(-) | 22 | - gen_helper_sve_ftmad_h, |
24 | 23 | - gen_helper_sve_ftmad_s, | |
25 | diff --git a/configure b/configure | 24 | - gen_helper_sve_ftmad_d, |
26 | index XXXXXXX..XXXXXXX 100755 | 25 | - }; |
27 | --- a/configure | ||
28 | +++ b/configure | ||
29 | @@ -XXX,XX +XXX,XX @@ ld_has() { | ||
30 | |||
31 | # default parameters | ||
32 | source_path=$(dirname "$0") | ||
33 | +# make source path absolute | ||
34 | +source_path=$(cd "$source_path"; pwd) | ||
35 | cpu="" | ||
36 | iasl="iasl" | ||
37 | interp_prefix="/usr/gnemul/qemu-%M" | ||
38 | @@ -XXX,XX +XXX,XX @@ for opt do | ||
39 | ;; | ||
40 | --cxx=*) CXX="$optarg" | ||
41 | ;; | ||
42 | - --source-path=*) source_path="$optarg" | ||
43 | - ;; | ||
44 | --cpu=*) cpu="$optarg" | ||
45 | ;; | ||
46 | --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg" | ||
47 | @@ -XXX,XX +XXX,XX @@ if test "$debug_info" = "yes"; then | ||
48 | LDFLAGS="-g $LDFLAGS" | ||
49 | fi | ||
50 | |||
51 | -# make source path absolute | ||
52 | -source_path=$(cd "$source_path"; pwd) | ||
53 | - | 26 | - |
54 | # running configure in the source tree? | 27 | - if (a->esz == 0) { |
55 | # we know that's the case if configure is there. | 28 | - return false; |
56 | if test -f "./configure"; then | 29 | - } |
57 | @@ -XXX,XX +XXX,XX @@ for opt do | 30 | - if (sve_access_check(s)) { |
58 | ;; | 31 | - unsigned vsz = vec_full_reg_size(s); |
59 | --interp-prefix=*) interp_prefix="$optarg" | 32 | - TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); |
60 | ;; | 33 | - tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, a->rd), |
61 | - --source-path=*) | 34 | - vec_full_reg_offset(s, a->rn), |
62 | - ;; | 35 | - vec_full_reg_offset(s, a->rm), |
63 | --cross-prefix=*) | 36 | - status, vsz, vsz, a->imm, fns[a->esz - 1]); |
64 | ;; | 37 | - tcg_temp_free_ptr(status); |
65 | --cc=*) | 38 | - } |
66 | @@ -XXX,XX +XXX,XX @@ $(echo Available targets: $default_target_list | \ | 39 | - return true; |
67 | --target-list-exclude=LIST exclude a set of targets from the default target-list | 40 | -} |
68 | 41 | +static gen_helper_gvec_3_ptr * const ftmad_fns[4] = { | |
69 | Advanced options (experts only): | 42 | + NULL, gen_helper_sve_ftmad_h, |
70 | - --source-path=PATH path of source code [$source_path] | 43 | + gen_helper_sve_ftmad_s, gen_helper_sve_ftmad_d, |
71 | --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix] | 44 | +}; |
72 | --cc=CC use C compiler CC [$cc] | 45 | +TRANS_FEAT(FTMAD, aa64_sve, gen_gvec_fpst_zzz, |
73 | --iasl=IASL use ACPI compiler IASL [$iasl] | 46 | + ftmad_fns[a->esz], a->rd, a->rn, a->rm, a->imm, |
47 | + a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR) | ||
48 | |||
49 | /* | ||
50 | *** SVE Floating Point Accumulating Reduction Group | ||
74 | -- | 51 | -- |
75 | 2.20.1 | 52 | 2.25.1 |
76 | |||
77 | diff view generated by jsdifflib |
1 | Enforce that for M-profile various FPSCR bits which are RES0 there | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | but have defined meanings on A-profile are never settable. This | ||
3 | ensures that M-profile code can't enable the A-profile behaviour | ||
4 | (notably vector length/stride handling) by accident. | ||
5 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-90-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@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: 20190416125744.27770-2-peter.maydell@linaro.org | ||
9 | --- | 7 | --- |
10 | target/arm/vfp_helper.c | 8 ++++++++ | 8 | target/arm/translate-sve.c | 30 +++++++++++++++++------------- |
11 | 1 file changed, 8 insertions(+) | 9 | 1 file changed, 17 insertions(+), 13 deletions(-) |
12 | 10 | ||
13 | diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.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/vfp_helper.c | 13 | --- a/target/arm/translate-sve.c |
16 | +++ b/target/arm/vfp_helper.c | 14 | +++ b/target/arm/translate-sve.c |
17 | @@ -XXX,XX +XXX,XX @@ void HELPER(vfp_set_fpscr)(CPUARMState *env, uint32_t val) | 15 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(FMUL_zzx, aa64_sve, gen_gvec_fpst_zzz, |
18 | val &= ~FPCR_FZ16; | 16 | typedef void gen_helper_fp_reduce(TCGv_i64, TCGv_ptr, TCGv_ptr, |
19 | } | 17 | TCGv_ptr, TCGv_i32); |
20 | 18 | ||
21 | + if (arm_feature(env, ARM_FEATURE_M)) { | 19 | -static void do_reduce(DisasContext *s, arg_rpr_esz *a, |
22 | + /* | 20 | +static bool do_reduce(DisasContext *s, arg_rpr_esz *a, |
23 | + * M profile FPSCR is RES0 for the QC, STRIDE, FZ16, LEN bits | 21 | gen_helper_fp_reduce *fn) |
24 | + * and also for the trapped-exception-handling bits IxE. | 22 | { |
25 | + */ | 23 | - unsigned vsz = vec_full_reg_size(s); |
26 | + val &= 0xf7c0009f; | 24 | - unsigned p2vsz = pow2ceil(vsz); |
25 | - TCGv_i32 t_desc = tcg_constant_i32(simd_desc(vsz, vsz, p2vsz)); | ||
26 | + unsigned vsz, p2vsz; | ||
27 | + TCGv_i32 t_desc; | ||
28 | TCGv_ptr t_zn, t_pg, status; | ||
29 | TCGv_i64 temp; | ||
30 | |||
31 | + if (fn == NULL) { | ||
32 | + return false; | ||
33 | + } | ||
34 | + if (!sve_access_check(s)) { | ||
35 | + return true; | ||
27 | + } | 36 | + } |
28 | + | 37 | + |
29 | /* | 38 | + vsz = vec_full_reg_size(s); |
30 | * We don't implement trapped exception handling, so the | 39 | + p2vsz = pow2ceil(vsz); |
31 | * trap enable bits, IDE|IXE|UFE|OFE|DZE|IOE are all RAZ/WI (not RES0!) | 40 | + t_desc = tcg_constant_i32(simd_desc(vsz, vsz, p2vsz)); |
41 | temp = tcg_temp_new_i64(); | ||
42 | t_zn = tcg_temp_new_ptr(); | ||
43 | t_pg = tcg_temp_new_ptr(); | ||
44 | @@ -XXX,XX +XXX,XX @@ static void do_reduce(DisasContext *s, arg_rpr_esz *a, | ||
45 | |||
46 | write_fp_dreg(s, a->rd, temp); | ||
47 | tcg_temp_free_i64(temp); | ||
48 | + return true; | ||
49 | } | ||
50 | |||
51 | #define DO_VPZ(NAME, name) \ | ||
52 | static bool trans_##NAME(DisasContext *s, arg_rpr_esz *a) \ | ||
53 | { \ | ||
54 | - static gen_helper_fp_reduce * const fns[3] = { \ | ||
55 | - gen_helper_sve_##name##_h, \ | ||
56 | + static gen_helper_fp_reduce * const fns[4] = { \ | ||
57 | + NULL, gen_helper_sve_##name##_h, \ | ||
58 | gen_helper_sve_##name##_s, \ | ||
59 | gen_helper_sve_##name##_d, \ | ||
60 | }; \ | ||
61 | - if (a->esz == 0) { \ | ||
62 | - return false; \ | ||
63 | - } \ | ||
64 | - if (sve_access_check(s)) { \ | ||
65 | - do_reduce(s, a, fns[a->esz - 1]); \ | ||
66 | - } \ | ||
67 | - return true; \ | ||
68 | + return do_reduce(s, a, fns[a->esz]); \ | ||
69 | } | ||
70 | |||
71 | DO_VPZ(FADDV, faddv) | ||
32 | -- | 72 | -- |
33 | 2.20.1 | 73 | 2.25.1 |
34 | |||
35 | diff view generated by jsdifflib |
1 | The M-profile floating point support has three associated config | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | registers: FPCAR, FPCCR and FPDSCR. It also makes the registers | ||
3 | CPACR and NSACR have behaviour other than reads-as-zero. | ||
4 | Add support for all of these as simple reads-as-written registers. | ||
5 | We will hook up actual functionality later. | ||
6 | 2 | ||
7 | The main complexity here is handling the FPCCR register, which | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | has a mix of banked and unbanked bits. | 4 | Message-id: 20220527181907.189259-91-richard.henderson@linaro.org |
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate-sve.c | 14 ++++++-------- | ||
9 | 1 file changed, 6 insertions(+), 8 deletions(-) | ||
9 | 10 | ||
10 | Note that we don't share storage with the A-profile | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
11 | cpu->cp15.nsacr and cpu->cp15.cpacr_el1, though the behaviour | ||
12 | is quite similar, for two reasons: | ||
13 | * the M profile CPACR is banked between security states | ||
14 | * it preserves the invariant that M profile uses no state | ||
15 | inside the cp15 substruct | ||
16 | |||
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
18 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
19 | Message-id: 20190416125744.27770-4-peter.maydell@linaro.org | ||
20 | --- | ||
21 | target/arm/cpu.h | 34 ++++++++++++ | ||
22 | hw/intc/armv7m_nvic.c | 125 ++++++++++++++++++++++++++++++++++++++++++ | ||
23 | target/arm/cpu.c | 5 ++ | ||
24 | target/arm/machine.c | 16 ++++++ | ||
25 | 4 files changed, 180 insertions(+) | ||
26 | |||
27 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
28 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
29 | --- a/target/arm/cpu.h | 13 | --- a/target/arm/translate-sve.c |
30 | +++ b/target/arm/cpu.h | 14 | +++ b/target/arm/translate-sve.c |
31 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState { | 15 | @@ -XXX,XX +XXX,XX @@ static bool do_reduce(DisasContext *s, arg_rpr_esz *a, |
32 | uint32_t scr[M_REG_NUM_BANKS]; | 16 | } |
33 | uint32_t msplim[M_REG_NUM_BANKS]; | 17 | |
34 | uint32_t psplim[M_REG_NUM_BANKS]; | 18 | #define DO_VPZ(NAME, name) \ |
35 | + uint32_t fpcar[M_REG_NUM_BANKS]; | 19 | -static bool trans_##NAME(DisasContext *s, arg_rpr_esz *a) \ |
36 | + uint32_t fpccr[M_REG_NUM_BANKS]; | 20 | -{ \ |
37 | + uint32_t fpdscr[M_REG_NUM_BANKS]; | 21 | - static gen_helper_fp_reduce * const fns[4] = { \ |
38 | + uint32_t cpacr[M_REG_NUM_BANKS]; | 22 | - NULL, gen_helper_sve_##name##_h, \ |
39 | + uint32_t nsacr; | 23 | - gen_helper_sve_##name##_s, \ |
40 | } v7m; | 24 | - gen_helper_sve_##name##_d, \ |
41 | 25 | + static gen_helper_fp_reduce * const name##_fns[4] = { \ | |
42 | /* Information associated with an exception about to be taken: | 26 | + NULL, gen_helper_sve_##name##_h, \ |
43 | @@ -XXX,XX +XXX,XX @@ FIELD(V7M_CSSELR, LEVEL, 1, 3) | 27 | + gen_helper_sve_##name##_s, gen_helper_sve_##name##_d, \ |
44 | */ | 28 | }; \ |
45 | FIELD(V7M_CSSELR, INDEX, 0, 4) | 29 | - return do_reduce(s, a, fns[a->esz]); \ |
46 | 30 | -} | |
47 | +/* v7M FPCCR bits */ | 31 | + TRANS_FEAT(NAME, aa64_sve, do_reduce, a, name##_fns[a->esz]) |
48 | +FIELD(V7M_FPCCR, LSPACT, 0, 1) | 32 | |
49 | +FIELD(V7M_FPCCR, USER, 1, 1) | 33 | DO_VPZ(FADDV, faddv) |
50 | +FIELD(V7M_FPCCR, S, 2, 1) | 34 | DO_VPZ(FMINNMV, fminnmv) |
51 | +FIELD(V7M_FPCCR, THREAD, 3, 1) | 35 | @@ -XXX,XX +XXX,XX @@ DO_VPZ(FMAXNMV, fmaxnmv) |
52 | +FIELD(V7M_FPCCR, HFRDY, 4, 1) | 36 | DO_VPZ(FMINV, fminv) |
53 | +FIELD(V7M_FPCCR, MMRDY, 5, 1) | 37 | DO_VPZ(FMAXV, fmaxv) |
54 | +FIELD(V7M_FPCCR, BFRDY, 6, 1) | 38 | |
55 | +FIELD(V7M_FPCCR, SFRDY, 7, 1) | 39 | +#undef DO_VPZ |
56 | +FIELD(V7M_FPCCR, MONRDY, 8, 1) | ||
57 | +FIELD(V7M_FPCCR, SPLIMVIOL, 9, 1) | ||
58 | +FIELD(V7M_FPCCR, UFRDY, 10, 1) | ||
59 | +FIELD(V7M_FPCCR, RES0, 11, 15) | ||
60 | +FIELD(V7M_FPCCR, TS, 26, 1) | ||
61 | +FIELD(V7M_FPCCR, CLRONRETS, 27, 1) | ||
62 | +FIELD(V7M_FPCCR, CLRONRET, 28, 1) | ||
63 | +FIELD(V7M_FPCCR, LSPENS, 29, 1) | ||
64 | +FIELD(V7M_FPCCR, LSPEN, 30, 1) | ||
65 | +FIELD(V7M_FPCCR, ASPEN, 31, 1) | ||
66 | +/* These bits are banked. Others are non-banked and live in the M_REG_S bank */ | ||
67 | +#define R_V7M_FPCCR_BANKED_MASK \ | ||
68 | + (R_V7M_FPCCR_LSPACT_MASK | \ | ||
69 | + R_V7M_FPCCR_USER_MASK | \ | ||
70 | + R_V7M_FPCCR_THREAD_MASK | \ | ||
71 | + R_V7M_FPCCR_MMRDY_MASK | \ | ||
72 | + R_V7M_FPCCR_SPLIMVIOL_MASK | \ | ||
73 | + R_V7M_FPCCR_UFRDY_MASK | \ | ||
74 | + R_V7M_FPCCR_ASPEN_MASK) | ||
75 | + | 40 | + |
76 | /* | 41 | /* |
77 | * System register ID fields. | 42 | *** SVE Floating Point Unary Operations - Unpredicated Group |
78 | */ | 43 | */ |
79 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c | ||
80 | index XXXXXXX..XXXXXXX 100644 | ||
81 | --- a/hw/intc/armv7m_nvic.c | ||
82 | +++ b/hw/intc/armv7m_nvic.c | ||
83 | @@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs) | ||
84 | } | ||
85 | case 0xd84: /* CSSELR */ | ||
86 | return cpu->env.v7m.csselr[attrs.secure]; | ||
87 | + case 0xd88: /* CPACR */ | ||
88 | + if (!arm_feature(&cpu->env, ARM_FEATURE_VFP)) { | ||
89 | + return 0; | ||
90 | + } | ||
91 | + return cpu->env.v7m.cpacr[attrs.secure]; | ||
92 | + case 0xd8c: /* NSACR */ | ||
93 | + if (!attrs.secure || !arm_feature(&cpu->env, ARM_FEATURE_VFP)) { | ||
94 | + return 0; | ||
95 | + } | ||
96 | + return cpu->env.v7m.nsacr; | ||
97 | /* TODO: Implement debug registers. */ | ||
98 | case 0xd90: /* MPU_TYPE */ | ||
99 | /* Unified MPU; if the MPU is not present this value is zero */ | ||
100 | @@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs) | ||
101 | return 0; | ||
102 | } | ||
103 | return cpu->env.v7m.sfar; | ||
104 | + case 0xf34: /* FPCCR */ | ||
105 | + if (!arm_feature(&cpu->env, ARM_FEATURE_VFP)) { | ||
106 | + return 0; | ||
107 | + } | ||
108 | + if (attrs.secure) { | ||
109 | + return cpu->env.v7m.fpccr[M_REG_S]; | ||
110 | + } else { | ||
111 | + /* | ||
112 | + * NS can read LSPEN, CLRONRET and MONRDY. It can read | ||
113 | + * BFRDY and HFRDY if AIRCR.BFHFNMINS != 0; | ||
114 | + * other non-banked bits RAZ. | ||
115 | + * TODO: MONRDY should RAZ/WI if DEMCR.SDME is set. | ||
116 | + */ | ||
117 | + uint32_t value = cpu->env.v7m.fpccr[M_REG_S]; | ||
118 | + uint32_t mask = R_V7M_FPCCR_LSPEN_MASK | | ||
119 | + R_V7M_FPCCR_CLRONRET_MASK | | ||
120 | + R_V7M_FPCCR_MONRDY_MASK; | ||
121 | + | ||
122 | + if (s->cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK) { | ||
123 | + mask |= R_V7M_FPCCR_BFRDY_MASK | R_V7M_FPCCR_HFRDY_MASK; | ||
124 | + } | ||
125 | + | ||
126 | + value &= mask; | ||
127 | + | ||
128 | + value |= cpu->env.v7m.fpccr[M_REG_NS]; | ||
129 | + return value; | ||
130 | + } | ||
131 | + case 0xf38: /* FPCAR */ | ||
132 | + if (!arm_feature(&cpu->env, ARM_FEATURE_VFP)) { | ||
133 | + return 0; | ||
134 | + } | ||
135 | + return cpu->env.v7m.fpcar[attrs.secure]; | ||
136 | + case 0xf3c: /* FPDSCR */ | ||
137 | + if (!arm_feature(&cpu->env, ARM_FEATURE_VFP)) { | ||
138 | + return 0; | ||
139 | + } | ||
140 | + return cpu->env.v7m.fpdscr[attrs.secure]; | ||
141 | case 0xf40: /* MVFR0 */ | ||
142 | return cpu->isar.mvfr0; | ||
143 | case 0xf44: /* MVFR1 */ | ||
144 | @@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value, | ||
145 | cpu->env.v7m.csselr[attrs.secure] = value & R_V7M_CSSELR_INDEX_MASK; | ||
146 | } | ||
147 | break; | ||
148 | + case 0xd88: /* CPACR */ | ||
149 | + if (arm_feature(&cpu->env, ARM_FEATURE_VFP)) { | ||
150 | + /* We implement only the Floating Point extension's CP10/CP11 */ | ||
151 | + cpu->env.v7m.cpacr[attrs.secure] = value & (0xf << 20); | ||
152 | + } | ||
153 | + break; | ||
154 | + case 0xd8c: /* NSACR */ | ||
155 | + if (attrs.secure && arm_feature(&cpu->env, ARM_FEATURE_VFP)) { | ||
156 | + /* We implement only the Floating Point extension's CP10/CP11 */ | ||
157 | + cpu->env.v7m.nsacr = value & (3 << 10); | ||
158 | + } | ||
159 | + break; | ||
160 | case 0xd90: /* MPU_TYPE */ | ||
161 | return; /* RO */ | ||
162 | case 0xd94: /* MPU_CTRL */ | ||
163 | @@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value, | ||
164 | } | ||
165 | break; | ||
166 | } | ||
167 | + case 0xf34: /* FPCCR */ | ||
168 | + if (arm_feature(&cpu->env, ARM_FEATURE_VFP)) { | ||
169 | + /* Not all bits here are banked. */ | ||
170 | + uint32_t fpccr_s; | ||
171 | + | ||
172 | + if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { | ||
173 | + /* Don't allow setting of bits not present in v7M */ | ||
174 | + value &= (R_V7M_FPCCR_LSPACT_MASK | | ||
175 | + R_V7M_FPCCR_USER_MASK | | ||
176 | + R_V7M_FPCCR_THREAD_MASK | | ||
177 | + R_V7M_FPCCR_HFRDY_MASK | | ||
178 | + R_V7M_FPCCR_MMRDY_MASK | | ||
179 | + R_V7M_FPCCR_BFRDY_MASK | | ||
180 | + R_V7M_FPCCR_MONRDY_MASK | | ||
181 | + R_V7M_FPCCR_LSPEN_MASK | | ||
182 | + R_V7M_FPCCR_ASPEN_MASK); | ||
183 | + } | ||
184 | + value &= ~R_V7M_FPCCR_RES0_MASK; | ||
185 | + | ||
186 | + if (!attrs.secure) { | ||
187 | + /* Some non-banked bits are configurably writable by NS */ | ||
188 | + fpccr_s = cpu->env.v7m.fpccr[M_REG_S]; | ||
189 | + if (!(fpccr_s & R_V7M_FPCCR_LSPENS_MASK)) { | ||
190 | + uint32_t lspen = FIELD_EX32(value, V7M_FPCCR, LSPEN); | ||
191 | + fpccr_s = FIELD_DP32(fpccr_s, V7M_FPCCR, LSPEN, lspen); | ||
192 | + } | ||
193 | + if (!(fpccr_s & R_V7M_FPCCR_CLRONRETS_MASK)) { | ||
194 | + uint32_t cor = FIELD_EX32(value, V7M_FPCCR, CLRONRET); | ||
195 | + fpccr_s = FIELD_DP32(fpccr_s, V7M_FPCCR, CLRONRET, cor); | ||
196 | + } | ||
197 | + if ((s->cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK)) { | ||
198 | + uint32_t hfrdy = FIELD_EX32(value, V7M_FPCCR, HFRDY); | ||
199 | + uint32_t bfrdy = FIELD_EX32(value, V7M_FPCCR, BFRDY); | ||
200 | + fpccr_s = FIELD_DP32(fpccr_s, V7M_FPCCR, HFRDY, hfrdy); | ||
201 | + fpccr_s = FIELD_DP32(fpccr_s, V7M_FPCCR, BFRDY, bfrdy); | ||
202 | + } | ||
203 | + /* TODO MONRDY should RAZ/WI if DEMCR.SDME is set */ | ||
204 | + { | ||
205 | + uint32_t monrdy = FIELD_EX32(value, V7M_FPCCR, MONRDY); | ||
206 | + fpccr_s = FIELD_DP32(fpccr_s, V7M_FPCCR, MONRDY, monrdy); | ||
207 | + } | ||
208 | + | ||
209 | + /* | ||
210 | + * All other non-banked bits are RAZ/WI from NS; write | ||
211 | + * just the banked bits to fpccr[M_REG_NS]. | ||
212 | + */ | ||
213 | + value &= R_V7M_FPCCR_BANKED_MASK; | ||
214 | + cpu->env.v7m.fpccr[M_REG_NS] = value; | ||
215 | + } else { | ||
216 | + fpccr_s = value; | ||
217 | + } | ||
218 | + cpu->env.v7m.fpccr[M_REG_S] = fpccr_s; | ||
219 | + } | ||
220 | + break; | ||
221 | + case 0xf38: /* FPCAR */ | ||
222 | + if (arm_feature(&cpu->env, ARM_FEATURE_VFP)) { | ||
223 | + value &= ~7; | ||
224 | + cpu->env.v7m.fpcar[attrs.secure] = value; | ||
225 | + } | ||
226 | + break; | ||
227 | + case 0xf3c: /* FPDSCR */ | ||
228 | + if (arm_feature(&cpu->env, ARM_FEATURE_VFP)) { | ||
229 | + value &= 0x07c00000; | ||
230 | + cpu->env.v7m.fpdscr[attrs.secure] = value; | ||
231 | + } | ||
232 | + break; | ||
233 | case 0xf50: /* ICIALLU */ | ||
234 | case 0xf58: /* ICIMVAU */ | ||
235 | case 0xf5c: /* DCIMVAC */ | ||
236 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
237 | index XXXXXXX..XXXXXXX 100644 | ||
238 | --- a/target/arm/cpu.c | ||
239 | +++ b/target/arm/cpu.c | ||
240 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(CPUState *s) | ||
241 | env->v7m.ccr[M_REG_S] |= R_V7M_CCR_UNALIGN_TRP_MASK; | ||
242 | } | ||
243 | |||
244 | + if (arm_feature(env, ARM_FEATURE_VFP)) { | ||
245 | + env->v7m.fpccr[M_REG_NS] = R_V7M_FPCCR_ASPEN_MASK; | ||
246 | + env->v7m.fpccr[M_REG_S] = R_V7M_FPCCR_ASPEN_MASK | | ||
247 | + R_V7M_FPCCR_LSPEN_MASK | R_V7M_FPCCR_S_MASK; | ||
248 | + } | ||
249 | /* Unlike A/R profile, M profile defines the reset LR value */ | ||
250 | env->regs[14] = 0xffffffff; | ||
251 | |||
252 | diff --git a/target/arm/machine.c b/target/arm/machine.c | ||
253 | index XXXXXXX..XXXXXXX 100644 | ||
254 | --- a/target/arm/machine.c | ||
255 | +++ b/target/arm/machine.c | ||
256 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m_v8m = { | ||
257 | } | ||
258 | }; | ||
259 | |||
260 | +static const VMStateDescription vmstate_m_fp = { | ||
261 | + .name = "cpu/m/fp", | ||
262 | + .version_id = 1, | ||
263 | + .minimum_version_id = 1, | ||
264 | + .needed = vfp_needed, | ||
265 | + .fields = (VMStateField[]) { | ||
266 | + VMSTATE_UINT32_ARRAY(env.v7m.fpcar, ARMCPU, M_REG_NUM_BANKS), | ||
267 | + VMSTATE_UINT32_ARRAY(env.v7m.fpccr, ARMCPU, M_REG_NUM_BANKS), | ||
268 | + VMSTATE_UINT32_ARRAY(env.v7m.fpdscr, ARMCPU, M_REG_NUM_BANKS), | ||
269 | + VMSTATE_UINT32_ARRAY(env.v7m.cpacr, ARMCPU, M_REG_NUM_BANKS), | ||
270 | + VMSTATE_UINT32(env.v7m.nsacr, ARMCPU), | ||
271 | + VMSTATE_END_OF_LIST() | ||
272 | + } | ||
273 | +}; | ||
274 | + | ||
275 | static const VMStateDescription vmstate_m = { | ||
276 | .name = "cpu/m", | ||
277 | .version_id = 4, | ||
278 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m = { | ||
279 | &vmstate_m_scr, | ||
280 | &vmstate_m_other_sp, | ||
281 | &vmstate_m_v8m, | ||
282 | + &vmstate_m_fp, | ||
283 | NULL | ||
284 | } | ||
285 | }; | ||
286 | -- | 44 | -- |
287 | 2.20.1 | 45 | 2.25.1 |
288 | |||
289 | diff view generated by jsdifflib |
1 | Implement the code which updates the FPCCR register on an | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | exception entry where we are going to use lazy FP stacking. | ||
3 | We have to defer to the NVIC to determine whether the | ||
4 | various exceptions are currently ready or not. | ||
5 | 2 | ||
3 | Rename do_zz_fp to gen_gvec_fpst_arg_zz, and move up. | ||
4 | Split out gen_gvec_fpst_zz as a helper while we're at it. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-92-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Message-id: 20190416125744.27770-12-peter.maydell@linaro.org | ||
8 | --- | 10 | --- |
9 | target/arm/cpu.h | 14 +++++++++ | 11 | target/arm/translate-sve.c | 77 ++++++++++++++++++-------------------- |
10 | hw/intc/armv7m_nvic.c | 34 ++++++++++++++++++++++ | 12 | 1 file changed, 36 insertions(+), 41 deletions(-) |
11 | target/arm/helper.c | 67 ++++++++++++++++++++++++++++++++++++++++++- | ||
12 | 3 files changed, 114 insertions(+), 1 deletion(-) | ||
13 | 13 | ||
14 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
15 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/cpu.h | 16 | --- a/target/arm/translate-sve.c |
17 | +++ b/target/arm/cpu.h | 17 | +++ b/target/arm/translate-sve.c |
18 | @@ -XXX,XX +XXX,XX @@ void armv7m_nvic_acknowledge_irq(void *opaque); | 18 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_zz(DisasContext *s, gen_helper_gvec_2 *fn, |
19 | * (Ignoring -1, this is the same as the RETTOBASE value before completion.) | 19 | return true; |
20 | */ | ||
21 | int armv7m_nvic_complete_irq(void *opaque, int irq, bool secure); | ||
22 | +/** | ||
23 | + * armv7m_nvic_get_ready_status(void *opaque, int irq, bool secure) | ||
24 | + * @opaque: the NVIC | ||
25 | + * @irq: the exception number to mark pending | ||
26 | + * @secure: false for non-banked exceptions or for the nonsecure | ||
27 | + * version of a banked exception, true for the secure version of a banked | ||
28 | + * exception. | ||
29 | + * | ||
30 | + * Return whether an exception is "ready", i.e. whether the exception is | ||
31 | + * enabled and is configured at a priority which would allow it to | ||
32 | + * interrupt the current execution priority. This controls whether the | ||
33 | + * RDY bit for it in the FPCCR is set. | ||
34 | + */ | ||
35 | +bool armv7m_nvic_get_ready_status(void *opaque, int irq, bool secure); | ||
36 | /** | ||
37 | * armv7m_nvic_raw_execution_priority: return the raw execution priority | ||
38 | * @opaque: the NVIC | ||
39 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c | ||
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/hw/intc/armv7m_nvic.c | ||
42 | +++ b/hw/intc/armv7m_nvic.c | ||
43 | @@ -XXX,XX +XXX,XX @@ int armv7m_nvic_complete_irq(void *opaque, int irq, bool secure) | ||
44 | return ret; | ||
45 | } | 20 | } |
46 | 21 | ||
47 | +bool armv7m_nvic_get_ready_status(void *opaque, int irq, bool secure) | 22 | +static bool gen_gvec_fpst_zz(DisasContext *s, gen_helper_gvec_2_ptr *fn, |
23 | + int rd, int rn, int data, | ||
24 | + ARMFPStatusFlavour flavour) | ||
48 | +{ | 25 | +{ |
49 | + /* | 26 | + if (fn == NULL) { |
50 | + * Return whether an exception is "ready", i.e. it is enabled and is | 27 | + return false; |
51 | + * configured at a priority which would allow it to interrupt the | 28 | + } |
52 | + * current execution priority. | 29 | + if (sve_access_check(s)) { |
53 | + * | 30 | + unsigned vsz = vec_full_reg_size(s); |
54 | + * irq and secure have the same semantics as for armv7m_nvic_set_pending(): | 31 | + TCGv_ptr status = fpstatus_ptr(flavour); |
55 | + * for non-banked exceptions secure is always false; for banked exceptions | ||
56 | + * it indicates which of the exceptions is required. | ||
57 | + */ | ||
58 | + NVICState *s = (NVICState *)opaque; | ||
59 | + bool banked = exc_is_banked(irq); | ||
60 | + VecInfo *vec; | ||
61 | + int running = nvic_exec_prio(s); | ||
62 | + | 32 | + |
63 | + assert(irq > ARMV7M_EXCP_RESET && irq < s->num_irq); | 33 | + tcg_gen_gvec_2_ptr(vec_full_reg_offset(s, rd), |
64 | + assert(!secure || banked); | 34 | + vec_full_reg_offset(s, rn), |
65 | + | 35 | + status, vsz, vsz, data, fn); |
66 | + /* | 36 | + tcg_temp_free_ptr(status); |
67 | + * HardFault is an odd special case: we always check against -1, | ||
68 | + * even if we're secure and HardFault has priority -3; we never | ||
69 | + * need to check for enabled state. | ||
70 | + */ | ||
71 | + if (irq == ARMV7M_EXCP_HARD) { | ||
72 | + return running > -1; | ||
73 | + } | 37 | + } |
74 | + | 38 | + return true; |
75 | + vec = (banked && secure) ? &s->sec_vectors[irq] : &s->vectors[irq]; | ||
76 | + | ||
77 | + return vec->enabled && | ||
78 | + exc_group_prio(s, vec->prio, secure) < running; | ||
79 | +} | 39 | +} |
80 | + | 40 | + |
81 | /* callback when external interrupt line is changed */ | 41 | +static bool gen_gvec_fpst_arg_zz(DisasContext *s, gen_helper_gvec_2_ptr *fn, |
82 | static void set_irq_level(void *opaque, int n, int level) | 42 | + arg_rr_esz *a, int data) |
83 | { | ||
84 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
85 | index XXXXXXX..XXXXXXX 100644 | ||
86 | --- a/target/arm/helper.c | ||
87 | +++ b/target/arm/helper.c | ||
88 | @@ -XXX,XX +XXX,XX @@ static void v7m_exception_taken(ARMCPU *cpu, uint32_t lr, bool dotailchain, | ||
89 | env->thumb = addr & 1; | ||
90 | } | ||
91 | |||
92 | +static void v7m_update_fpccr(CPUARMState *env, uint32_t frameptr, | ||
93 | + bool apply_splim) | ||
94 | +{ | 43 | +{ |
95 | + /* | 44 | + return gen_gvec_fpst_zz(s, fn, a->rd, a->rn, data, |
96 | + * Like the pseudocode UpdateFPCCR: save state in FPCAR and FPCCR | 45 | + a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); |
97 | + * that we will need later in order to do lazy FP reg stacking. | ||
98 | + */ | ||
99 | + bool is_secure = env->v7m.secure; | ||
100 | + void *nvic = env->nvic; | ||
101 | + /* | ||
102 | + * Some bits are unbanked and live always in fpccr[M_REG_S]; some bits | ||
103 | + * are banked and we want to update the bit in the bank for the | ||
104 | + * current security state; and in one case we want to specifically | ||
105 | + * update the NS banked version of a bit even if we are secure. | ||
106 | + */ | ||
107 | + uint32_t *fpccr_s = &env->v7m.fpccr[M_REG_S]; | ||
108 | + uint32_t *fpccr_ns = &env->v7m.fpccr[M_REG_NS]; | ||
109 | + uint32_t *fpccr = &env->v7m.fpccr[is_secure]; | ||
110 | + bool hfrdy, bfrdy, mmrdy, ns_ufrdy, s_ufrdy, sfrdy, monrdy; | ||
111 | + | ||
112 | + env->v7m.fpcar[is_secure] = frameptr & ~0x7; | ||
113 | + | ||
114 | + if (apply_splim && arm_feature(env, ARM_FEATURE_V8)) { | ||
115 | + bool splimviol; | ||
116 | + uint32_t splim = v7m_sp_limit(env); | ||
117 | + bool ign = armv7m_nvic_neg_prio_requested(nvic, is_secure) && | ||
118 | + (env->v7m.ccr[is_secure] & R_V7M_CCR_STKOFHFNMIGN_MASK); | ||
119 | + | ||
120 | + splimviol = !ign && frameptr < splim; | ||
121 | + *fpccr = FIELD_DP32(*fpccr, V7M_FPCCR, SPLIMVIOL, splimviol); | ||
122 | + } | ||
123 | + | ||
124 | + *fpccr = FIELD_DP32(*fpccr, V7M_FPCCR, LSPACT, 1); | ||
125 | + | ||
126 | + *fpccr_s = FIELD_DP32(*fpccr_s, V7M_FPCCR, S, is_secure); | ||
127 | + | ||
128 | + *fpccr = FIELD_DP32(*fpccr, V7M_FPCCR, USER, arm_current_el(env) == 0); | ||
129 | + | ||
130 | + *fpccr = FIELD_DP32(*fpccr, V7M_FPCCR, THREAD, | ||
131 | + !arm_v7m_is_handler_mode(env)); | ||
132 | + | ||
133 | + hfrdy = armv7m_nvic_get_ready_status(nvic, ARMV7M_EXCP_HARD, false); | ||
134 | + *fpccr_s = FIELD_DP32(*fpccr_s, V7M_FPCCR, HFRDY, hfrdy); | ||
135 | + | ||
136 | + bfrdy = armv7m_nvic_get_ready_status(nvic, ARMV7M_EXCP_BUS, false); | ||
137 | + *fpccr_s = FIELD_DP32(*fpccr_s, V7M_FPCCR, BFRDY, bfrdy); | ||
138 | + | ||
139 | + mmrdy = armv7m_nvic_get_ready_status(nvic, ARMV7M_EXCP_MEM, is_secure); | ||
140 | + *fpccr = FIELD_DP32(*fpccr, V7M_FPCCR, MMRDY, mmrdy); | ||
141 | + | ||
142 | + ns_ufrdy = armv7m_nvic_get_ready_status(nvic, ARMV7M_EXCP_USAGE, false); | ||
143 | + *fpccr_ns = FIELD_DP32(*fpccr_ns, V7M_FPCCR, UFRDY, ns_ufrdy); | ||
144 | + | ||
145 | + monrdy = armv7m_nvic_get_ready_status(nvic, ARMV7M_EXCP_DEBUG, false); | ||
146 | + *fpccr_s = FIELD_DP32(*fpccr_s, V7M_FPCCR, MONRDY, monrdy); | ||
147 | + | ||
148 | + if (arm_feature(env, ARM_FEATURE_M_SECURITY)) { | ||
149 | + s_ufrdy = armv7m_nvic_get_ready_status(nvic, ARMV7M_EXCP_USAGE, true); | ||
150 | + *fpccr_s = FIELD_DP32(*fpccr_s, V7M_FPCCR, UFRDY, s_ufrdy); | ||
151 | + | ||
152 | + sfrdy = armv7m_nvic_get_ready_status(nvic, ARMV7M_EXCP_SECURE, false); | ||
153 | + *fpccr_s = FIELD_DP32(*fpccr_s, V7M_FPCCR, SFRDY, sfrdy); | ||
154 | + } | ||
155 | +} | 46 | +} |
156 | + | 47 | + |
157 | static bool v7m_push_stack(ARMCPU *cpu) | 48 | /* Invoke an out-of-line helper on 3 Zregs. */ |
158 | { | 49 | static bool gen_gvec_ool_zzz(DisasContext *s, gen_helper_gvec_3 *fn, |
159 | /* Do the "set up stack frame" part of exception entry, | 50 | int rd, int rn, int rm, int data) |
160 | @@ -XXX,XX +XXX,XX @@ static bool v7m_push_stack(ARMCPU *cpu) | 51 | @@ -XXX,XX +XXX,XX @@ DO_VPZ(FMAXV, fmaxv) |
161 | } | 52 | *** SVE Floating Point Unary Operations - Unpredicated Group |
162 | } else { | 53 | */ |
163 | /* Lazy stacking enabled, save necessary info to stack later */ | 54 | |
164 | - /* TODO : equivalent of UpdateFPCCR() pseudocode */ | 55 | -static void do_zz_fp(DisasContext *s, arg_rr_esz *a, gen_helper_gvec_2_ptr *fn) |
165 | + v7m_update_fpccr(env, frameptr + 0x20, true); | 56 | -{ |
166 | } | 57 | - unsigned vsz = vec_full_reg_size(s); |
167 | } | 58 | - TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); |
168 | } | 59 | +static gen_helper_gvec_2_ptr * const frecpe_fns[] = { |
60 | + NULL, gen_helper_gvec_frecpe_h, | ||
61 | + gen_helper_gvec_frecpe_s, gen_helper_gvec_frecpe_d, | ||
62 | +}; | ||
63 | +TRANS_FEAT(FRECPE, aa64_sve, gen_gvec_fpst_arg_zz, frecpe_fns[a->esz], a, 0) | ||
64 | |||
65 | - tcg_gen_gvec_2_ptr(vec_full_reg_offset(s, a->rd), | ||
66 | - vec_full_reg_offset(s, a->rn), | ||
67 | - status, vsz, vsz, 0, fn); | ||
68 | - tcg_temp_free_ptr(status); | ||
69 | -} | ||
70 | - | ||
71 | -static bool trans_FRECPE(DisasContext *s, arg_rr_esz *a) | ||
72 | -{ | ||
73 | - static gen_helper_gvec_2_ptr * const fns[3] = { | ||
74 | - gen_helper_gvec_frecpe_h, | ||
75 | - gen_helper_gvec_frecpe_s, | ||
76 | - gen_helper_gvec_frecpe_d, | ||
77 | - }; | ||
78 | - if (a->esz == 0) { | ||
79 | - return false; | ||
80 | - } | ||
81 | - if (sve_access_check(s)) { | ||
82 | - do_zz_fp(s, a, fns[a->esz - 1]); | ||
83 | - } | ||
84 | - return true; | ||
85 | -} | ||
86 | - | ||
87 | -static bool trans_FRSQRTE(DisasContext *s, arg_rr_esz *a) | ||
88 | -{ | ||
89 | - static gen_helper_gvec_2_ptr * const fns[3] = { | ||
90 | - gen_helper_gvec_frsqrte_h, | ||
91 | - gen_helper_gvec_frsqrte_s, | ||
92 | - gen_helper_gvec_frsqrte_d, | ||
93 | - }; | ||
94 | - if (a->esz == 0) { | ||
95 | - return false; | ||
96 | - } | ||
97 | - if (sve_access_check(s)) { | ||
98 | - do_zz_fp(s, a, fns[a->esz - 1]); | ||
99 | - } | ||
100 | - return true; | ||
101 | -} | ||
102 | +static gen_helper_gvec_2_ptr * const frsqrte_fns[] = { | ||
103 | + NULL, gen_helper_gvec_frsqrte_h, | ||
104 | + gen_helper_gvec_frsqrte_s, gen_helper_gvec_frsqrte_d, | ||
105 | +}; | ||
106 | +TRANS_FEAT(FRSQRTE, aa64_sve, gen_gvec_fpst_arg_zz, frsqrte_fns[a->esz], a, 0) | ||
107 | |||
108 | /* | ||
109 | *** SVE Floating Point Compare with Zero Group | ||
169 | -- | 110 | -- |
170 | 2.20.1 | 111 | 2.25.1 |
171 | |||
172 | diff view generated by jsdifflib |
1 | Add a new helper function which returns the MMU index to use | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | for v7M, where the caller specifies all of the security | ||
3 | state, privilege level and whether the execution priority | ||
4 | is negative, and reimplement the existing | ||
5 | arm_v7m_mmu_idx_for_secstate_and_priv() in terms of it. | ||
6 | 2 | ||
7 | We are going to need this for the lazy-FP-stacking code. | 3 | Simplify indexing of this array. This will allow folding |
4 | of the illegal esz == 0 into the normal fn == NULL check. | ||
8 | 5 | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220527181907.189259-93-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Message-id: 20190416125744.27770-21-peter.maydell@linaro.org | ||
12 | --- | 10 | --- |
13 | target/arm/cpu.h | 7 +++++++ | 11 | target/arm/translate-sve.c | 15 ++++++++------- |
14 | target/arm/helper.c | 14 +++++++++++--- | 12 | 1 file changed, 8 insertions(+), 7 deletions(-) |
15 | 2 files changed, 18 insertions(+), 3 deletions(-) | ||
16 | 13 | ||
17 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 14 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
18 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/target/arm/cpu.h | 16 | --- a/target/arm/translate-sve.c |
20 | +++ b/target/arm/cpu.h | 17 | +++ b/target/arm/translate-sve.c |
21 | @@ -XXX,XX +XXX,XX @@ static inline int arm_mmu_idx_to_el(ARMMMUIdx mmu_idx) | 18 | @@ -XXX,XX +XXX,XX @@ static bool trans_FCVTZU_dd(DisasContext *s, arg_rpr_esz *a) |
19 | return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvtzu_dd); | ||
20 | } | ||
21 | |||
22 | -static gen_helper_gvec_3_ptr * const frint_fns[3] = { | ||
23 | +static gen_helper_gvec_3_ptr * const frint_fns[] = { | ||
24 | + NULL, | ||
25 | gen_helper_sve_frint_h, | ||
26 | gen_helper_sve_frint_s, | ||
27 | gen_helper_sve_frint_d | ||
28 | @@ -XXX,XX +XXX,XX @@ static bool trans_FRINTI(DisasContext *s, arg_rpr_esz *a) | ||
29 | return false; | ||
22 | } | 30 | } |
31 | return do_zpz_ptr(s, a->rd, a->rn, a->pg, a->esz == MO_16, | ||
32 | - frint_fns[a->esz - 1]); | ||
33 | + frint_fns[a->esz]); | ||
23 | } | 34 | } |
24 | 35 | ||
25 | +/* | 36 | static bool trans_FRINTX(DisasContext *s, arg_rpr_esz *a) |
26 | + * Return the MMU index for a v7M CPU with all relevant information | 37 | @@ -XXX,XX +XXX,XX @@ static bool trans_FRINTN(DisasContext *s, arg_rpr_esz *a) |
27 | + * manually specified. | 38 | if (a->esz == 0) { |
28 | + */ | 39 | return false; |
29 | +ARMMMUIdx arm_v7m_mmu_idx_all(CPUARMState *env, | 40 | } |
30 | + bool secstate, bool priv, bool negpri); | 41 | - return do_frint_mode(s, a, float_round_nearest_even, frint_fns[a->esz - 1]); |
31 | + | 42 | + return do_frint_mode(s, a, float_round_nearest_even, frint_fns[a->esz]); |
32 | /* Return the MMU index for a v7M CPU in the specified security and | ||
33 | * privilege state. | ||
34 | */ | ||
35 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
36 | index XXXXXXX..XXXXXXX 100644 | ||
37 | --- a/target/arm/helper.c | ||
38 | +++ b/target/arm/helper.c | ||
39 | @@ -XXX,XX +XXX,XX @@ int fp_exception_el(CPUARMState *env, int cur_el) | ||
40 | return 0; | ||
41 | } | 43 | } |
42 | 44 | ||
43 | -ARMMMUIdx arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env, | 45 | static bool trans_FRINTP(DisasContext *s, arg_rpr_esz *a) |
44 | - bool secstate, bool priv) | 46 | @@ -XXX,XX +XXX,XX @@ static bool trans_FRINTP(DisasContext *s, arg_rpr_esz *a) |
45 | +ARMMMUIdx arm_v7m_mmu_idx_all(CPUARMState *env, | 47 | if (a->esz == 0) { |
46 | + bool secstate, bool priv, bool negpri) | 48 | return false; |
47 | { | ||
48 | ARMMMUIdx mmu_idx = ARM_MMU_IDX_M; | ||
49 | |||
50 | @@ -XXX,XX +XXX,XX @@ ARMMMUIdx arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env, | ||
51 | mmu_idx |= ARM_MMU_IDX_M_PRIV; | ||
52 | } | 49 | } |
53 | 50 | - return do_frint_mode(s, a, float_round_up, frint_fns[a->esz - 1]); | |
54 | - if (armv7m_nvic_neg_prio_requested(env->nvic, secstate)) { | 51 | + return do_frint_mode(s, a, float_round_up, frint_fns[a->esz]); |
55 | + if (negpri) { | 52 | } |
56 | mmu_idx |= ARM_MMU_IDX_M_NEGPRI; | 53 | |
54 | static bool trans_FRINTM(DisasContext *s, arg_rpr_esz *a) | ||
55 | @@ -XXX,XX +XXX,XX @@ static bool trans_FRINTM(DisasContext *s, arg_rpr_esz *a) | ||
56 | if (a->esz == 0) { | ||
57 | return false; | ||
57 | } | 58 | } |
58 | 59 | - return do_frint_mode(s, a, float_round_down, frint_fns[a->esz - 1]); | |
59 | @@ -XXX,XX +XXX,XX @@ ARMMMUIdx arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env, | 60 | + return do_frint_mode(s, a, float_round_down, frint_fns[a->esz]); |
60 | return mmu_idx; | ||
61 | } | 61 | } |
62 | 62 | ||
63 | +ARMMMUIdx arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env, | 63 | static bool trans_FRINTZ(DisasContext *s, arg_rpr_esz *a) |
64 | + bool secstate, bool priv) | 64 | @@ -XXX,XX +XXX,XX @@ static bool trans_FRINTZ(DisasContext *s, arg_rpr_esz *a) |
65 | +{ | 65 | if (a->esz == 0) { |
66 | + bool negpri = armv7m_nvic_neg_prio_requested(env->nvic, secstate); | 66 | return false; |
67 | + | 67 | } |
68 | + return arm_v7m_mmu_idx_all(env, secstate, priv, negpri); | 68 | - return do_frint_mode(s, a, float_round_to_zero, frint_fns[a->esz - 1]); |
69 | +} | 69 | + return do_frint_mode(s, a, float_round_to_zero, frint_fns[a->esz]); |
70 | + | 70 | } |
71 | /* Return the MMU index for a v7M CPU in the specified security state */ | 71 | |
72 | ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate) | 72 | static bool trans_FRINTA(DisasContext *s, arg_rpr_esz *a) |
73 | { | 73 | @@ -XXX,XX +XXX,XX @@ static bool trans_FRINTA(DisasContext *s, arg_rpr_esz *a) |
74 | if (a->esz == 0) { | ||
75 | return false; | ||
76 | } | ||
77 | - return do_frint_mode(s, a, float_round_ties_away, frint_fns[a->esz - 1]); | ||
78 | + return do_frint_mode(s, a, float_round_ties_away, frint_fns[a->esz]); | ||
79 | } | ||
80 | |||
81 | static bool trans_FRECPX(DisasContext *s, arg_rpr_esz *a) | ||
74 | -- | 82 | -- |
75 | 2.20.1 | 83 | 2.25.1 |
76 | |||
77 | diff view generated by jsdifflib |
1 | In the v7M architecture, if an exception is generated in the process | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | of doing the lazy stacking of FP registers, the handling of | ||
3 | possible escalation to HardFault is treated differently to the normal | ||
4 | approach: it works based on the saved information about exception | ||
5 | readiness that was stored in the FPCCR when the stack frame was | ||
6 | created. Provide a new function armv7m_nvic_set_pending_lazyfp() | ||
7 | which pends exceptions during lazy stacking, and implements | ||
8 | this logic. | ||
9 | 2 | ||
10 | This corresponds to the pseudocode TakePreserveFPException(). | 3 | Rename the function to match other expansion function and |
4 | move to be adjacent. Split out gen_gvec_fpst_zzp as a | ||
5 | helper while we're at it. | ||
11 | 6 | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20220527181907.189259-94-richard.henderson@linaro.org | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
14 | Message-id: 20190416125744.27770-22-peter.maydell@linaro.org | ||
15 | --- | 11 | --- |
16 | target/arm/cpu.h | 12 ++++++ | 12 | target/arm/translate-sve.c | 392 ++++++++++++------------------------- |
17 | hw/intc/armv7m_nvic.c | 96 +++++++++++++++++++++++++++++++++++++++++++ | 13 | 1 file changed, 129 insertions(+), 263 deletions(-) |
18 | 2 files changed, 108 insertions(+) | ||
19 | 14 | ||
20 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 15 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
21 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/target/arm/cpu.h | 17 | --- a/target/arm/translate-sve.c |
23 | +++ b/target/arm/cpu.h | 18 | +++ b/target/arm/translate-sve.c |
24 | @@ -XXX,XX +XXX,XX @@ void armv7m_nvic_set_pending(void *opaque, int irq, bool secure); | 19 | @@ -XXX,XX +XXX,XX @@ static bool gen_gvec_ool_arg_zpzi(DisasContext *s, gen_helper_gvec_3 *fn, |
25 | * a different exception). | 20 | return gen_gvec_ool_zzp(s, fn, a->rd, a->rn, a->pg, a->imm); |
26 | */ | ||
27 | void armv7m_nvic_set_pending_derived(void *opaque, int irq, bool secure); | ||
28 | +/** | ||
29 | + * armv7m_nvic_set_pending_lazyfp: mark this lazy FP exception as pending | ||
30 | + * @opaque: the NVIC | ||
31 | + * @irq: the exception number to mark pending | ||
32 | + * @secure: false for non-banked exceptions or for the nonsecure | ||
33 | + * version of a banked exception, true for the secure version of a banked | ||
34 | + * exception. | ||
35 | + * | ||
36 | + * Similar to armv7m_nvic_set_pending(), but specifically for exceptions | ||
37 | + * generated in the course of lazy stacking of FP registers. | ||
38 | + */ | ||
39 | +void armv7m_nvic_set_pending_lazyfp(void *opaque, int irq, bool secure); | ||
40 | /** | ||
41 | * armv7m_nvic_get_pending_irq_info: return highest priority pending | ||
42 | * exception, and whether it targets Secure state | ||
43 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c | ||
44 | index XXXXXXX..XXXXXXX 100644 | ||
45 | --- a/hw/intc/armv7m_nvic.c | ||
46 | +++ b/hw/intc/armv7m_nvic.c | ||
47 | @@ -XXX,XX +XXX,XX @@ void armv7m_nvic_set_pending_derived(void *opaque, int irq, bool secure) | ||
48 | do_armv7m_nvic_set_pending(opaque, irq, secure, true); | ||
49 | } | 21 | } |
50 | 22 | ||
51 | +void armv7m_nvic_set_pending_lazyfp(void *opaque, int irq, bool secure) | 23 | +static bool gen_gvec_fpst_zzp(DisasContext *s, gen_helper_gvec_3_ptr *fn, |
24 | + int rd, int rn, int pg, int data, | ||
25 | + ARMFPStatusFlavour flavour) | ||
52 | +{ | 26 | +{ |
53 | + /* | 27 | + if (fn == NULL) { |
54 | + * Pend an exception during lazy FP stacking. This differs | 28 | + return false; |
55 | + * from the usual exception pending because the logic for | 29 | + } |
56 | + * whether we should escalate depends on the saved context | 30 | + if (sve_access_check(s)) { |
57 | + * in the FPCCR register, not on the current state of the CPU/NVIC. | 31 | + unsigned vsz = vec_full_reg_size(s); |
58 | + */ | 32 | + TCGv_ptr status = fpstatus_ptr(flavour); |
59 | + NVICState *s = (NVICState *)opaque; | ||
60 | + bool banked = exc_is_banked(irq); | ||
61 | + VecInfo *vec; | ||
62 | + bool targets_secure; | ||
63 | + bool escalate = false; | ||
64 | + /* | ||
65 | + * We will only look at bits in fpccr if this is a banked exception | ||
66 | + * (in which case 'secure' tells us whether it is the S or NS version). | ||
67 | + * All the bits for the non-banked exceptions are in fpccr_s. | ||
68 | + */ | ||
69 | + uint32_t fpccr_s = s->cpu->env.v7m.fpccr[M_REG_S]; | ||
70 | + uint32_t fpccr = s->cpu->env.v7m.fpccr[secure]; | ||
71 | + | 33 | + |
72 | + assert(irq > ARMV7M_EXCP_RESET && irq < s->num_irq); | 34 | + tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, rd), |
73 | + assert(!secure || banked); | 35 | + vec_full_reg_offset(s, rn), |
74 | + | 36 | + pred_full_reg_offset(s, pg), |
75 | + vec = (banked && secure) ? &s->sec_vectors[irq] : &s->vectors[irq]; | 37 | + status, vsz, vsz, data, fn); |
76 | + | 38 | + tcg_temp_free_ptr(status); |
77 | + targets_secure = banked ? secure : exc_targets_secure(s, irq); | ||
78 | + | ||
79 | + switch (irq) { | ||
80 | + case ARMV7M_EXCP_DEBUG: | ||
81 | + if (!(fpccr_s & R_V7M_FPCCR_MONRDY_MASK)) { | ||
82 | + /* Ignore DebugMonitor exception */ | ||
83 | + return; | ||
84 | + } | ||
85 | + break; | ||
86 | + case ARMV7M_EXCP_MEM: | ||
87 | + escalate = !(fpccr & R_V7M_FPCCR_MMRDY_MASK); | ||
88 | + break; | ||
89 | + case ARMV7M_EXCP_USAGE: | ||
90 | + escalate = !(fpccr & R_V7M_FPCCR_UFRDY_MASK); | ||
91 | + break; | ||
92 | + case ARMV7M_EXCP_BUS: | ||
93 | + escalate = !(fpccr_s & R_V7M_FPCCR_BFRDY_MASK); | ||
94 | + break; | ||
95 | + case ARMV7M_EXCP_SECURE: | ||
96 | + escalate = !(fpccr_s & R_V7M_FPCCR_SFRDY_MASK); | ||
97 | + break; | ||
98 | + default: | ||
99 | + g_assert_not_reached(); | ||
100 | + } | 39 | + } |
101 | + | 40 | + return true; |
102 | + if (escalate) { | ||
103 | + /* | ||
104 | + * Escalate to HardFault: faults that initially targeted Secure | ||
105 | + * continue to do so, even if HF normally targets NonSecure. | ||
106 | + */ | ||
107 | + irq = ARMV7M_EXCP_HARD; | ||
108 | + if (arm_feature(&s->cpu->env, ARM_FEATURE_M_SECURITY) && | ||
109 | + (targets_secure || | ||
110 | + !(s->cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK))) { | ||
111 | + vec = &s->sec_vectors[irq]; | ||
112 | + } else { | ||
113 | + vec = &s->vectors[irq]; | ||
114 | + } | ||
115 | + } | ||
116 | + | ||
117 | + if (!vec->enabled || | ||
118 | + nvic_exec_prio(s) <= exc_group_prio(s, vec->prio, secure)) { | ||
119 | + if (!(fpccr_s & R_V7M_FPCCR_HFRDY_MASK)) { | ||
120 | + /* | ||
121 | + * We want to escalate to HardFault but the context the | ||
122 | + * FP state belongs to prevents the exception pre-empting. | ||
123 | + */ | ||
124 | + cpu_abort(&s->cpu->parent_obj, | ||
125 | + "Lockup: can't escalate to HardFault during " | ||
126 | + "lazy FP register stacking\n"); | ||
127 | + } | ||
128 | + } | ||
129 | + | ||
130 | + if (escalate) { | ||
131 | + s->cpu->env.v7m.hfsr |= R_V7M_HFSR_FORCED_MASK; | ||
132 | + } | ||
133 | + if (!vec->pending) { | ||
134 | + vec->pending = 1; | ||
135 | + /* | ||
136 | + * We do not call nvic_irq_update(), because we know our caller | ||
137 | + * is going to handle causing us to take the exception by | ||
138 | + * raising EXCP_LAZYFP, so raising the IRQ line would be | ||
139 | + * pointless extra work. We just need to recompute the | ||
140 | + * priorities so that armv7m_nvic_can_take_pending_exception() | ||
141 | + * returns the right answer. | ||
142 | + */ | ||
143 | + nvic_recompute_state(s); | ||
144 | + } | ||
145 | +} | 41 | +} |
146 | + | 42 | + |
147 | /* Make pending IRQ active. */ | 43 | +static bool gen_gvec_fpst_arg_zpz(DisasContext *s, gen_helper_gvec_3_ptr *fn, |
148 | void armv7m_nvic_acknowledge_irq(void *opaque) | 44 | + arg_rpr_esz *a, int data, |
45 | + ARMFPStatusFlavour flavour) | ||
46 | +{ | ||
47 | + return gen_gvec_fpst_zzp(s, fn, a->rd, a->rn, a->pg, data, flavour); | ||
48 | +} | ||
49 | + | ||
50 | /* Invoke an out-of-line helper on 3 Zregs and a predicate. */ | ||
51 | static bool gen_gvec_ool_zzzp(DisasContext *s, gen_helper_gvec_4 *fn, | ||
52 | int rd, int rn, int rm, int pg, int data) | ||
53 | @@ -XXX,XX +XXX,XX @@ static bool trans_FCMLA_zzxz(DisasContext *s, arg_FCMLA_zzxz *a) | ||
54 | *** SVE Floating Point Unary Operations Predicated Group | ||
55 | */ | ||
56 | |||
57 | -static bool do_zpz_ptr(DisasContext *s, int rd, int rn, int pg, | ||
58 | - bool is_fp16, gen_helper_gvec_3_ptr *fn) | ||
59 | -{ | ||
60 | - if (sve_access_check(s)) { | ||
61 | - unsigned vsz = vec_full_reg_size(s); | ||
62 | - TCGv_ptr status = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_FPCR); | ||
63 | - tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, rd), | ||
64 | - vec_full_reg_offset(s, rn), | ||
65 | - pred_full_reg_offset(s, pg), | ||
66 | - status, vsz, vsz, 0, fn); | ||
67 | - tcg_temp_free_ptr(status); | ||
68 | - } | ||
69 | - return true; | ||
70 | -} | ||
71 | +TRANS_FEAT(FCVT_sh, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
72 | + gen_helper_sve_fcvt_sh, a, 0, FPST_FPCR) | ||
73 | +TRANS_FEAT(FCVT_hs, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
74 | + gen_helper_sve_fcvt_hs, a, 0, FPST_FPCR) | ||
75 | |||
76 | -static bool trans_FCVT_sh(DisasContext *s, arg_rpr_esz *a) | ||
77 | -{ | ||
78 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvt_sh); | ||
79 | -} | ||
80 | +TRANS_FEAT(BFCVT, aa64_sve_bf16, gen_gvec_fpst_arg_zpz, | ||
81 | + gen_helper_sve_bfcvt, a, 0, FPST_FPCR) | ||
82 | |||
83 | -static bool trans_FCVT_hs(DisasContext *s, arg_rpr_esz *a) | ||
84 | -{ | ||
85 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvt_hs); | ||
86 | -} | ||
87 | +TRANS_FEAT(FCVT_dh, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
88 | + gen_helper_sve_fcvt_dh, a, 0, FPST_FPCR) | ||
89 | +TRANS_FEAT(FCVT_hd, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
90 | + gen_helper_sve_fcvt_hd, a, 0, FPST_FPCR) | ||
91 | +TRANS_FEAT(FCVT_ds, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
92 | + gen_helper_sve_fcvt_ds, a, 0, FPST_FPCR) | ||
93 | +TRANS_FEAT(FCVT_sd, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
94 | + gen_helper_sve_fcvt_sd, a, 0, FPST_FPCR) | ||
95 | |||
96 | -static bool trans_BFCVT(DisasContext *s, arg_rpr_esz *a) | ||
97 | -{ | ||
98 | - if (!dc_isar_feature(aa64_sve_bf16, s)) { | ||
99 | - return false; | ||
100 | - } | ||
101 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_bfcvt); | ||
102 | -} | ||
103 | +TRANS_FEAT(FCVTZS_hh, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
104 | + gen_helper_sve_fcvtzs_hh, a, 0, FPST_FPCR_F16) | ||
105 | +TRANS_FEAT(FCVTZU_hh, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
106 | + gen_helper_sve_fcvtzu_hh, a, 0, FPST_FPCR_F16) | ||
107 | +TRANS_FEAT(FCVTZS_hs, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
108 | + gen_helper_sve_fcvtzs_hs, a, 0, FPST_FPCR_F16) | ||
109 | +TRANS_FEAT(FCVTZU_hs, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
110 | + gen_helper_sve_fcvtzu_hs, a, 0, FPST_FPCR_F16) | ||
111 | +TRANS_FEAT(FCVTZS_hd, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
112 | + gen_helper_sve_fcvtzs_hd, a, 0, FPST_FPCR_F16) | ||
113 | +TRANS_FEAT(FCVTZU_hd, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
114 | + gen_helper_sve_fcvtzu_hd, a, 0, FPST_FPCR_F16) | ||
115 | |||
116 | -static bool trans_FCVT_dh(DisasContext *s, arg_rpr_esz *a) | ||
117 | -{ | ||
118 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvt_dh); | ||
119 | -} | ||
120 | +TRANS_FEAT(FCVTZS_ss, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
121 | + gen_helper_sve_fcvtzs_ss, a, 0, FPST_FPCR) | ||
122 | +TRANS_FEAT(FCVTZU_ss, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
123 | + gen_helper_sve_fcvtzu_ss, a, 0, FPST_FPCR) | ||
124 | +TRANS_FEAT(FCVTZS_sd, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
125 | + gen_helper_sve_fcvtzs_sd, a, 0, FPST_FPCR) | ||
126 | +TRANS_FEAT(FCVTZU_sd, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
127 | + gen_helper_sve_fcvtzu_sd, a, 0, FPST_FPCR) | ||
128 | +TRANS_FEAT(FCVTZS_ds, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
129 | + gen_helper_sve_fcvtzs_ds, a, 0, FPST_FPCR) | ||
130 | +TRANS_FEAT(FCVTZU_ds, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
131 | + gen_helper_sve_fcvtzu_ds, a, 0, FPST_FPCR) | ||
132 | |||
133 | -static bool trans_FCVT_hd(DisasContext *s, arg_rpr_esz *a) | ||
134 | -{ | ||
135 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvt_hd); | ||
136 | -} | ||
137 | - | ||
138 | -static bool trans_FCVT_ds(DisasContext *s, arg_rpr_esz *a) | ||
139 | -{ | ||
140 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvt_ds); | ||
141 | -} | ||
142 | - | ||
143 | -static bool trans_FCVT_sd(DisasContext *s, arg_rpr_esz *a) | ||
144 | -{ | ||
145 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvt_sd); | ||
146 | -} | ||
147 | - | ||
148 | -static bool trans_FCVTZS_hh(DisasContext *s, arg_rpr_esz *a) | ||
149 | -{ | ||
150 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_fcvtzs_hh); | ||
151 | -} | ||
152 | - | ||
153 | -static bool trans_FCVTZU_hh(DisasContext *s, arg_rpr_esz *a) | ||
154 | -{ | ||
155 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_fcvtzu_hh); | ||
156 | -} | ||
157 | - | ||
158 | -static bool trans_FCVTZS_hs(DisasContext *s, arg_rpr_esz *a) | ||
159 | -{ | ||
160 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_fcvtzs_hs); | ||
161 | -} | ||
162 | - | ||
163 | -static bool trans_FCVTZU_hs(DisasContext *s, arg_rpr_esz *a) | ||
164 | -{ | ||
165 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_fcvtzu_hs); | ||
166 | -} | ||
167 | - | ||
168 | -static bool trans_FCVTZS_hd(DisasContext *s, arg_rpr_esz *a) | ||
169 | -{ | ||
170 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_fcvtzs_hd); | ||
171 | -} | ||
172 | - | ||
173 | -static bool trans_FCVTZU_hd(DisasContext *s, arg_rpr_esz *a) | ||
174 | -{ | ||
175 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_fcvtzu_hd); | ||
176 | -} | ||
177 | - | ||
178 | -static bool trans_FCVTZS_ss(DisasContext *s, arg_rpr_esz *a) | ||
179 | -{ | ||
180 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvtzs_ss); | ||
181 | -} | ||
182 | - | ||
183 | -static bool trans_FCVTZU_ss(DisasContext *s, arg_rpr_esz *a) | ||
184 | -{ | ||
185 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvtzu_ss); | ||
186 | -} | ||
187 | - | ||
188 | -static bool trans_FCVTZS_sd(DisasContext *s, arg_rpr_esz *a) | ||
189 | -{ | ||
190 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvtzs_sd); | ||
191 | -} | ||
192 | - | ||
193 | -static bool trans_FCVTZU_sd(DisasContext *s, arg_rpr_esz *a) | ||
194 | -{ | ||
195 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvtzu_sd); | ||
196 | -} | ||
197 | - | ||
198 | -static bool trans_FCVTZS_ds(DisasContext *s, arg_rpr_esz *a) | ||
199 | -{ | ||
200 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvtzs_ds); | ||
201 | -} | ||
202 | - | ||
203 | -static bool trans_FCVTZU_ds(DisasContext *s, arg_rpr_esz *a) | ||
204 | -{ | ||
205 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvtzu_ds); | ||
206 | -} | ||
207 | - | ||
208 | -static bool trans_FCVTZS_dd(DisasContext *s, arg_rpr_esz *a) | ||
209 | -{ | ||
210 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvtzs_dd); | ||
211 | -} | ||
212 | - | ||
213 | -static bool trans_FCVTZU_dd(DisasContext *s, arg_rpr_esz *a) | ||
214 | -{ | ||
215 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_fcvtzu_dd); | ||
216 | -} | ||
217 | +TRANS_FEAT(FCVTZS_dd, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
218 | + gen_helper_sve_fcvtzs_dd, a, 0, FPST_FPCR) | ||
219 | +TRANS_FEAT(FCVTZU_dd, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
220 | + gen_helper_sve_fcvtzu_dd, a, 0, FPST_FPCR) | ||
221 | |||
222 | static gen_helper_gvec_3_ptr * const frint_fns[] = { | ||
223 | NULL, | ||
224 | @@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_3_ptr * const frint_fns[] = { | ||
225 | gen_helper_sve_frint_s, | ||
226 | gen_helper_sve_frint_d | ||
227 | }; | ||
228 | +TRANS_FEAT(FRINTI, aa64_sve, gen_gvec_fpst_arg_zpz, frint_fns[a->esz], | ||
229 | + a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR) | ||
230 | |||
231 | -static bool trans_FRINTI(DisasContext *s, arg_rpr_esz *a) | ||
232 | -{ | ||
233 | - if (a->esz == 0) { | ||
234 | - return false; | ||
235 | - } | ||
236 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, a->esz == MO_16, | ||
237 | - frint_fns[a->esz]); | ||
238 | -} | ||
239 | - | ||
240 | -static bool trans_FRINTX(DisasContext *s, arg_rpr_esz *a) | ||
241 | -{ | ||
242 | - static gen_helper_gvec_3_ptr * const fns[3] = { | ||
243 | - gen_helper_sve_frintx_h, | ||
244 | - gen_helper_sve_frintx_s, | ||
245 | - gen_helper_sve_frintx_d | ||
246 | - }; | ||
247 | - if (a->esz == 0) { | ||
248 | - return false; | ||
249 | - } | ||
250 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, a->esz == MO_16, fns[a->esz - 1]); | ||
251 | -} | ||
252 | +static gen_helper_gvec_3_ptr * const frintx_fns[] = { | ||
253 | + NULL, | ||
254 | + gen_helper_sve_frintx_h, | ||
255 | + gen_helper_sve_frintx_s, | ||
256 | + gen_helper_sve_frintx_d | ||
257 | +}; | ||
258 | +TRANS_FEAT(FRINTX, aa64_sve, gen_gvec_fpst_arg_zpz, frintx_fns[a->esz], | ||
259 | + a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); | ||
260 | |||
261 | static bool do_frint_mode(DisasContext *s, arg_rpr_esz *a, | ||
262 | int mode, gen_helper_gvec_3_ptr *fn) | ||
263 | @@ -XXX,XX +XXX,XX @@ static bool trans_FRINTA(DisasContext *s, arg_rpr_esz *a) | ||
264 | return do_frint_mode(s, a, float_round_ties_away, frint_fns[a->esz]); | ||
265 | } | ||
266 | |||
267 | -static bool trans_FRECPX(DisasContext *s, arg_rpr_esz *a) | ||
268 | -{ | ||
269 | - static gen_helper_gvec_3_ptr * const fns[3] = { | ||
270 | - gen_helper_sve_frecpx_h, | ||
271 | - gen_helper_sve_frecpx_s, | ||
272 | - gen_helper_sve_frecpx_d | ||
273 | - }; | ||
274 | - if (a->esz == 0) { | ||
275 | - return false; | ||
276 | - } | ||
277 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, a->esz == MO_16, fns[a->esz - 1]); | ||
278 | -} | ||
279 | +static gen_helper_gvec_3_ptr * const frecpx_fns[] = { | ||
280 | + NULL, gen_helper_sve_frecpx_h, | ||
281 | + gen_helper_sve_frecpx_s, gen_helper_sve_frecpx_d, | ||
282 | +}; | ||
283 | +TRANS_FEAT(FRECPX, aa64_sve, gen_gvec_fpst_arg_zpz, frecpx_fns[a->esz], | ||
284 | + a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR) | ||
285 | |||
286 | -static bool trans_FSQRT(DisasContext *s, arg_rpr_esz *a) | ||
287 | -{ | ||
288 | - static gen_helper_gvec_3_ptr * const fns[3] = { | ||
289 | - gen_helper_sve_fsqrt_h, | ||
290 | - gen_helper_sve_fsqrt_s, | ||
291 | - gen_helper_sve_fsqrt_d | ||
292 | - }; | ||
293 | - if (a->esz == 0) { | ||
294 | - return false; | ||
295 | - } | ||
296 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, a->esz == MO_16, fns[a->esz - 1]); | ||
297 | -} | ||
298 | +static gen_helper_gvec_3_ptr * const fsqrt_fns[] = { | ||
299 | + NULL, gen_helper_sve_fsqrt_h, | ||
300 | + gen_helper_sve_fsqrt_s, gen_helper_sve_fsqrt_d, | ||
301 | +}; | ||
302 | +TRANS_FEAT(FSQRT, aa64_sve, gen_gvec_fpst_arg_zpz, fsqrt_fns[a->esz], | ||
303 | + a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR) | ||
304 | |||
305 | -static bool trans_SCVTF_hh(DisasContext *s, arg_rpr_esz *a) | ||
306 | -{ | ||
307 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_scvt_hh); | ||
308 | -} | ||
309 | +TRANS_FEAT(SCVTF_hh, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
310 | + gen_helper_sve_scvt_hh, a, 0, FPST_FPCR_F16) | ||
311 | +TRANS_FEAT(SCVTF_sh, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
312 | + gen_helper_sve_scvt_sh, a, 0, FPST_FPCR_F16) | ||
313 | +TRANS_FEAT(SCVTF_dh, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
314 | + gen_helper_sve_scvt_dh, a, 0, FPST_FPCR_F16) | ||
315 | |||
316 | -static bool trans_SCVTF_sh(DisasContext *s, arg_rpr_esz *a) | ||
317 | -{ | ||
318 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_scvt_sh); | ||
319 | -} | ||
320 | +TRANS_FEAT(SCVTF_ss, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
321 | + gen_helper_sve_scvt_ss, a, 0, FPST_FPCR) | ||
322 | +TRANS_FEAT(SCVTF_ds, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
323 | + gen_helper_sve_scvt_ds, a, 0, FPST_FPCR) | ||
324 | |||
325 | -static bool trans_SCVTF_dh(DisasContext *s, arg_rpr_esz *a) | ||
326 | -{ | ||
327 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_scvt_dh); | ||
328 | -} | ||
329 | +TRANS_FEAT(SCVTF_sd, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
330 | + gen_helper_sve_scvt_sd, a, 0, FPST_FPCR) | ||
331 | +TRANS_FEAT(SCVTF_dd, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
332 | + gen_helper_sve_scvt_dd, a, 0, FPST_FPCR) | ||
333 | |||
334 | -static bool trans_SCVTF_ss(DisasContext *s, arg_rpr_esz *a) | ||
335 | -{ | ||
336 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_scvt_ss); | ||
337 | -} | ||
338 | +TRANS_FEAT(UCVTF_hh, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
339 | + gen_helper_sve_ucvt_hh, a, 0, FPST_FPCR_F16) | ||
340 | +TRANS_FEAT(UCVTF_sh, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
341 | + gen_helper_sve_ucvt_sh, a, 0, FPST_FPCR_F16) | ||
342 | +TRANS_FEAT(UCVTF_dh, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
343 | + gen_helper_sve_ucvt_dh, a, 0, FPST_FPCR_F16) | ||
344 | |||
345 | -static bool trans_SCVTF_ds(DisasContext *s, arg_rpr_esz *a) | ||
346 | -{ | ||
347 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_scvt_ds); | ||
348 | -} | ||
349 | +TRANS_FEAT(UCVTF_ss, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
350 | + gen_helper_sve_ucvt_ss, a, 0, FPST_FPCR) | ||
351 | +TRANS_FEAT(UCVTF_ds, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
352 | + gen_helper_sve_ucvt_ds, a, 0, FPST_FPCR) | ||
353 | +TRANS_FEAT(UCVTF_sd, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
354 | + gen_helper_sve_ucvt_sd, a, 0, FPST_FPCR) | ||
355 | |||
356 | -static bool trans_SCVTF_sd(DisasContext *s, arg_rpr_esz *a) | ||
357 | -{ | ||
358 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_scvt_sd); | ||
359 | -} | ||
360 | - | ||
361 | -static bool trans_SCVTF_dd(DisasContext *s, arg_rpr_esz *a) | ||
362 | -{ | ||
363 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_scvt_dd); | ||
364 | -} | ||
365 | - | ||
366 | -static bool trans_UCVTF_hh(DisasContext *s, arg_rpr_esz *a) | ||
367 | -{ | ||
368 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_ucvt_hh); | ||
369 | -} | ||
370 | - | ||
371 | -static bool trans_UCVTF_sh(DisasContext *s, arg_rpr_esz *a) | ||
372 | -{ | ||
373 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_ucvt_sh); | ||
374 | -} | ||
375 | - | ||
376 | -static bool trans_UCVTF_dh(DisasContext *s, arg_rpr_esz *a) | ||
377 | -{ | ||
378 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, true, gen_helper_sve_ucvt_dh); | ||
379 | -} | ||
380 | - | ||
381 | -static bool trans_UCVTF_ss(DisasContext *s, arg_rpr_esz *a) | ||
382 | -{ | ||
383 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_ucvt_ss); | ||
384 | -} | ||
385 | - | ||
386 | -static bool trans_UCVTF_ds(DisasContext *s, arg_rpr_esz *a) | ||
387 | -{ | ||
388 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_ucvt_ds); | ||
389 | -} | ||
390 | - | ||
391 | -static bool trans_UCVTF_sd(DisasContext *s, arg_rpr_esz *a) | ||
392 | -{ | ||
393 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_ucvt_sd); | ||
394 | -} | ||
395 | - | ||
396 | -static bool trans_UCVTF_dd(DisasContext *s, arg_rpr_esz *a) | ||
397 | -{ | ||
398 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_ucvt_dd); | ||
399 | -} | ||
400 | +TRANS_FEAT(UCVTF_dd, aa64_sve, gen_gvec_fpst_arg_zpz, | ||
401 | + gen_helper_sve_ucvt_dd, a, 0, FPST_FPCR) | ||
402 | |||
403 | /* | ||
404 | *** SVE Memory - 32-bit Gather and Unsized Contiguous Group | ||
405 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(SM4EKEY, aa64_sve2_sm4, gen_gvec_ool_arg_zzz, | ||
406 | |||
407 | TRANS_FEAT(RAX1, aa64_sve2_sha3, gen_gvec_fn_arg_zzz, gen_gvec_rax1, a) | ||
408 | |||
409 | -static bool trans_FCVTNT_sh(DisasContext *s, arg_rpr_esz *a) | ||
410 | -{ | ||
411 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
412 | - return false; | ||
413 | - } | ||
414 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve2_fcvtnt_sh); | ||
415 | -} | ||
416 | +TRANS_FEAT(FCVTNT_sh, aa64_sve2, gen_gvec_fpst_arg_zpz, | ||
417 | + gen_helper_sve2_fcvtnt_sh, a, 0, FPST_FPCR) | ||
418 | +TRANS_FEAT(FCVTNT_ds, aa64_sve2, gen_gvec_fpst_arg_zpz, | ||
419 | + gen_helper_sve2_fcvtnt_ds, a, 0, FPST_FPCR) | ||
420 | |||
421 | -static bool trans_BFCVTNT(DisasContext *s, arg_rpr_esz *a) | ||
422 | -{ | ||
423 | - if (!dc_isar_feature(aa64_sve_bf16, s)) { | ||
424 | - return false; | ||
425 | - } | ||
426 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve_bfcvtnt); | ||
427 | -} | ||
428 | +TRANS_FEAT(BFCVTNT, aa64_sve_bf16, gen_gvec_fpst_arg_zpz, | ||
429 | + gen_helper_sve_bfcvtnt, a, 0, FPST_FPCR) | ||
430 | |||
431 | -static bool trans_FCVTNT_ds(DisasContext *s, arg_rpr_esz *a) | ||
432 | -{ | ||
433 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
434 | - return false; | ||
435 | - } | ||
436 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve2_fcvtnt_ds); | ||
437 | -} | ||
438 | - | ||
439 | -static bool trans_FCVTLT_hs(DisasContext *s, arg_rpr_esz *a) | ||
440 | -{ | ||
441 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
442 | - return false; | ||
443 | - } | ||
444 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve2_fcvtlt_hs); | ||
445 | -} | ||
446 | - | ||
447 | -static bool trans_FCVTLT_sd(DisasContext *s, arg_rpr_esz *a) | ||
448 | -{ | ||
449 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
450 | - return false; | ||
451 | - } | ||
452 | - return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve2_fcvtlt_sd); | ||
453 | -} | ||
454 | +TRANS_FEAT(FCVTLT_hs, aa64_sve2, gen_gvec_fpst_arg_zpz, | ||
455 | + gen_helper_sve2_fcvtlt_hs, a, 0, FPST_FPCR) | ||
456 | +TRANS_FEAT(FCVTLT_sd, aa64_sve2, gen_gvec_fpst_arg_zpz, | ||
457 | + gen_helper_sve2_fcvtlt_sd, a, 0, FPST_FPCR) | ||
458 | |||
459 | static bool trans_FCVTX_ds(DisasContext *s, arg_rpr_esz *a) | ||
149 | { | 460 | { |
150 | -- | 461 | -- |
151 | 2.20.1 | 462 | 2.25.1 |
152 | |||
153 | diff view generated by jsdifflib |
1 | The M-profile FPCCR.S bit indicates the security status of | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | the floating point context. In the pseudocode ExecuteFPCheck() | ||
3 | function it is unconditionally set to match the current | ||
4 | security state whenever a floating point instruction is | ||
5 | executed. | ||
6 | 2 | ||
7 | Implement this by adding a new TB flag which tracks whether | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | FPCCR.S is different from the current security state, so | 4 | Message-id: 20220527181907.189259-95-richard.henderson@linaro.org |
9 | that we only need to emit the code to update it in the | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | less-common case when it is not already set correctly. | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | ||
8 | target/arm/translate-sve.c | 52 +++++++++++++++++--------------------- | ||
9 | 1 file changed, 23 insertions(+), 29 deletions(-) | ||
11 | 10 | ||
12 | Note that we will add the handling for the other work done | 11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c |
13 | by ExecuteFPCheck() in later commits. | ||
14 | |||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
16 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
17 | Message-id: 20190416125744.27770-19-peter.maydell@linaro.org | ||
18 | --- | ||
19 | target/arm/cpu.h | 2 ++ | ||
20 | target/arm/translate.h | 1 + | ||
21 | target/arm/helper.c | 5 +++++ | ||
22 | target/arm/translate.c | 20 ++++++++++++++++++++ | ||
23 | 4 files changed, 28 insertions(+) | ||
24 | |||
25 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
26 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
27 | --- a/target/arm/cpu.h | 13 | --- a/target/arm/translate-sve.c |
28 | +++ b/target/arm/cpu.h | 14 | +++ b/target/arm/translate-sve.c |
29 | @@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_A32, NS, 6, 1) | 15 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(FRINTX, aa64_sve, gen_gvec_fpst_arg_zpz, frintx_fns[a->esz], |
30 | FIELD(TBFLAG_A32, VFPEN, 7, 1) | 16 | static bool do_frint_mode(DisasContext *s, arg_rpr_esz *a, |
31 | FIELD(TBFLAG_A32, CONDEXEC, 8, 8) | 17 | int mode, gen_helper_gvec_3_ptr *fn) |
32 | FIELD(TBFLAG_A32, SCTLR_B, 16, 1) | 18 | { |
33 | +/* For M profile only, set if FPCCR.S does not match current security state */ | 19 | - if (sve_access_check(s)) { |
34 | +FIELD(TBFLAG_A32, FPCCR_S_WRONG, 20, 1) | 20 | - unsigned vsz = vec_full_reg_size(s); |
35 | /* For M profile only, Handler (ie not Thread) mode */ | 21 | - TCGv_i32 tmode = tcg_const_i32(mode); |
36 | FIELD(TBFLAG_A32, HANDLER, 21, 1) | 22 | - TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); |
37 | /* For M profile only, whether we should generate stack-limit checks */ | 23 | + unsigned vsz; |
38 | diff --git a/target/arm/translate.h b/target/arm/translate.h | 24 | + TCGv_i32 tmode; |
39 | index XXXXXXX..XXXXXXX 100644 | 25 | + TCGv_ptr status; |
40 | --- a/target/arm/translate.h | 26 | |
41 | +++ b/target/arm/translate.h | 27 | - gen_helper_set_rmode(tmode, tmode, status); |
42 | @@ -XXX,XX +XXX,XX @@ typedef struct DisasContext { | 28 | - |
43 | bool v7m_handler_mode; | 29 | - tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, a->rd), |
44 | bool v8m_secure; /* true if v8M and we're in Secure mode */ | 30 | - vec_full_reg_offset(s, a->rn), |
45 | bool v8m_stackcheck; /* true if we need to perform v8M stack limit checks */ | 31 | - pred_full_reg_offset(s, a->pg), |
46 | + bool v8m_fpccr_s_wrong; /* true if v8M FPCCR.S != v8m_secure */ | 32 | - status, vsz, vsz, 0, fn); |
47 | /* Immediate value in AArch32 SVC insn; must be set if is_jmp == DISAS_SWI | 33 | - |
48 | * so that top level loop can generate correct syndrome information. | 34 | - gen_helper_set_rmode(tmode, tmode, status); |
49 | */ | 35 | - tcg_temp_free_i32(tmode); |
50 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 36 | - tcg_temp_free_ptr(status); |
51 | index XXXXXXX..XXXXXXX 100644 | 37 | + if (fn == NULL) { |
52 | --- a/target/arm/helper.c | 38 | + return false; |
53 | +++ b/target/arm/helper.c | ||
54 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
55 | flags = FIELD_DP32(flags, TBFLAG_A32, STACKCHECK, 1); | ||
56 | } | 39 | } |
57 | 40 | + if (!sve_access_check(s)) { | |
58 | + if (arm_feature(env, ARM_FEATURE_M_SECURITY) && | 41 | + return true; |
59 | + FIELD_EX32(env->v7m.fpccr[M_REG_S], V7M_FPCCR, S) != env->v7m.secure) { | ||
60 | + flags = FIELD_DP32(flags, TBFLAG_A32, FPCCR_S_WRONG, 1); | ||
61 | + } | 42 | + } |
62 | + | 43 | + |
63 | *pflags = flags; | 44 | + vsz = vec_full_reg_size(s); |
64 | *cs_base = 0; | 45 | + tmode = tcg_const_i32(mode); |
46 | + status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); | ||
47 | + | ||
48 | + gen_helper_set_rmode(tmode, tmode, status); | ||
49 | + | ||
50 | + tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, a->rd), | ||
51 | + vec_full_reg_offset(s, a->rn), | ||
52 | + pred_full_reg_offset(s, a->pg), | ||
53 | + status, vsz, vsz, 0, fn); | ||
54 | + | ||
55 | + gen_helper_set_rmode(tmode, tmode, status); | ||
56 | + tcg_temp_free_i32(tmode); | ||
57 | + tcg_temp_free_ptr(status); | ||
58 | return true; | ||
65 | } | 59 | } |
66 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 60 | |
67 | index XXXXXXX..XXXXXXX 100644 | 61 | static bool trans_FRINTN(DisasContext *s, arg_rpr_esz *a) |
68 | --- a/target/arm/translate.c | 62 | { |
69 | +++ b/target/arm/translate.c | 63 | - if (a->esz == 0) { |
70 | @@ -XXX,XX +XXX,XX @@ static int disas_vfp_insn(DisasContext *s, uint32_t insn) | 64 | - return false; |
71 | } | 65 | - } |
72 | } | 66 | return do_frint_mode(s, a, float_round_nearest_even, frint_fns[a->esz]); |
73 | 67 | } | |
74 | + if (arm_dc_feature(s, ARM_FEATURE_M)) { | 68 | |
75 | + /* Handle M-profile lazy FP state mechanics */ | 69 | static bool trans_FRINTP(DisasContext *s, arg_rpr_esz *a) |
76 | + | 70 | { |
77 | + /* Update ownership of FP context: set FPCCR.S to match current state */ | 71 | - if (a->esz == 0) { |
78 | + if (s->v8m_fpccr_s_wrong) { | 72 | - return false; |
79 | + TCGv_i32 tmp; | 73 | - } |
80 | + | 74 | return do_frint_mode(s, a, float_round_up, frint_fns[a->esz]); |
81 | + tmp = load_cpu_field(v7m.fpccr[M_REG_S]); | 75 | } |
82 | + if (s->v8m_secure) { | 76 | |
83 | + tcg_gen_ori_i32(tmp, tmp, R_V7M_FPCCR_S_MASK); | 77 | static bool trans_FRINTM(DisasContext *s, arg_rpr_esz *a) |
84 | + } else { | 78 | { |
85 | + tcg_gen_andi_i32(tmp, tmp, ~R_V7M_FPCCR_S_MASK); | 79 | - if (a->esz == 0) { |
86 | + } | 80 | - return false; |
87 | + store_cpu_field(tmp, v7m.fpccr[M_REG_S]); | 81 | - } |
88 | + /* Don't need to do this for any further FP insns in this TB */ | 82 | return do_frint_mode(s, a, float_round_down, frint_fns[a->esz]); |
89 | + s->v8m_fpccr_s_wrong = false; | 83 | } |
90 | + } | 84 | |
91 | + } | 85 | static bool trans_FRINTZ(DisasContext *s, arg_rpr_esz *a) |
92 | + | 86 | { |
93 | if (extract32(insn, 28, 4) == 0xf) { | 87 | - if (a->esz == 0) { |
94 | /* | 88 | - return false; |
95 | * Encodings with T=1 (Thumb) or unconditional (ARM): | 89 | - } |
96 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) | 90 | return do_frint_mode(s, a, float_round_to_zero, frint_fns[a->esz]); |
97 | dc->v8m_secure = arm_feature(env, ARM_FEATURE_M_SECURITY) && | 91 | } |
98 | regime_is_secure(env, dc->mmu_idx); | 92 | |
99 | dc->v8m_stackcheck = FIELD_EX32(tb_flags, TBFLAG_A32, STACKCHECK); | 93 | static bool trans_FRINTA(DisasContext *s, arg_rpr_esz *a) |
100 | + dc->v8m_fpccr_s_wrong = FIELD_EX32(tb_flags, TBFLAG_A32, FPCCR_S_WRONG); | 94 | { |
101 | dc->cp_regs = cpu->cp_regs; | 95 | - if (a->esz == 0) { |
102 | dc->features = env->features; | 96 | - return false; |
97 | - } | ||
98 | return do_frint_mode(s, a, float_round_ties_away, frint_fns[a->esz]); | ||
99 | } | ||
103 | 100 | ||
104 | -- | 101 | -- |
105 | 2.20.1 | 102 | 2.25.1 |
106 | |||
107 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Thomas Huth <thuth@redhat.com> | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
4 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | 4 | Message-id: 20220527181907.189259-96-richard.henderson@linaro.org |
5 | Reviewed-by: Markus Armbruster <armbru@redhat.com> | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
7 | Message-id: 20190412165416.7977-2-philmd@redhat.com | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 7 | --- |
10 | hw/arm/aspeed.c | 13 +++++++++---- | 8 | target/arm/translate-sve.c | 53 ++++++++++---------------------------- |
11 | 1 file changed, 9 insertions(+), 4 deletions(-) | 9 | 1 file changed, 14 insertions(+), 39 deletions(-) |
12 | 10 | ||
13 | diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.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/hw/arm/aspeed.c | 13 | --- a/target/arm/translate-sve.c |
16 | +++ b/hw/arm/aspeed.c | 14 | +++ b/target/arm/translate-sve.c |
17 | @@ -XXX,XX +XXX,XX @@ | 15 | @@ -XXX,XX +XXX,XX @@ static bool do_frint_mode(DisasContext *s, arg_rpr_esz *a, |
18 | #include "hw/arm/aspeed_soc.h" | 16 | return true; |
19 | #include "hw/boards.h" | ||
20 | #include "hw/i2c/smbus_eeprom.h" | ||
21 | +#include "hw/misc/pca9552.h" | ||
22 | +#include "hw/misc/tmp105.h" | ||
23 | #include "qemu/log.h" | ||
24 | #include "sysemu/block-backend.h" | ||
25 | #include "hw/loader.h" | ||
26 | @@ -XXX,XX +XXX,XX @@ static void ast2500_evb_i2c_init(AspeedBoardState *bmc) | ||
27 | eeprom_buf); | ||
28 | |||
29 | /* The AST2500 EVB expects a LM75 but a TMP105 is compatible */ | ||
30 | - i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 7), "tmp105", 0x4d); | ||
31 | + i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 7), | ||
32 | + TYPE_TMP105, 0x4d); | ||
33 | |||
34 | /* The AST2500 EVB does not have an RTC. Let's pretend that one is | ||
35 | * plugged on the I2C bus header */ | ||
36 | @@ -XXX,XX +XXX,XX @@ static void witherspoon_bmc_i2c_init(AspeedBoardState *bmc) | ||
37 | AspeedSoCState *soc = &bmc->soc; | ||
38 | uint8_t *eeprom_buf = g_malloc0(8 * 1024); | ||
39 | |||
40 | - i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 3), "pca9552", 0x60); | ||
41 | + i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 3), TYPE_PCA9552, | ||
42 | + 0x60); | ||
43 | |||
44 | i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 4), "tmp423", 0x4c); | ||
45 | i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 5), "tmp423", 0x4c); | ||
46 | |||
47 | /* The Witherspoon expects a TMP275 but a TMP105 is compatible */ | ||
48 | - i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 9), "tmp105", 0x4a); | ||
49 | + i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 9), TYPE_TMP105, | ||
50 | + 0x4a); | ||
51 | |||
52 | /* The witherspoon board expects Epson RX8900 I2C RTC but a ds1338 is | ||
53 | * good enough */ | ||
54 | @@ -XXX,XX +XXX,XX @@ static void witherspoon_bmc_i2c_init(AspeedBoardState *bmc) | ||
55 | |||
56 | smbus_eeprom_init_one(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), 0x51, | ||
57 | eeprom_buf); | ||
58 | - i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), "pca9552", | ||
59 | + i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), TYPE_PCA9552, | ||
60 | 0x60); | ||
61 | } | 17 | } |
62 | 18 | ||
19 | -static bool trans_FRINTN(DisasContext *s, arg_rpr_esz *a) | ||
20 | -{ | ||
21 | - return do_frint_mode(s, a, float_round_nearest_even, frint_fns[a->esz]); | ||
22 | -} | ||
23 | - | ||
24 | -static bool trans_FRINTP(DisasContext *s, arg_rpr_esz *a) | ||
25 | -{ | ||
26 | - return do_frint_mode(s, a, float_round_up, frint_fns[a->esz]); | ||
27 | -} | ||
28 | - | ||
29 | -static bool trans_FRINTM(DisasContext *s, arg_rpr_esz *a) | ||
30 | -{ | ||
31 | - return do_frint_mode(s, a, float_round_down, frint_fns[a->esz]); | ||
32 | -} | ||
33 | - | ||
34 | -static bool trans_FRINTZ(DisasContext *s, arg_rpr_esz *a) | ||
35 | -{ | ||
36 | - return do_frint_mode(s, a, float_round_to_zero, frint_fns[a->esz]); | ||
37 | -} | ||
38 | - | ||
39 | -static bool trans_FRINTA(DisasContext *s, arg_rpr_esz *a) | ||
40 | -{ | ||
41 | - return do_frint_mode(s, a, float_round_ties_away, frint_fns[a->esz]); | ||
42 | -} | ||
43 | +TRANS_FEAT(FRINTN, aa64_sve, do_frint_mode, a, | ||
44 | + float_round_nearest_even, frint_fns[a->esz]) | ||
45 | +TRANS_FEAT(FRINTP, aa64_sve, do_frint_mode, a, | ||
46 | + float_round_up, frint_fns[a->esz]) | ||
47 | +TRANS_FEAT(FRINTM, aa64_sve, do_frint_mode, a, | ||
48 | + float_round_down, frint_fns[a->esz]) | ||
49 | +TRANS_FEAT(FRINTZ, aa64_sve, do_frint_mode, a, | ||
50 | + float_round_to_zero, frint_fns[a->esz]) | ||
51 | +TRANS_FEAT(FRINTA, aa64_sve, do_frint_mode, a, | ||
52 | + float_round_ties_away, frint_fns[a->esz]) | ||
53 | |||
54 | static gen_helper_gvec_3_ptr * const frecpx_fns[] = { | ||
55 | NULL, gen_helper_sve_frecpx_h, | ||
56 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(FCVTLT_hs, aa64_sve2, gen_gvec_fpst_arg_zpz, | ||
57 | TRANS_FEAT(FCVTLT_sd, aa64_sve2, gen_gvec_fpst_arg_zpz, | ||
58 | gen_helper_sve2_fcvtlt_sd, a, 0, FPST_FPCR) | ||
59 | |||
60 | -static bool trans_FCVTX_ds(DisasContext *s, arg_rpr_esz *a) | ||
61 | -{ | ||
62 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
63 | - return false; | ||
64 | - } | ||
65 | - return do_frint_mode(s, a, float_round_to_odd, gen_helper_sve_fcvt_ds); | ||
66 | -} | ||
67 | - | ||
68 | -static bool trans_FCVTXNT_ds(DisasContext *s, arg_rpr_esz *a) | ||
69 | -{ | ||
70 | - if (!dc_isar_feature(aa64_sve2, s)) { | ||
71 | - return false; | ||
72 | - } | ||
73 | - return do_frint_mode(s, a, float_round_to_odd, gen_helper_sve2_fcvtnt_ds); | ||
74 | -} | ||
75 | +TRANS_FEAT(FCVTX_ds, aa64_sve2, do_frint_mode, a, | ||
76 | + float_round_to_odd, gen_helper_sve_fcvt_ds) | ||
77 | +TRANS_FEAT(FCVTXNT_ds, aa64_sve2, do_frint_mode, a, | ||
78 | + float_round_to_odd, gen_helper_sve2_fcvtnt_ds) | ||
79 | |||
80 | static bool trans_FLOGB(DisasContext *s, arg_rpr_esz *a) | ||
81 | { | ||
63 | -- | 82 | -- |
64 | 2.20.1 | 83 | 2.25.1 |
65 | |||
66 | diff view generated by jsdifflib |
1 | In the stripe8() function we use a variable length array; however | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | we know that the maximum length required is MAX_NUM_BUSSES. Use | ||
3 | a fixed-length array and an assert instead. | ||
4 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Message-id: 20220527181907.189259-97-richard.henderson@linaro.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@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: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> | ||
8 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
9 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> | ||
10 | Message-id: 20190328152635.2794-1-peter.maydell@linaro.org | ||
11 | --- | 7 | --- |
12 | hw/ssi/xilinx_spips.c | 6 ++++-- | 8 | target/arm/translate-sve.c | 29 ++++++----------------------- |
13 | 1 file changed, 4 insertions(+), 2 deletions(-) | 9 | 1 file changed, 6 insertions(+), 23 deletions(-) |
14 | 10 | ||
15 | diff --git a/hw/ssi/xilinx_spips.c b/hw/ssi/xilinx_spips.c | 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/hw/ssi/xilinx_spips.c | 13 | --- a/target/arm/translate-sve.c |
18 | +++ b/hw/ssi/xilinx_spips.c | 14 | +++ b/target/arm/translate-sve.c |
19 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_qspips_reset(DeviceState *d) | 15 | @@ -XXX,XX +XXX,XX @@ TRANS_FEAT(FCVTX_ds, aa64_sve2, do_frint_mode, a, |
20 | 16 | TRANS_FEAT(FCVTXNT_ds, aa64_sve2, do_frint_mode, a, | |
21 | static inline void stripe8(uint8_t *x, int num, bool dir) | 17 | float_round_to_odd, gen_helper_sve2_fcvtnt_ds) |
18 | |||
19 | -static bool trans_FLOGB(DisasContext *s, arg_rpr_esz *a) | ||
20 | -{ | ||
21 | - static gen_helper_gvec_3_ptr * const fns[] = { | ||
22 | - NULL, gen_helper_flogb_h, | ||
23 | - gen_helper_flogb_s, gen_helper_flogb_d | ||
24 | - }; | ||
25 | - | ||
26 | - if (!dc_isar_feature(aa64_sve2, s) || fns[a->esz] == NULL) { | ||
27 | - return false; | ||
28 | - } | ||
29 | - if (sve_access_check(s)) { | ||
30 | - TCGv_ptr status = | ||
31 | - fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); | ||
32 | - unsigned vsz = vec_full_reg_size(s); | ||
33 | - | ||
34 | - tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, a->rd), | ||
35 | - vec_full_reg_offset(s, a->rn), | ||
36 | - pred_full_reg_offset(s, a->pg), | ||
37 | - status, vsz, vsz, 0, fns[a->esz]); | ||
38 | - tcg_temp_free_ptr(status); | ||
39 | - } | ||
40 | - return true; | ||
41 | -} | ||
42 | +static gen_helper_gvec_3_ptr * const flogb_fns[] = { | ||
43 | + NULL, gen_helper_flogb_h, | ||
44 | + gen_helper_flogb_s, gen_helper_flogb_d | ||
45 | +}; | ||
46 | +TRANS_FEAT(FLOGB, aa64_sve2, gen_gvec_fpst_arg_zpz, flogb_fns[a->esz], | ||
47 | + a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR) | ||
48 | |||
49 | static bool do_FMLAL_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sub, bool sel) | ||
22 | { | 50 | { |
23 | - uint8_t r[num]; | ||
24 | - memset(r, 0, sizeof(uint8_t) * num); | ||
25 | + uint8_t r[MAX_NUM_BUSSES]; | ||
26 | int idx[2] = {0, 0}; | ||
27 | int bit[2] = {0, 7}; | ||
28 | int d = dir; | ||
29 | |||
30 | + assert(num <= MAX_NUM_BUSSES); | ||
31 | + memset(r, 0, sizeof(uint8_t) * num); | ||
32 | + | ||
33 | for (idx[0] = 0; idx[0] < num; ++idx[0]) { | ||
34 | for (bit[0] = 7; bit[0] >= 0; bit[0]--) { | ||
35 | r[idx[!d]] |= x[idx[d]] & 1 << bit[d] ? 1 << bit[!d] : 0; | ||
36 | -- | 51 | -- |
37 | 2.20.1 | 52 | 2.25.1 |
38 | |||
39 | diff view generated by jsdifflib |