diff mbox

tcg/optimize: Handle or r, a, a with constant a

Message ID 1426274817-25763-1-git-send-email-rth@twiddle.net
State New
Headers show

Commit Message

Richard Henderson March 13, 2015, 7:26 p.m. UTC
As seen with ubuntu-5.10-live-powerpc.iso.

Reported-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 tcg/optimize.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Bastian Koppelmann March 14, 2015, 12:54 a.m. UTC | #1
On 03/13/2015 07:26 PM, Richard Henderson wrote:
> As seen with ubuntu-5.10-live-powerpc.iso.
>
> Reported-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
>   tcg/optimize.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/tcg/optimize.c b/tcg/optimize.c
> index 067917c..37c1110 100644
> --- a/tcg/optimize.c
> +++ b/tcg/optimize.c
> @@ -980,8 +980,11 @@ static void tcg_constant_folding(TCGContext *s)
>               if (temps_are_copies(args[1], args[2])) {
>                   if (temps_are_copies(args[0], args[1])) {
>                       tcg_op_remove(s, op);
> -                } else {
> +                } else if (temps[args[1]].state != TCG_TEMP_CONST) {
>                       tcg_opt_gen_mov(s, op, args, opc, args[0], args[1]);
> +                } else {
> +                    tcg_opt_gen_movi(s, op, args, opc,
> +                                     args[0], temps[args[1]].val);
>                   }
>                   continue;
>               }
Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>

Cheers,
Bastian
Mark Cave-Ayland March 15, 2015, 12:42 p.m. UTC | #2
On 13/03/15 19:26, Richard Henderson wrote:

> As seen with ubuntu-5.10-live-powerpc.iso.
> 
> Reported-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
>  tcg/optimize.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/tcg/optimize.c b/tcg/optimize.c
> index 067917c..37c1110 100644
> --- a/tcg/optimize.c
> +++ b/tcg/optimize.c
> @@ -980,8 +980,11 @@ static void tcg_constant_folding(TCGContext *s)
>              if (temps_are_copies(args[1], args[2])) {
>                  if (temps_are_copies(args[0], args[1])) {
>                      tcg_op_remove(s, op);
> -                } else {
> +                } else if (temps[args[1]].state != TCG_TEMP_CONST) {
>                      tcg_opt_gen_mov(s, op, args, opc, args[0], args[1]);
> +                } else {
> +                    tcg_opt_gen_movi(s, op, args, opc,
> +                                     args[0], temps[args[1]].val);
>                  }
>                  continue;
>              }
> 

Great work! Fixes the issue here for me so:

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


ATB,

Mark.
diff mbox

Patch

diff --git a/tcg/optimize.c b/tcg/optimize.c
index 067917c..37c1110 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -980,8 +980,11 @@  static void tcg_constant_folding(TCGContext *s)
             if (temps_are_copies(args[1], args[2])) {
                 if (temps_are_copies(args[0], args[1])) {
                     tcg_op_remove(s, op);
-                } else {
+                } else if (temps[args[1]].state != TCG_TEMP_CONST) {
                     tcg_opt_gen_mov(s, op, args, opc, args[0], args[1]);
+                } else {
+                    tcg_opt_gen_movi(s, op, args, opc,
+                                     args[0], temps[args[1]].val);
                 }
                 continue;
             }