Commit fd56059fb612090f5fab049d44e39760ac8fe523
1 parent
38453b93
Optimize clear insns by treating support reg P0 specially and
add missing micro-op RETURN's (Edgar E. Iglesias). git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3913 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
30 additions
and
19 deletions
target-cris/op.c
@@ -205,6 +205,7 @@ void OPPROTO op_ccs_lshift (void) | @@ -205,6 +205,7 @@ void OPPROTO op_ccs_lshift (void) | ||
205 | ccs = env->pregs[SR_CCS]; | 205 | ccs = env->pregs[SR_CCS]; |
206 | ccs = (ccs & 0xc0000000) | ((ccs << 12) >> 2); | 206 | ccs = (ccs & 0xc0000000) | ((ccs << 12) >> 2); |
207 | env->pregs[SR_CCS] = ccs; | 207 | env->pregs[SR_CCS] = ccs; |
208 | + RETURN(); | ||
208 | } | 209 | } |
209 | void OPPROTO op_ccs_rshift (void) | 210 | void OPPROTO op_ccs_rshift (void) |
210 | { | 211 | { |
@@ -214,6 +215,7 @@ void OPPROTO op_ccs_rshift (void) | @@ -214,6 +215,7 @@ void OPPROTO op_ccs_rshift (void) | ||
214 | ccs = env->pregs[SR_CCS]; | 215 | ccs = env->pregs[SR_CCS]; |
215 | ccs = (ccs & 0xc0000000) | (ccs >> 10); | 216 | ccs = (ccs & 0xc0000000) | (ccs >> 10); |
216 | env->pregs[SR_CCS] = ccs; | 217 | env->pregs[SR_CCS] = ccs; |
218 | + RETURN(); | ||
217 | } | 219 | } |
218 | 220 | ||
219 | void OPPROTO op_setf (void) | 221 | void OPPROTO op_setf (void) |
target-cris/translate.c
@@ -110,15 +110,6 @@ typedef struct DisasContext { | @@ -110,15 +110,6 @@ typedef struct DisasContext { | ||
110 | unsigned int mode; | 110 | unsigned int mode; |
111 | unsigned int postinc; | 111 | unsigned int postinc; |
112 | 112 | ||
113 | - | ||
114 | - struct | ||
115 | - { | ||
116 | - int op; | ||
117 | - int size; | ||
118 | - unsigned int mask; | ||
119 | - } cc_state[3]; | ||
120 | - int cc_i; | ||
121 | - | ||
122 | int update_cc; | 113 | int update_cc; |
123 | int cc_op; | 114 | int cc_op; |
124 | int cc_size; | 115 | int cc_size; |
@@ -183,6 +174,10 @@ static void gen_vr_read(void) { | @@ -183,6 +174,10 @@ static void gen_vr_read(void) { | ||
183 | gen_op_movl_T0_im(32); | 174 | gen_op_movl_T0_im(32); |
184 | } | 175 | } |
185 | 176 | ||
177 | +static void gen_movl_T0_p0(void) { | ||
178 | + gen_op_movl_T0_im(0); | ||
179 | +} | ||
180 | + | ||
186 | static void gen_ccs_read(void) { | 181 | static void gen_ccs_read(void) { |
187 | gen_op_movl_T0_p13(); | 182 | gen_op_movl_T0_p13(); |
188 | } | 183 | } |
@@ -209,7 +204,7 @@ static GenOpFunc *gen_movl_preg_T0[16] = | @@ -209,7 +204,7 @@ static GenOpFunc *gen_movl_preg_T0[16] = | ||
209 | }; | 204 | }; |
210 | static GenOpFunc *gen_movl_T0_preg[16] = | 205 | static GenOpFunc *gen_movl_T0_preg[16] = |
211 | { | 206 | { |
212 | - gen_op_movl_T0_p0, | 207 | + gen_movl_T0_p0, |
213 | gen_vr_read, | 208 | gen_vr_read, |
214 | gen_op_movl_T0_p2, gen_op_movl_T0_p3, | 209 | gen_op_movl_T0_p2, gen_op_movl_T0_p3, |
215 | gen_op_movl_T0_p4, gen_op_movl_T0_p5, | 210 | gen_op_movl_T0_p4, gen_op_movl_T0_p5, |
@@ -345,6 +340,8 @@ static void cris_cc_mask(DisasContext *dc, unsigned int mask) | @@ -345,6 +340,8 @@ static void cris_cc_mask(DisasContext *dc, unsigned int mask) | ||
345 | { | 340 | { |
346 | uint32_t ovl; | 341 | uint32_t ovl; |
347 | 342 | ||
343 | + /* Check if we need to evaluate the condition codes due to | ||
344 | + CC overlaying. */ | ||
348 | ovl = (dc->cc_mask ^ mask) & ~mask; | 345 | ovl = (dc->cc_mask ^ mask) & ~mask; |
349 | if (ovl) { | 346 | if (ovl) { |
350 | /* TODO: optimize this case. It trigs all the time. */ | 347 | /* TODO: optimize this case. It trigs all the time. */ |
@@ -987,7 +984,6 @@ static unsigned int dec_btstq(DisasContext *dc) | @@ -987,7 +984,6 @@ static unsigned int dec_btstq(DisasContext *dc) | ||
987 | { | 984 | { |
988 | dc->op1 = EXTRACT_FIELD(dc->ir, 0, 4); | 985 | dc->op1 = EXTRACT_FIELD(dc->ir, 0, 4); |
989 | DIS(fprintf (logfile, "btstq %u, $r%d\n", dc->op1, dc->op2)); | 986 | DIS(fprintf (logfile, "btstq %u, $r%d\n", dc->op1, dc->op2)); |
990 | - cris_evaluate_flags(dc); | ||
991 | cris_cc_mask(dc, CC_MASK_NZ); | 987 | cris_cc_mask(dc, CC_MASK_NZ); |
992 | gen_movl_T0_reg[dc->op2](); | 988 | gen_movl_T0_reg[dc->op2](); |
993 | gen_op_movl_T1_im(dc->op1); | 989 | gen_op_movl_T1_im(dc->op1); |
@@ -1333,7 +1329,6 @@ static unsigned int dec_btst_r(DisasContext *dc) | @@ -1333,7 +1329,6 @@ static unsigned int dec_btst_r(DisasContext *dc) | ||
1333 | { | 1329 | { |
1334 | DIS(fprintf (logfile, "btst $r%u, $r%u\n", | 1330 | DIS(fprintf (logfile, "btst $r%u, $r%u\n", |
1335 | dc->op1, dc->op2)); | 1331 | dc->op1, dc->op2)); |
1336 | - cris_evaluate_flags(dc); | ||
1337 | cris_cc_mask(dc, CC_MASK_NZ); | 1332 | cris_cc_mask(dc, CC_MASK_NZ); |
1338 | dec_prep_alu_r(dc, dc->op1, dc->op2, 4, 0); | 1333 | dec_prep_alu_r(dc, dc->op1, dc->op2, 4, 0); |
1339 | crisv32_alu_op(dc, CC_OP_BTST, dc->op2, 4); | 1334 | crisv32_alu_op(dc, CC_OP_BTST, dc->op2, 4); |
@@ -1518,8 +1513,14 @@ static unsigned int dec_move_pr(DisasContext *dc) | @@ -1518,8 +1513,14 @@ static unsigned int dec_move_pr(DisasContext *dc) | ||
1518 | { | 1513 | { |
1519 | DIS(fprintf (logfile, "move $p%u, $r%u\n", dc->op1, dc->op2)); | 1514 | DIS(fprintf (logfile, "move $p%u, $r%u\n", dc->op1, dc->op2)); |
1520 | cris_cc_mask(dc, 0); | 1515 | cris_cc_mask(dc, 0); |
1521 | - gen_movl_T0_preg[dc->op2](); | ||
1522 | - gen_op_movl_T1_T0(); | 1516 | + /* Support register 0 is hardwired to zero. |
1517 | + Treat it specially. */ | ||
1518 | + if (dc->op2 == 0) | ||
1519 | + gen_op_movl_T1_im(0); | ||
1520 | + else { | ||
1521 | + gen_movl_T0_preg[dc->op2](); | ||
1522 | + gen_op_movl_T1_T0(); | ||
1523 | + } | ||
1523 | crisv32_alu_op(dc, CC_OP_MOVE, dc->op1, preg_sizes[dc->op2]); | 1524 | crisv32_alu_op(dc, CC_OP_MOVE, dc->op1, preg_sizes[dc->op2]); |
1524 | return 2; | 1525 | return 2; |
1525 | } | 1526 | } |
@@ -1846,13 +1847,21 @@ static unsigned int dec_move_pm(DisasContext *dc) | @@ -1846,13 +1847,21 @@ static unsigned int dec_move_pm(DisasContext *dc) | ||
1846 | 1847 | ||
1847 | memsize = preg_sizes[dc->op2]; | 1848 | memsize = preg_sizes[dc->op2]; |
1848 | 1849 | ||
1849 | - DIS(fprintf (logfile, "move.%d $p%u, [$r%u%s\n", | ||
1850 | - memsize, dc->op2, dc->op1, dc->postinc ? "+]" : "]")); | 1850 | + DIS(fprintf (logfile, "move.%c $p%u, [$r%u%s\n", |
1851 | + memsize_char(memsize), | ||
1852 | + dc->op2, dc->op1, dc->postinc ? "+]" : "]")); | ||
1851 | 1853 | ||
1852 | cris_cc_mask(dc, 0); | 1854 | cris_cc_mask(dc, 0); |
1853 | - /* prepare store. */ | ||
1854 | - gen_movl_T0_preg[dc->op2](); | ||
1855 | - gen_op_movl_T1_T0(); | 1855 | + /* prepare store. Address in T0, value in T1. */ |
1856 | + /* Support register 0 is hardwired to zero. | ||
1857 | + Treat it specially. */ | ||
1858 | + if (dc->op2 == 0) | ||
1859 | + gen_op_movl_T1_im(0); | ||
1860 | + else | ||
1861 | + { | ||
1862 | + gen_movl_T0_preg[dc->op2](); | ||
1863 | + gen_op_movl_T1_T0(); | ||
1864 | + } | ||
1856 | gen_movl_T0_reg[dc->op1](); | 1865 | gen_movl_T0_reg[dc->op1](); |
1857 | gen_store_T0_T1(dc, memsize); | 1866 | gen_store_T0_T1(dc, memsize); |
1858 | if (dc->postinc) | 1867 | if (dc->postinc) |