1 | The following changes since commit 6eeea6725a70e6fcb5abba0764496bdab07ddfb3: | 1 | The following changes since commit 1cbd2d914939ee6028e9688d4ba859a528c28405: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2020-10-06' into staging (2020-10-06 21:13:34 +0100) | 3 | Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging (2021-06-04 13:38:49 +0100) |
4 | 4 | ||
5 | are available in the Git repository at: | 5 | are available in the Git repository at: |
6 | 6 | ||
7 | https://github.com/rth7680/qemu.git tags/pull-tcg-20201008 | 7 | https://gitlab.com/rth7680/qemu.git tags/pull-tcg-20210604 |
8 | 8 | ||
9 | for you to fetch changes up to 62475e9d007d83db4d0a6ccebcda8914f392e9c9: | 9 | for you to fetch changes up to 0006039e29b9e6118beab300146f7c4931f7a217: |
10 | 10 | ||
11 | accel/tcg: Fix computing of is_write for MIPS (2020-10-08 05:57:32 -0500) | 11 | tcg/arm: Implement TCG_TARGET_HAS_rotv_vec (2021-06-04 11:50:11 -0700) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Extend maximum gvec vector size | 14 | Host vector support for arm neon. |
15 | Fix i386 avx2 dupi | ||
16 | Fix mips host user-only write detection | ||
17 | Misc cleanups. | ||
18 | 15 | ||
19 | ---------------------------------------------------------------- | 16 | ---------------------------------------------------------------- |
20 | Kele Huang (1): | 17 | Richard Henderson (15): |
21 | accel/tcg: Fix computing of is_write for MIPS | 18 | tcg: Change parameters for tcg_target_const_match |
19 | tcg/arm: Add host vector framework | ||
20 | tcg/arm: Implement tcg_out_ld/st for vector types | ||
21 | tcg/arm: Implement tcg_out_mov for vector types | ||
22 | tcg/arm: Implement tcg_out_dup*_vec | ||
23 | tcg/arm: Implement minimal vector operations | ||
24 | tcg/arm: Implement andc, orc, abs, neg, not vector operations | ||
25 | tcg/arm: Implement TCG_TARGET_HAS_shi_vec | ||
26 | tcg/arm: Implement TCG_TARGET_HAS_mul_vec | ||
27 | tcg/arm: Implement TCG_TARGET_HAS_sat_vec | ||
28 | tcg/arm: Implement TCG_TARGET_HAS_minmax_vec | ||
29 | tcg/arm: Implement TCG_TARGET_HAS_bitsel_vec | ||
30 | tcg/arm: Implement TCG_TARGET_HAS_shv_vec | ||
31 | tcg/arm: Implement TCG_TARGET_HAS_roti_vec | ||
32 | tcg/arm: Implement TCG_TARGET_HAS_rotv_vec | ||
22 | 33 | ||
23 | Richard Henderson (10): | 34 | tcg/arm/tcg-target-con-set.h | 10 + |
24 | tcg: Adjust simd_desc size encoding | 35 | tcg/arm/tcg-target-con-str.h | 3 + |
25 | tcg: Drop union from TCGArgConstraint | 36 | tcg/arm/tcg-target.h | 52 ++- |
26 | tcg: Move sorted_args into TCGArgConstraint.sort_index | 37 | tcg/arm/tcg-target.opc.h | 16 + |
27 | tcg: Remove TCG_CT_REG | 38 | tcg/tcg.c | 5 +- |
28 | tcg: Move some TCG_CT_* bits to TCGArgConstraint bitfields | 39 | tcg/aarch64/tcg-target.c.inc | 5 +- |
29 | tcg: Remove TCGOpDef.used | 40 | tcg/arm/tcg-target.c.inc | 956 +++++++++++++++++++++++++++++++++++++++++-- |
30 | tcg/i386: Fix dupi for avx2 32-bit hosts | 41 | tcg/i386/tcg-target.c.inc | 4 +- |
31 | tcg: Fix generation of dupi_vec for 32-bit host | 42 | tcg/mips/tcg-target.c.inc | 5 +- |
32 | tcg/optimize: Fold dup2_vec | 43 | tcg/ppc/tcg-target.c.inc | 4 +- |
33 | tcg: Remove TCG_TARGET_HAS_cmp_vec | 44 | tcg/riscv/tcg-target.c.inc | 4 +- |
45 | tcg/s390/tcg-target.c.inc | 5 +- | ||
46 | tcg/sparc/tcg-target.c.inc | 5 +- | ||
47 | tcg/tci/tcg-target.c.inc | 6 +- | ||
48 | 14 files changed, 1001 insertions(+), 79 deletions(-) | ||
49 | create mode 100644 tcg/arm/tcg-target.opc.h | ||
34 | 50 | ||
35 | include/tcg/tcg-gvec-desc.h | 38 ++++++++++++------ | ||
36 | include/tcg/tcg.h | 22 ++++------ | ||
37 | tcg/aarch64/tcg-target.h | 1 - | ||
38 | tcg/i386/tcg-target.h | 1 - | ||
39 | tcg/ppc/tcg-target.h | 1 - | ||
40 | accel/tcg/user-exec.c | 43 ++++++++++++++++++-- | ||
41 | tcg/optimize.c | 15 +++++++ | ||
42 | tcg/tcg-op-gvec.c | 35 ++++++++++++---- | ||
43 | tcg/tcg-op-vec.c | 12 ++++-- | ||
44 | tcg/tcg.c | 96 +++++++++++++++++++------------------------- | ||
45 | tcg/aarch64/tcg-target.c.inc | 17 ++++---- | ||
46 | tcg/arm/tcg-target.c.inc | 29 ++++++------- | ||
47 | tcg/i386/tcg-target.c.inc | 39 +++++++----------- | ||
48 | tcg/mips/tcg-target.c.inc | 21 +++++----- | ||
49 | tcg/ppc/tcg-target.c.inc | 29 ++++++------- | ||
50 | tcg/riscv/tcg-target.c.inc | 16 ++++---- | ||
51 | tcg/s390/tcg-target.c.inc | 22 +++++----- | ||
52 | tcg/sparc/tcg-target.c.inc | 21 ++++------ | ||
53 | tcg/tci/tcg-target.c.inc | 3 +- | ||
54 | 19 files changed, 244 insertions(+), 217 deletions(-) | ||
55 | diff view generated by jsdifflib |
1 | This wasn't actually used for anything, really. All variable | 1 | Change the return value to bool, because that's what is should |
---|---|---|---|
2 | operands must accept registers, and which are indicated by the | 2 | have been from the start. Pass the ct mask instead of the whole |
3 | set in TCGArgConstraint.regs. | 3 | TCGArgConstraint, as that's the only part that's relevant. |
4 | 4 | ||
5 | Change the value argument to int64_t. We will need the extra | ||
6 | width for 32-bit hosts wanting to match vector constants. | ||
7 | |||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
6 | --- | 10 | --- |
7 | include/tcg/tcg.h | 1 - | 11 | tcg/tcg.c | 5 ++--- |
8 | tcg/tcg.c | 15 ++++----------- | 12 | tcg/aarch64/tcg-target.c.inc | 5 +---- |
9 | tcg/aarch64/tcg-target.c.inc | 3 --- | 13 | tcg/arm/tcg-target.c.inc | 5 +---- |
10 | tcg/arm/tcg-target.c.inc | 3 --- | 14 | tcg/i386/tcg-target.c.inc | 4 +--- |
11 | tcg/i386/tcg-target.c.inc | 11 ----------- | 15 | tcg/mips/tcg-target.c.inc | 5 +---- |
12 | tcg/mips/tcg-target.c.inc | 3 --- | 16 | tcg/ppc/tcg-target.c.inc | 4 +--- |
13 | tcg/ppc/tcg-target.c.inc | 5 ----- | 17 | tcg/riscv/tcg-target.c.inc | 4 +--- |
14 | tcg/riscv/tcg-target.c.inc | 2 -- | 18 | tcg/s390/tcg-target.c.inc | 5 +---- |
15 | tcg/s390/tcg-target.c.inc | 4 ---- | 19 | tcg/sparc/tcg-target.c.inc | 5 +---- |
16 | tcg/sparc/tcg-target.c.inc | 5 ----- | 20 | tcg/tci/tcg-target.c.inc | 6 ++---- |
17 | tcg/tci/tcg-target.c.inc | 1 - | 21 | 10 files changed, 12 insertions(+), 36 deletions(-) |
18 | 11 files changed, 4 insertions(+), 49 deletions(-) | 22 | |
19 | |||
20 | diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/include/tcg/tcg.h | ||
23 | +++ b/include/tcg/tcg.h | ||
24 | @@ -XXX,XX +XXX,XX @@ void tcg_dump_op_count(void); | ||
25 | #define TCG_CT_ALIAS 0x80 | ||
26 | #define TCG_CT_IALIAS 0x40 | ||
27 | #define TCG_CT_NEWREG 0x20 /* output requires a new register */ | ||
28 | -#define TCG_CT_REG 0x01 | ||
29 | #define TCG_CT_CONST 0x02 /* any constant of register size */ | ||
30 | |||
31 | typedef struct TCGArgConstraint { | ||
32 | diff --git a/tcg/tcg.c b/tcg/tcg.c | 23 | diff --git a/tcg/tcg.c b/tcg/tcg.c |
33 | index XXXXXXX..XXXXXXX 100644 | 24 | index XXXXXXX..XXXXXXX 100644 |
34 | --- a/tcg/tcg.c | 25 | --- a/tcg/tcg.c |
35 | +++ b/tcg/tcg.c | 26 | +++ b/tcg/tcg.c |
36 | @@ -XXX,XX +XXX,XX @@ static void tcg_dump_ops(TCGContext *s, bool have_prefs) | 27 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg, TCGReg arg1, |
37 | /* we give more priority to constraints with less registers */ | 28 | static bool tcg_out_sti(TCGContext *s, TCGType type, TCGArg val, |
38 | static int get_constraint_priority(const TCGOpDef *def, int k) | 29 | TCGReg base, intptr_t ofs); |
39 | { | 30 | static void tcg_out_call(TCGContext *s, const tcg_insn_unit *target); |
40 | - const TCGArgConstraint *arg_ct; | 31 | -static int tcg_target_const_match(tcg_target_long val, TCGType type, |
41 | + const TCGArgConstraint *arg_ct = &def->args_ct[k]; | 32 | - const TCGArgConstraint *arg_ct); |
42 | + int n; | 33 | +static bool tcg_target_const_match(int64_t val, TCGType type, int ct); |
43 | 34 | #ifdef TCG_TARGET_NEED_LDST_LABELS | |
44 | - int i, n; | 35 | static int tcg_out_ldst_finalize(TCGContext *s); |
45 | - arg_ct = &def->args_ct[k]; | 36 | #endif |
46 | if (arg_ct->ct & TCG_CT_ALIAS) { | 37 | @@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) |
47 | /* an alias is equivalent to a single register */ | 38 | ts = arg_temp(arg); |
48 | n = 1; | 39 | |
49 | } else { | 40 | if (ts->val_type == TEMP_VAL_CONST |
50 | - if (!(arg_ct->ct & TCG_CT_REG)) | 41 | - && tcg_target_const_match(ts->val, ts->type, arg_ct)) { |
51 | - return 0; | 42 | + && tcg_target_const_match(ts->val, ts->type, arg_ct->ct)) { |
52 | - n = 0; | 43 | /* constant is OK for instruction */ |
53 | - for(i = 0; i < TCG_TARGET_NB_REGS; i++) { | 44 | const_args[i] = 1; |
54 | - if (tcg_regset_test_reg(arg_ct->regs, i)) | 45 | new_args[i] = ts->val; |
55 | - n++; | ||
56 | - } | ||
57 | + n = ctpop64(arg_ct->regs); | ||
58 | } | ||
59 | return TCG_TARGET_NB_REGS - n + 1; | ||
60 | } | ||
61 | @@ -XXX,XX +XXX,XX @@ static void process_op_defs(TCGContext *s) | ||
62 | int oarg = *ct_str - '0'; | ||
63 | tcg_debug_assert(ct_str == tdefs->args_ct_str[i]); | ||
64 | tcg_debug_assert(oarg < def->nb_oargs); | ||
65 | - tcg_debug_assert(def->args_ct[oarg].ct & TCG_CT_REG); | ||
66 | + tcg_debug_assert(def->args_ct[oarg].regs != 0); | ||
67 | /* TCG_CT_ALIAS is for the output arguments. | ||
68 | The input is tagged with TCG_CT_IALIAS. */ | ||
69 | def->args_ct[i] = def->args_ct[oarg]; | ||
70 | diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc | 46 | diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc |
71 | index XXXXXXX..XXXXXXX 100644 | 47 | index XXXXXXX..XXXXXXX 100644 |
72 | --- a/tcg/aarch64/tcg-target.c.inc | 48 | --- a/tcg/aarch64/tcg-target.c.inc |
73 | +++ b/tcg/aarch64/tcg-target.c.inc | 49 | +++ b/tcg/aarch64/tcg-target.c.inc |
74 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | 50 | @@ -XXX,XX +XXX,XX @@ static bool is_shimm1632(uint32_t v32, int *cmode, int *imm8) |
75 | { | 51 | } |
76 | switch (*ct_str++) { | 52 | } |
77 | case 'r': /* general registers */ | 53 | |
78 | - ct->ct |= TCG_CT_REG; | 54 | -static int tcg_target_const_match(tcg_target_long val, TCGType type, |
79 | ct->regs |= 0xffffffffu; | 55 | - const TCGArgConstraint *arg_ct) |
80 | break; | 56 | +static bool tcg_target_const_match(int64_t val, TCGType type, int ct) |
81 | case 'w': /* advsimd registers */ | 57 | { |
82 | - ct->ct |= TCG_CT_REG; | 58 | - int ct = arg_ct->ct; |
83 | ct->regs |= 0xffffffff00000000ull; | 59 | - |
84 | break; | 60 | if (ct & TCG_CT_CONST) { |
85 | case 'l': /* qemu_ld / qemu_st address, data_reg */ | 61 | return 1; |
86 | - ct->ct |= TCG_CT_REG; | 62 | } |
87 | ct->regs = 0xffffffffu; | ||
88 | #ifdef CONFIG_SOFTMMU | ||
89 | /* x0 and x1 will be overwritten when reading the tlb entry, | ||
90 | diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc | 63 | diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc |
91 | index XXXXXXX..XXXXXXX 100644 | 64 | index XXXXXXX..XXXXXXX 100644 |
92 | --- a/tcg/arm/tcg-target.c.inc | 65 | --- a/tcg/arm/tcg-target.c.inc |
93 | +++ b/tcg/arm/tcg-target.c.inc | 66 | +++ b/tcg/arm/tcg-target.c.inc |
94 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | 67 | @@ -XXX,XX +XXX,XX @@ static inline int check_fit_imm(uint32_t imm) |
95 | break; | 68 | * mov operand2: values represented with x << (2 * y), x < 0x100 |
96 | 69 | * add, sub, eor...: ditto | |
97 | case 'r': | 70 | */ |
98 | - ct->ct |= TCG_CT_REG; | 71 | -static inline int tcg_target_const_match(tcg_target_long val, TCGType type, |
99 | ct->regs = 0xffff; | 72 | - const TCGArgConstraint *arg_ct) |
100 | break; | 73 | +static bool tcg_target_const_match(int64_t val, TCGType type, int ct) |
101 | 74 | { | |
102 | /* qemu_ld address */ | 75 | - int ct; |
103 | case 'l': | 76 | - ct = arg_ct->ct; |
104 | - ct->ct |= TCG_CT_REG; | 77 | if (ct & TCG_CT_CONST) { |
105 | ct->regs = 0xffff; | 78 | return 1; |
106 | #ifdef CONFIG_SOFTMMU | 79 | } else if ((ct & TCG_CT_CONST_ARM) && check_fit_imm(val)) { |
107 | /* r0-r2,lr will be overwritten when reading the tlb entry, | ||
108 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
109 | |||
110 | /* qemu_st address & data */ | ||
111 | case 's': | ||
112 | - ct->ct |= TCG_CT_REG; | ||
113 | ct->regs = 0xffff; | ||
114 | /* r0-r2 will be overwritten when reading the tlb entry (softmmu only) | ||
115 | and r0-r1 doing the byte swapping, so don't use these. */ | ||
116 | diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc | 80 | diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc |
117 | index XXXXXXX..XXXXXXX 100644 | 81 | index XXXXXXX..XXXXXXX 100644 |
118 | --- a/tcg/i386/tcg-target.c.inc | 82 | --- a/tcg/i386/tcg-target.c.inc |
119 | +++ b/tcg/i386/tcg-target.c.inc | 83 | +++ b/tcg/i386/tcg-target.c.inc |
120 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | 84 | @@ -XXX,XX +XXX,XX @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int type, |
121 | { | 85 | } |
122 | switch(*ct_str++) { | 86 | |
123 | case 'a': | 87 | /* test if a constant matches the constraint */ |
124 | - ct->ct |= TCG_CT_REG; | 88 | -static inline int tcg_target_const_match(tcg_target_long val, TCGType type, |
125 | tcg_regset_set_reg(ct->regs, TCG_REG_EAX); | 89 | - const TCGArgConstraint *arg_ct) |
126 | break; | 90 | +static bool tcg_target_const_match(int64_t val, TCGType type, int ct) |
127 | case 'b': | 91 | { |
128 | - ct->ct |= TCG_CT_REG; | 92 | - int ct = arg_ct->ct; |
129 | tcg_regset_set_reg(ct->regs, TCG_REG_EBX); | 93 | if (ct & TCG_CT_CONST) { |
130 | break; | 94 | return 1; |
131 | case 'c': | 95 | } |
132 | - ct->ct |= TCG_CT_REG; | ||
133 | tcg_regset_set_reg(ct->regs, TCG_REG_ECX); | ||
134 | break; | ||
135 | case 'd': | ||
136 | - ct->ct |= TCG_CT_REG; | ||
137 | tcg_regset_set_reg(ct->regs, TCG_REG_EDX); | ||
138 | break; | ||
139 | case 'S': | ||
140 | - ct->ct |= TCG_CT_REG; | ||
141 | tcg_regset_set_reg(ct->regs, TCG_REG_ESI); | ||
142 | break; | ||
143 | case 'D': | ||
144 | - ct->ct |= TCG_CT_REG; | ||
145 | tcg_regset_set_reg(ct->regs, TCG_REG_EDI); | ||
146 | break; | ||
147 | case 'q': | ||
148 | /* A register that can be used as a byte operand. */ | ||
149 | - ct->ct |= TCG_CT_REG; | ||
150 | ct->regs = TCG_TARGET_REG_BITS == 64 ? 0xffff : 0xf; | ||
151 | break; | ||
152 | case 'Q': | ||
153 | /* A register with an addressable second byte (e.g. %ah). */ | ||
154 | - ct->ct |= TCG_CT_REG; | ||
155 | ct->regs = 0xf; | ||
156 | break; | ||
157 | case 'r': | ||
158 | /* A general register. */ | ||
159 | - ct->ct |= TCG_CT_REG; | ||
160 | ct->regs |= ALL_GENERAL_REGS; | ||
161 | break; | ||
162 | case 'W': | ||
163 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
164 | break; | ||
165 | case 'x': | ||
166 | /* A vector register. */ | ||
167 | - ct->ct |= TCG_CT_REG; | ||
168 | ct->regs |= ALL_VECTOR_REGS; | ||
169 | break; | ||
170 | |||
171 | /* qemu_ld/st address constraint */ | ||
172 | case 'L': | ||
173 | - ct->ct |= TCG_CT_REG; | ||
174 | ct->regs = TCG_TARGET_REG_BITS == 64 ? 0xffff : 0xff; | ||
175 | tcg_regset_reset_reg(ct->regs, TCG_REG_L0); | ||
176 | tcg_regset_reset_reg(ct->regs, TCG_REG_L1); | ||
177 | diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc | 96 | diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc |
178 | index XXXXXXX..XXXXXXX 100644 | 97 | index XXXXXXX..XXXXXXX 100644 |
179 | --- a/tcg/mips/tcg-target.c.inc | 98 | --- a/tcg/mips/tcg-target.c.inc |
180 | +++ b/tcg/mips/tcg-target.c.inc | 99 | +++ b/tcg/mips/tcg-target.c.inc |
181 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | 100 | @@ -XXX,XX +XXX,XX @@ static inline bool is_p2m1(tcg_target_long val) |
182 | { | 101 | } |
183 | switch(*ct_str++) { | 102 | |
184 | case 'r': | 103 | /* test if a constant matches the constraint */ |
185 | - ct->ct |= TCG_CT_REG; | 104 | -static inline int tcg_target_const_match(tcg_target_long val, TCGType type, |
186 | ct->regs = 0xffffffff; | 105 | - const TCGArgConstraint *arg_ct) |
187 | break; | 106 | +static bool tcg_target_const_match(int64_t val, TCGType type, int ct) |
188 | case 'L': /* qemu_ld input arg constraint */ | 107 | { |
189 | - ct->ct |= TCG_CT_REG; | 108 | - int ct; |
190 | ct->regs = 0xffffffff; | 109 | - ct = arg_ct->ct; |
191 | tcg_regset_reset_reg(ct->regs, TCG_REG_A0); | 110 | if (ct & TCG_CT_CONST) { |
192 | #if defined(CONFIG_SOFTMMU) | 111 | return 1; |
193 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | 112 | } else if ((ct & TCG_CT_CONST_ZERO) && val == 0) { |
194 | #endif | ||
195 | break; | ||
196 | case 'S': /* qemu_st constraint */ | ||
197 | - ct->ct |= TCG_CT_REG; | ||
198 | ct->regs = 0xffffffff; | ||
199 | tcg_regset_reset_reg(ct->regs, TCG_REG_A0); | ||
200 | #if defined(CONFIG_SOFTMMU) | ||
201 | diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc | 113 | diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc |
202 | index XXXXXXX..XXXXXXX 100644 | 114 | index XXXXXXX..XXXXXXX 100644 |
203 | --- a/tcg/ppc/tcg-target.c.inc | 115 | --- a/tcg/ppc/tcg-target.c.inc |
204 | +++ b/tcg/ppc/tcg-target.c.inc | 116 | +++ b/tcg/ppc/tcg-target.c.inc |
205 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | 117 | @@ -XXX,XX +XXX,XX @@ static bool reloc_pc14(tcg_insn_unit *src_rw, const tcg_insn_unit *target) |
206 | { | 118 | } |
207 | switch (*ct_str++) { | 119 | |
208 | case 'A': case 'B': case 'C': case 'D': | 120 | /* test if a constant matches the constraint */ |
209 | - ct->ct |= TCG_CT_REG; | 121 | -static int tcg_target_const_match(tcg_target_long val, TCGType type, |
210 | tcg_regset_set_reg(ct->regs, 3 + ct_str[0] - 'A'); | 122 | - const TCGArgConstraint *arg_ct) |
211 | break; | 123 | +static bool tcg_target_const_match(int64_t val, TCGType type, int ct) |
212 | case 'r': | 124 | { |
213 | - ct->ct |= TCG_CT_REG; | 125 | - int ct = arg_ct->ct; |
214 | ct->regs = 0xffffffff; | 126 | if (ct & TCG_CT_CONST) { |
215 | break; | 127 | return 1; |
216 | case 'v': | 128 | } |
217 | - ct->ct |= TCG_CT_REG; | ||
218 | ct->regs = 0xffffffff00000000ull; | ||
219 | break; | ||
220 | case 'L': /* qemu_ld constraint */ | ||
221 | - ct->ct |= TCG_CT_REG; | ||
222 | ct->regs = 0xffffffff; | ||
223 | tcg_regset_reset_reg(ct->regs, TCG_REG_R3); | ||
224 | #ifdef CONFIG_SOFTMMU | ||
225 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
226 | #endif | ||
227 | break; | ||
228 | case 'S': /* qemu_st constraint */ | ||
229 | - ct->ct |= TCG_CT_REG; | ||
230 | ct->regs = 0xffffffff; | ||
231 | tcg_regset_reset_reg(ct->regs, TCG_REG_R3); | ||
232 | #ifdef CONFIG_SOFTMMU | ||
233 | diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc | 129 | diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc |
234 | index XXXXXXX..XXXXXXX 100644 | 130 | index XXXXXXX..XXXXXXX 100644 |
235 | --- a/tcg/riscv/tcg-target.c.inc | 131 | --- a/tcg/riscv/tcg-target.c.inc |
236 | +++ b/tcg/riscv/tcg-target.c.inc | 132 | +++ b/tcg/riscv/tcg-target.c.inc |
237 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | 133 | @@ -XXX,XX +XXX,XX @@ static inline tcg_target_long sextreg(tcg_target_long val, int pos, int len) |
238 | { | 134 | } |
239 | switch (*ct_str++) { | 135 | |
240 | case 'r': | 136 | /* test if a constant matches the constraint */ |
241 | - ct->ct |= TCG_CT_REG; | 137 | -static int tcg_target_const_match(tcg_target_long val, TCGType type, |
242 | ct->regs = 0xffffffff; | 138 | - const TCGArgConstraint *arg_ct) |
243 | break; | 139 | +static bool tcg_target_const_match(int64_t val, TCGType type, int ct) |
244 | case 'L': | 140 | { |
245 | /* qemu_ld/qemu_st constraint */ | 141 | - int ct = arg_ct->ct; |
246 | - ct->ct |= TCG_CT_REG; | 142 | if (ct & TCG_CT_CONST) { |
247 | ct->regs = 0xffffffff; | 143 | return 1; |
248 | /* qemu_ld/qemu_st uses TCG_REG_TMP0 */ | 144 | } |
249 | #if defined(CONFIG_SOFTMMU) | ||
250 | diff --git a/tcg/s390/tcg-target.c.inc b/tcg/s390/tcg-target.c.inc | 145 | diff --git a/tcg/s390/tcg-target.c.inc b/tcg/s390/tcg-target.c.inc |
251 | index XXXXXXX..XXXXXXX 100644 | 146 | index XXXXXXX..XXXXXXX 100644 |
252 | --- a/tcg/s390/tcg-target.c.inc | 147 | --- a/tcg/s390/tcg-target.c.inc |
253 | +++ b/tcg/s390/tcg-target.c.inc | 148 | +++ b/tcg/s390/tcg-target.c.inc |
254 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | 149 | @@ -XXX,XX +XXX,XX @@ static bool patch_reloc(tcg_insn_unit *src_rw, int type, |
255 | { | 150 | } |
256 | switch (*ct_str++) { | 151 | |
257 | case 'r': /* all registers */ | 152 | /* Test if a constant matches the constraint. */ |
258 | - ct->ct |= TCG_CT_REG; | 153 | -static int tcg_target_const_match(tcg_target_long val, TCGType type, |
259 | ct->regs = 0xffff; | 154 | - const TCGArgConstraint *arg_ct) |
260 | break; | 155 | +static bool tcg_target_const_match(int64_t val, TCGType type, int ct) |
261 | case 'L': /* qemu_ld/st constraint */ | 156 | { |
262 | - ct->ct |= TCG_CT_REG; | 157 | - int ct = arg_ct->ct; |
263 | ct->regs = 0xffff; | 158 | - |
264 | tcg_regset_reset_reg(ct->regs, TCG_REG_R2); | 159 | if (ct & TCG_CT_CONST) { |
265 | tcg_regset_reset_reg(ct->regs, TCG_REG_R3); | 160 | return 1; |
266 | tcg_regset_reset_reg(ct->regs, TCG_REG_R4); | 161 | } |
267 | break; | ||
268 | case 'a': /* force R2 for division */ | ||
269 | - ct->ct |= TCG_CT_REG; | ||
270 | ct->regs = 0; | ||
271 | tcg_regset_set_reg(ct->regs, TCG_REG_R2); | ||
272 | break; | ||
273 | case 'b': /* force R3 for division */ | ||
274 | - ct->ct |= TCG_CT_REG; | ||
275 | ct->regs = 0; | ||
276 | tcg_regset_set_reg(ct->regs, TCG_REG_R3); | ||
277 | break; | ||
278 | diff --git a/tcg/sparc/tcg-target.c.inc b/tcg/sparc/tcg-target.c.inc | 162 | diff --git a/tcg/sparc/tcg-target.c.inc b/tcg/sparc/tcg-target.c.inc |
279 | index XXXXXXX..XXXXXXX 100644 | 163 | index XXXXXXX..XXXXXXX 100644 |
280 | --- a/tcg/sparc/tcg-target.c.inc | 164 | --- a/tcg/sparc/tcg-target.c.inc |
281 | +++ b/tcg/sparc/tcg-target.c.inc | 165 | +++ b/tcg/sparc/tcg-target.c.inc |
282 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | 166 | @@ -XXX,XX +XXX,XX @@ static bool patch_reloc(tcg_insn_unit *src_rw, int type, |
283 | { | 167 | } |
284 | switch (*ct_str++) { | 168 | |
285 | case 'r': | 169 | /* test if a constant matches the constraint */ |
286 | - ct->ct |= TCG_CT_REG; | 170 | -static inline int tcg_target_const_match(tcg_target_long val, TCGType type, |
287 | ct->regs = 0xffffffff; | 171 | - const TCGArgConstraint *arg_ct) |
288 | break; | 172 | +static bool tcg_target_const_match(int64_t val, TCGType type, int ct) |
289 | case 'R': | 173 | { |
290 | - ct->ct |= TCG_CT_REG; | 174 | - int ct = arg_ct->ct; |
291 | ct->regs = ALL_64; | 175 | - |
292 | break; | 176 | if (ct & TCG_CT_CONST) { |
293 | case 'A': /* qemu_ld/st address constraint */ | 177 | return 1; |
294 | - ct->ct |= TCG_CT_REG; | 178 | } |
295 | ct->regs = TARGET_LONG_BITS == 64 ? ALL_64 : 0xffffffff; | ||
296 | reserve_helpers: | ||
297 | tcg_regset_reset_reg(ct->regs, TCG_REG_O0); | ||
298 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
299 | tcg_regset_reset_reg(ct->regs, TCG_REG_O2); | ||
300 | break; | ||
301 | case 's': /* qemu_st data 32-bit constraint */ | ||
302 | - ct->ct |= TCG_CT_REG; | ||
303 | ct->regs = 0xffffffff; | ||
304 | goto reserve_helpers; | ||
305 | case 'S': /* qemu_st data 64-bit constraint */ | ||
306 | - ct->ct |= TCG_CT_REG; | ||
307 | ct->regs = ALL_64; | ||
308 | goto reserve_helpers; | ||
309 | case 'I': | ||
310 | diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc | 179 | diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc |
311 | index XXXXXXX..XXXXXXX 100644 | 180 | index XXXXXXX..XXXXXXX 100644 |
312 | --- a/tcg/tci/tcg-target.c.inc | 181 | --- a/tcg/tci/tcg-target.c.inc |
313 | +++ b/tcg/tci/tcg-target.c.inc | 182 | +++ b/tcg/tci/tcg-target.c.inc |
314 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | 183 | @@ -XXX,XX +XXX,XX @@ static inline bool tcg_out_sti(TCGContext *s, TCGType type, TCGArg val, |
315 | case 'r': | 184 | } |
316 | case 'L': /* qemu_ld constraint */ | 185 | |
317 | case 'S': /* qemu_st constraint */ | 186 | /* Test if a constant matches the constraint. */ |
318 | - ct->ct |= TCG_CT_REG; | 187 | -static int tcg_target_const_match(tcg_target_long val, TCGType type, |
319 | ct->regs = BIT(TCG_TARGET_NB_REGS) - 1; | 188 | - const TCGArgConstraint *arg_ct) |
320 | break; | 189 | +static bool tcg_target_const_match(int64_t val, TCGType type, int ct) |
321 | default: | 190 | { |
191 | - /* No need to return 0 or 1, 0 or != 0 is good enough. */ | ||
192 | - return arg_ct->ct & TCG_CT_CONST; | ||
193 | + return ct & TCG_CT_CONST; | ||
194 | } | ||
195 | |||
196 | static void tcg_target_init(TCGContext *s) | ||
322 | -- | 197 | -- |
323 | 2.25.1 | 198 | 2.25.1 |
324 | 199 | ||
325 | 200 | diff view generated by jsdifflib |
1 | This uses an existing hole in the TCGArgConstraint structure | 1 | Add registers and function stubs. The functionality |
---|---|---|---|
2 | and will be convenient for keeping the data in one place. | 2 | is disabled via use_neon_instructions defined to 0. |
3 | 3 | ||
4 | We must still include results for the mandatory opcodes in | ||
5 | tcg_target_op_def, as all opcodes are checked during tcg init. | ||
6 | |||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
5 | --- | 9 | --- |
6 | include/tcg/tcg.h | 2 +- | 10 | tcg/arm/tcg-target-con-set.h | 4 ++ |
7 | tcg/tcg.c | 35 +++++++++++++++++------------------ | 11 | tcg/arm/tcg-target-con-str.h | 1 + |
8 | 2 files changed, 18 insertions(+), 19 deletions(-) | 12 | tcg/arm/tcg-target.h | 48 ++++++++++++-- |
9 | 13 | tcg/arm/tcg-target.opc.h | 12 ++++ | |
10 | diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h | 14 | tcg/arm/tcg-target.c.inc | 117 +++++++++++++++++++++++++++++------ |
15 | 5 files changed, 158 insertions(+), 24 deletions(-) | ||
16 | create mode 100644 tcg/arm/tcg-target.opc.h | ||
17 | |||
18 | diff --git a/tcg/arm/tcg-target-con-set.h b/tcg/arm/tcg-target-con-set.h | ||
11 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
12 | --- a/include/tcg/tcg.h | 20 | --- a/tcg/arm/tcg-target-con-set.h |
13 | +++ b/include/tcg/tcg.h | 21 | +++ b/tcg/arm/tcg-target-con-set.h |
14 | @@ -XXX,XX +XXX,XX @@ void tcg_dump_op_count(void); | 22 | @@ -XXX,XX +XXX,XX @@ C_O0_I1(r) |
15 | typedef struct TCGArgConstraint { | 23 | C_O0_I2(r, r) |
16 | uint16_t ct; | 24 | C_O0_I2(r, rIN) |
17 | uint8_t alias_index; | 25 | C_O0_I2(s, s) |
18 | + uint8_t sort_index; | 26 | +C_O0_I2(w, r) |
19 | TCGRegSet regs; | 27 | C_O0_I3(s, s, s) |
20 | } TCGArgConstraint; | 28 | C_O0_I4(r, r, rI, rI) |
21 | 29 | C_O0_I4(s, s, s, s) | |
22 | @@ -XXX,XX +XXX,XX @@ typedef struct TCGOpDef { | 30 | C_O1_I1(r, l) |
23 | uint8_t nb_oargs, nb_iargs, nb_cargs, nb_args; | 31 | C_O1_I1(r, r) |
24 | uint8_t flags; | 32 | +C_O1_I1(w, r) |
25 | TCGArgConstraint *args_ct; | 33 | +C_O1_I1(w, wr) |
26 | - int *sorted_args; | 34 | C_O1_I2(r, 0, rZ) |
27 | #if defined(CONFIG_DEBUG_TCG) | 35 | C_O1_I2(r, l, l) |
28 | int used; | 36 | C_O1_I2(r, r, r) |
37 | @@ -XXX,XX +XXX,XX @@ C_O1_I2(r, r, rIK) | ||
38 | C_O1_I2(r, r, rIN) | ||
39 | C_O1_I2(r, r, ri) | ||
40 | C_O1_I2(r, rZ, rZ) | ||
41 | +C_O1_I2(w, w, w) | ||
42 | C_O1_I4(r, r, r, rI, rI) | ||
43 | C_O1_I4(r, r, rIN, rIK, 0) | ||
44 | C_O2_I1(r, r, l) | ||
45 | diff --git a/tcg/arm/tcg-target-con-str.h b/tcg/arm/tcg-target-con-str.h | ||
46 | index XXXXXXX..XXXXXXX 100644 | ||
47 | --- a/tcg/arm/tcg-target-con-str.h | ||
48 | +++ b/tcg/arm/tcg-target-con-str.h | ||
49 | @@ -XXX,XX +XXX,XX @@ | ||
50 | REGS('r', ALL_GENERAL_REGS) | ||
51 | REGS('l', ALL_QLOAD_REGS) | ||
52 | REGS('s', ALL_QSTORE_REGS) | ||
53 | +REGS('w', ALL_VECTOR_REGS) | ||
54 | |||
55 | /* | ||
56 | * Define constraint letters for constants: | ||
57 | diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h | ||
58 | index XXXXXXX..XXXXXXX 100644 | ||
59 | --- a/tcg/arm/tcg-target.h | ||
60 | +++ b/tcg/arm/tcg-target.h | ||
61 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
62 | TCG_REG_R13, | ||
63 | TCG_REG_R14, | ||
64 | TCG_REG_PC, | ||
65 | + | ||
66 | + TCG_REG_Q0, | ||
67 | + TCG_REG_Q1, | ||
68 | + TCG_REG_Q2, | ||
69 | + TCG_REG_Q3, | ||
70 | + TCG_REG_Q4, | ||
71 | + TCG_REG_Q5, | ||
72 | + TCG_REG_Q6, | ||
73 | + TCG_REG_Q7, | ||
74 | + TCG_REG_Q8, | ||
75 | + TCG_REG_Q9, | ||
76 | + TCG_REG_Q10, | ||
77 | + TCG_REG_Q11, | ||
78 | + TCG_REG_Q12, | ||
79 | + TCG_REG_Q13, | ||
80 | + TCG_REG_Q14, | ||
81 | + TCG_REG_Q15, | ||
82 | + | ||
83 | + TCG_AREG0 = TCG_REG_R6, | ||
84 | + TCG_REG_CALL_STACK = TCG_REG_R13, | ||
85 | } TCGReg; | ||
86 | |||
87 | -#define TCG_TARGET_NB_REGS 16 | ||
88 | +#define TCG_TARGET_NB_REGS 32 | ||
89 | |||
90 | #ifdef __ARM_ARCH_EXT_IDIV__ | ||
91 | #define use_idiv_instructions 1 | ||
92 | #else | ||
93 | extern bool use_idiv_instructions; | ||
29 | #endif | 94 | #endif |
30 | diff --git a/tcg/tcg.c b/tcg/tcg.c | 95 | - |
96 | +#define use_neon_instructions 0 | ||
97 | |||
98 | /* used for function call generation */ | ||
99 | -#define TCG_REG_CALL_STACK TCG_REG_R13 | ||
100 | #define TCG_TARGET_STACK_ALIGN 8 | ||
101 | #define TCG_TARGET_CALL_ALIGN_ARGS 1 | ||
102 | #define TCG_TARGET_CALL_STACK_OFFSET 0 | ||
103 | @@ -XXX,XX +XXX,XX @@ extern bool use_idiv_instructions; | ||
104 | #define TCG_TARGET_HAS_direct_jump 0 | ||
105 | #define TCG_TARGET_HAS_qemu_st8_i32 0 | ||
106 | |||
107 | -enum { | ||
108 | - TCG_AREG0 = TCG_REG_R6, | ||
109 | -}; | ||
110 | +#define TCG_TARGET_HAS_v64 use_neon_instructions | ||
111 | +#define TCG_TARGET_HAS_v128 use_neon_instructions | ||
112 | +#define TCG_TARGET_HAS_v256 0 | ||
113 | + | ||
114 | +#define TCG_TARGET_HAS_andc_vec 0 | ||
115 | +#define TCG_TARGET_HAS_orc_vec 0 | ||
116 | +#define TCG_TARGET_HAS_not_vec 0 | ||
117 | +#define TCG_TARGET_HAS_neg_vec 0 | ||
118 | +#define TCG_TARGET_HAS_abs_vec 0 | ||
119 | +#define TCG_TARGET_HAS_roti_vec 0 | ||
120 | +#define TCG_TARGET_HAS_rots_vec 0 | ||
121 | +#define TCG_TARGET_HAS_rotv_vec 0 | ||
122 | +#define TCG_TARGET_HAS_shi_vec 0 | ||
123 | +#define TCG_TARGET_HAS_shs_vec 0 | ||
124 | +#define TCG_TARGET_HAS_shv_vec 0 | ||
125 | +#define TCG_TARGET_HAS_mul_vec 0 | ||
126 | +#define TCG_TARGET_HAS_sat_vec 0 | ||
127 | +#define TCG_TARGET_HAS_minmax_vec 0 | ||
128 | +#define TCG_TARGET_HAS_bitsel_vec 0 | ||
129 | +#define TCG_TARGET_HAS_cmpsel_vec 0 | ||
130 | |||
131 | #define TCG_TARGET_DEFAULT_MO (0) | ||
132 | #define TCG_TARGET_HAS_MEMORY_BSWAP 1 | ||
133 | diff --git a/tcg/arm/tcg-target.opc.h b/tcg/arm/tcg-target.opc.h | ||
134 | new file mode 100644 | ||
135 | index XXXXXXX..XXXXXXX | ||
136 | --- /dev/null | ||
137 | +++ b/tcg/arm/tcg-target.opc.h | ||
138 | @@ -XXX,XX +XXX,XX @@ | ||
139 | +/* | ||
140 | + * Copyright (c) 2019 Linaro | ||
141 | + * | ||
142 | + * This work is licensed under the terms of the GNU GPL, version 2 or | ||
143 | + * (at your option) any later version. | ||
144 | + * | ||
145 | + * See the COPYING file in the top-level directory for details. | ||
146 | + * | ||
147 | + * Target-specific opcodes for host vector expansion. These will be | ||
148 | + * emitted by tcg_expand_vec_op. For those familiar with GCC internals, | ||
149 | + * consider these to be UNSPEC with names. | ||
150 | + */ | ||
151 | diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc | ||
31 | index XXXXXXX..XXXXXXX 100644 | 152 | index XXXXXXX..XXXXXXX 100644 |
32 | --- a/tcg/tcg.c | 153 | --- a/tcg/arm/tcg-target.c.inc |
33 | +++ b/tcg/tcg.c | 154 | +++ b/tcg/arm/tcg-target.c.inc |
34 | @@ -XXX,XX +XXX,XX @@ void tcg_context_init(TCGContext *s) | 155 | @@ -XXX,XX +XXX,XX @@ bool use_idiv_instructions; |
35 | int op, total_args, n, i; | 156 | |
36 | TCGOpDef *def; | 157 | #ifdef CONFIG_DEBUG_TCG |
37 | TCGArgConstraint *args_ct; | 158 | static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = { |
38 | - int *sorted_args; | 159 | - "%r0", |
39 | TCGTemp *ts; | 160 | - "%r1", |
40 | 161 | - "%r2", | |
41 | memset(s, 0, sizeof(*s)); | 162 | - "%r3", |
42 | @@ -XXX,XX +XXX,XX @@ void tcg_context_init(TCGContext *s) | 163 | - "%r4", |
164 | - "%r5", | ||
165 | - "%r6", | ||
166 | - "%r7", | ||
167 | - "%r8", | ||
168 | - "%r9", | ||
169 | - "%r10", | ||
170 | - "%r11", | ||
171 | - "%r12", | ||
172 | - "%r13", | ||
173 | - "%r14", | ||
174 | - "%pc", | ||
175 | + "%r0", "%r1", "%r2", "%r3", "%r4", "%r5", "%r6", "%r7", | ||
176 | + "%r8", "%r9", "%r10", "%r11", "%r12", "%sp", "%r14", "%pc", | ||
177 | + "%q0", "%q1", "%q2", "%q3", "%q4", "%q5", "%q6", "%q7", | ||
178 | + "%q8", "%q9", "%q10", "%q11", "%q12", "%q13", "%q14", "%q15", | ||
179 | }; | ||
180 | #endif | ||
181 | |||
182 | @@ -XXX,XX +XXX,XX @@ static const int tcg_target_reg_alloc_order[] = { | ||
183 | TCG_REG_R3, | ||
184 | TCG_REG_R12, | ||
185 | TCG_REG_R14, | ||
186 | + | ||
187 | + TCG_REG_Q0, | ||
188 | + TCG_REG_Q1, | ||
189 | + TCG_REG_Q2, | ||
190 | + TCG_REG_Q3, | ||
191 | + /* Q4 - Q7 are call-saved, and skipped. */ | ||
192 | + TCG_REG_Q8, | ||
193 | + TCG_REG_Q9, | ||
194 | + TCG_REG_Q10, | ||
195 | + TCG_REG_Q11, | ||
196 | + TCG_REG_Q12, | ||
197 | + TCG_REG_Q13, | ||
198 | + TCG_REG_Q14, | ||
199 | + TCG_REG_Q15, | ||
200 | }; | ||
201 | |||
202 | static const int tcg_target_call_iarg_regs[4] = { | ||
203 | @@ -XXX,XX +XXX,XX @@ static const int tcg_target_call_oarg_regs[2] = { | ||
204 | }; | ||
205 | |||
206 | #define TCG_REG_TMP TCG_REG_R12 | ||
207 | +#define TCG_VEC_TMP TCG_REG_Q15 | ||
208 | |||
209 | enum arm_cond_code_e { | ||
210 | COND_EQ = 0x0, | ||
211 | @@ -XXX,XX +XXX,XX @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int type, | ||
212 | #define TCG_CT_CONST_ZERO 0x800 | ||
213 | |||
214 | #define ALL_GENERAL_REGS 0xffffu | ||
215 | +#define ALL_VECTOR_REGS 0xffff0000u | ||
216 | |||
217 | /* | ||
218 | * r0-r2 will be overwritten when reading the tlb entry (softmmu only) | ||
219 | @@ -XXX,XX +XXX,XX @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) | ||
220 | case INDEX_op_qemu_st_i64: | ||
221 | return TARGET_LONG_BITS == 32 ? C_O0_I3(s, s, s) : C_O0_I4(s, s, s, s); | ||
222 | |||
223 | + case INDEX_op_st_vec: | ||
224 | + return C_O0_I2(w, r); | ||
225 | + case INDEX_op_ld_vec: | ||
226 | + case INDEX_op_dupm_vec: | ||
227 | + return C_O1_I1(w, r); | ||
228 | + case INDEX_op_dup_vec: | ||
229 | + return C_O1_I1(w, wr); | ||
230 | + case INDEX_op_dup2_vec: | ||
231 | + case INDEX_op_add_vec: | ||
232 | + case INDEX_op_sub_vec: | ||
233 | + case INDEX_op_xor_vec: | ||
234 | + case INDEX_op_or_vec: | ||
235 | + case INDEX_op_and_vec: | ||
236 | + case INDEX_op_cmp_vec: | ||
237 | + return C_O1_I2(w, w, w); | ||
238 | + | ||
239 | default: | ||
240 | g_assert_not_reached(); | ||
43 | } | 241 | } |
44 | 242 | @@ -XXX,XX +XXX,XX @@ static void tcg_target_init(TCGContext *s) | |
45 | args_ct = g_malloc(sizeof(TCGArgConstraint) * total_args); | 243 | { |
46 | - sorted_args = g_malloc(sizeof(int) * total_args); | 244 | /* Only probe for the platform and capabilities if we havn't already |
47 | 245 | determined maximum values at compile time. */ | |
48 | for(op = 0; op < NB_OPS; op++) { | 246 | -#ifndef use_idiv_instructions |
49 | def = &tcg_op_defs[op]; | 247 | +#if !defined(use_idiv_instructions) || !defined(use_neon_instructions) |
50 | def->args_ct = args_ct; | 248 | { |
51 | - def->sorted_args = sorted_args; | 249 | unsigned long hwcap = qemu_getauxval(AT_HWCAP); |
52 | n = def->nb_iargs + def->nb_oargs; | 250 | +#ifndef use_idiv_instructions |
53 | - sorted_args += n; | 251 | use_idiv_instructions = (hwcap & HWCAP_ARM_IDIVA) != 0; |
54 | args_ct += n; | 252 | +#endif |
253 | +#ifndef use_neon_instructions | ||
254 | + use_neon_instructions = (hwcap & HWCAP_ARM_NEON) != 0; | ||
255 | +#endif | ||
55 | } | 256 | } |
56 | 257 | #endif | |
57 | @@ -XXX,XX +XXX,XX @@ static int get_constraint_priority(const TCGOpDef *def, int k) | 258 | + |
58 | /* sort from highest priority to lowest */ | 259 | if (__ARM_ARCH < 7) { |
59 | static void sort_constraints(TCGOpDef *def, int start, int n) | 260 | const char *pl = (const char *)qemu_getauxval(AT_PLATFORM); |
60 | { | 261 | if (pl != NULL && pl[0] == 'v' && pl[1] >= '4' && pl[1] <= '9') { |
61 | - int i, j, p1, p2, tmp; | 262 | @@ -XXX,XX +XXX,XX @@ static void tcg_target_init(TCGContext *s) |
62 | + int i, j; | ||
63 | + TCGArgConstraint *a = def->args_ct; | ||
64 | |||
65 | - for(i = 0; i < n; i++) | ||
66 | - def->sorted_args[start + i] = start + i; | ||
67 | - if (n <= 1) | ||
68 | + for (i = 0; i < n; i++) { | ||
69 | + a[start + i].sort_index = start + i; | ||
70 | + } | ||
71 | + if (n <= 1) { | ||
72 | return; | ||
73 | - for(i = 0; i < n - 1; i++) { | ||
74 | - for(j = i + 1; j < n; j++) { | ||
75 | - p1 = get_constraint_priority(def, def->sorted_args[start + i]); | ||
76 | - p2 = get_constraint_priority(def, def->sorted_args[start + j]); | ||
77 | + } | ||
78 | + for (i = 0; i < n - 1; i++) { | ||
79 | + for (j = i + 1; j < n; j++) { | ||
80 | + int p1 = get_constraint_priority(def, a[start + i].sort_index); | ||
81 | + int p2 = get_constraint_priority(def, a[start + j].sort_index); | ||
82 | if (p1 < p2) { | ||
83 | - tmp = def->sorted_args[start + i]; | ||
84 | - def->sorted_args[start + i] = def->sorted_args[start + j]; | ||
85 | - def->sorted_args[start + j] = tmp; | ||
86 | + int tmp = a[start + i].sort_index; | ||
87 | + a[start + i].sort_index = a[start + j].sort_index; | ||
88 | + a[start + j].sort_index = tmp; | ||
89 | } | ||
90 | } | 263 | } |
91 | } | 264 | } |
92 | @@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) | 265 | |
93 | for (k = 0; k < nb_iargs; k++) { | 266 | - tcg_target_available_regs[TCG_TYPE_I32] = 0xffff; |
94 | TCGRegSet i_preferred_regs, o_preferred_regs; | 267 | + tcg_target_available_regs[TCG_TYPE_I32] = ALL_GENERAL_REGS; |
95 | 268 | ||
96 | - i = def->sorted_args[nb_oargs + k]; | 269 | tcg_target_call_clobber_regs = 0; |
97 | + i = def->args_ct[nb_oargs + k].sort_index; | 270 | tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_R0); |
98 | arg = op->args[i]; | 271 | @@ -XXX,XX +XXX,XX @@ static void tcg_target_init(TCGContext *s) |
99 | arg_ct = &def->args_ct[i]; | 272 | tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_R12); |
100 | ts = arg_temp(arg); | 273 | tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_R14); |
101 | @@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) | 274 | |
102 | int k2, i2; | 275 | + if (use_neon_instructions) { |
103 | reg = ts->reg; | 276 | + tcg_target_available_regs[TCG_TYPE_V64] = ALL_VECTOR_REGS; |
104 | for (k2 = 0 ; k2 < k ; k2++) { | 277 | + tcg_target_available_regs[TCG_TYPE_V128] = ALL_VECTOR_REGS; |
105 | - i2 = def->sorted_args[nb_oargs + k2]; | 278 | + |
106 | + i2 = def->args_ct[nb_oargs + k2].sort_index; | 279 | + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_Q0); |
107 | if ((def->args_ct[i2].ct & TCG_CT_IALIAS) && | 280 | + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_Q1); |
108 | reg == new_args[i2]) { | 281 | + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_Q2); |
109 | goto allocate_in_reg; | 282 | + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_Q3); |
110 | @@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) | 283 | + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_Q8); |
111 | 284 | + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_Q9); | |
112 | /* satisfy the output constraints */ | 285 | + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_Q10); |
113 | for(k = 0; k < nb_oargs; k++) { | 286 | + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_Q11); |
114 | - i = def->sorted_args[k]; | 287 | + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_Q12); |
115 | + i = def->args_ct[k].sort_index; | 288 | + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_Q13); |
116 | arg = op->args[i]; | 289 | + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_Q14); |
117 | arg_ct = &def->args_ct[i]; | 290 | + tcg_regset_set_reg(tcg_target_call_clobber_regs, TCG_REG_Q15); |
118 | ts = arg_temp(arg); | 291 | + } |
292 | + | ||
293 | s->reserved_regs = 0; | ||
294 | tcg_regset_set_reg(s->reserved_regs, TCG_REG_CALL_STACK); | ||
295 | tcg_regset_set_reg(s->reserved_regs, TCG_REG_TMP); | ||
296 | tcg_regset_set_reg(s->reserved_regs, TCG_REG_PC); | ||
297 | + tcg_regset_set_reg(s->reserved_regs, TCG_VEC_TMP); | ||
298 | } | ||
299 | |||
300 | static inline void tcg_out_ld(TCGContext *s, TCGType type, TCGReg arg, | ||
301 | @@ -XXX,XX +XXX,XX @@ static inline void tcg_out_movi(TCGContext *s, TCGType type, | ||
302 | tcg_out_movi32(s, COND_AL, ret, arg); | ||
303 | } | ||
304 | |||
305 | +static bool tcg_out_dup_vec(TCGContext *s, TCGType type, unsigned vece, | ||
306 | + TCGReg rd, TCGReg rs) | ||
307 | +{ | ||
308 | + g_assert_not_reached(); | ||
309 | +} | ||
310 | + | ||
311 | +static bool tcg_out_dupm_vec(TCGContext *s, TCGType type, unsigned vece, | ||
312 | + TCGReg rd, TCGReg base, intptr_t offset) | ||
313 | +{ | ||
314 | + g_assert_not_reached(); | ||
315 | +} | ||
316 | + | ||
317 | +static void tcg_out_dupi_vec(TCGContext *s, TCGType type, unsigned vece, | ||
318 | + TCGReg rd, int64_t v64) | ||
319 | +{ | ||
320 | + g_assert_not_reached(); | ||
321 | +} | ||
322 | + | ||
323 | +static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, | ||
324 | + unsigned vecl, unsigned vece, | ||
325 | + const TCGArg *args, const int *const_args) | ||
326 | +{ | ||
327 | + g_assert_not_reached(); | ||
328 | +} | ||
329 | + | ||
330 | +int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) | ||
331 | +{ | ||
332 | + return 0; | ||
333 | +} | ||
334 | + | ||
335 | +void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, | ||
336 | + TCGArg a0, ...) | ||
337 | +{ | ||
338 | + g_assert_not_reached(); | ||
339 | +} | ||
340 | + | ||
341 | static void tcg_out_nop_fill(tcg_insn_unit *p, int count) | ||
342 | { | ||
343 | int i; | ||
119 | -- | 344 | -- |
120 | 2.25.1 | 345 | 2.25.1 |
121 | 346 | ||
122 | 347 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
2 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
3 | --- | ||
4 | tcg/arm/tcg-target.c.inc | 70 ++++++++++++++++++++++++++++++++++++---- | ||
5 | 1 file changed, 64 insertions(+), 6 deletions(-) | ||
1 | 6 | ||
7 | diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc | ||
8 | index XXXXXXX..XXXXXXX 100644 | ||
9 | --- a/tcg/arm/tcg-target.c.inc | ||
10 | +++ b/tcg/arm/tcg-target.c.inc | ||
11 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
12 | INSN_NOP_v6k = 0xe320f000, | ||
13 | /* Otherwise the assembler uses mov r0,r0 */ | ||
14 | INSN_NOP_v4 = (COND_AL << 28) | ARITH_MOV, | ||
15 | + | ||
16 | + INSN_VLD1 = 0xf4200000, /* VLD1 (multiple single elements) */ | ||
17 | + INSN_VST1 = 0xf4000000, /* VST1 (multiple single elements) */ | ||
18 | } ARMInsn; | ||
19 | |||
20 | #define INSN_NOP (use_armv7_instructions ? INSN_NOP_v6k : INSN_NOP_v4) | ||
21 | @@ -XXX,XX +XXX,XX @@ static TCGCond tcg_out_cmp2(TCGContext *s, const TCGArg *args, | ||
22 | } | ||
23 | } | ||
24 | |||
25 | +/* | ||
26 | + * Note that TCGReg references Q-registers. | ||
27 | + * Q-regno = 2 * D-regno, so shift left by 1 whlie inserting. | ||
28 | + */ | ||
29 | +static uint32_t encode_vd(TCGReg rd) | ||
30 | +{ | ||
31 | + tcg_debug_assert(rd >= TCG_REG_Q0); | ||
32 | + return (extract32(rd, 3, 1) << 22) | (extract32(rd, 0, 3) << 13); | ||
33 | +} | ||
34 | + | ||
35 | +static void tcg_out_vldst(TCGContext *s, ARMInsn insn, | ||
36 | + TCGReg rd, TCGReg rn, int offset) | ||
37 | +{ | ||
38 | + if (offset != 0) { | ||
39 | + if (check_fit_imm(offset) || check_fit_imm(-offset)) { | ||
40 | + tcg_out_dat_rIN(s, COND_AL, ARITH_ADD, ARITH_SUB, | ||
41 | + TCG_REG_TMP, rn, offset, true); | ||
42 | + } else { | ||
43 | + tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_TMP, offset); | ||
44 | + tcg_out_dat_reg(s, COND_AL, ARITH_ADD, | ||
45 | + TCG_REG_TMP, TCG_REG_TMP, rn, 0); | ||
46 | + } | ||
47 | + rn = TCG_REG_TMP; | ||
48 | + } | ||
49 | + tcg_out32(s, insn | (rn << 16) | encode_vd(rd) | 0xf); | ||
50 | +} | ||
51 | + | ||
52 | #ifdef CONFIG_SOFTMMU | ||
53 | #include "../tcg-ldst.c.inc" | ||
54 | |||
55 | @@ -XXX,XX +XXX,XX @@ static void tcg_target_init(TCGContext *s) | ||
56 | tcg_regset_set_reg(s->reserved_regs, TCG_VEC_TMP); | ||
57 | } | ||
58 | |||
59 | -static inline void tcg_out_ld(TCGContext *s, TCGType type, TCGReg arg, | ||
60 | - TCGReg arg1, intptr_t arg2) | ||
61 | +static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg arg, | ||
62 | + TCGReg arg1, intptr_t arg2) | ||
63 | { | ||
64 | - tcg_out_ld32u(s, COND_AL, arg, arg1, arg2); | ||
65 | + switch (type) { | ||
66 | + case TCG_TYPE_I32: | ||
67 | + tcg_out_ld32u(s, COND_AL, arg, arg1, arg2); | ||
68 | + return; | ||
69 | + case TCG_TYPE_V64: | ||
70 | + /* regs 1; size 8; align 8 */ | ||
71 | + tcg_out_vldst(s, INSN_VLD1 | 0x7d0, arg, arg1, arg2); | ||
72 | + return; | ||
73 | + case TCG_TYPE_V128: | ||
74 | + /* regs 2; size 8; align 16 */ | ||
75 | + tcg_out_vldst(s, INSN_VLD1 | 0xae0, arg, arg1, arg2); | ||
76 | + return; | ||
77 | + default: | ||
78 | + g_assert_not_reached(); | ||
79 | + } | ||
80 | } | ||
81 | |||
82 | -static inline void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg, | ||
83 | - TCGReg arg1, intptr_t arg2) | ||
84 | +static void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg, | ||
85 | + TCGReg arg1, intptr_t arg2) | ||
86 | { | ||
87 | - tcg_out_st32(s, COND_AL, arg, arg1, arg2); | ||
88 | + switch (type) { | ||
89 | + case TCG_TYPE_I32: | ||
90 | + tcg_out_st32(s, COND_AL, arg, arg1, arg2); | ||
91 | + return; | ||
92 | + case TCG_TYPE_V64: | ||
93 | + /* regs 1; size 8; align 8 */ | ||
94 | + tcg_out_vldst(s, INSN_VST1 | 0x7d0, arg, arg1, arg2); | ||
95 | + return; | ||
96 | + case TCG_TYPE_V128: | ||
97 | + /* regs 2; size 8; align 16 */ | ||
98 | + tcg_out_vldst(s, INSN_VST1 | 0xae0, arg, arg1, arg2); | ||
99 | + return; | ||
100 | + default: | ||
101 | + g_assert_not_reached(); | ||
102 | + } | ||
103 | } | ||
104 | |||
105 | static inline bool tcg_out_sti(TCGContext *s, TCGType type, TCGArg val, | ||
106 | -- | ||
107 | 2.25.1 | ||
108 | |||
109 | diff view generated by jsdifflib |
1 | From: Kele Huang <kele.hwang@gmail.com> | 1 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
---|---|---|---|
2 | |||
3 | Detect all MIPS store instructions in cpu_signal_handler for all available | ||
4 | MIPS versions, and set is_write if encountering such store instructions. | ||
5 | |||
6 | This fixed the error while dealing with self-modified code for MIPS. | ||
7 | |||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Signed-off-by: Kele Huang <kele.hwang@gmail.com> | ||
10 | Signed-off-by: Xu Zou <iwatchnima@gmail.com> | ||
11 | Message-Id: <20201002081420.10814-1-kele.hwang@gmail.com> | ||
12 | [rth: Use uintptr_t for pc to fix n32 build error.] | ||
13 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 2 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
14 | --- | 3 | --- |
15 | accel/tcg/user-exec.c | 43 +++++++++++++++++++++++++++++++++++++++---- | 4 | tcg/arm/tcg-target.c.inc | 52 +++++++++++++++++++++++++++++++++++----- |
16 | 1 file changed, 39 insertions(+), 4 deletions(-) | 5 | 1 file changed, 46 insertions(+), 6 deletions(-) |
17 | 6 | ||
18 | diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c | 7 | diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc |
19 | index XXXXXXX..XXXXXXX 100644 | 8 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/accel/tcg/user-exec.c | 9 | --- a/tcg/arm/tcg-target.c.inc |
21 | +++ b/accel/tcg/user-exec.c | 10 | +++ b/tcg/arm/tcg-target.c.inc |
22 | @@ -XXX,XX +XXX,XX @@ int cpu_signal_handler(int host_signum, void *pinfo, | 11 | @@ -XXX,XX +XXX,XX @@ typedef enum { |
23 | 12 | /* Otherwise the assembler uses mov r0,r0 */ | |
24 | #elif defined(__mips__) | 13 | INSN_NOP_v4 = (COND_AL << 28) | ARITH_MOV, |
25 | 14 | ||
26 | +#if defined(__misp16) || defined(__mips_micromips) | 15 | + INSN_VORR = 0xf2200110, |
27 | +#error "Unsupported encoding" | ||
28 | +#endif | ||
29 | + | 16 | + |
30 | int cpu_signal_handler(int host_signum, void *pinfo, | 17 | INSN_VLD1 = 0xf4200000, /* VLD1 (multiple single elements) */ |
31 | void *puc) | 18 | INSN_VST1 = 0xf4000000, /* VST1 (multiple single elements) */ |
19 | } ARMInsn; | ||
20 | @@ -XXX,XX +XXX,XX @@ static uint32_t encode_vd(TCGReg rd) | ||
21 | return (extract32(rd, 3, 1) << 22) | (extract32(rd, 0, 3) << 13); | ||
22 | } | ||
23 | |||
24 | +static uint32_t encode_vn(TCGReg rn) | ||
25 | +{ | ||
26 | + tcg_debug_assert(rn >= TCG_REG_Q0); | ||
27 | + return (extract32(rn, 3, 1) << 7) | (extract32(rn, 0, 3) << 17); | ||
28 | +} | ||
29 | + | ||
30 | +static uint32_t encode_vm(TCGReg rm) | ||
31 | +{ | ||
32 | + tcg_debug_assert(rm >= TCG_REG_Q0); | ||
33 | + return (extract32(rm, 3, 1) << 5) | (extract32(rm, 0, 3) << 1); | ||
34 | +} | ||
35 | + | ||
36 | +static void tcg_out_vreg3(TCGContext *s, ARMInsn insn, int q, int vece, | ||
37 | + TCGReg d, TCGReg n, TCGReg m) | ||
38 | +{ | ||
39 | + tcg_out32(s, insn | (vece << 20) | (q << 6) | | ||
40 | + encode_vd(d) | encode_vn(n) | encode_vm(m)); | ||
41 | +} | ||
42 | + | ||
43 | static void tcg_out_vldst(TCGContext *s, ARMInsn insn, | ||
44 | TCGReg rd, TCGReg rn, int offset) | ||
32 | { | 45 | { |
33 | siginfo_t *info = pinfo; | 46 | @@ -XXX,XX +XXX,XX @@ static inline bool tcg_out_sti(TCGContext *s, TCGType type, TCGArg val, |
34 | ucontext_t *uc = puc; | 47 | return false; |
35 | - greg_t pc = uc->uc_mcontext.pc; | 48 | } |
36 | - int is_write; | 49 | |
37 | + uintptr_t pc = uc->uc_mcontext.pc; | 50 | -static inline bool tcg_out_mov(TCGContext *s, TCGType type, |
38 | + uint32_t insn = *(uint32_t *)pc; | 51 | - TCGReg ret, TCGReg arg) |
39 | + int is_write = 0; | 52 | +static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg) |
53 | { | ||
54 | - tcg_out_mov_reg(s, COND_AL, ret, arg); | ||
55 | - return true; | ||
56 | + if (ret == arg) { | ||
57 | + return true; | ||
58 | + } | ||
59 | + switch (type) { | ||
60 | + case TCG_TYPE_I32: | ||
61 | + if (ret < TCG_REG_Q0 && arg < TCG_REG_Q0) { | ||
62 | + tcg_out_mov_reg(s, COND_AL, ret, arg); | ||
63 | + return true; | ||
64 | + } | ||
65 | + return false; | ||
40 | + | 66 | + |
41 | + /* Detect all store instructions at program counter. */ | 67 | + case TCG_TYPE_V64: |
42 | + switch((insn >> 26) & 077) { | 68 | + case TCG_TYPE_V128: |
43 | + case 050: /* SB */ | 69 | + /* "VMOV D,N" is an alias for "VORR D,N,N". */ |
44 | + case 051: /* SH */ | 70 | + tcg_out_vreg3(s, INSN_VORR, type - TCG_TYPE_V64, 0, ret, arg, arg); |
45 | + case 052: /* SWL */ | 71 | + return true; |
46 | + case 053: /* SW */ | 72 | + |
47 | + case 054: /* SDL */ | 73 | + default: |
48 | + case 055: /* SDR */ | 74 | + g_assert_not_reached(); |
49 | + case 056: /* SWR */ | ||
50 | + case 070: /* SC */ | ||
51 | + case 071: /* SWC1 */ | ||
52 | + case 074: /* SCD */ | ||
53 | + case 075: /* SDC1 */ | ||
54 | + case 077: /* SD */ | ||
55 | +#if !defined(__mips_isa_rev) || __mips_isa_rev < 6 | ||
56 | + case 072: /* SWC2 */ | ||
57 | + case 076: /* SDC2 */ | ||
58 | +#endif | ||
59 | + is_write = 1; | ||
60 | + break; | ||
61 | + case 023: /* COP1X */ | ||
62 | + /* Required in all versions of MIPS64 since | ||
63 | + MIPS64r1 and subsequent versions of MIPS32r2. */ | ||
64 | + switch (insn & 077) { | ||
65 | + case 010: /* SWXC1 */ | ||
66 | + case 011: /* SDXC1 */ | ||
67 | + case 015: /* SUXC1 */ | ||
68 | + is_write = 1; | ||
69 | + } | ||
70 | + break; | ||
71 | + } | 75 | + } |
72 | |||
73 | - /* XXX: compute is_write */ | ||
74 | - is_write = 0; | ||
75 | return handle_cpu_signal(pc, info, is_write, &uc->uc_sigmask); | ||
76 | } | 76 | } |
77 | |||
78 | -static inline void tcg_out_movi(TCGContext *s, TCGType type, | ||
79 | - TCGReg ret, tcg_target_long arg) | ||
80 | +static void tcg_out_movi(TCGContext *s, TCGType type, | ||
81 | + TCGReg ret, tcg_target_long arg) | ||
82 | { | ||
83 | + tcg_debug_assert(type == TCG_TYPE_I32); | ||
84 | + tcg_debug_assert(ret < TCG_REG_Q0); | ||
85 | tcg_out_movi32(s, COND_AL, ret, arg); | ||
86 | } | ||
77 | 87 | ||
78 | -- | 88 | -- |
79 | 2.25.1 | 89 | 2.25.1 |
80 | 90 | ||
81 | 91 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | Most of dupi is copied from tcg/aarch64, which has the same | ||
2 | encoding for AdvSimdExpandImm. | ||
1 | 3 | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | --- | ||
7 | tcg/arm/tcg-target.c.inc | 283 +++++++++++++++++++++++++++++++++++++-- | ||
8 | 1 file changed, 275 insertions(+), 8 deletions(-) | ||
9 | |||
10 | diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc | ||
11 | index XXXXXXX..XXXXXXX 100644 | ||
12 | --- a/tcg/arm/tcg-target.c.inc | ||
13 | +++ b/tcg/arm/tcg-target.c.inc | ||
14 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
15 | |||
16 | INSN_VORR = 0xf2200110, | ||
17 | |||
18 | + INSN_VDUP_G = 0xee800b10, /* VDUP (ARM core register) */ | ||
19 | + INSN_VDUP_S = 0xf3b00c00, /* VDUP (scalar) */ | ||
20 | + INSN_VLDR_D = 0xed100b00, /* VLDR.64 */ | ||
21 | INSN_VLD1 = 0xf4200000, /* VLD1 (multiple single elements) */ | ||
22 | + INSN_VLD1R = 0xf4a00c00, /* VLD1 (single element to all lanes) */ | ||
23 | INSN_VST1 = 0xf4000000, /* VST1 (multiple single elements) */ | ||
24 | + INSN_VMOVI = 0xf2800010, /* VMOV (immediate) */ | ||
25 | } ARMInsn; | ||
26 | |||
27 | #define INSN_NOP (use_armv7_instructions ? INSN_NOP_v6k : INSN_NOP_v4) | ||
28 | @@ -XXX,XX +XXX,XX @@ static const uint8_t tcg_cond_to_arm_cond[] = { | ||
29 | [TCG_COND_GTU] = COND_HI, | ||
30 | }; | ||
31 | |||
32 | +static int encode_imm(uint32_t imm); | ||
33 | + | ||
34 | +/* TCG private relocation type: add with pc+imm8 */ | ||
35 | +#define R_ARM_PC8 11 | ||
36 | + | ||
37 | +/* TCG private relocation type: vldr with imm8 << 2 */ | ||
38 | +#define R_ARM_PC11 12 | ||
39 | + | ||
40 | static bool reloc_pc24(tcg_insn_unit *src_rw, const tcg_insn_unit *target) | ||
41 | { | ||
42 | const tcg_insn_unit *src_rx = tcg_splitwx_to_rx(src_rw); | ||
43 | @@ -XXX,XX +XXX,XX @@ static bool reloc_pc13(tcg_insn_unit *src_rw, const tcg_insn_unit *target) | ||
44 | return false; | ||
45 | } | ||
46 | |||
47 | +static bool reloc_pc11(tcg_insn_unit *src_rw, const tcg_insn_unit *target) | ||
48 | +{ | ||
49 | + const tcg_insn_unit *src_rx = tcg_splitwx_to_rx(src_rw); | ||
50 | + ptrdiff_t offset = (tcg_ptr_byte_diff(target, src_rx) - 8) / 4; | ||
51 | + | ||
52 | + if (offset >= -0xff && offset <= 0xff) { | ||
53 | + tcg_insn_unit insn = *src_rw; | ||
54 | + bool u = (offset >= 0); | ||
55 | + if (!u) { | ||
56 | + offset = -offset; | ||
57 | + } | ||
58 | + insn = deposit32(insn, 23, 1, u); | ||
59 | + insn = deposit32(insn, 0, 8, offset); | ||
60 | + *src_rw = insn; | ||
61 | + return true; | ||
62 | + } | ||
63 | + return false; | ||
64 | +} | ||
65 | + | ||
66 | +static bool reloc_pc8(tcg_insn_unit *src_rw, const tcg_insn_unit *target) | ||
67 | +{ | ||
68 | + const tcg_insn_unit *src_rx = tcg_splitwx_to_rx(src_rw); | ||
69 | + ptrdiff_t offset = tcg_ptr_byte_diff(target, src_rx) - 8; | ||
70 | + int rot = encode_imm(offset); | ||
71 | + | ||
72 | + if (rot >= 0) { | ||
73 | + *src_rw = deposit32(*src_rw, 0, 12, rol32(offset, rot) | (rot << 7)); | ||
74 | + return true; | ||
75 | + } | ||
76 | + return false; | ||
77 | +} | ||
78 | + | ||
79 | static bool patch_reloc(tcg_insn_unit *code_ptr, int type, | ||
80 | intptr_t value, intptr_t addend) | ||
81 | { | ||
82 | tcg_debug_assert(addend == 0); | ||
83 | - | ||
84 | - if (type == R_ARM_PC24) { | ||
85 | + switch (type) { | ||
86 | + case R_ARM_PC24: | ||
87 | return reloc_pc24(code_ptr, (const tcg_insn_unit *)value); | ||
88 | - } else if (type == R_ARM_PC13) { | ||
89 | + case R_ARM_PC13: | ||
90 | return reloc_pc13(code_ptr, (const tcg_insn_unit *)value); | ||
91 | - } else { | ||
92 | + case R_ARM_PC11: | ||
93 | + return reloc_pc11(code_ptr, (const tcg_insn_unit *)value); | ||
94 | + case R_ARM_PC8: | ||
95 | + return reloc_pc8(code_ptr, (const tcg_insn_unit *)value); | ||
96 | + default: | ||
97 | g_assert_not_reached(); | ||
98 | } | ||
99 | } | ||
100 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t rotl(uint32_t val, int n) | ||
101 | |||
102 | /* ARM immediates for ALU instructions are made of an unsigned 8-bit | ||
103 | right-rotated by an even amount between 0 and 30. */ | ||
104 | -static inline int encode_imm(uint32_t imm) | ||
105 | +static int encode_imm(uint32_t imm) | ||
106 | { | ||
107 | int shift; | ||
108 | |||
109 | @@ -XXX,XX +XXX,XX @@ static inline int check_fit_imm(uint32_t imm) | ||
110 | return encode_imm(imm) >= 0; | ||
111 | } | ||
112 | |||
113 | +/* Return true if v16 is a valid 16-bit shifted immediate. */ | ||
114 | +static bool is_shimm16(uint16_t v16, int *cmode, int *imm8) | ||
115 | +{ | ||
116 | + if (v16 == (v16 & 0xff)) { | ||
117 | + *cmode = 0x8; | ||
118 | + *imm8 = v16 & 0xff; | ||
119 | + return true; | ||
120 | + } else if (v16 == (v16 & 0xff00)) { | ||
121 | + *cmode = 0xa; | ||
122 | + *imm8 = v16 >> 8; | ||
123 | + return true; | ||
124 | + } | ||
125 | + return false; | ||
126 | +} | ||
127 | + | ||
128 | +/* Return true if v32 is a valid 32-bit shifted immediate. */ | ||
129 | +static bool is_shimm32(uint32_t v32, int *cmode, int *imm8) | ||
130 | +{ | ||
131 | + if (v32 == (v32 & 0xff)) { | ||
132 | + *cmode = 0x0; | ||
133 | + *imm8 = v32 & 0xff; | ||
134 | + return true; | ||
135 | + } else if (v32 == (v32 & 0xff00)) { | ||
136 | + *cmode = 0x2; | ||
137 | + *imm8 = (v32 >> 8) & 0xff; | ||
138 | + return true; | ||
139 | + } else if (v32 == (v32 & 0xff0000)) { | ||
140 | + *cmode = 0x4; | ||
141 | + *imm8 = (v32 >> 16) & 0xff; | ||
142 | + return true; | ||
143 | + } else if (v32 == (v32 & 0xff000000)) { | ||
144 | + *cmode = 0x6; | ||
145 | + *imm8 = v32 >> 24; | ||
146 | + return true; | ||
147 | + } | ||
148 | + return false; | ||
149 | +} | ||
150 | + | ||
151 | +/* Return true if v32 is a valid 32-bit shifting ones immediate. */ | ||
152 | +static bool is_soimm32(uint32_t v32, int *cmode, int *imm8) | ||
153 | +{ | ||
154 | + if ((v32 & 0xffff00ff) == 0xff) { | ||
155 | + *cmode = 0xc; | ||
156 | + *imm8 = (v32 >> 8) & 0xff; | ||
157 | + return true; | ||
158 | + } else if ((v32 & 0xff00ffff) == 0xffff) { | ||
159 | + *cmode = 0xd; | ||
160 | + *imm8 = (v32 >> 16) & 0xff; | ||
161 | + return true; | ||
162 | + } | ||
163 | + return false; | ||
164 | +} | ||
165 | + | ||
166 | +/* | ||
167 | + * Return non-zero if v32 can be formed by MOVI+ORR. | ||
168 | + * Place the parameters for MOVI in (cmode, imm8). | ||
169 | + * Return the cmode for ORR; the imm8 can be had via extraction from v32. | ||
170 | + */ | ||
171 | +static int is_shimm32_pair(uint32_t v32, int *cmode, int *imm8) | ||
172 | +{ | ||
173 | + int i; | ||
174 | + | ||
175 | + for (i = 6; i > 0; i -= 2) { | ||
176 | + /* Mask out one byte we can add with ORR. */ | ||
177 | + uint32_t tmp = v32 & ~(0xffu << (i * 4)); | ||
178 | + if (is_shimm32(tmp, cmode, imm8) || | ||
179 | + is_soimm32(tmp, cmode, imm8)) { | ||
180 | + break; | ||
181 | + } | ||
182 | + } | ||
183 | + return i; | ||
184 | +} | ||
185 | + | ||
186 | /* Test if a constant matches the constraint. | ||
187 | * TODO: define constraints for: | ||
188 | * | ||
189 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_vreg3(TCGContext *s, ARMInsn insn, int q, int vece, | ||
190 | encode_vd(d) | encode_vn(n) | encode_vm(m)); | ||
191 | } | ||
192 | |||
193 | +static void tcg_out_vmovi(TCGContext *s, TCGReg rd, | ||
194 | + int q, int op, int cmode, uint8_t imm8) | ||
195 | +{ | ||
196 | + tcg_out32(s, INSN_VMOVI | encode_vd(rd) | (q << 6) | (op << 5) | ||
197 | + | (cmode << 8) | extract32(imm8, 0, 4) | ||
198 | + | (extract32(imm8, 4, 3) << 16) | ||
199 | + | (extract32(imm8, 7, 1) << 24)); | ||
200 | +} | ||
201 | + | ||
202 | static void tcg_out_vldst(TCGContext *s, ARMInsn insn, | ||
203 | TCGReg rd, TCGReg rn, int offset) | ||
204 | { | ||
205 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_movi(TCGContext *s, TCGType type, | ||
206 | tcg_out_movi32(s, COND_AL, ret, arg); | ||
207 | } | ||
208 | |||
209 | +/* Type is always V128, with I64 elements. */ | ||
210 | +static void tcg_out_dup2_vec(TCGContext *s, TCGReg rd, TCGReg rl, TCGReg rh) | ||
211 | +{ | ||
212 | + /* Move high element into place first. */ | ||
213 | + /* VMOV Dd+1, Ds */ | ||
214 | + tcg_out_vreg3(s, INSN_VORR | (1 << 12), 0, 0, rd, rh, rh); | ||
215 | + /* Move low element into place; tcg_out_mov will check for nop. */ | ||
216 | + tcg_out_mov(s, TCG_TYPE_V64, rd, rl); | ||
217 | +} | ||
218 | + | ||
219 | static bool tcg_out_dup_vec(TCGContext *s, TCGType type, unsigned vece, | ||
220 | TCGReg rd, TCGReg rs) | ||
221 | { | ||
222 | - g_assert_not_reached(); | ||
223 | + int q = type - TCG_TYPE_V64; | ||
224 | + | ||
225 | + if (vece == MO_64) { | ||
226 | + if (type == TCG_TYPE_V128) { | ||
227 | + tcg_out_dup2_vec(s, rd, rs, rs); | ||
228 | + } else { | ||
229 | + tcg_out_mov(s, TCG_TYPE_V64, rd, rs); | ||
230 | + } | ||
231 | + } else if (rs < TCG_REG_Q0) { | ||
232 | + int b = (vece == MO_8); | ||
233 | + int e = (vece == MO_16); | ||
234 | + tcg_out32(s, INSN_VDUP_G | (b << 22) | (q << 21) | (e << 5) | | ||
235 | + encode_vn(rd) | (rs << 12)); | ||
236 | + } else { | ||
237 | + int imm4 = 1 << vece; | ||
238 | + tcg_out32(s, INSN_VDUP_S | (imm4 << 16) | (q << 6) | | ||
239 | + encode_vd(rd) | encode_vm(rs)); | ||
240 | + } | ||
241 | + return true; | ||
242 | } | ||
243 | |||
244 | static bool tcg_out_dupm_vec(TCGContext *s, TCGType type, unsigned vece, | ||
245 | TCGReg rd, TCGReg base, intptr_t offset) | ||
246 | { | ||
247 | - g_assert_not_reached(); | ||
248 | + if (vece == MO_64) { | ||
249 | + tcg_out_ld(s, TCG_TYPE_V64, rd, base, offset); | ||
250 | + if (type == TCG_TYPE_V128) { | ||
251 | + tcg_out_dup2_vec(s, rd, rd, rd); | ||
252 | + } | ||
253 | + } else { | ||
254 | + int q = type - TCG_TYPE_V64; | ||
255 | + tcg_out_vldst(s, INSN_VLD1R | (vece << 6) | (q << 5), | ||
256 | + rd, base, offset); | ||
257 | + } | ||
258 | + return true; | ||
259 | } | ||
260 | |||
261 | static void tcg_out_dupi_vec(TCGContext *s, TCGType type, unsigned vece, | ||
262 | TCGReg rd, int64_t v64) | ||
263 | { | ||
264 | - g_assert_not_reached(); | ||
265 | + int q = type - TCG_TYPE_V64; | ||
266 | + int cmode, imm8, i; | ||
267 | + | ||
268 | + /* Test all bytes equal first. */ | ||
269 | + if (vece == MO_8) { | ||
270 | + tcg_out_vmovi(s, rd, q, 0, 0xe, v64); | ||
271 | + return; | ||
272 | + } | ||
273 | + | ||
274 | + /* | ||
275 | + * Test all bytes 0x00 or 0xff second. This can match cases that | ||
276 | + * might otherwise take 2 or 3 insns for MO_16 or MO_32 below. | ||
277 | + */ | ||
278 | + for (i = imm8 = 0; i < 8; i++) { | ||
279 | + uint8_t byte = v64 >> (i * 8); | ||
280 | + if (byte == 0xff) { | ||
281 | + imm8 |= 1 << i; | ||
282 | + } else if (byte != 0) { | ||
283 | + goto fail_bytes; | ||
284 | + } | ||
285 | + } | ||
286 | + tcg_out_vmovi(s, rd, q, 1, 0xe, imm8); | ||
287 | + return; | ||
288 | + fail_bytes: | ||
289 | + | ||
290 | + /* | ||
291 | + * Tests for various replications. For each element width, if we | ||
292 | + * cannot find an expansion there's no point checking a larger | ||
293 | + * width because we already know by replication it cannot match. | ||
294 | + */ | ||
295 | + if (vece == MO_16) { | ||
296 | + uint16_t v16 = v64; | ||
297 | + | ||
298 | + if (is_shimm16(v16, &cmode, &imm8)) { | ||
299 | + tcg_out_vmovi(s, rd, q, 0, cmode, imm8); | ||
300 | + return; | ||
301 | + } | ||
302 | + if (is_shimm16(~v16, &cmode, &imm8)) { | ||
303 | + tcg_out_vmovi(s, rd, q, 1, cmode, imm8); | ||
304 | + return; | ||
305 | + } | ||
306 | + | ||
307 | + /* | ||
308 | + * Otherwise, all remaining constants can be loaded in two insns: | ||
309 | + * rd = v16 & 0xff, rd |= v16 & 0xff00. | ||
310 | + */ | ||
311 | + tcg_out_vmovi(s, rd, q, 0, 0x8, v16 & 0xff); | ||
312 | + tcg_out_vmovi(s, rd, q, 0, 0xb, v16 >> 8); /* VORRI */ | ||
313 | + return; | ||
314 | + } | ||
315 | + | ||
316 | + if (vece == MO_32) { | ||
317 | + uint32_t v32 = v64; | ||
318 | + | ||
319 | + if (is_shimm32(v32, &cmode, &imm8) || | ||
320 | + is_soimm32(v32, &cmode, &imm8)) { | ||
321 | + tcg_out_vmovi(s, rd, q, 0, cmode, imm8); | ||
322 | + return; | ||
323 | + } | ||
324 | + if (is_shimm32(~v32, &cmode, &imm8) || | ||
325 | + is_soimm32(~v32, &cmode, &imm8)) { | ||
326 | + tcg_out_vmovi(s, rd, q, 1, cmode, imm8); | ||
327 | + return; | ||
328 | + } | ||
329 | + | ||
330 | + /* | ||
331 | + * Restrict the set of constants to those we can load with | ||
332 | + * two instructions. Others we load from the pool. | ||
333 | + */ | ||
334 | + i = is_shimm32_pair(v32, &cmode, &imm8); | ||
335 | + if (i) { | ||
336 | + tcg_out_vmovi(s, rd, q, 0, cmode, imm8); | ||
337 | + tcg_out_vmovi(s, rd, q, 0, i | 1, extract32(v32, i * 4, 8)); | ||
338 | + return; | ||
339 | + } | ||
340 | + i = is_shimm32_pair(~v32, &cmode, &imm8); | ||
341 | + if (i) { | ||
342 | + tcg_out_vmovi(s, rd, q, 1, cmode, imm8); | ||
343 | + tcg_out_vmovi(s, rd, q, 1, i | 1, extract32(~v32, i * 4, 8)); | ||
344 | + return; | ||
345 | + } | ||
346 | + } | ||
347 | + | ||
348 | + /* | ||
349 | + * As a last resort, load from the constant pool. | ||
350 | + */ | ||
351 | + if (!q || vece == MO_64) { | ||
352 | + new_pool_l2(s, R_ARM_PC11, s->code_ptr, 0, v64, v64 >> 32); | ||
353 | + /* VLDR Dd, [pc + offset] */ | ||
354 | + tcg_out32(s, INSN_VLDR_D | encode_vd(rd) | (0xf << 16)); | ||
355 | + if (q) { | ||
356 | + tcg_out_dup2_vec(s, rd, rd, rd); | ||
357 | + } | ||
358 | + } else { | ||
359 | + new_pool_label(s, (uint32_t)v64, R_ARM_PC8, s->code_ptr, 0); | ||
360 | + /* add tmp, pc, offset */ | ||
361 | + tcg_out_dat_imm(s, COND_AL, ARITH_ADD, TCG_REG_TMP, TCG_REG_PC, 0); | ||
362 | + tcg_out_dupm_vec(s, type, MO_32, rd, TCG_REG_TMP, 0); | ||
363 | + } | ||
364 | } | ||
365 | |||
366 | static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, | ||
367 | -- | ||
368 | 2.25.1 | ||
369 | |||
370 | diff view generated by jsdifflib |
1 | With larger vector sizes, it turns out oprsz == maxsz, and we only | 1 | Implementing dup2, add, sub, and, or, xor as the minimal set. |
---|---|---|---|
2 | need to represent mismatch for oprsz <= 32. We do, however, need | 2 | This allows us to actually enable neon in the header file. |
3 | to represent larger oprsz and do so without reducing SIMD_DATA_BITS. | ||
4 | 3 | ||
5 | Reduce the size of the oprsz field and increase the maxsz field. | 4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Steal the oprsz value of 24 to indicate equality with maxsz. | ||
7 | |||
8 | Tested-by: Frank Chang <frank.chang@sifive.com> | ||
9 | Reviewed-by: Frank Chang <frank.chang@sifive.com> | ||
10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
11 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
12 | --- | 6 | --- |
13 | include/tcg/tcg-gvec-desc.h | 38 ++++++++++++++++++++++++------------- | 7 | tcg/arm/tcg-target-con-set.h | 3 + |
14 | tcg/tcg-op-gvec.c | 35 ++++++++++++++++++++++++++-------- | 8 | tcg/arm/tcg-target-con-str.h | 2 + |
15 | 2 files changed, 52 insertions(+), 21 deletions(-) | 9 | tcg/arm/tcg-target.h | 6 +- |
10 | tcg/arm/tcg-target.c.inc | 201 +++++++++++++++++++++++++++++++++-- | ||
11 | 4 files changed, 204 insertions(+), 8 deletions(-) | ||
16 | 12 | ||
17 | diff --git a/include/tcg/tcg-gvec-desc.h b/include/tcg/tcg-gvec-desc.h | 13 | diff --git a/tcg/arm/tcg-target-con-set.h b/tcg/arm/tcg-target-con-set.h |
18 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/include/tcg/tcg-gvec-desc.h | 15 | --- a/tcg/arm/tcg-target-con-set.h |
20 | +++ b/include/tcg/tcg-gvec-desc.h | 16 | +++ b/tcg/arm/tcg-target-con-set.h |
21 | @@ -XXX,XX +XXX,XX @@ | 17 | @@ -XXX,XX +XXX,XX @@ C_O1_I2(r, r, rIN) |
22 | #ifndef TCG_TCG_GVEC_DESC_H | 18 | C_O1_I2(r, r, ri) |
23 | #define TCG_TCG_GVEC_DESC_H | 19 | C_O1_I2(r, rZ, rZ) |
24 | 20 | C_O1_I2(w, w, w) | |
25 | -/* ??? These bit widths are set for ARM SVE, maxing out at 256 byte vectors. */ | 21 | +C_O1_I2(w, w, wO) |
26 | -#define SIMD_OPRSZ_SHIFT 0 | 22 | +C_O1_I2(w, w, wV) |
27 | -#define SIMD_OPRSZ_BITS 5 | 23 | +C_O1_I2(w, w, wZ) |
28 | +/* | 24 | C_O1_I4(r, r, r, rI, rI) |
29 | + * This configuration allows MAXSZ to represent 2048 bytes, and | 25 | C_O1_I4(r, r, rIN, rIK, 0) |
30 | + * OPRSZ to match MAXSZ, or represent the smaller values 8, 16, or 32. | 26 | C_O2_I1(r, r, l) |
31 | + * | 27 | diff --git a/tcg/arm/tcg-target-con-str.h b/tcg/arm/tcg-target-con-str.h |
32 | + * Encode this with: | 28 | index XXXXXXX..XXXXXXX 100644 |
33 | + * 0, 1, 3 -> 8, 16, 32 | 29 | --- a/tcg/arm/tcg-target-con-str.h |
34 | + * 2 -> maxsz | 30 | +++ b/tcg/arm/tcg-target-con-str.h |
35 | + * | 31 | @@ -XXX,XX +XXX,XX @@ REGS('w', ALL_VECTOR_REGS) |
36 | + * This steals the input that would otherwise map to 24 to match maxsz. | 32 | CONST('I', TCG_CT_CONST_ARM) |
37 | + */ | 33 | CONST('K', TCG_CT_CONST_INV) |
38 | +#define SIMD_MAXSZ_SHIFT 0 | 34 | CONST('N', TCG_CT_CONST_NEG) |
39 | +#define SIMD_MAXSZ_BITS 8 | 35 | +CONST('O', TCG_CT_CONST_ORRI) |
40 | 36 | +CONST('V', TCG_CT_CONST_ANDI) | |
41 | -#define SIMD_MAXSZ_SHIFT (SIMD_OPRSZ_SHIFT + SIMD_OPRSZ_BITS) | 37 | CONST('Z', TCG_CT_CONST_ZERO) |
42 | -#define SIMD_MAXSZ_BITS 5 | 38 | diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h |
43 | +#define SIMD_OPRSZ_SHIFT (SIMD_MAXSZ_SHIFT + SIMD_MAXSZ_BITS) | 39 | index XXXXXXX..XXXXXXX 100644 |
44 | +#define SIMD_OPRSZ_BITS 2 | 40 | --- a/tcg/arm/tcg-target.h |
45 | 41 | +++ b/tcg/arm/tcg-target.h | |
46 | -#define SIMD_DATA_SHIFT (SIMD_MAXSZ_SHIFT + SIMD_MAXSZ_BITS) | 42 | @@ -XXX,XX +XXX,XX @@ typedef enum { |
47 | +#define SIMD_DATA_SHIFT (SIMD_OPRSZ_SHIFT + SIMD_OPRSZ_BITS) | 43 | #else |
48 | #define SIMD_DATA_BITS (32 - SIMD_DATA_SHIFT) | 44 | extern bool use_idiv_instructions; |
49 | 45 | #endif | |
50 | /* Create a descriptor from components. */ | 46 | -#define use_neon_instructions 0 |
51 | uint32_t simd_desc(uint32_t oprsz, uint32_t maxsz, int32_t data); | 47 | +#ifdef __ARM_NEON__ |
52 | 48 | +#define use_neon_instructions 1 | |
53 | -/* Extract the operation size from a descriptor. */ | 49 | +#else |
54 | -static inline intptr_t simd_oprsz(uint32_t desc) | 50 | +extern bool use_neon_instructions; |
55 | -{ | 51 | +#endif |
56 | - return (extract32(desc, SIMD_OPRSZ_SHIFT, SIMD_OPRSZ_BITS) + 1) * 8; | 52 | |
57 | -} | 53 | /* used for function call generation */ |
58 | - | 54 | #define TCG_TARGET_STACK_ALIGN 8 |
59 | /* Extract the max vector size from a descriptor. */ | 55 | diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc |
60 | static inline intptr_t simd_maxsz(uint32_t desc) | 56 | index XXXXXXX..XXXXXXX 100644 |
61 | { | 57 | --- a/tcg/arm/tcg-target.c.inc |
62 | - return (extract32(desc, SIMD_MAXSZ_SHIFT, SIMD_MAXSZ_BITS) + 1) * 8; | 58 | +++ b/tcg/arm/tcg-target.c.inc |
63 | + return extract32(desc, SIMD_MAXSZ_SHIFT, SIMD_MAXSZ_BITS) * 8 + 8; | 59 | @@ -XXX,XX +XXX,XX @@ int arm_arch = __ARM_ARCH; |
60 | #ifndef use_idiv_instructions | ||
61 | bool use_idiv_instructions; | ||
62 | #endif | ||
63 | +#ifndef use_neon_instructions | ||
64 | +bool use_neon_instructions; | ||
65 | +#endif | ||
66 | |||
67 | /* ??? Ought to think about changing CONFIG_SOFTMMU to always defined. */ | ||
68 | #ifdef CONFIG_SOFTMMU | ||
69 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
70 | /* Otherwise the assembler uses mov r0,r0 */ | ||
71 | INSN_NOP_v4 = (COND_AL << 28) | ARITH_MOV, | ||
72 | |||
73 | + INSN_VADD = 0xf2000800, | ||
74 | + INSN_VAND = 0xf2000110, | ||
75 | + INSN_VEOR = 0xf3000110, | ||
76 | INSN_VORR = 0xf2200110, | ||
77 | + INSN_VSUB = 0xf3000800, | ||
78 | + | ||
79 | + INSN_VMVN = 0xf3b00580, | ||
80 | + | ||
81 | + INSN_VCEQ0 = 0xf3b10100, | ||
82 | + INSN_VCGT0 = 0xf3b10000, | ||
83 | + INSN_VCGE0 = 0xf3b10080, | ||
84 | + INSN_VCLE0 = 0xf3b10180, | ||
85 | + INSN_VCLT0 = 0xf3b10200, | ||
86 | + | ||
87 | + INSN_VCEQ = 0xf3000810, | ||
88 | + INSN_VCGE = 0xf2000310, | ||
89 | + INSN_VCGT = 0xf2000300, | ||
90 | + INSN_VCGE_U = 0xf3000310, | ||
91 | + INSN_VCGT_U = 0xf3000300, | ||
92 | + | ||
93 | + INSN_VTST = 0xf2000810, | ||
94 | |||
95 | INSN_VDUP_G = 0xee800b10, /* VDUP (ARM core register) */ | ||
96 | INSN_VDUP_S = 0xf3b00c00, /* VDUP (scalar) */ | ||
97 | @@ -XXX,XX +XXX,XX @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int type, | ||
98 | #define TCG_CT_CONST_INV 0x200 | ||
99 | #define TCG_CT_CONST_NEG 0x400 | ||
100 | #define TCG_CT_CONST_ZERO 0x800 | ||
101 | +#define TCG_CT_CONST_ORRI 0x1000 | ||
102 | +#define TCG_CT_CONST_ANDI 0x2000 | ||
103 | |||
104 | #define ALL_GENERAL_REGS 0xffffu | ||
105 | #define ALL_VECTOR_REGS 0xffff0000u | ||
106 | @@ -XXX,XX +XXX,XX @@ static int is_shimm32_pair(uint32_t v32, int *cmode, int *imm8) | ||
107 | return i; | ||
108 | } | ||
109 | |||
110 | +/* Return true if V is a valid 16-bit or 32-bit shifted immediate. */ | ||
111 | +static bool is_shimm1632(uint32_t v32, int *cmode, int *imm8) | ||
112 | +{ | ||
113 | + if (v32 == deposit32(v32, 16, 16, v32)) { | ||
114 | + return is_shimm16(v32, cmode, imm8); | ||
115 | + } else { | ||
116 | + return is_shimm32(v32, cmode, imm8); | ||
117 | + } | ||
64 | +} | 118 | +} |
65 | + | 119 | + |
66 | +/* Extract the operation size from a descriptor. */ | 120 | /* Test if a constant matches the constraint. |
67 | +static inline intptr_t simd_oprsz(uint32_t desc) | 121 | * TODO: define constraints for: |
68 | +{ | 122 | * |
69 | + uint32_t f = extract32(desc, SIMD_OPRSZ_SHIFT, SIMD_OPRSZ_BITS); | 123 | @@ -XXX,XX +XXX,XX @@ static bool tcg_target_const_match(int64_t val, TCGType type, int ct) |
70 | + intptr_t o = f * 8 + 8; | 124 | return 1; |
71 | + intptr_t m = simd_maxsz(desc); | 125 | } else if ((ct & TCG_CT_CONST_ZERO) && val == 0) { |
72 | + return f == 2 ? m : o; | 126 | return 1; |
73 | } | 127 | - } else { |
74 | 128 | - return 0; | |
75 | /* Extract the operation-specific data from a descriptor. */ | 129 | } |
76 | diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c | 130 | + |
77 | index XXXXXXX..XXXXXXX 100644 | 131 | + switch (ct & (TCG_CT_CONST_ORRI | TCG_CT_CONST_ANDI)) { |
78 | --- a/tcg/tcg-op-gvec.c | 132 | + case 0: |
79 | +++ b/tcg/tcg-op-gvec.c | 133 | + break; |
80 | @@ -XXX,XX +XXX,XX @@ static const TCGOpcode vecop_list_empty[1] = { 0 }; | 134 | + case TCG_CT_CONST_ANDI: |
81 | of the operand offsets so that we can check them all at once. */ | 135 | + val = ~val; |
82 | static void check_size_align(uint32_t oprsz, uint32_t maxsz, uint32_t ofs) | 136 | + /* fallthru */ |
83 | { | 137 | + case TCG_CT_CONST_ORRI: |
84 | - uint32_t opr_align = oprsz >= 16 ? 15 : 7; | 138 | + if (val == deposit64(val, 32, 32, val)) { |
85 | - uint32_t max_align = maxsz >= 16 || oprsz >= 16 ? 15 : 7; | 139 | + int cmode, imm8; |
86 | - tcg_debug_assert(oprsz > 0); | 140 | + return is_shimm1632(val, &cmode, &imm8); |
87 | - tcg_debug_assert(oprsz <= maxsz); | 141 | + } |
88 | - tcg_debug_assert((oprsz & opr_align) == 0); | ||
89 | + uint32_t max_align; | ||
90 | + | ||
91 | + switch (oprsz) { | ||
92 | + case 8: | ||
93 | + case 16: | ||
94 | + case 32: | ||
95 | + tcg_debug_assert(oprsz <= maxsz); | ||
96 | + break; | 142 | + break; |
97 | + default: | 143 | + default: |
98 | + tcg_debug_assert(oprsz == maxsz); | 144 | + /* Both bits should not be set for the same insn. */ |
99 | + break; | 145 | + g_assert_not_reached(); |
100 | + } | 146 | + } |
101 | + tcg_debug_assert(maxsz <= (8 << SIMD_MAXSZ_BITS)); | 147 | + |
102 | + | 148 | + return 0; |
103 | + max_align = maxsz >= 16 ? 15 : 7; | 149 | } |
104 | tcg_debug_assert((maxsz & max_align) == 0); | 150 | |
105 | tcg_debug_assert((ofs & max_align) == 0); | 151 | static inline void tcg_out_b(TCGContext *s, int cond, int32_t offset) |
106 | } | 152 | @@ -XXX,XX +XXX,XX @@ static uint32_t encode_vm(TCGReg rm) |
107 | @@ -XXX,XX +XXX,XX @@ uint32_t simd_desc(uint32_t oprsz, uint32_t maxsz, int32_t data) | 153 | return (extract32(rm, 3, 1) << 5) | (extract32(rm, 0, 3) << 1); |
154 | } | ||
155 | |||
156 | +static void tcg_out_vreg2(TCGContext *s, ARMInsn insn, int q, int vece, | ||
157 | + TCGReg d, TCGReg m) | ||
158 | +{ | ||
159 | + tcg_out32(s, insn | (vece << 18) | (q << 6) | | ||
160 | + encode_vd(d) | encode_vm(m)); | ||
161 | +} | ||
162 | + | ||
163 | static void tcg_out_vreg3(TCGContext *s, ARMInsn insn, int q, int vece, | ||
164 | TCGReg d, TCGReg n, TCGReg m) | ||
108 | { | 165 | { |
109 | uint32_t desc = 0; | 166 | @@ -XXX,XX +XXX,XX @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) |
110 | 167 | case INDEX_op_add_vec: | |
111 | - assert(oprsz % 8 == 0 && oprsz <= (8 << SIMD_OPRSZ_BITS)); | 168 | case INDEX_op_sub_vec: |
112 | - assert(maxsz % 8 == 0 && maxsz <= (8 << SIMD_MAXSZ_BITS)); | 169 | case INDEX_op_xor_vec: |
113 | - assert(data == sextract32(data, 0, SIMD_DATA_BITS)); | 170 | - case INDEX_op_or_vec: |
114 | + check_size_align(oprsz, maxsz, 0); | 171 | - case INDEX_op_and_vec: |
115 | + tcg_debug_assert(data == sextract32(data, 0, SIMD_DATA_BITS)); | 172 | - case INDEX_op_cmp_vec: |
116 | 173 | return C_O1_I2(w, w, w); | |
117 | oprsz = (oprsz / 8) - 1; | 174 | + case INDEX_op_or_vec: |
118 | maxsz = (maxsz / 8) - 1; | 175 | + return C_O1_I2(w, w, wO); |
119 | + | 176 | + case INDEX_op_and_vec: |
120 | + /* | 177 | + return C_O1_I2(w, w, wV); |
121 | + * We have just asserted in check_size_align that either | 178 | + case INDEX_op_cmp_vec: |
122 | + * oprsz is {8,16,32} or matches maxsz. Encode the final | 179 | + return C_O1_I2(w, w, wZ); |
123 | + * case with '2', as that would otherwise map to 24. | 180 | |
124 | + */ | 181 | default: |
125 | + if (oprsz == maxsz) { | 182 | g_assert_not_reached(); |
126 | + oprsz = 2; | 183 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, unsigned vece, |
184 | } | ||
185 | } | ||
186 | |||
187 | +static const ARMInsn vec_cmp_insn[16] = { | ||
188 | + [TCG_COND_EQ] = INSN_VCEQ, | ||
189 | + [TCG_COND_GT] = INSN_VCGT, | ||
190 | + [TCG_COND_GE] = INSN_VCGE, | ||
191 | + [TCG_COND_GTU] = INSN_VCGT_U, | ||
192 | + [TCG_COND_GEU] = INSN_VCGE_U, | ||
193 | +}; | ||
194 | + | ||
195 | +static const ARMInsn vec_cmp0_insn[16] = { | ||
196 | + [TCG_COND_EQ] = INSN_VCEQ0, | ||
197 | + [TCG_COND_GT] = INSN_VCGT0, | ||
198 | + [TCG_COND_GE] = INSN_VCGE0, | ||
199 | + [TCG_COND_LT] = INSN_VCLT0, | ||
200 | + [TCG_COND_LE] = INSN_VCLE0, | ||
201 | +}; | ||
202 | + | ||
203 | static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, | ||
204 | unsigned vecl, unsigned vece, | ||
205 | const TCGArg *args, const int *const_args) | ||
206 | { | ||
207 | - g_assert_not_reached(); | ||
208 | + TCGType type = vecl + TCG_TYPE_V64; | ||
209 | + unsigned q = vecl; | ||
210 | + TCGArg a0, a1, a2; | ||
211 | + int cmode, imm8; | ||
212 | + | ||
213 | + a0 = args[0]; | ||
214 | + a1 = args[1]; | ||
215 | + a2 = args[2]; | ||
216 | + | ||
217 | + switch (opc) { | ||
218 | + case INDEX_op_ld_vec: | ||
219 | + tcg_out_ld(s, type, a0, a1, a2); | ||
220 | + return; | ||
221 | + case INDEX_op_st_vec: | ||
222 | + tcg_out_st(s, type, a0, a1, a2); | ||
223 | + return; | ||
224 | + case INDEX_op_dupm_vec: | ||
225 | + tcg_out_dupm_vec(s, type, vece, a0, a1, a2); | ||
226 | + return; | ||
227 | + case INDEX_op_dup2_vec: | ||
228 | + tcg_out_dup2_vec(s, a0, a1, a2); | ||
229 | + return; | ||
230 | + case INDEX_op_add_vec: | ||
231 | + tcg_out_vreg3(s, INSN_VADD, q, vece, a0, a1, a2); | ||
232 | + return; | ||
233 | + case INDEX_op_sub_vec: | ||
234 | + tcg_out_vreg3(s, INSN_VSUB, q, vece, a0, a1, a2); | ||
235 | + return; | ||
236 | + case INDEX_op_xor_vec: | ||
237 | + tcg_out_vreg3(s, INSN_VEOR, q, 0, a0, a1, a2); | ||
238 | + return; | ||
239 | + | ||
240 | + case INDEX_op_and_vec: | ||
241 | + if (const_args[2]) { | ||
242 | + is_shimm1632(~a2, &cmode, &imm8); | ||
243 | + if (a0 == a1) { | ||
244 | + tcg_out_vmovi(s, a0, q, 1, cmode | 1, imm8); /* VBICI */ | ||
245 | + return; | ||
246 | + } | ||
247 | + tcg_out_vmovi(s, a0, q, 1, cmode, imm8); /* VMVNI */ | ||
248 | + a2 = a0; | ||
249 | + } | ||
250 | + tcg_out_vreg3(s, INSN_VAND, q, 0, a0, a1, a2); | ||
251 | + return; | ||
252 | + | ||
253 | + case INDEX_op_or_vec: | ||
254 | + if (const_args[2]) { | ||
255 | + is_shimm1632(a2, &cmode, &imm8); | ||
256 | + if (a0 == a1) { | ||
257 | + tcg_out_vmovi(s, a0, q, 0, cmode | 1, imm8); /* VORRI */ | ||
258 | + return; | ||
259 | + } | ||
260 | + tcg_out_vmovi(s, a0, q, 0, cmode, imm8); /* VMOVI */ | ||
261 | + a2 = a0; | ||
262 | + } | ||
263 | + tcg_out_vreg3(s, INSN_VORR, q, 0, a0, a1, a2); | ||
264 | + return; | ||
265 | + | ||
266 | + case INDEX_op_cmp_vec: | ||
267 | + { | ||
268 | + TCGCond cond = args[3]; | ||
269 | + | ||
270 | + if (cond == TCG_COND_NE) { | ||
271 | + if (const_args[2]) { | ||
272 | + tcg_out_vreg3(s, INSN_VTST, q, vece, a0, a1, a1); | ||
273 | + } else { | ||
274 | + tcg_out_vreg3(s, INSN_VCEQ, q, vece, a0, a1, a2); | ||
275 | + tcg_out_vreg2(s, INSN_VMVN, q, 0, a0, a0); | ||
276 | + } | ||
277 | + } else { | ||
278 | + ARMInsn insn; | ||
279 | + | ||
280 | + if (const_args[2]) { | ||
281 | + insn = vec_cmp0_insn[cond]; | ||
282 | + if (insn) { | ||
283 | + tcg_out_vreg2(s, insn, q, vece, a0, a1); | ||
284 | + return; | ||
285 | + } | ||
286 | + tcg_out_dupi_vec(s, type, MO_8, TCG_VEC_TMP, 0); | ||
287 | + a2 = TCG_VEC_TMP; | ||
288 | + } | ||
289 | + insn = vec_cmp_insn[cond]; | ||
290 | + if (insn == 0) { | ||
291 | + TCGArg t; | ||
292 | + t = a1, a1 = a2, a2 = t; | ||
293 | + cond = tcg_swap_cond(cond); | ||
294 | + insn = vec_cmp_insn[cond]; | ||
295 | + tcg_debug_assert(insn != 0); | ||
296 | + } | ||
297 | + tcg_out_vreg3(s, insn, q, vece, a0, a1, a2); | ||
298 | + } | ||
299 | + } | ||
300 | + return; | ||
301 | + | ||
302 | + case INDEX_op_mov_vec: /* Always emitted via tcg_out_mov. */ | ||
303 | + case INDEX_op_dup_vec: /* Always emitted via tcg_out_dup_vec. */ | ||
304 | + default: | ||
305 | + g_assert_not_reached(); | ||
127 | + } | 306 | + } |
128 | + | 307 | } |
129 | desc = deposit32(desc, SIMD_OPRSZ_SHIFT, SIMD_OPRSZ_BITS, oprsz); | 308 | |
130 | desc = deposit32(desc, SIMD_MAXSZ_SHIFT, SIMD_MAXSZ_BITS, maxsz); | 309 | int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) |
131 | desc = deposit32(desc, SIMD_DATA_SHIFT, SIMD_DATA_BITS, data); | 310 | { |
311 | - return 0; | ||
312 | + switch (opc) { | ||
313 | + case INDEX_op_add_vec: | ||
314 | + case INDEX_op_sub_vec: | ||
315 | + case INDEX_op_and_vec: | ||
316 | + case INDEX_op_or_vec: | ||
317 | + case INDEX_op_xor_vec: | ||
318 | + return 1; | ||
319 | + case INDEX_op_cmp_vec: | ||
320 | + return vece < MO_64; | ||
321 | + default: | ||
322 | + return 0; | ||
323 | + } | ||
324 | } | ||
325 | |||
326 | void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, | ||
132 | -- | 327 | -- |
133 | 2.25.1 | 328 | 2.25.1 |
134 | 329 | ||
135 | 330 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | These logical and arithmetic operations are optional, but are | ||
2 | trivial to accomplish with the existing infrastructure. | ||
1 | 3 | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | --- | ||
7 | tcg/arm/tcg-target-con-set.h | 1 + | ||
8 | tcg/arm/tcg-target.h | 10 +++++----- | ||
9 | tcg/arm/tcg-target.c.inc | 38 ++++++++++++++++++++++++++++++++++++ | ||
10 | 3 files changed, 44 insertions(+), 5 deletions(-) | ||
11 | |||
12 | diff --git a/tcg/arm/tcg-target-con-set.h b/tcg/arm/tcg-target-con-set.h | ||
13 | index XXXXXXX..XXXXXXX 100644 | ||
14 | --- a/tcg/arm/tcg-target-con-set.h | ||
15 | +++ b/tcg/arm/tcg-target-con-set.h | ||
16 | @@ -XXX,XX +XXX,XX @@ C_O0_I4(s, s, s, s) | ||
17 | C_O1_I1(r, l) | ||
18 | C_O1_I1(r, r) | ||
19 | C_O1_I1(w, r) | ||
20 | +C_O1_I1(w, w) | ||
21 | C_O1_I1(w, wr) | ||
22 | C_O1_I2(r, 0, rZ) | ||
23 | C_O1_I2(r, l, l) | ||
24 | diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h | ||
25 | index XXXXXXX..XXXXXXX 100644 | ||
26 | --- a/tcg/arm/tcg-target.h | ||
27 | +++ b/tcg/arm/tcg-target.h | ||
28 | @@ -XXX,XX +XXX,XX @@ extern bool use_neon_instructions; | ||
29 | #define TCG_TARGET_HAS_v128 use_neon_instructions | ||
30 | #define TCG_TARGET_HAS_v256 0 | ||
31 | |||
32 | -#define TCG_TARGET_HAS_andc_vec 0 | ||
33 | -#define TCG_TARGET_HAS_orc_vec 0 | ||
34 | -#define TCG_TARGET_HAS_not_vec 0 | ||
35 | -#define TCG_TARGET_HAS_neg_vec 0 | ||
36 | -#define TCG_TARGET_HAS_abs_vec 0 | ||
37 | +#define TCG_TARGET_HAS_andc_vec 1 | ||
38 | +#define TCG_TARGET_HAS_orc_vec 1 | ||
39 | +#define TCG_TARGET_HAS_not_vec 1 | ||
40 | +#define TCG_TARGET_HAS_neg_vec 1 | ||
41 | +#define TCG_TARGET_HAS_abs_vec 1 | ||
42 | #define TCG_TARGET_HAS_roti_vec 0 | ||
43 | #define TCG_TARGET_HAS_rots_vec 0 | ||
44 | #define TCG_TARGET_HAS_rotv_vec 0 | ||
45 | diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc | ||
46 | index XXXXXXX..XXXXXXX 100644 | ||
47 | --- a/tcg/arm/tcg-target.c.inc | ||
48 | +++ b/tcg/arm/tcg-target.c.inc | ||
49 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
50 | |||
51 | INSN_VADD = 0xf2000800, | ||
52 | INSN_VAND = 0xf2000110, | ||
53 | + INSN_VBIC = 0xf2100110, | ||
54 | INSN_VEOR = 0xf3000110, | ||
55 | + INSN_VORN = 0xf2300110, | ||
56 | INSN_VORR = 0xf2200110, | ||
57 | INSN_VSUB = 0xf3000800, | ||
58 | |||
59 | + INSN_VABS = 0xf3b10300, | ||
60 | INSN_VMVN = 0xf3b00580, | ||
61 | + INSN_VNEG = 0xf3b10380, | ||
62 | |||
63 | INSN_VCEQ0 = 0xf3b10100, | ||
64 | INSN_VCGT0 = 0xf3b10000, | ||
65 | @@ -XXX,XX +XXX,XX @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) | ||
66 | return C_O1_I1(w, r); | ||
67 | case INDEX_op_dup_vec: | ||
68 | return C_O1_I1(w, wr); | ||
69 | + case INDEX_op_abs_vec: | ||
70 | + case INDEX_op_neg_vec: | ||
71 | + case INDEX_op_not_vec: | ||
72 | + return C_O1_I1(w, w); | ||
73 | case INDEX_op_dup2_vec: | ||
74 | case INDEX_op_add_vec: | ||
75 | case INDEX_op_sub_vec: | ||
76 | case INDEX_op_xor_vec: | ||
77 | return C_O1_I2(w, w, w); | ||
78 | case INDEX_op_or_vec: | ||
79 | + case INDEX_op_andc_vec: | ||
80 | return C_O1_I2(w, w, wO); | ||
81 | case INDEX_op_and_vec: | ||
82 | + case INDEX_op_orc_vec: | ||
83 | return C_O1_I2(w, w, wV); | ||
84 | case INDEX_op_cmp_vec: | ||
85 | return C_O1_I2(w, w, wZ); | ||
86 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, | ||
87 | case INDEX_op_dup2_vec: | ||
88 | tcg_out_dup2_vec(s, a0, a1, a2); | ||
89 | return; | ||
90 | + case INDEX_op_abs_vec: | ||
91 | + tcg_out_vreg2(s, INSN_VABS, q, vece, a0, a1); | ||
92 | + return; | ||
93 | + case INDEX_op_neg_vec: | ||
94 | + tcg_out_vreg2(s, INSN_VNEG, q, vece, a0, a1); | ||
95 | + return; | ||
96 | + case INDEX_op_not_vec: | ||
97 | + tcg_out_vreg2(s, INSN_VMVN, q, 0, a0, a1); | ||
98 | + return; | ||
99 | case INDEX_op_add_vec: | ||
100 | tcg_out_vreg3(s, INSN_VADD, q, vece, a0, a1, a2); | ||
101 | return; | ||
102 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, | ||
103 | tcg_out_vreg3(s, INSN_VEOR, q, 0, a0, a1, a2); | ||
104 | return; | ||
105 | |||
106 | + case INDEX_op_andc_vec: | ||
107 | + if (!const_args[2]) { | ||
108 | + tcg_out_vreg3(s, INSN_VBIC, q, 0, a0, a1, a2); | ||
109 | + return; | ||
110 | + } | ||
111 | + a2 = ~a2; | ||
112 | + /* fall through */ | ||
113 | case INDEX_op_and_vec: | ||
114 | if (const_args[2]) { | ||
115 | is_shimm1632(~a2, &cmode, &imm8); | ||
116 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, | ||
117 | tcg_out_vreg3(s, INSN_VAND, q, 0, a0, a1, a2); | ||
118 | return; | ||
119 | |||
120 | + case INDEX_op_orc_vec: | ||
121 | + if (!const_args[2]) { | ||
122 | + tcg_out_vreg3(s, INSN_VORN, q, 0, a0, a1, a2); | ||
123 | + return; | ||
124 | + } | ||
125 | + a2 = ~a2; | ||
126 | + /* fall through */ | ||
127 | case INDEX_op_or_vec: | ||
128 | if (const_args[2]) { | ||
129 | is_shimm1632(a2, &cmode, &imm8); | ||
130 | @@ -XXX,XX +XXX,XX @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) | ||
131 | case INDEX_op_add_vec: | ||
132 | case INDEX_op_sub_vec: | ||
133 | case INDEX_op_and_vec: | ||
134 | + case INDEX_op_andc_vec: | ||
135 | case INDEX_op_or_vec: | ||
136 | + case INDEX_op_orc_vec: | ||
137 | case INDEX_op_xor_vec: | ||
138 | + case INDEX_op_not_vec: | ||
139 | return 1; | ||
140 | + case INDEX_op_abs_vec: | ||
141 | case INDEX_op_cmp_vec: | ||
142 | + case INDEX_op_neg_vec: | ||
143 | return vece < MO_64; | ||
144 | default: | ||
145 | return 0; | ||
146 | -- | ||
147 | 2.25.1 | ||
148 | |||
149 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | This consists of the three immediate shifts: shli, shri, sari. | ||
1 | 2 | ||
3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | --- | ||
6 | tcg/arm/tcg-target.h | 2 +- | ||
7 | tcg/arm/tcg-target.c.inc | 27 +++++++++++++++++++++++++++ | ||
8 | 2 files changed, 28 insertions(+), 1 deletion(-) | ||
9 | |||
10 | diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h | ||
11 | index XXXXXXX..XXXXXXX 100644 | ||
12 | --- a/tcg/arm/tcg-target.h | ||
13 | +++ b/tcg/arm/tcg-target.h | ||
14 | @@ -XXX,XX +XXX,XX @@ extern bool use_neon_instructions; | ||
15 | #define TCG_TARGET_HAS_roti_vec 0 | ||
16 | #define TCG_TARGET_HAS_rots_vec 0 | ||
17 | #define TCG_TARGET_HAS_rotv_vec 0 | ||
18 | -#define TCG_TARGET_HAS_shi_vec 0 | ||
19 | +#define TCG_TARGET_HAS_shi_vec 1 | ||
20 | #define TCG_TARGET_HAS_shs_vec 0 | ||
21 | #define TCG_TARGET_HAS_shv_vec 0 | ||
22 | #define TCG_TARGET_HAS_mul_vec 0 | ||
23 | diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc | ||
24 | index XXXXXXX..XXXXXXX 100644 | ||
25 | --- a/tcg/arm/tcg-target.c.inc | ||
26 | +++ b/tcg/arm/tcg-target.c.inc | ||
27 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
28 | INSN_VCGE_U = 0xf3000310, | ||
29 | INSN_VCGT_U = 0xf3000300, | ||
30 | |||
31 | + INSN_VSHLI = 0xf2800510, /* VSHL (immediate) */ | ||
32 | + INSN_VSARI = 0xf2800010, /* VSHR.S */ | ||
33 | + INSN_VSHRI = 0xf3800010, /* VSHR.U */ | ||
34 | + | ||
35 | INSN_VTST = 0xf2000810, | ||
36 | |||
37 | INSN_VDUP_G = 0xee800b10, /* VDUP (ARM core register) */ | ||
38 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_vmovi(TCGContext *s, TCGReg rd, | ||
39 | | (extract32(imm8, 7, 1) << 24)); | ||
40 | } | ||
41 | |||
42 | +static void tcg_out_vshifti(TCGContext *s, ARMInsn insn, int q, | ||
43 | + TCGReg rd, TCGReg rm, int l_imm6) | ||
44 | +{ | ||
45 | + tcg_out32(s, insn | (q << 6) | encode_vd(rd) | encode_vm(rm) | | ||
46 | + (extract32(l_imm6, 6, 1) << 7) | | ||
47 | + (extract32(l_imm6, 0, 6) << 16)); | ||
48 | +} | ||
49 | + | ||
50 | static void tcg_out_vldst(TCGContext *s, ARMInsn insn, | ||
51 | TCGReg rd, TCGReg rn, int offset) | ||
52 | { | ||
53 | @@ -XXX,XX +XXX,XX @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) | ||
54 | case INDEX_op_abs_vec: | ||
55 | case INDEX_op_neg_vec: | ||
56 | case INDEX_op_not_vec: | ||
57 | + case INDEX_op_shli_vec: | ||
58 | + case INDEX_op_shri_vec: | ||
59 | + case INDEX_op_sari_vec: | ||
60 | return C_O1_I1(w, w); | ||
61 | case INDEX_op_dup2_vec: | ||
62 | case INDEX_op_add_vec: | ||
63 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, | ||
64 | case INDEX_op_xor_vec: | ||
65 | tcg_out_vreg3(s, INSN_VEOR, q, 0, a0, a1, a2); | ||
66 | return; | ||
67 | + case INDEX_op_shli_vec: | ||
68 | + tcg_out_vshifti(s, INSN_VSHLI, q, a0, a1, a2 + (8 << vece)); | ||
69 | + return; | ||
70 | + case INDEX_op_shri_vec: | ||
71 | + tcg_out_vshifti(s, INSN_VSHRI, q, a0, a1, (16 << vece) - a2); | ||
72 | + return; | ||
73 | + case INDEX_op_sari_vec: | ||
74 | + tcg_out_vshifti(s, INSN_VSARI, q, a0, a1, (16 << vece) - a2); | ||
75 | + return; | ||
76 | |||
77 | case INDEX_op_andc_vec: | ||
78 | if (!const_args[2]) { | ||
79 | @@ -XXX,XX +XXX,XX @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) | ||
80 | case INDEX_op_orc_vec: | ||
81 | case INDEX_op_xor_vec: | ||
82 | case INDEX_op_not_vec: | ||
83 | + case INDEX_op_shli_vec: | ||
84 | + case INDEX_op_shri_vec: | ||
85 | + case INDEX_op_sari_vec: | ||
86 | return 1; | ||
87 | case INDEX_op_abs_vec: | ||
88 | case INDEX_op_cmp_vec: | ||
89 | -- | ||
90 | 2.25.1 | ||
91 | |||
92 | diff view generated by jsdifflib |
1 | When the two arguments are identical, this can be reduced to | 1 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
---|---|---|---|
2 | dup_vec or to mov_vec from a tcg_constant_vec. | ||
3 | |||
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 2 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
5 | --- | 3 | --- |
6 | tcg/optimize.c | 15 +++++++++++++++ | 4 | tcg/arm/tcg-target.h | 2 +- |
7 | 1 file changed, 15 insertions(+) | 5 | tcg/arm/tcg-target.c.inc | 6 ++++++ |
6 | 2 files changed, 7 insertions(+), 1 deletion(-) | ||
8 | 7 | ||
9 | diff --git a/tcg/optimize.c b/tcg/optimize.c | 8 | diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h |
10 | index XXXXXXX..XXXXXXX 100644 | 9 | index XXXXXXX..XXXXXXX 100644 |
11 | --- a/tcg/optimize.c | 10 | --- a/tcg/arm/tcg-target.h |
12 | +++ b/tcg/optimize.c | 11 | +++ b/tcg/arm/tcg-target.h |
13 | @@ -XXX,XX +XXX,XX @@ void tcg_optimize(TCGContext *s) | 12 | @@ -XXX,XX +XXX,XX @@ extern bool use_neon_instructions; |
14 | } | 13 | #define TCG_TARGET_HAS_shi_vec 1 |
15 | goto do_default; | 14 | #define TCG_TARGET_HAS_shs_vec 0 |
16 | 15 | #define TCG_TARGET_HAS_shv_vec 0 | |
17 | + case INDEX_op_dup2_vec: | 16 | -#define TCG_TARGET_HAS_mul_vec 0 |
18 | + assert(TCG_TARGET_REG_BITS == 32); | 17 | +#define TCG_TARGET_HAS_mul_vec 1 |
19 | + if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) { | 18 | #define TCG_TARGET_HAS_sat_vec 0 |
20 | + tmp = arg_info(op->args[1])->val; | 19 | #define TCG_TARGET_HAS_minmax_vec 0 |
21 | + if (tmp == arg_info(op->args[2])->val) { | 20 | #define TCG_TARGET_HAS_bitsel_vec 0 |
22 | + tcg_opt_gen_movi(s, op, op->args[0], tmp); | 21 | diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc |
23 | + break; | 22 | index XXXXXXX..XXXXXXX 100644 |
24 | + } | 23 | --- a/tcg/arm/tcg-target.c.inc |
25 | + } else if (args_are_copies(op->args[1], op->args[2])) { | 24 | +++ b/tcg/arm/tcg-target.c.inc |
26 | + op->opc = INDEX_op_dup_vec; | 25 | @@ -XXX,XX +XXX,XX @@ typedef enum { |
27 | + TCGOP_VECE(op) = MO_32; | 26 | INSN_VORN = 0xf2300110, |
28 | + nb_iargs = 1; | 27 | INSN_VORR = 0xf2200110, |
29 | + } | 28 | INSN_VSUB = 0xf3000800, |
30 | + goto do_default; | 29 | + INSN_VMUL = 0xf2000910, |
31 | + | 30 | |
32 | CASE_OP_32_64(not): | 31 | INSN_VABS = 0xf3b10300, |
33 | CASE_OP_32_64(neg): | 32 | INSN_VMVN = 0xf3b00580, |
34 | CASE_OP_32_64(ext8s): | 33 | @@ -XXX,XX +XXX,XX @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) |
34 | return C_O1_I1(w, w); | ||
35 | case INDEX_op_dup2_vec: | ||
36 | case INDEX_op_add_vec: | ||
37 | + case INDEX_op_mul_vec: | ||
38 | case INDEX_op_sub_vec: | ||
39 | case INDEX_op_xor_vec: | ||
40 | return C_O1_I2(w, w, w); | ||
41 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, | ||
42 | case INDEX_op_add_vec: | ||
43 | tcg_out_vreg3(s, INSN_VADD, q, vece, a0, a1, a2); | ||
44 | return; | ||
45 | + case INDEX_op_mul_vec: | ||
46 | + tcg_out_vreg3(s, INSN_VMUL, q, vece, a0, a1, a2); | ||
47 | + return; | ||
48 | case INDEX_op_sub_vec: | ||
49 | tcg_out_vreg3(s, INSN_VSUB, q, vece, a0, a1, a2); | ||
50 | return; | ||
51 | @@ -XXX,XX +XXX,XX @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) | ||
52 | return 1; | ||
53 | case INDEX_op_abs_vec: | ||
54 | case INDEX_op_cmp_vec: | ||
55 | + case INDEX_op_mul_vec: | ||
56 | case INDEX_op_neg_vec: | ||
57 | return vece < MO_64; | ||
58 | default: | ||
35 | -- | 59 | -- |
36 | 2.25.1 | 60 | 2.25.1 |
37 | 61 | ||
38 | 62 | diff view generated by jsdifflib |
1 | The previous change wrongly stated that 32-bit avx2 should have | 1 | This is saturating add and subtract, signed and unsigned. |
---|---|---|---|
2 | used VPBROADCASTW. But that's a 16-bit broadcast and we want a | ||
3 | 32-bit broadcast. | ||
4 | 2 | ||
5 | Fixes: 7b60ef3264e | 3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Cc: qemu-stable@nongnu.org | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | --- | 5 | --- |
9 | tcg/i386/tcg-target.c.inc | 2 +- | 6 | tcg/arm/tcg-target.h | 2 +- |
10 | 1 file changed, 1 insertion(+), 1 deletion(-) | 7 | tcg/arm/tcg-target.c.inc | 24 ++++++++++++++++++++++++ |
8 | 2 files changed, 25 insertions(+), 1 deletion(-) | ||
11 | 9 | ||
12 | diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc | 10 | diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h |
13 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/tcg/i386/tcg-target.c.inc | 12 | --- a/tcg/arm/tcg-target.h |
15 | +++ b/tcg/i386/tcg-target.c.inc | 13 | +++ b/tcg/arm/tcg-target.h |
16 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, | 14 | @@ -XXX,XX +XXX,XX @@ extern bool use_neon_instructions; |
17 | new_pool_label(s, arg, R_386_PC32, s->code_ptr - 4, -4); | 15 | #define TCG_TARGET_HAS_shs_vec 0 |
18 | } else { | 16 | #define TCG_TARGET_HAS_shv_vec 0 |
19 | if (have_avx2) { | 17 | #define TCG_TARGET_HAS_mul_vec 1 |
20 | - tcg_out_vex_modrm_pool(s, OPC_VPBROADCASTW + vex_l, ret); | 18 | -#define TCG_TARGET_HAS_sat_vec 0 |
21 | + tcg_out_vex_modrm_pool(s, OPC_VPBROADCASTD + vex_l, ret); | 19 | +#define TCG_TARGET_HAS_sat_vec 1 |
22 | } else { | 20 | #define TCG_TARGET_HAS_minmax_vec 0 |
23 | tcg_out_vex_modrm_pool(s, OPC_VBROADCASTSS, ret); | 21 | #define TCG_TARGET_HAS_bitsel_vec 0 |
24 | } | 22 | #define TCG_TARGET_HAS_cmpsel_vec 0 |
23 | diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc | ||
24 | index XXXXXXX..XXXXXXX 100644 | ||
25 | --- a/tcg/arm/tcg-target.c.inc | ||
26 | +++ b/tcg/arm/tcg-target.c.inc | ||
27 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
28 | INSN_VORR = 0xf2200110, | ||
29 | INSN_VSUB = 0xf3000800, | ||
30 | INSN_VMUL = 0xf2000910, | ||
31 | + INSN_VQADD = 0xf2000010, | ||
32 | + INSN_VQADD_U = 0xf3000010, | ||
33 | + INSN_VQSUB = 0xf2000210, | ||
34 | + INSN_VQSUB_U = 0xf3000210, | ||
35 | |||
36 | INSN_VABS = 0xf3b10300, | ||
37 | INSN_VMVN = 0xf3b00580, | ||
38 | @@ -XXX,XX +XXX,XX @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) | ||
39 | case INDEX_op_dup2_vec: | ||
40 | case INDEX_op_add_vec: | ||
41 | case INDEX_op_mul_vec: | ||
42 | + case INDEX_op_ssadd_vec: | ||
43 | + case INDEX_op_sssub_vec: | ||
44 | case INDEX_op_sub_vec: | ||
45 | + case INDEX_op_usadd_vec: | ||
46 | + case INDEX_op_ussub_vec: | ||
47 | case INDEX_op_xor_vec: | ||
48 | return C_O1_I2(w, w, w); | ||
49 | case INDEX_op_or_vec: | ||
50 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, | ||
51 | case INDEX_op_sub_vec: | ||
52 | tcg_out_vreg3(s, INSN_VSUB, q, vece, a0, a1, a2); | ||
53 | return; | ||
54 | + case INDEX_op_ssadd_vec: | ||
55 | + tcg_out_vreg3(s, INSN_VQADD, q, vece, a0, a1, a2); | ||
56 | + return; | ||
57 | + case INDEX_op_sssub_vec: | ||
58 | + tcg_out_vreg3(s, INSN_VQSUB, q, vece, a0, a1, a2); | ||
59 | + return; | ||
60 | + case INDEX_op_usadd_vec: | ||
61 | + tcg_out_vreg3(s, INSN_VQADD_U, q, vece, a0, a1, a2); | ||
62 | + return; | ||
63 | + case INDEX_op_ussub_vec: | ||
64 | + tcg_out_vreg3(s, INSN_VQSUB_U, q, vece, a0, a1, a2); | ||
65 | + return; | ||
66 | case INDEX_op_xor_vec: | ||
67 | tcg_out_vreg3(s, INSN_VEOR, q, 0, a0, a1, a2); | ||
68 | return; | ||
69 | @@ -XXX,XX +XXX,XX @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) | ||
70 | case INDEX_op_shli_vec: | ||
71 | case INDEX_op_shri_vec: | ||
72 | case INDEX_op_sari_vec: | ||
73 | + case INDEX_op_ssadd_vec: | ||
74 | + case INDEX_op_sssub_vec: | ||
75 | + case INDEX_op_usadd_vec: | ||
76 | + case INDEX_op_ussub_vec: | ||
77 | return 1; | ||
78 | case INDEX_op_abs_vec: | ||
79 | case INDEX_op_cmp_vec: | ||
25 | -- | 80 | -- |
26 | 2.25.1 | 81 | 2.25.1 |
27 | 82 | ||
28 | 83 | diff view generated by jsdifflib |
1 | The last user of this field disappeared in f69d277ece4. | 1 | This is minimum and maximum, signed and unsigned. |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
5 | --- | 5 | --- |
6 | include/tcg/tcg.h | 3 --- | 6 | tcg/arm/tcg-target.h | 2 +- |
7 | 1 file changed, 3 deletions(-) | 7 | tcg/arm/tcg-target.c.inc | 24 ++++++++++++++++++++++++ |
8 | 2 files changed, 25 insertions(+), 1 deletion(-) | ||
8 | 9 | ||
9 | diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h | 10 | diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h |
10 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
11 | --- a/include/tcg/tcg.h | 12 | --- a/tcg/arm/tcg-target.h |
12 | +++ b/include/tcg/tcg.h | 13 | +++ b/tcg/arm/tcg-target.h |
13 | @@ -XXX,XX +XXX,XX @@ typedef struct TCGOpDef { | 14 | @@ -XXX,XX +XXX,XX @@ extern bool use_neon_instructions; |
14 | uint8_t nb_oargs, nb_iargs, nb_cargs, nb_args; | 15 | #define TCG_TARGET_HAS_shv_vec 0 |
15 | uint8_t flags; | 16 | #define TCG_TARGET_HAS_mul_vec 1 |
16 | TCGArgConstraint *args_ct; | 17 | #define TCG_TARGET_HAS_sat_vec 1 |
17 | -#if defined(CONFIG_DEBUG_TCG) | 18 | -#define TCG_TARGET_HAS_minmax_vec 0 |
18 | - int used; | 19 | +#define TCG_TARGET_HAS_minmax_vec 1 |
19 | -#endif | 20 | #define TCG_TARGET_HAS_bitsel_vec 0 |
20 | } TCGOpDef; | 21 | #define TCG_TARGET_HAS_cmpsel_vec 0 |
21 | 22 | ||
22 | extern TCGOpDef tcg_op_defs[]; | 23 | diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc |
24 | index XXXXXXX..XXXXXXX 100644 | ||
25 | --- a/tcg/arm/tcg-target.c.inc | ||
26 | +++ b/tcg/arm/tcg-target.c.inc | ||
27 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
28 | INSN_VQADD_U = 0xf3000010, | ||
29 | INSN_VQSUB = 0xf2000210, | ||
30 | INSN_VQSUB_U = 0xf3000210, | ||
31 | + INSN_VMAX = 0xf2000600, | ||
32 | + INSN_VMAX_U = 0xf3000600, | ||
33 | + INSN_VMIN = 0xf2000610, | ||
34 | + INSN_VMIN_U = 0xf3000610, | ||
35 | |||
36 | INSN_VABS = 0xf3b10300, | ||
37 | INSN_VMVN = 0xf3b00580, | ||
38 | @@ -XXX,XX +XXX,XX @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) | ||
39 | case INDEX_op_dup2_vec: | ||
40 | case INDEX_op_add_vec: | ||
41 | case INDEX_op_mul_vec: | ||
42 | + case INDEX_op_smax_vec: | ||
43 | + case INDEX_op_smin_vec: | ||
44 | case INDEX_op_ssadd_vec: | ||
45 | case INDEX_op_sssub_vec: | ||
46 | case INDEX_op_sub_vec: | ||
47 | + case INDEX_op_umax_vec: | ||
48 | + case INDEX_op_umin_vec: | ||
49 | case INDEX_op_usadd_vec: | ||
50 | case INDEX_op_ussub_vec: | ||
51 | case INDEX_op_xor_vec: | ||
52 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, | ||
53 | case INDEX_op_mul_vec: | ||
54 | tcg_out_vreg3(s, INSN_VMUL, q, vece, a0, a1, a2); | ||
55 | return; | ||
56 | + case INDEX_op_smax_vec: | ||
57 | + tcg_out_vreg3(s, INSN_VMAX, q, vece, a0, a1, a2); | ||
58 | + return; | ||
59 | + case INDEX_op_smin_vec: | ||
60 | + tcg_out_vreg3(s, INSN_VMIN, q, vece, a0, a1, a2); | ||
61 | + return; | ||
62 | case INDEX_op_sub_vec: | ||
63 | tcg_out_vreg3(s, INSN_VSUB, q, vece, a0, a1, a2); | ||
64 | return; | ||
65 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, | ||
66 | case INDEX_op_sssub_vec: | ||
67 | tcg_out_vreg3(s, INSN_VQSUB, q, vece, a0, a1, a2); | ||
68 | return; | ||
69 | + case INDEX_op_umax_vec: | ||
70 | + tcg_out_vreg3(s, INSN_VMAX_U, q, vece, a0, a1, a2); | ||
71 | + return; | ||
72 | + case INDEX_op_umin_vec: | ||
73 | + tcg_out_vreg3(s, INSN_VMIN_U, q, vece, a0, a1, a2); | ||
74 | + return; | ||
75 | case INDEX_op_usadd_vec: | ||
76 | tcg_out_vreg3(s, INSN_VQADD_U, q, vece, a0, a1, a2); | ||
77 | return; | ||
78 | @@ -XXX,XX +XXX,XX @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) | ||
79 | case INDEX_op_cmp_vec: | ||
80 | case INDEX_op_mul_vec: | ||
81 | case INDEX_op_neg_vec: | ||
82 | + case INDEX_op_smax_vec: | ||
83 | + case INDEX_op_smin_vec: | ||
84 | + case INDEX_op_umax_vec: | ||
85 | + case INDEX_op_umin_vec: | ||
86 | return vece < MO_64; | ||
87 | default: | ||
88 | return 0; | ||
23 | -- | 89 | -- |
24 | 2.25.1 | 90 | 2.25.1 |
25 | 91 | ||
26 | 92 | diff view generated by jsdifflib |
1 | The cmp_vec opcode is mandatory; this symbol is unused. | 1 | NEON has 3 instructions implementing this 4 argument operation, |
---|---|---|---|
2 | with each insn overlapping a different logical input onto the | ||
3 | destination register. | ||
2 | 4 | ||
3 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
5 | --- | 7 | --- |
6 | tcg/aarch64/tcg-target.h | 1 - | 8 | tcg/arm/tcg-target-con-set.h | 1 + |
7 | tcg/i386/tcg-target.h | 1 - | 9 | tcg/arm/tcg-target.h | 2 +- |
8 | tcg/ppc/tcg-target.h | 1 - | 10 | tcg/arm/tcg-target.c.inc | 22 ++++++++++++++++++++-- |
9 | 3 files changed, 3 deletions(-) | 11 | 3 files changed, 22 insertions(+), 3 deletions(-) |
10 | 12 | ||
11 | diff --git a/tcg/aarch64/tcg-target.h b/tcg/aarch64/tcg-target.h | 13 | diff --git a/tcg/arm/tcg-target-con-set.h b/tcg/arm/tcg-target-con-set.h |
12 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/tcg/aarch64/tcg-target.h | 15 | --- a/tcg/arm/tcg-target-con-set.h |
14 | +++ b/tcg/aarch64/tcg-target.h | 16 | +++ b/tcg/arm/tcg-target-con-set.h |
15 | @@ -XXX,XX +XXX,XX @@ typedef enum { | 17 | @@ -XXX,XX +XXX,XX @@ C_O1_I2(w, w, w) |
16 | #define TCG_TARGET_HAS_shi_vec 1 | 18 | C_O1_I2(w, w, wO) |
17 | #define TCG_TARGET_HAS_shs_vec 0 | 19 | C_O1_I2(w, w, wV) |
18 | #define TCG_TARGET_HAS_shv_vec 1 | 20 | C_O1_I2(w, w, wZ) |
19 | -#define TCG_TARGET_HAS_cmp_vec 1 | 21 | +C_O1_I3(w, w, w, w) |
22 | C_O1_I4(r, r, r, rI, rI) | ||
23 | C_O1_I4(r, r, rIN, rIK, 0) | ||
24 | C_O2_I1(r, r, l) | ||
25 | diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h | ||
26 | index XXXXXXX..XXXXXXX 100644 | ||
27 | --- a/tcg/arm/tcg-target.h | ||
28 | +++ b/tcg/arm/tcg-target.h | ||
29 | @@ -XXX,XX +XXX,XX @@ extern bool use_neon_instructions; | ||
20 | #define TCG_TARGET_HAS_mul_vec 1 | 30 | #define TCG_TARGET_HAS_mul_vec 1 |
21 | #define TCG_TARGET_HAS_sat_vec 1 | 31 | #define TCG_TARGET_HAS_sat_vec 1 |
22 | #define TCG_TARGET_HAS_minmax_vec 1 | 32 | #define TCG_TARGET_HAS_minmax_vec 1 |
23 | diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h | 33 | -#define TCG_TARGET_HAS_bitsel_vec 0 |
34 | +#define TCG_TARGET_HAS_bitsel_vec 1 | ||
35 | #define TCG_TARGET_HAS_cmpsel_vec 0 | ||
36 | |||
37 | #define TCG_TARGET_DEFAULT_MO (0) | ||
38 | diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc | ||
24 | index XXXXXXX..XXXXXXX 100644 | 39 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/tcg/i386/tcg-target.h | 40 | --- a/tcg/arm/tcg-target.c.inc |
26 | +++ b/tcg/i386/tcg-target.h | 41 | +++ b/tcg/arm/tcg-target.c.inc |
27 | @@ -XXX,XX +XXX,XX @@ extern bool have_avx2; | 42 | @@ -XXX,XX +XXX,XX @@ typedef enum { |
28 | #define TCG_TARGET_HAS_shi_vec 1 | 43 | INSN_VSARI = 0xf2800010, /* VSHR.S */ |
29 | #define TCG_TARGET_HAS_shs_vec 1 | 44 | INSN_VSHRI = 0xf3800010, /* VSHR.U */ |
30 | #define TCG_TARGET_HAS_shv_vec have_avx2 | 45 | |
31 | -#define TCG_TARGET_HAS_cmp_vec 1 | 46 | + INSN_VBSL = 0xf3100110, |
32 | #define TCG_TARGET_HAS_mul_vec 1 | 47 | + INSN_VBIT = 0xf3200110, |
33 | #define TCG_TARGET_HAS_sat_vec 1 | 48 | + INSN_VBIF = 0xf3300110, |
34 | #define TCG_TARGET_HAS_minmax_vec 1 | 49 | + |
35 | diff --git a/tcg/ppc/tcg-target.h b/tcg/ppc/tcg-target.h | 50 | INSN_VTST = 0xf2000810, |
36 | index XXXXXXX..XXXXXXX 100644 | 51 | |
37 | --- a/tcg/ppc/tcg-target.h | 52 | INSN_VDUP_G = 0xee800b10, /* VDUP (ARM core register) */ |
38 | +++ b/tcg/ppc/tcg-target.h | 53 | @@ -XXX,XX +XXX,XX @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) |
39 | @@ -XXX,XX +XXX,XX @@ extern bool have_vsx; | 54 | return C_O1_I2(w, w, wV); |
40 | #define TCG_TARGET_HAS_shi_vec 0 | 55 | case INDEX_op_cmp_vec: |
41 | #define TCG_TARGET_HAS_shs_vec 0 | 56 | return C_O1_I2(w, w, wZ); |
42 | #define TCG_TARGET_HAS_shv_vec 1 | 57 | - |
43 | -#define TCG_TARGET_HAS_cmp_vec 1 | 58 | + case INDEX_op_bitsel_vec: |
44 | #define TCG_TARGET_HAS_mul_vec 1 | 59 | + return C_O1_I3(w, w, w, w); |
45 | #define TCG_TARGET_HAS_sat_vec 1 | 60 | default: |
46 | #define TCG_TARGET_HAS_minmax_vec 1 | 61 | g_assert_not_reached(); |
62 | } | ||
63 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, | ||
64 | { | ||
65 | TCGType type = vecl + TCG_TYPE_V64; | ||
66 | unsigned q = vecl; | ||
67 | - TCGArg a0, a1, a2; | ||
68 | + TCGArg a0, a1, a2, a3; | ||
69 | int cmode, imm8; | ||
70 | |||
71 | a0 = args[0]; | ||
72 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, | ||
73 | } | ||
74 | return; | ||
75 | |||
76 | + case INDEX_op_bitsel_vec: | ||
77 | + a3 = args[3]; | ||
78 | + if (a0 == a3) { | ||
79 | + tcg_out_vreg3(s, INSN_VBIT, q, 0, a0, a2, a1); | ||
80 | + } else if (a0 == a2) { | ||
81 | + tcg_out_vreg3(s, INSN_VBIF, q, 0, a0, a3, a1); | ||
82 | + } else { | ||
83 | + tcg_out_mov(s, type, a0, a1); | ||
84 | + tcg_out_vreg3(s, INSN_VBSL, q, 0, a0, a2, a3); | ||
85 | + } | ||
86 | + return; | ||
87 | + | ||
88 | case INDEX_op_mov_vec: /* Always emitted via tcg_out_mov. */ | ||
89 | case INDEX_op_dup_vec: /* Always emitted via tcg_out_dup_vec. */ | ||
90 | default: | ||
91 | @@ -XXX,XX +XXX,XX @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) | ||
92 | case INDEX_op_sssub_vec: | ||
93 | case INDEX_op_usadd_vec: | ||
94 | case INDEX_op_ussub_vec: | ||
95 | + case INDEX_op_bitsel_vec: | ||
96 | return 1; | ||
97 | case INDEX_op_abs_vec: | ||
98 | case INDEX_op_cmp_vec: | ||
47 | -- | 99 | -- |
48 | 2.25.1 | 100 | 2.25.1 |
49 | 101 | ||
50 | 102 | diff view generated by jsdifflib |
1 | The definition of INDEX_op_dupi_vec is that it operates on | 1 | The three vector shift by vector operations are all implemented via |
---|---|---|---|
2 | units of tcg_target_ulong -- in this case 32 bits. It does | 2 | expansion. Therefore do not actually set TCG_TARGET_HAS_shv_vec, |
3 | not work to use this for a uint64_t value that happens to be | 3 | as none of shlv_vec, shrv_vec, sarv_vec may actually appear in the |
4 | small enough to fit in tcg_target_ulong. | 4 | instruction stream, and therefore also do not appear in tcg_target_op_def. |
5 | 5 | ||
6 | Fixes: d2fd745fe8b | 6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Fixes: db432672dc5 | ||
8 | Cc: qemu-stable@nongnu.org | ||
9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
10 | --- | 8 | --- |
11 | tcg/tcg-op-vec.c | 12 ++++++++---- | 9 | tcg/arm/tcg-target.opc.h | 3 ++ |
12 | 1 file changed, 8 insertions(+), 4 deletions(-) | 10 | tcg/arm/tcg-target.c.inc | 61 +++++++++++++++++++++++++++++++++++++++- |
11 | 2 files changed, 63 insertions(+), 1 deletion(-) | ||
13 | 12 | ||
14 | diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c | 13 | diff --git a/tcg/arm/tcg-target.opc.h b/tcg/arm/tcg-target.opc.h |
15 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/tcg/tcg-op-vec.c | 15 | --- a/tcg/arm/tcg-target.opc.h |
17 | +++ b/tcg/tcg-op-vec.c | 16 | +++ b/tcg/arm/tcg-target.opc.h |
18 | @@ -XXX,XX +XXX,XX @@ TCGv_vec tcg_const_ones_vec_matching(TCGv_vec m) | 17 | @@ -XXX,XX +XXX,XX @@ |
19 | 18 | * emitted by tcg_expand_vec_op. For those familiar with GCC internals, | |
20 | void tcg_gen_dup64i_vec(TCGv_vec r, uint64_t a) | 19 | * consider these to be UNSPEC with names. |
20 | */ | ||
21 | + | ||
22 | +DEF(arm_sshl_vec, 1, 2, 0, IMPLVEC) | ||
23 | +DEF(arm_ushl_vec, 1, 2, 0, IMPLVEC) | ||
24 | diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc | ||
25 | index XXXXXXX..XXXXXXX 100644 | ||
26 | --- a/tcg/arm/tcg-target.c.inc | ||
27 | +++ b/tcg/arm/tcg-target.c.inc | ||
28 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
29 | INSN_VSHLI = 0xf2800510, /* VSHL (immediate) */ | ||
30 | INSN_VSARI = 0xf2800010, /* VSHR.S */ | ||
31 | INSN_VSHRI = 0xf3800010, /* VSHR.U */ | ||
32 | + INSN_VSHL_S = 0xf2000400, /* VSHL.S (register) */ | ||
33 | + INSN_VSHL_U = 0xf3000400, /* VSHL.U (register) */ | ||
34 | |||
35 | INSN_VBSL = 0xf3100110, | ||
36 | INSN_VBIT = 0xf3200110, | ||
37 | @@ -XXX,XX +XXX,XX @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) | ||
38 | case INDEX_op_usadd_vec: | ||
39 | case INDEX_op_ussub_vec: | ||
40 | case INDEX_op_xor_vec: | ||
41 | + case INDEX_op_arm_sshl_vec: | ||
42 | + case INDEX_op_arm_ushl_vec: | ||
43 | return C_O1_I2(w, w, w); | ||
44 | case INDEX_op_or_vec: | ||
45 | case INDEX_op_andc_vec: | ||
46 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, | ||
47 | case INDEX_op_xor_vec: | ||
48 | tcg_out_vreg3(s, INSN_VEOR, q, 0, a0, a1, a2); | ||
49 | return; | ||
50 | + case INDEX_op_arm_sshl_vec: | ||
51 | + /* | ||
52 | + * Note that Vm is the data and Vn is the shift count, | ||
53 | + * therefore the arguments appear reversed. | ||
54 | + */ | ||
55 | + tcg_out_vreg3(s, INSN_VSHL_S, q, vece, a0, a2, a1); | ||
56 | + return; | ||
57 | + case INDEX_op_arm_ushl_vec: | ||
58 | + /* See above. */ | ||
59 | + tcg_out_vreg3(s, INSN_VSHL_U, q, vece, a0, a2, a1); | ||
60 | + return; | ||
61 | case INDEX_op_shli_vec: | ||
62 | tcg_out_vshifti(s, INSN_VSHLI, q, a0, a1, a2 + (8 << vece)); | ||
63 | return; | ||
64 | @@ -XXX,XX +XXX,XX @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) | ||
65 | case INDEX_op_umax_vec: | ||
66 | case INDEX_op_umin_vec: | ||
67 | return vece < MO_64; | ||
68 | + case INDEX_op_shlv_vec: | ||
69 | + case INDEX_op_shrv_vec: | ||
70 | + case INDEX_op_sarv_vec: | ||
71 | + return -1; | ||
72 | default: | ||
73 | return 0; | ||
74 | } | ||
75 | @@ -XXX,XX +XXX,XX @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) | ||
76 | void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, | ||
77 | TCGArg a0, ...) | ||
21 | { | 78 | { |
22 | - if (TCG_TARGET_REG_BITS == 32 && a == deposit64(a, 32, 32, a)) { | 79 | - g_assert_not_reached(); |
23 | - do_dupi_vec(r, MO_32, a); | 80 | + va_list va; |
24 | - } else if (TCG_TARGET_REG_BITS == 64 || a == (uint64_t)(int32_t)a) { | 81 | + TCGv_vec v0, v1, v2, t1; |
25 | + if (TCG_TARGET_REG_BITS == 64) { | 82 | + TCGArg a2; |
26 | do_dupi_vec(r, MO_64, a); | 83 | + |
27 | + } else if (a == dup_const(MO_32, a)) { | 84 | + va_start(va, a0); |
28 | + do_dupi_vec(r, MO_32, a); | 85 | + v0 = temp_tcgv_vec(arg_temp(a0)); |
29 | } else { | 86 | + v1 = temp_tcgv_vec(arg_temp(va_arg(va, TCGArg))); |
30 | TCGv_i64 c = tcg_const_i64(a); | 87 | + a2 = va_arg(va, TCGArg); |
31 | tcg_gen_dup_i64_vec(MO_64, r, c); | 88 | + va_end(va); |
32 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_dup8i_vec(TCGv_vec r, uint32_t a) | 89 | + |
33 | 90 | + switch (opc) { | |
34 | void tcg_gen_dupi_vec(unsigned vece, TCGv_vec r, uint64_t a) | 91 | + case INDEX_op_shlv_vec: |
35 | { | 92 | + /* |
36 | - do_dupi_vec(r, MO_REG, dup_const(vece, a)); | 93 | + * Merely propagate shlv_vec to arm_ushl_vec. |
37 | + if (vece == MO_64) { | 94 | + * In this way we don't set TCG_TARGET_HAS_shv_vec |
38 | + tcg_gen_dup64i_vec(r, a); | 95 | + * because everything is done via expansion. |
39 | + } else { | 96 | + */ |
40 | + do_dupi_vec(r, MO_REG, dup_const(vece, a)); | 97 | + v2 = temp_tcgv_vec(arg_temp(a2)); |
98 | + vec_gen_3(INDEX_op_arm_ushl_vec, type, vece, tcgv_vec_arg(v0), | ||
99 | + tcgv_vec_arg(v1), tcgv_vec_arg(v2)); | ||
100 | + break; | ||
101 | + | ||
102 | + case INDEX_op_shrv_vec: | ||
103 | + case INDEX_op_sarv_vec: | ||
104 | + /* Right shifts are negative left shifts for NEON. */ | ||
105 | + v2 = temp_tcgv_vec(arg_temp(a2)); | ||
106 | + t1 = tcg_temp_new_vec(type); | ||
107 | + tcg_gen_neg_vec(vece, t1, v2); | ||
108 | + if (opc == INDEX_op_shrv_vec) { | ||
109 | + opc = INDEX_op_arm_ushl_vec; | ||
110 | + } else { | ||
111 | + opc = INDEX_op_arm_sshl_vec; | ||
112 | + } | ||
113 | + vec_gen_3(opc, type, vece, tcgv_vec_arg(v0), | ||
114 | + tcgv_vec_arg(v1), tcgv_vec_arg(t1)); | ||
115 | + tcg_temp_free_vec(t1); | ||
116 | + break; | ||
117 | + | ||
118 | + default: | ||
119 | + g_assert_not_reached(); | ||
41 | + } | 120 | + } |
42 | } | 121 | } |
43 | 122 | ||
44 | void tcg_gen_dup_i64_vec(unsigned vece, TCGv_vec r, TCGv_i64 a) | 123 | static void tcg_out_nop_fill(tcg_insn_unit *p, int count) |
45 | -- | 124 | -- |
46 | 2.25.1 | 125 | 2.25.1 |
47 | 126 | ||
48 | 127 | diff view generated by jsdifflib |
1 | These are easier to set and test when they have their own fields. | 1 | Implement via expansion, so don't actually set TCG_TARGET_HAS_roti_vec. |
---|---|---|---|
2 | Reduce the size of alias_index and sort_index to 4 bits, which is | 2 | For NEON, this is shift-right followed by shift-left-and-insert. |
3 | sufficient for TCG_MAX_OP_ARGS. This leaves only the bits indicating | ||
4 | constants within the ct field. | ||
5 | 3 | ||
6 | Move all initialization to allocation time, rather than init | 4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
7 | individual fields in process_op_defs. | ||
8 | |||
9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
10 | --- | 6 | --- |
11 | include/tcg/tcg.h | 14 +++++++------- | 7 | tcg/arm/tcg-target-con-set.h | 1 + |
12 | tcg/tcg.c | 28 ++++++++++++---------------- | 8 | tcg/arm/tcg-target.opc.h | 1 + |
13 | 2 files changed, 19 insertions(+), 23 deletions(-) | 9 | tcg/arm/tcg-target.c.inc | 15 +++++++++++++++ |
10 | 3 files changed, 17 insertions(+) | ||
14 | 11 | ||
15 | diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h | 12 | diff --git a/tcg/arm/tcg-target-con-set.h b/tcg/arm/tcg-target-con-set.h |
16 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/include/tcg/tcg.h | 14 | --- a/tcg/arm/tcg-target-con-set.h |
18 | +++ b/include/tcg/tcg.h | 15 | +++ b/tcg/arm/tcg-target-con-set.h |
19 | @@ -XXX,XX +XXX,XX @@ int64_t tcg_cpu_exec_time(void); | 16 | @@ -XXX,XX +XXX,XX @@ C_O1_I2(r, r, rIK) |
20 | void tcg_dump_info(void); | 17 | C_O1_I2(r, r, rIN) |
21 | void tcg_dump_op_count(void); | 18 | C_O1_I2(r, r, ri) |
22 | 19 | C_O1_I2(r, rZ, rZ) | |
23 | -#define TCG_CT_ALIAS 0x80 | 20 | +C_O1_I2(w, 0, w) |
24 | -#define TCG_CT_IALIAS 0x40 | 21 | C_O1_I2(w, w, w) |
25 | -#define TCG_CT_NEWREG 0x20 /* output requires a new register */ | 22 | C_O1_I2(w, w, wO) |
26 | -#define TCG_CT_CONST 0x02 /* any constant of register size */ | 23 | C_O1_I2(w, w, wV) |
27 | +#define TCG_CT_CONST 1 /* any constant of register size */ | 24 | diff --git a/tcg/arm/tcg-target.opc.h b/tcg/arm/tcg-target.opc.h |
28 | |||
29 | typedef struct TCGArgConstraint { | ||
30 | - uint16_t ct; | ||
31 | - uint8_t alias_index; | ||
32 | - uint8_t sort_index; | ||
33 | + unsigned ct : 16; | ||
34 | + unsigned alias_index : 4; | ||
35 | + unsigned sort_index : 4; | ||
36 | + bool oalias : 1; | ||
37 | + bool ialias : 1; | ||
38 | + bool newreg : 1; | ||
39 | TCGRegSet regs; | ||
40 | } TCGArgConstraint; | ||
41 | |||
42 | diff --git a/tcg/tcg.c b/tcg/tcg.c | ||
43 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
44 | --- a/tcg/tcg.c | 26 | --- a/tcg/arm/tcg-target.opc.h |
45 | +++ b/tcg/tcg.c | 27 | +++ b/tcg/arm/tcg-target.opc.h |
46 | @@ -XXX,XX +XXX,XX @@ void tcg_context_init(TCGContext *s) | 28 | @@ -XXX,XX +XXX,XX @@ |
47 | total_args += n; | 29 | * consider these to be UNSPEC with names. |
30 | */ | ||
31 | |||
32 | +DEF(arm_sli_vec, 1, 2, 1, IMPLVEC) | ||
33 | DEF(arm_sshl_vec, 1, 2, 0, IMPLVEC) | ||
34 | DEF(arm_ushl_vec, 1, 2, 0, IMPLVEC) | ||
35 | diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc | ||
36 | index XXXXXXX..XXXXXXX 100644 | ||
37 | --- a/tcg/arm/tcg-target.c.inc | ||
38 | +++ b/tcg/arm/tcg-target.c.inc | ||
39 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
40 | INSN_VSHLI = 0xf2800510, /* VSHL (immediate) */ | ||
41 | INSN_VSARI = 0xf2800010, /* VSHR.S */ | ||
42 | INSN_VSHRI = 0xf3800010, /* VSHR.U */ | ||
43 | + INSN_VSLI = 0xf3800510, | ||
44 | INSN_VSHL_S = 0xf2000400, /* VSHL.S (register) */ | ||
45 | INSN_VSHL_U = 0xf3000400, /* VSHL.U (register) */ | ||
46 | |||
47 | @@ -XXX,XX +XXX,XX @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) | ||
48 | case INDEX_op_arm_sshl_vec: | ||
49 | case INDEX_op_arm_ushl_vec: | ||
50 | return C_O1_I2(w, w, w); | ||
51 | + case INDEX_op_arm_sli_vec: | ||
52 | + return C_O1_I2(w, 0, w); | ||
53 | case INDEX_op_or_vec: | ||
54 | case INDEX_op_andc_vec: | ||
55 | return C_O1_I2(w, w, wO); | ||
56 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, | ||
57 | case INDEX_op_sari_vec: | ||
58 | tcg_out_vshifti(s, INSN_VSARI, q, a0, a1, (16 << vece) - a2); | ||
59 | return; | ||
60 | + case INDEX_op_arm_sli_vec: | ||
61 | + tcg_out_vshifti(s, INSN_VSLI, q, a0, a2, args[3] + (8 << vece)); | ||
62 | + return; | ||
63 | |||
64 | case INDEX_op_andc_vec: | ||
65 | if (!const_args[2]) { | ||
66 | @@ -XXX,XX +XXX,XX @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) | ||
67 | case INDEX_op_shlv_vec: | ||
68 | case INDEX_op_shrv_vec: | ||
69 | case INDEX_op_sarv_vec: | ||
70 | + case INDEX_op_rotli_vec: | ||
71 | return -1; | ||
72 | default: | ||
73 | return 0; | ||
74 | @@ -XXX,XX +XXX,XX @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, | ||
75 | tcg_temp_free_vec(t1); | ||
76 | break; | ||
77 | |||
78 | + case INDEX_op_rotli_vec: | ||
79 | + t1 = tcg_temp_new_vec(type); | ||
80 | + tcg_gen_shri_vec(vece, t1, v1, -a2 & ((8 << vece) - 1)); | ||
81 | + vec_gen_4(INDEX_op_arm_sli_vec, type, vece, | ||
82 | + tcgv_vec_arg(v0), tcgv_vec_arg(t1), tcgv_vec_arg(v1), a2); | ||
83 | + tcg_temp_free_vec(t1); | ||
84 | + break; | ||
85 | + | ||
86 | default: | ||
87 | g_assert_not_reached(); | ||
48 | } | 88 | } |
49 | |||
50 | - args_ct = g_malloc(sizeof(TCGArgConstraint) * total_args); | ||
51 | + args_ct = g_new0(TCGArgConstraint, total_args); | ||
52 | |||
53 | for(op = 0; op < NB_OPS; op++) { | ||
54 | def = &tcg_op_defs[op]; | ||
55 | @@ -XXX,XX +XXX,XX @@ static int get_constraint_priority(const TCGOpDef *def, int k) | ||
56 | const TCGArgConstraint *arg_ct = &def->args_ct[k]; | ||
57 | int n; | ||
58 | |||
59 | - if (arg_ct->ct & TCG_CT_ALIAS) { | ||
60 | + if (arg_ct->oalias) { | ||
61 | /* an alias is equivalent to a single register */ | ||
62 | n = 1; | ||
63 | } else { | ||
64 | @@ -XXX,XX +XXX,XX @@ static void process_op_defs(TCGContext *s) | ||
65 | /* Incomplete TCGTargetOpDef entry. */ | ||
66 | tcg_debug_assert(ct_str != NULL); | ||
67 | |||
68 | - def->args_ct[i].regs = 0; | ||
69 | - def->args_ct[i].ct = 0; | ||
70 | while (*ct_str != '\0') { | ||
71 | switch(*ct_str) { | ||
72 | case '0' ... '9': | ||
73 | @@ -XXX,XX +XXX,XX @@ static void process_op_defs(TCGContext *s) | ||
74 | tcg_debug_assert(ct_str == tdefs->args_ct_str[i]); | ||
75 | tcg_debug_assert(oarg < def->nb_oargs); | ||
76 | tcg_debug_assert(def->args_ct[oarg].regs != 0); | ||
77 | - /* TCG_CT_ALIAS is for the output arguments. | ||
78 | - The input is tagged with TCG_CT_IALIAS. */ | ||
79 | def->args_ct[i] = def->args_ct[oarg]; | ||
80 | - def->args_ct[oarg].ct |= TCG_CT_ALIAS; | ||
81 | + /* The output sets oalias. */ | ||
82 | + def->args_ct[oarg].oalias = true; | ||
83 | def->args_ct[oarg].alias_index = i; | ||
84 | - def->args_ct[i].ct |= TCG_CT_IALIAS; | ||
85 | + /* The input sets ialias. */ | ||
86 | + def->args_ct[i].ialias = true; | ||
87 | def->args_ct[i].alias_index = oarg; | ||
88 | } | ||
89 | ct_str++; | ||
90 | break; | ||
91 | case '&': | ||
92 | - def->args_ct[i].ct |= TCG_CT_NEWREG; | ||
93 | + def->args_ct[i].newreg = true; | ||
94 | ct_str++; | ||
95 | break; | ||
96 | case 'i': | ||
97 | @@ -XXX,XX +XXX,XX @@ static void liveness_pass_1(TCGContext *s) | ||
98 | set = *pset; | ||
99 | |||
100 | set &= ct->regs; | ||
101 | - if (ct->ct & TCG_CT_IALIAS) { | ||
102 | + if (ct->ialias) { | ||
103 | set &= op->output_pref[ct->alias_index]; | ||
104 | } | ||
105 | /* If the combination is not possible, restart. */ | ||
106 | @@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) | ||
107 | } | ||
108 | |||
109 | i_preferred_regs = o_preferred_regs = 0; | ||
110 | - if (arg_ct->ct & TCG_CT_IALIAS) { | ||
111 | + if (arg_ct->ialias) { | ||
112 | o_preferred_regs = op->output_pref[arg_ct->alias_index]; | ||
113 | if (ts->fixed_reg) { | ||
114 | /* if fixed register, we must allocate a new register | ||
115 | @@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) | ||
116 | reg = ts->reg; | ||
117 | for (k2 = 0 ; k2 < k ; k2++) { | ||
118 | i2 = def->args_ct[nb_oargs + k2].sort_index; | ||
119 | - if ((def->args_ct[i2].ct & TCG_CT_IALIAS) && | ||
120 | - reg == new_args[i2]) { | ||
121 | + if (def->args_ct[i2].ialias && reg == new_args[i2]) { | ||
122 | goto allocate_in_reg; | ||
123 | } | ||
124 | } | ||
125 | @@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) | ||
126 | /* ENV should not be modified. */ | ||
127 | tcg_debug_assert(!ts->fixed_reg); | ||
128 | |||
129 | - if ((arg_ct->ct & TCG_CT_ALIAS) | ||
130 | - && !const_args[arg_ct->alias_index]) { | ||
131 | + if (arg_ct->oalias && !const_args[arg_ct->alias_index]) { | ||
132 | reg = new_args[arg_ct->alias_index]; | ||
133 | - } else if (arg_ct->ct & TCG_CT_NEWREG) { | ||
134 | + } else if (arg_ct->newreg) { | ||
135 | reg = tcg_reg_alloc(s, arg_ct->regs, | ||
136 | i_allocated_regs | o_allocated_regs, | ||
137 | op->output_pref[k], ts->indirect_base); | ||
138 | -- | 89 | -- |
139 | 2.25.1 | 90 | 2.25.1 |
140 | 91 | ||
141 | 92 | diff view generated by jsdifflib |
1 | The union is unused; let "regs" appear in the main structure | 1 | Implement via expansion, so don't actually set TCG_TARGET_HAS_rotv_vec. |
---|---|---|---|
2 | without the "u.regs" wrapping. | ||
3 | 2 | ||
4 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
6 | --- | 5 | --- |
7 | include/tcg/tcg.h | 4 +--- | 6 | tcg/arm/tcg-target.c.inc | 35 ++++++++++++++++++++++++++++++++++- |
8 | tcg/tcg.c | 22 +++++++++++----------- | 7 | 1 file changed, 34 insertions(+), 1 deletion(-) |
9 | tcg/aarch64/tcg-target.c.inc | 14 +++++++------- | ||
10 | tcg/arm/tcg-target.c.inc | 26 +++++++++++++------------- | ||
11 | tcg/i386/tcg-target.c.inc | 26 +++++++++++++------------- | ||
12 | tcg/mips/tcg-target.c.inc | 18 +++++++++--------- | ||
13 | tcg/ppc/tcg-target.c.inc | 24 ++++++++++++------------ | ||
14 | tcg/riscv/tcg-target.c.inc | 14 +++++++------- | ||
15 | tcg/s390/tcg-target.c.inc | 18 +++++++++--------- | ||
16 | tcg/sparc/tcg-target.c.inc | 16 ++++++++-------- | ||
17 | tcg/tci/tcg-target.c.inc | 2 +- | ||
18 | 11 files changed, 91 insertions(+), 93 deletions(-) | ||
19 | 8 | ||
20 | diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/include/tcg/tcg.h | ||
23 | +++ b/include/tcg/tcg.h | ||
24 | @@ -XXX,XX +XXX,XX @@ void tcg_dump_op_count(void); | ||
25 | typedef struct TCGArgConstraint { | ||
26 | uint16_t ct; | ||
27 | uint8_t alias_index; | ||
28 | - union { | ||
29 | - TCGRegSet regs; | ||
30 | - } u; | ||
31 | + TCGRegSet regs; | ||
32 | } TCGArgConstraint; | ||
33 | |||
34 | #define TCG_MAX_OP_ARGS 16 | ||
35 | diff --git a/tcg/tcg.c b/tcg/tcg.c | ||
36 | index XXXXXXX..XXXXXXX 100644 | ||
37 | --- a/tcg/tcg.c | ||
38 | +++ b/tcg/tcg.c | ||
39 | @@ -XXX,XX +XXX,XX @@ static int get_constraint_priority(const TCGOpDef *def, int k) | ||
40 | return 0; | ||
41 | n = 0; | ||
42 | for(i = 0; i < TCG_TARGET_NB_REGS; i++) { | ||
43 | - if (tcg_regset_test_reg(arg_ct->u.regs, i)) | ||
44 | + if (tcg_regset_test_reg(arg_ct->regs, i)) | ||
45 | n++; | ||
46 | } | ||
47 | } | ||
48 | @@ -XXX,XX +XXX,XX @@ static void process_op_defs(TCGContext *s) | ||
49 | /* Incomplete TCGTargetOpDef entry. */ | ||
50 | tcg_debug_assert(ct_str != NULL); | ||
51 | |||
52 | - def->args_ct[i].u.regs = 0; | ||
53 | + def->args_ct[i].regs = 0; | ||
54 | def->args_ct[i].ct = 0; | ||
55 | while (*ct_str != '\0') { | ||
56 | switch(*ct_str) { | ||
57 | @@ -XXX,XX +XXX,XX @@ static void liveness_pass_1(TCGContext *s) | ||
58 | pset = la_temp_pref(ts); | ||
59 | set = *pset; | ||
60 | |||
61 | - set &= ct->u.regs; | ||
62 | + set &= ct->regs; | ||
63 | if (ct->ct & TCG_CT_IALIAS) { | ||
64 | set &= op->output_pref[ct->alias_index]; | ||
65 | } | ||
66 | /* If the combination is not possible, restart. */ | ||
67 | if (set == 0) { | ||
68 | - set = ct->u.regs; | ||
69 | + set = ct->regs; | ||
70 | } | ||
71 | *pset = set; | ||
72 | } | ||
73 | @@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_dup(TCGContext *s, const TCGOp *op) | ||
74 | return; | ||
75 | } | ||
76 | |||
77 | - dup_out_regs = tcg_op_defs[INDEX_op_dup_vec].args_ct[0].u.regs; | ||
78 | - dup_in_regs = tcg_op_defs[INDEX_op_dup_vec].args_ct[1].u.regs; | ||
79 | + dup_out_regs = tcg_op_defs[INDEX_op_dup_vec].args_ct[0].regs; | ||
80 | + dup_in_regs = tcg_op_defs[INDEX_op_dup_vec].args_ct[1].regs; | ||
81 | |||
82 | /* Allocate the output register now. */ | ||
83 | if (ots->val_type != TEMP_VAL_REG) { | ||
84 | @@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) | ||
85 | } | ||
86 | } | ||
87 | |||
88 | - temp_load(s, ts, arg_ct->u.regs, i_allocated_regs, i_preferred_regs); | ||
89 | + temp_load(s, ts, arg_ct->regs, i_allocated_regs, i_preferred_regs); | ||
90 | reg = ts->reg; | ||
91 | |||
92 | - if (tcg_regset_test_reg(arg_ct->u.regs, reg)) { | ||
93 | + if (tcg_regset_test_reg(arg_ct->regs, reg)) { | ||
94 | /* nothing to do : the constraint is satisfied */ | ||
95 | } else { | ||
96 | allocate_in_reg: | ||
97 | @@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) | ||
98 | and move the temporary register into it */ | ||
99 | temp_load(s, ts, tcg_target_available_regs[ts->type], | ||
100 | i_allocated_regs, 0); | ||
101 | - reg = tcg_reg_alloc(s, arg_ct->u.regs, i_allocated_regs, | ||
102 | + reg = tcg_reg_alloc(s, arg_ct->regs, i_allocated_regs, | ||
103 | o_preferred_regs, ts->indirect_base); | ||
104 | if (!tcg_out_mov(s, ts->type, reg, ts->reg)) { | ||
105 | /* | ||
106 | @@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) | ||
107 | && !const_args[arg_ct->alias_index]) { | ||
108 | reg = new_args[arg_ct->alias_index]; | ||
109 | } else if (arg_ct->ct & TCG_CT_NEWREG) { | ||
110 | - reg = tcg_reg_alloc(s, arg_ct->u.regs, | ||
111 | + reg = tcg_reg_alloc(s, arg_ct->regs, | ||
112 | i_allocated_regs | o_allocated_regs, | ||
113 | op->output_pref[k], ts->indirect_base); | ||
114 | } else { | ||
115 | - reg = tcg_reg_alloc(s, arg_ct->u.regs, o_allocated_regs, | ||
116 | + reg = tcg_reg_alloc(s, arg_ct->regs, o_allocated_regs, | ||
117 | op->output_pref[k], ts->indirect_base); | ||
118 | } | ||
119 | tcg_regset_set_reg(o_allocated_regs, reg); | ||
120 | diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc | ||
121 | index XXXXXXX..XXXXXXX 100644 | ||
122 | --- a/tcg/aarch64/tcg-target.c.inc | ||
123 | +++ b/tcg/aarch64/tcg-target.c.inc | ||
124 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
125 | switch (*ct_str++) { | ||
126 | case 'r': /* general registers */ | ||
127 | ct->ct |= TCG_CT_REG; | ||
128 | - ct->u.regs |= 0xffffffffu; | ||
129 | + ct->regs |= 0xffffffffu; | ||
130 | break; | ||
131 | case 'w': /* advsimd registers */ | ||
132 | ct->ct |= TCG_CT_REG; | ||
133 | - ct->u.regs |= 0xffffffff00000000ull; | ||
134 | + ct->regs |= 0xffffffff00000000ull; | ||
135 | break; | ||
136 | case 'l': /* qemu_ld / qemu_st address, data_reg */ | ||
137 | ct->ct |= TCG_CT_REG; | ||
138 | - ct->u.regs = 0xffffffffu; | ||
139 | + ct->regs = 0xffffffffu; | ||
140 | #ifdef CONFIG_SOFTMMU | ||
141 | /* x0 and x1 will be overwritten when reading the tlb entry, | ||
142 | and x2, and x3 for helper args, better to avoid using them. */ | ||
143 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_X0); | ||
144 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_X1); | ||
145 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_X2); | ||
146 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_X3); | ||
147 | + tcg_regset_reset_reg(ct->regs, TCG_REG_X0); | ||
148 | + tcg_regset_reset_reg(ct->regs, TCG_REG_X1); | ||
149 | + tcg_regset_reset_reg(ct->regs, TCG_REG_X2); | ||
150 | + tcg_regset_reset_reg(ct->regs, TCG_REG_X3); | ||
151 | #endif | ||
152 | break; | ||
153 | case 'A': /* Valid for arithmetic immediate (positive or negative). */ | ||
154 | diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc | 9 | diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc |
155 | index XXXXXXX..XXXXXXX 100644 | 10 | index XXXXXXX..XXXXXXX 100644 |
156 | --- a/tcg/arm/tcg-target.c.inc | 11 | --- a/tcg/arm/tcg-target.c.inc |
157 | +++ b/tcg/arm/tcg-target.c.inc | 12 | +++ b/tcg/arm/tcg-target.c.inc |
158 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | 13 | @@ -XXX,XX +XXX,XX @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece) |
159 | 14 | case INDEX_op_shrv_vec: | |
160 | case 'r': | 15 | case INDEX_op_sarv_vec: |
161 | ct->ct |= TCG_CT_REG; | 16 | case INDEX_op_rotli_vec: |
162 | - ct->u.regs = 0xffff; | 17 | + case INDEX_op_rotlv_vec: |
163 | + ct->regs = 0xffff; | 18 | + case INDEX_op_rotrv_vec: |
19 | return -1; | ||
20 | default: | ||
21 | return 0; | ||
22 | @@ -XXX,XX +XXX,XX @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, | ||
23 | TCGArg a0, ...) | ||
24 | { | ||
25 | va_list va; | ||
26 | - TCGv_vec v0, v1, v2, t1; | ||
27 | + TCGv_vec v0, v1, v2, t1, t2, c1; | ||
28 | TCGArg a2; | ||
29 | |||
30 | va_start(va, a0); | ||
31 | @@ -XXX,XX +XXX,XX @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, | ||
32 | tcg_temp_free_vec(t1); | ||
164 | break; | 33 | break; |
165 | 34 | ||
166 | /* qemu_ld address */ | 35 | + case INDEX_op_rotlv_vec: |
167 | case 'l': | 36 | + v2 = temp_tcgv_vec(arg_temp(a2)); |
168 | ct->ct |= TCG_CT_REG; | 37 | + t1 = tcg_temp_new_vec(type); |
169 | - ct->u.regs = 0xffff; | 38 | + c1 = tcg_constant_vec(type, vece, 8 << vece); |
170 | + ct->regs = 0xffff; | 39 | + tcg_gen_sub_vec(vece, t1, v2, c1); |
171 | #ifdef CONFIG_SOFTMMU | 40 | + /* Right shifts are negative left shifts for NEON. */ |
172 | /* r0-r2,lr will be overwritten when reading the tlb entry, | 41 | + vec_gen_3(INDEX_op_arm_ushl_vec, type, vece, tcgv_vec_arg(t1), |
173 | so don't use these. */ | 42 | + tcgv_vec_arg(v1), tcgv_vec_arg(t1)); |
174 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R0); | 43 | + vec_gen_3(INDEX_op_arm_ushl_vec, type, vece, tcgv_vec_arg(v0), |
175 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R1); | 44 | + tcgv_vec_arg(v1), tcgv_vec_arg(v2)); |
176 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R2); | 45 | + tcg_gen_or_vec(vece, v0, v0, t1); |
177 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R3); | 46 | + tcg_temp_free_vec(t1); |
178 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R14); | 47 | + break; |
179 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R0); | 48 | + |
180 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R1); | 49 | + case INDEX_op_rotrv_vec: |
181 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R2); | 50 | + v2 = temp_tcgv_vec(arg_temp(a2)); |
182 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R3); | 51 | + t1 = tcg_temp_new_vec(type); |
183 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R14); | 52 | + t2 = tcg_temp_new_vec(type); |
184 | #endif | 53 | + c1 = tcg_constant_vec(type, vece, 8 << vece); |
185 | break; | 54 | + tcg_gen_neg_vec(vece, t1, v2); |
186 | 55 | + tcg_gen_sub_vec(vece, t2, c1, v2); | |
187 | /* qemu_st address & data */ | 56 | + /* Right shifts are negative left shifts for NEON. */ |
188 | case 's': | 57 | + vec_gen_3(INDEX_op_arm_ushl_vec, type, vece, tcgv_vec_arg(t1), |
189 | ct->ct |= TCG_CT_REG; | 58 | + tcgv_vec_arg(v1), tcgv_vec_arg(t1)); |
190 | - ct->u.regs = 0xffff; | 59 | + vec_gen_3(INDEX_op_arm_ushl_vec, type, vece, tcgv_vec_arg(t2), |
191 | + ct->regs = 0xffff; | 60 | + tcgv_vec_arg(v1), tcgv_vec_arg(t2)); |
192 | /* r0-r2 will be overwritten when reading the tlb entry (softmmu only) | 61 | + tcg_gen_or_vec(vece, v0, t1, t2); |
193 | and r0-r1 doing the byte swapping, so don't use these. */ | 62 | + tcg_temp_free_vec(t1); |
194 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R0); | 63 | + tcg_temp_free_vec(t2); |
195 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R1); | 64 | + break; |
196 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R0); | 65 | + |
197 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R1); | ||
198 | #if defined(CONFIG_SOFTMMU) | ||
199 | /* Avoid clashes with registers being used for helper args */ | ||
200 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R2); | ||
201 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R2); | ||
202 | #if TARGET_LONG_BITS == 64 | ||
203 | /* Avoid clashes with registers being used for helper args */ | ||
204 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R3); | ||
205 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R3); | ||
206 | #endif | ||
207 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R14); | ||
208 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R14); | ||
209 | #endif | ||
210 | break; | ||
211 | |||
212 | diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc | ||
213 | index XXXXXXX..XXXXXXX 100644 | ||
214 | --- a/tcg/i386/tcg-target.c.inc | ||
215 | +++ b/tcg/i386/tcg-target.c.inc | ||
216 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
217 | switch(*ct_str++) { | ||
218 | case 'a': | ||
219 | ct->ct |= TCG_CT_REG; | ||
220 | - tcg_regset_set_reg(ct->u.regs, TCG_REG_EAX); | ||
221 | + tcg_regset_set_reg(ct->regs, TCG_REG_EAX); | ||
222 | break; | ||
223 | case 'b': | ||
224 | ct->ct |= TCG_CT_REG; | ||
225 | - tcg_regset_set_reg(ct->u.regs, TCG_REG_EBX); | ||
226 | + tcg_regset_set_reg(ct->regs, TCG_REG_EBX); | ||
227 | break; | ||
228 | case 'c': | ||
229 | ct->ct |= TCG_CT_REG; | ||
230 | - tcg_regset_set_reg(ct->u.regs, TCG_REG_ECX); | ||
231 | + tcg_regset_set_reg(ct->regs, TCG_REG_ECX); | ||
232 | break; | ||
233 | case 'd': | ||
234 | ct->ct |= TCG_CT_REG; | ||
235 | - tcg_regset_set_reg(ct->u.regs, TCG_REG_EDX); | ||
236 | + tcg_regset_set_reg(ct->regs, TCG_REG_EDX); | ||
237 | break; | ||
238 | case 'S': | ||
239 | ct->ct |= TCG_CT_REG; | ||
240 | - tcg_regset_set_reg(ct->u.regs, TCG_REG_ESI); | ||
241 | + tcg_regset_set_reg(ct->regs, TCG_REG_ESI); | ||
242 | break; | ||
243 | case 'D': | ||
244 | ct->ct |= TCG_CT_REG; | ||
245 | - tcg_regset_set_reg(ct->u.regs, TCG_REG_EDI); | ||
246 | + tcg_regset_set_reg(ct->regs, TCG_REG_EDI); | ||
247 | break; | ||
248 | case 'q': | ||
249 | /* A register that can be used as a byte operand. */ | ||
250 | ct->ct |= TCG_CT_REG; | ||
251 | - ct->u.regs = TCG_TARGET_REG_BITS == 64 ? 0xffff : 0xf; | ||
252 | + ct->regs = TCG_TARGET_REG_BITS == 64 ? 0xffff : 0xf; | ||
253 | break; | ||
254 | case 'Q': | ||
255 | /* A register with an addressable second byte (e.g. %ah). */ | ||
256 | ct->ct |= TCG_CT_REG; | ||
257 | - ct->u.regs = 0xf; | ||
258 | + ct->regs = 0xf; | ||
259 | break; | ||
260 | case 'r': | ||
261 | /* A general register. */ | ||
262 | ct->ct |= TCG_CT_REG; | ||
263 | - ct->u.regs |= ALL_GENERAL_REGS; | ||
264 | + ct->regs |= ALL_GENERAL_REGS; | ||
265 | break; | ||
266 | case 'W': | ||
267 | /* With TZCNT/LZCNT, we can have operand-size as an input. */ | ||
268 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
269 | case 'x': | ||
270 | /* A vector register. */ | ||
271 | ct->ct |= TCG_CT_REG; | ||
272 | - ct->u.regs |= ALL_VECTOR_REGS; | ||
273 | + ct->regs |= ALL_VECTOR_REGS; | ||
274 | break; | ||
275 | |||
276 | /* qemu_ld/st address constraint */ | ||
277 | case 'L': | ||
278 | ct->ct |= TCG_CT_REG; | ||
279 | - ct->u.regs = TCG_TARGET_REG_BITS == 64 ? 0xffff : 0xff; | ||
280 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_L0); | ||
281 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_L1); | ||
282 | + ct->regs = TCG_TARGET_REG_BITS == 64 ? 0xffff : 0xff; | ||
283 | + tcg_regset_reset_reg(ct->regs, TCG_REG_L0); | ||
284 | + tcg_regset_reset_reg(ct->regs, TCG_REG_L1); | ||
285 | break; | ||
286 | |||
287 | case 'e': | ||
288 | diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc | ||
289 | index XXXXXXX..XXXXXXX 100644 | ||
290 | --- a/tcg/mips/tcg-target.c.inc | ||
291 | +++ b/tcg/mips/tcg-target.c.inc | ||
292 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
293 | switch(*ct_str++) { | ||
294 | case 'r': | ||
295 | ct->ct |= TCG_CT_REG; | ||
296 | - ct->u.regs = 0xffffffff; | ||
297 | + ct->regs = 0xffffffff; | ||
298 | break; | ||
299 | case 'L': /* qemu_ld input arg constraint */ | ||
300 | ct->ct |= TCG_CT_REG; | ||
301 | - ct->u.regs = 0xffffffff; | ||
302 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_A0); | ||
303 | + ct->regs = 0xffffffff; | ||
304 | + tcg_regset_reset_reg(ct->regs, TCG_REG_A0); | ||
305 | #if defined(CONFIG_SOFTMMU) | ||
306 | if (TCG_TARGET_REG_BITS < TARGET_LONG_BITS) { | ||
307 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_A2); | ||
308 | + tcg_regset_reset_reg(ct->regs, TCG_REG_A2); | ||
309 | } | ||
310 | #endif | ||
311 | break; | ||
312 | case 'S': /* qemu_st constraint */ | ||
313 | ct->ct |= TCG_CT_REG; | ||
314 | - ct->u.regs = 0xffffffff; | ||
315 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_A0); | ||
316 | + ct->regs = 0xffffffff; | ||
317 | + tcg_regset_reset_reg(ct->regs, TCG_REG_A0); | ||
318 | #if defined(CONFIG_SOFTMMU) | ||
319 | if (TCG_TARGET_REG_BITS < TARGET_LONG_BITS) { | ||
320 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_A2); | ||
321 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_A3); | ||
322 | + tcg_regset_reset_reg(ct->regs, TCG_REG_A2); | ||
323 | + tcg_regset_reset_reg(ct->regs, TCG_REG_A3); | ||
324 | } else { | ||
325 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_A1); | ||
326 | + tcg_regset_reset_reg(ct->regs, TCG_REG_A1); | ||
327 | } | ||
328 | #endif | ||
329 | break; | ||
330 | diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc | ||
331 | index XXXXXXX..XXXXXXX 100644 | ||
332 | --- a/tcg/ppc/tcg-target.c.inc | ||
333 | +++ b/tcg/ppc/tcg-target.c.inc | ||
334 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
335 | switch (*ct_str++) { | ||
336 | case 'A': case 'B': case 'C': case 'D': | ||
337 | ct->ct |= TCG_CT_REG; | ||
338 | - tcg_regset_set_reg(ct->u.regs, 3 + ct_str[0] - 'A'); | ||
339 | + tcg_regset_set_reg(ct->regs, 3 + ct_str[0] - 'A'); | ||
340 | break; | ||
341 | case 'r': | ||
342 | ct->ct |= TCG_CT_REG; | ||
343 | - ct->u.regs = 0xffffffff; | ||
344 | + ct->regs = 0xffffffff; | ||
345 | break; | ||
346 | case 'v': | ||
347 | ct->ct |= TCG_CT_REG; | ||
348 | - ct->u.regs = 0xffffffff00000000ull; | ||
349 | + ct->regs = 0xffffffff00000000ull; | ||
350 | break; | ||
351 | case 'L': /* qemu_ld constraint */ | ||
352 | ct->ct |= TCG_CT_REG; | ||
353 | - ct->u.regs = 0xffffffff; | ||
354 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R3); | ||
355 | + ct->regs = 0xffffffff; | ||
356 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R3); | ||
357 | #ifdef CONFIG_SOFTMMU | ||
358 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R4); | ||
359 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R5); | ||
360 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R4); | ||
361 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R5); | ||
362 | #endif | ||
363 | break; | ||
364 | case 'S': /* qemu_st constraint */ | ||
365 | ct->ct |= TCG_CT_REG; | ||
366 | - ct->u.regs = 0xffffffff; | ||
367 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R3); | ||
368 | + ct->regs = 0xffffffff; | ||
369 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R3); | ||
370 | #ifdef CONFIG_SOFTMMU | ||
371 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R4); | ||
372 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R5); | ||
373 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R6); | ||
374 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R4); | ||
375 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R5); | ||
376 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R6); | ||
377 | #endif | ||
378 | break; | ||
379 | case 'I': | ||
380 | diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc | ||
381 | index XXXXXXX..XXXXXXX 100644 | ||
382 | --- a/tcg/riscv/tcg-target.c.inc | ||
383 | +++ b/tcg/riscv/tcg-target.c.inc | ||
384 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
385 | switch (*ct_str++) { | ||
386 | case 'r': | ||
387 | ct->ct |= TCG_CT_REG; | ||
388 | - ct->u.regs = 0xffffffff; | ||
389 | + ct->regs = 0xffffffff; | ||
390 | break; | ||
391 | case 'L': | ||
392 | /* qemu_ld/qemu_st constraint */ | ||
393 | ct->ct |= TCG_CT_REG; | ||
394 | - ct->u.regs = 0xffffffff; | ||
395 | + ct->regs = 0xffffffff; | ||
396 | /* qemu_ld/qemu_st uses TCG_REG_TMP0 */ | ||
397 | #if defined(CONFIG_SOFTMMU) | ||
398 | - tcg_regset_reset_reg(ct->u.regs, tcg_target_call_iarg_regs[0]); | ||
399 | - tcg_regset_reset_reg(ct->u.regs, tcg_target_call_iarg_regs[1]); | ||
400 | - tcg_regset_reset_reg(ct->u.regs, tcg_target_call_iarg_regs[2]); | ||
401 | - tcg_regset_reset_reg(ct->u.regs, tcg_target_call_iarg_regs[3]); | ||
402 | - tcg_regset_reset_reg(ct->u.regs, tcg_target_call_iarg_regs[4]); | ||
403 | + tcg_regset_reset_reg(ct->regs, tcg_target_call_iarg_regs[0]); | ||
404 | + tcg_regset_reset_reg(ct->regs, tcg_target_call_iarg_regs[1]); | ||
405 | + tcg_regset_reset_reg(ct->regs, tcg_target_call_iarg_regs[2]); | ||
406 | + tcg_regset_reset_reg(ct->regs, tcg_target_call_iarg_regs[3]); | ||
407 | + tcg_regset_reset_reg(ct->regs, tcg_target_call_iarg_regs[4]); | ||
408 | #endif | ||
409 | break; | ||
410 | case 'I': | ||
411 | diff --git a/tcg/s390/tcg-target.c.inc b/tcg/s390/tcg-target.c.inc | ||
412 | index XXXXXXX..XXXXXXX 100644 | ||
413 | --- a/tcg/s390/tcg-target.c.inc | ||
414 | +++ b/tcg/s390/tcg-target.c.inc | ||
415 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
416 | switch (*ct_str++) { | ||
417 | case 'r': /* all registers */ | ||
418 | ct->ct |= TCG_CT_REG; | ||
419 | - ct->u.regs = 0xffff; | ||
420 | + ct->regs = 0xffff; | ||
421 | break; | ||
422 | case 'L': /* qemu_ld/st constraint */ | ||
423 | ct->ct |= TCG_CT_REG; | ||
424 | - ct->u.regs = 0xffff; | ||
425 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R2); | ||
426 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R3); | ||
427 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R4); | ||
428 | + ct->regs = 0xffff; | ||
429 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R2); | ||
430 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R3); | ||
431 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R4); | ||
432 | break; | ||
433 | case 'a': /* force R2 for division */ | ||
434 | ct->ct |= TCG_CT_REG; | ||
435 | - ct->u.regs = 0; | ||
436 | - tcg_regset_set_reg(ct->u.regs, TCG_REG_R2); | ||
437 | + ct->regs = 0; | ||
438 | + tcg_regset_set_reg(ct->regs, TCG_REG_R2); | ||
439 | break; | ||
440 | case 'b': /* force R3 for division */ | ||
441 | ct->ct |= TCG_CT_REG; | ||
442 | - ct->u.regs = 0; | ||
443 | - tcg_regset_set_reg(ct->u.regs, TCG_REG_R3); | ||
444 | + ct->regs = 0; | ||
445 | + tcg_regset_set_reg(ct->regs, TCG_REG_R3); | ||
446 | break; | ||
447 | case 'A': | ||
448 | ct->ct |= TCG_CT_CONST_S33; | ||
449 | diff --git a/tcg/sparc/tcg-target.c.inc b/tcg/sparc/tcg-target.c.inc | ||
450 | index XXXXXXX..XXXXXXX 100644 | ||
451 | --- a/tcg/sparc/tcg-target.c.inc | ||
452 | +++ b/tcg/sparc/tcg-target.c.inc | ||
453 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
454 | switch (*ct_str++) { | ||
455 | case 'r': | ||
456 | ct->ct |= TCG_CT_REG; | ||
457 | - ct->u.regs = 0xffffffff; | ||
458 | + ct->regs = 0xffffffff; | ||
459 | break; | ||
460 | case 'R': | ||
461 | ct->ct |= TCG_CT_REG; | ||
462 | - ct->u.regs = ALL_64; | ||
463 | + ct->regs = ALL_64; | ||
464 | break; | ||
465 | case 'A': /* qemu_ld/st address constraint */ | ||
466 | ct->ct |= TCG_CT_REG; | ||
467 | - ct->u.regs = TARGET_LONG_BITS == 64 ? ALL_64 : 0xffffffff; | ||
468 | + ct->regs = TARGET_LONG_BITS == 64 ? ALL_64 : 0xffffffff; | ||
469 | reserve_helpers: | ||
470 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_O0); | ||
471 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_O1); | ||
472 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_O2); | ||
473 | + tcg_regset_reset_reg(ct->regs, TCG_REG_O0); | ||
474 | + tcg_regset_reset_reg(ct->regs, TCG_REG_O1); | ||
475 | + tcg_regset_reset_reg(ct->regs, TCG_REG_O2); | ||
476 | break; | ||
477 | case 's': /* qemu_st data 32-bit constraint */ | ||
478 | ct->ct |= TCG_CT_REG; | ||
479 | - ct->u.regs = 0xffffffff; | ||
480 | + ct->regs = 0xffffffff; | ||
481 | goto reserve_helpers; | ||
482 | case 'S': /* qemu_st data 64-bit constraint */ | ||
483 | ct->ct |= TCG_CT_REG; | ||
484 | - ct->u.regs = ALL_64; | ||
485 | + ct->regs = ALL_64; | ||
486 | goto reserve_helpers; | ||
487 | case 'I': | ||
488 | ct->ct |= TCG_CT_CONST_S11; | ||
489 | diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc | ||
490 | index XXXXXXX..XXXXXXX 100644 | ||
491 | --- a/tcg/tci/tcg-target.c.inc | ||
492 | +++ b/tcg/tci/tcg-target.c.inc | ||
493 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
494 | case 'L': /* qemu_ld constraint */ | ||
495 | case 'S': /* qemu_st constraint */ | ||
496 | ct->ct |= TCG_CT_REG; | ||
497 | - ct->u.regs = BIT(TCG_TARGET_NB_REGS) - 1; | ||
498 | + ct->regs = BIT(TCG_TARGET_NB_REGS) - 1; | ||
499 | break; | ||
500 | default: | 66 | default: |
501 | return NULL; | 67 | g_assert_not_reached(); |
68 | } | ||
502 | -- | 69 | -- |
503 | 2.25.1 | 70 | 2.25.1 |
504 | 71 | ||
505 | 72 | diff view generated by jsdifflib |