* [Qemu-devel] [PATCH] tcg: Complete handling of ALWAYS and NEVER
[not found] <CABoDooPPEOWJQ6MeehCKvu=+rCwxj9tH5ZPOX1uHFgVkYiOpnw@mail.gmail.com>
@ 2015-02-20 19:19 ` Richard Henderson
2015-02-23 7:40 ` Laurent Desnogues
0 siblings, 1 reply; 2+ messages in thread
From: Richard Henderson @ 2015-02-20 19:19 UTC (permalink / raw)
To: qemu-devel; +Cc: laurent.desnogues
Missing from movcond, and brcondi_i32 (but not brcondi_i64).
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
tcg/tcg-op.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
---
On 02/20/2015 05:05 AM, Laurent Desnogues wrote:> Hi Richard,
>
> this patch results in movcond with always as a condition to be
> generated for csel al. The issue is that optimize.c did not get
> patched to accept that which results in some tcg_abort to fire (in
> do_constant_folding_cond_64 in this case).
Consider this patch to precede 08/11.
r~
---
diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
index 6674bb4..f7a2767 100644
--- a/tcg/tcg-op.c
+++ b/tcg/tcg-op.c
@@ -286,9 +286,13 @@ void tcg_gen_brcond_i32(TCGCond cond, TCGv_i32 arg1, TCGv_i32 arg2, TCGLabel *l)
void tcg_gen_brcondi_i32(TCGCond cond, TCGv_i32 arg1, int32_t arg2, TCGLabel *l)
{
- TCGv_i32 t0 = tcg_const_i32(arg2);
- tcg_gen_brcond_i32(cond, arg1, t0, l);
- tcg_temp_free_i32(t0);
+ if (cond == TCG_COND_ALWAYS) {
+ tcg_gen_br(l);
+ } else if (cond != TCG_COND_NEVER) {
+ TCGv_i32 t0 = tcg_const_i32(arg2);
+ tcg_gen_brcond_i32(cond, arg1, t0, l);
+ tcg_temp_free_i32(t0);
+ }
}
void tcg_gen_setcond_i32(TCGCond cond, TCGv_i32 ret,
@@ -546,7 +550,11 @@ void tcg_gen_deposit_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2,
void tcg_gen_movcond_i32(TCGCond cond, TCGv_i32 ret, TCGv_i32 c1,
TCGv_i32 c2, TCGv_i32 v1, TCGv_i32 v2)
{
- if (TCG_TARGET_HAS_movcond_i32) {
+ if (cond == TCG_COND_ALWAYS) {
+ tcg_gen_mov_i32(ret, v1);
+ } else if (cond == TCG_COND_NEVER) {
+ tcg_gen_mov_i32(ret, v2);
+ } else if (TCG_TARGET_HAS_movcond_i32) {
tcg_gen_op6i_i32(INDEX_op_movcond_i32, ret, c1, c2, v1, v2, cond);
} else {
TCGv_i32 t0 = tcg_temp_new_i32();
@@ -1590,7 +1598,11 @@ void tcg_gen_deposit_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2,
void tcg_gen_movcond_i64(TCGCond cond, TCGv_i64 ret, TCGv_i64 c1,
TCGv_i64 c2, TCGv_i64 v1, TCGv_i64 v2)
{
- if (TCG_TARGET_REG_BITS == 32) {
+ if (cond == TCG_COND_ALWAYS) {
+ tcg_gen_mov_i64(ret, v1);
+ } else if (cond == TCG_COND_NEVER) {
+ tcg_gen_mov_i64(ret, v2);
+ } else if (TCG_TARGET_REG_BITS == 32) {
TCGv_i32 t0 = tcg_temp_new_i32();
TCGv_i32 t1 = tcg_temp_new_i32();
tcg_gen_op6i_i32(INDEX_op_setcond2_i32, t0,
--
2.1.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] tcg: Complete handling of ALWAYS and NEVER
2015-02-20 19:19 ` [Qemu-devel] [PATCH] tcg: Complete handling of ALWAYS and NEVER Richard Henderson
@ 2015-02-23 7:40 ` Laurent Desnogues
0 siblings, 0 replies; 2+ messages in thread
From: Laurent Desnogues @ 2015-02-23 7:40 UTC (permalink / raw)
To: Richard Henderson; +Cc: qemu-devel@nongnu.org
Hi Richard,
On Fri, Feb 20, 2015 at 8:19 PM, Richard Henderson <rth@twiddle.net> wrote:
> Missing from movcond, and brcondi_i32 (but not brcondi_i64).
>
> Signed-off-by: Richard Henderson <rth@twiddle.net>
Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
> ---
> tcg/tcg-op.c | 22 +++++++++++++++++-----
> 1 file changed, 17 insertions(+), 5 deletions(-)
> ---
>
> On 02/20/2015 05:05 AM, Laurent Desnogues wrote:> Hi Richard,
>>
>> this patch results in movcond with always as a condition to be
>> generated for csel al. The issue is that optimize.c did not get
>> patched to accept that which results in some tcg_abort to fire (in
>> do_constant_folding_cond_64 in this case).
>
> Consider this patch to precede 08/11.
Works fine.
Thanks,
Laurent
>
> r~
> ---
>
> diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
> index 6674bb4..f7a2767 100644
> --- a/tcg/tcg-op.c
> +++ b/tcg/tcg-op.c
> @@ -286,9 +286,13 @@ void tcg_gen_brcond_i32(TCGCond cond, TCGv_i32 arg1, TCGv_i32 arg2, TCGLabel *l)
>
> void tcg_gen_brcondi_i32(TCGCond cond, TCGv_i32 arg1, int32_t arg2, TCGLabel *l)
> {
> - TCGv_i32 t0 = tcg_const_i32(arg2);
> - tcg_gen_brcond_i32(cond, arg1, t0, l);
> - tcg_temp_free_i32(t0);
> + if (cond == TCG_COND_ALWAYS) {
> + tcg_gen_br(l);
> + } else if (cond != TCG_COND_NEVER) {
> + TCGv_i32 t0 = tcg_const_i32(arg2);
> + tcg_gen_brcond_i32(cond, arg1, t0, l);
> + tcg_temp_free_i32(t0);
> + }
> }
>
> void tcg_gen_setcond_i32(TCGCond cond, TCGv_i32 ret,
> @@ -546,7 +550,11 @@ void tcg_gen_deposit_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2,
> void tcg_gen_movcond_i32(TCGCond cond, TCGv_i32 ret, TCGv_i32 c1,
> TCGv_i32 c2, TCGv_i32 v1, TCGv_i32 v2)
> {
> - if (TCG_TARGET_HAS_movcond_i32) {
> + if (cond == TCG_COND_ALWAYS) {
> + tcg_gen_mov_i32(ret, v1);
> + } else if (cond == TCG_COND_NEVER) {
> + tcg_gen_mov_i32(ret, v2);
> + } else if (TCG_TARGET_HAS_movcond_i32) {
> tcg_gen_op6i_i32(INDEX_op_movcond_i32, ret, c1, c2, v1, v2, cond);
> } else {
> TCGv_i32 t0 = tcg_temp_new_i32();
> @@ -1590,7 +1598,11 @@ void tcg_gen_deposit_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2,
> void tcg_gen_movcond_i64(TCGCond cond, TCGv_i64 ret, TCGv_i64 c1,
> TCGv_i64 c2, TCGv_i64 v1, TCGv_i64 v2)
> {
> - if (TCG_TARGET_REG_BITS == 32) {
> + if (cond == TCG_COND_ALWAYS) {
> + tcg_gen_mov_i64(ret, v1);
> + } else if (cond == TCG_COND_NEVER) {
> + tcg_gen_mov_i64(ret, v2);
> + } else if (TCG_TARGET_REG_BITS == 32) {
> TCGv_i32 t0 = tcg_temp_new_i32();
> TCGv_i32 t1 = tcg_temp_new_i32();
> tcg_gen_op6i_i32(INDEX_op_setcond2_i32, t0,
> --
> 2.1.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-23 7:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CABoDooPPEOWJQ6MeehCKvu=+rCwxj9tH5ZPOX1uHFgVkYiOpnw@mail.gmail.com>
2015-02-20 19:19 ` [Qemu-devel] [PATCH] tcg: Complete handling of ALWAYS and NEVER Richard Henderson
2015-02-23 7:40 ` Laurent Desnogues
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).