]> git.proxmox.com Git - qemu.git/commitdiff
Do not try handle "special" arguments of and/or/xor/shl/shr, upper level does it
authormalc <malc@c046a42c-6fe2-441c-8c8c-71466251a162>
Mon, 28 Jul 2008 23:46:03 +0000 (23:46 +0000)
committermalc <malc@c046a42c-6fe2-441c-8c8c-71466251a162>
Mon, 28 Jul 2008 23:46:03 +0000 (23:46 +0000)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4961 c046a42c-6fe2-441c-8c8c-71466251a162

tcg/ppc/tcg-target.c
tcg/ppc64/tcg-target.c

index 7dfb17f2cf7a402349bffef6aef1f5caeb19bbbd..7f95dd1060a9c0b2c297bc425da6f62d265af2e0 100644 (file)
@@ -1113,22 +1113,14 @@ static void tcg_out_op(TCGContext *s, int opc, const TCGArg *args,
 
     case INDEX_op_and_i32:
         if (const_args[2]) {
-            if (!args[2])
-                tcg_out_movi (s, TCG_TYPE_I32, args[0], 0);
+            if ((args[2] & 0xffff) == args[2])
+                tcg_out32 (s, ANDI | RS (args[1]) | RA (args[0]) | args[2]);
+            else if ((args[2] & 0xffff0000) == args[2])
+                tcg_out32 (s, ANDIS | RS (args[1]) | RA (args[0])
+                           | ((args[2] >> 16) & 0xffff));
             else {
-                if ((args[2] & 0xffff) == args[2])
-                    tcg_out32 (s, ANDI | RS (args[1]) | RA (args[0]) | args[2]);
-                else if ((args[2] & 0xffff0000) == args[2])
-                    tcg_out32 (s, ANDIS | RS (args[1]) | RA (args[0])
-                               | ((args[2] >> 16) & 0xffff));
-                else if (args[2] == 0xffffffff) {
-                    if (args[0] != args[1])
-                        tcg_out_mov (s, args[0], args[1]);
-                }
-                else {
-                    tcg_out_movi (s, TCG_TYPE_I32, 0, args[2]);
-                    tcg_out32 (s, AND | SAB (args[1], args[0], 0));
-                }
+                tcg_out_movi (s, TCG_TYPE_I32, 0, args[2]);
+                tcg_out32 (s, AND | SAB (args[1], args[0], 0));
             }
         }
         else
@@ -1136,22 +1128,16 @@ static void tcg_out_op(TCGContext *s, int opc, const TCGArg *args,
         break;
     case INDEX_op_or_i32:
         if (const_args[2]) {
-            if (args[2]) {
-                if (args[2] & 0xffff) {
-                    tcg_out32 (s, ORI | RS (args[1])  | RA (args[0])
-                               | (args[2] & 0xffff));
-                    if (args[2] >> 16)
-                        tcg_out32 (s, ORIS | RS (args[0])  | RA (args[0])
-                                   | ((args[2] >> 16) & 0xffff));
-                }
-                else {
-                    tcg_out32 (s, ORIS | RS (args[1])  | RA (args[0])
+            if (args[2] & 0xffff) {
+                tcg_out32 (s, ORI | RS (args[1])  | RA (args[0])
+                           | (args[2] & 0xffff));
+                if (args[2] >> 16)
+                    tcg_out32 (s, ORIS | RS (args[0])  | RA (args[0])
                                | ((args[2] >> 16) & 0xffff));
-                }
             }
             else {
-                if (args[0] != args[1])
-                    tcg_out_mov (s, args[0], args[1]);
+                tcg_out32 (s, ORIS | RS (args[1])  | RA (args[0])
+                           | ((args[2] >> 16) & 0xffff));
             }
         }
         else
@@ -1159,21 +1145,15 @@ static void tcg_out_op(TCGContext *s, int opc, const TCGArg *args,
         break;
     case INDEX_op_xor_i32:
         if (const_args[2]) {
-            if (args[2]) {
-                if ((args[2] & 0xffff) == args[2])
-                    tcg_out32 (s, XORI | RS (args[1])  | RA (args[0])
-                               | (args[2] & 0xffff));
-                else if ((args[2] & 0xffff0000) == args[2])
-                    tcg_out32 (s, XORIS | RS (args[1])  | RA (args[0])
-                               | ((args[2] >> 16) & 0xffff));
-                else {
-                    tcg_out_movi (s, TCG_TYPE_I32, 0, args[2]);
-                    tcg_out32 (s, XOR | SAB (args[1], args[0], 0));
-                }
-            }
+            if ((args[2] & 0xffff) == args[2])
+                tcg_out32 (s, XORI | RS (args[1])  | RA (args[0])
+                           | (args[2] & 0xffff));
+            else if ((args[2] & 0xffff0000) == args[2])
+                tcg_out32 (s, XORIS | RS (args[1])  | RA (args[0])
+                           | ((args[2] >> 16) & 0xffff));
             else {
-                if (args[0] != args[1])
-                    tcg_out_mov (s, args[0], args[1]);
+                tcg_out_movi (s, TCG_TYPE_I32, 0, args[2]);
+                tcg_out32 (s, XOR | SAB (args[1], args[0], 0));
             }
         }
         else
@@ -1228,34 +1208,28 @@ static void tcg_out_op(TCGContext *s, int opc, const TCGArg *args,
 
     case INDEX_op_shl_i32:
         if (const_args[2]) {
-            if (args[2])
-                tcg_out32 (s, (RLWINM
-                               | RA (args[0])
-                               | RS (args[1])
-                               | SH (args[2])
-                               | MB (0)
-                               | ME (31 - args[2])
-                               )
-                    );
-            else
-                tcg_out_mov (s, args[0], args[1]);
+            tcg_out32 (s, (RLWINM
+                           | RA (args[0])
+                           | RS (args[1])
+                           | SH (args[2])
+                           | MB (0)
+                           | ME (31 - args[2])
+                           )
+                );
         }
         else
             tcg_out32 (s, SLW | SAB (args[1], args[0], args[2]));
         break;
     case INDEX_op_shr_i32:
         if (const_args[2]) {
-            if (args[2])
-                tcg_out32 (s, (RLWINM
-                               | RA (args[0])
-                               | RS (args[1])
-                               | SH (32 - args[2])
-                               | MB (args[2])
-                               | ME (31)
-                               )
-                    );
-            else
-                tcg_out_mov (s, args[0], args[1]);
+            tcg_out32 (s, (RLWINM
+                           | RA (args[0])
+                           | RS (args[1])
+                           | SH (32 - args[2])
+                           | MB (args[2])
+                           | ME (31)
+                           )
+                );
         }
         else
             tcg_out32 (s, SRW | SAB (args[1], args[0], args[2]));
index c4b1f99c38b372a923e88f34e4c3bd1fc047a11f..8eb37513ddac0dc75ee62b379f26c3904c6f312d 100644 (file)
@@ -1104,22 +1104,14 @@ static void tcg_out_op (TCGContext *s, int opc, const TCGArg *args,
 
     case INDEX_op_and_i32:
         if (const_args[2]) {
-            if (!args[2])
-                tcg_out_movi (s, TCG_TYPE_I32, args[0], 0);
+            if ((args[2] & 0xffff) == args[2])
+                tcg_out32 (s, ANDI | RS (args[1]) | RA (args[0]) | args[2]);
+            else if ((args[2] & 0xffff0000) == args[2])
+                tcg_out32 (s, ANDIS | RS (args[1]) | RA (args[0])
+                           | ((args[2] >> 16) & 0xffff));
             else {
-                if ((args[2] & 0xffff) == args[2])
-                    tcg_out32 (s, ANDI | RS (args[1]) | RA (args[0]) | args[2]);
-                else if ((args[2] & 0xffff0000) == args[2])
-                    tcg_out32 (s, ANDIS | RS (args[1]) | RA (args[0])
-                               | ((args[2] >> 16) & 0xffff));
-                else if (args[2] == 0xffffffff) {
-                    if (args[0] != args[1])
-                        tcg_out_mov (s, args[0], args[1]);
-                }
-                else {
-                    tcg_out_movi (s, TCG_TYPE_I32, 0, args[2]);
-                    tcg_out32 (s, AND | SAB (args[1], args[0], 0));
-                }
+                tcg_out_movi (s, TCG_TYPE_I32, 0, args[2]);
+                tcg_out32 (s, AND | SAB (args[1], args[0], 0));
             }
         }
         else
@@ -1127,22 +1119,16 @@ static void tcg_out_op (TCGContext *s, int opc, const TCGArg *args,
         break;
     case INDEX_op_or_i32:
         if (const_args[2]) {
-            if (args[2]) {
-                if (args[2] & 0xffff) {
-                    tcg_out32 (s, ORI | RS (args[1])  | RA (args[0])
-                               | (args[2] & 0xffff));
-                    if (args[2] >> 16)
-                        tcg_out32 (s, ORIS | RS (args[0])  | RA (args[0])
-                                   | ((args[2] >> 16) & 0xffff));
-                }
-                else {
-                    tcg_out32 (s, ORIS | RS (args[1])  | RA (args[0])
+            if (args[2] & 0xffff) {
+                tcg_out32 (s, ORI | RS (args[1]) | RA (args[0])
+                           | (args[2] & 0xffff));
+                if (args[2] >> 16)
+                    tcg_out32 (s, ORIS | RS (args[0])  | RA (args[0])
                                | ((args[2] >> 16) & 0xffff));
-                }
             }
             else {
-                if (args[0] != args[1])
-                    tcg_out_mov (s, args[0], args[1]);
+                tcg_out32 (s, ORIS | RS (args[1])  | RA (args[0])
+                           | ((args[2] >> 16) & 0xffff));
             }
         }
         else
@@ -1150,21 +1136,15 @@ static void tcg_out_op (TCGContext *s, int opc, const TCGArg *args,
         break;
     case INDEX_op_xor_i32:
         if (const_args[2]) {
-            if (args[2]) {
-                if ((args[2] & 0xffff) == args[2])
-                    tcg_out32 (s, XORI | RS (args[1])  | RA (args[0])
-                               | (args[2] & 0xffff));
-                else if ((args[2] & 0xffff0000) == args[2])
-                    tcg_out32 (s, XORIS | RS (args[1])  | RA (args[0])
-                               | ((args[2] >> 16) & 0xffff));
-                else {
-                    tcg_out_movi (s, TCG_TYPE_I32, 0, args[2]);
-                    tcg_out32 (s, XOR | SAB (args[1], args[0], 0));
-                }
-            }
+            if ((args[2] & 0xffff) == args[2])
+                tcg_out32 (s, XORI | RS (args[1])  | RA (args[0])
+                           | (args[2] & 0xffff));
+            else if ((args[2] & 0xffff0000) == args[2])
+                tcg_out32 (s, XORIS | RS (args[1])  | RA (args[0])
+                           | ((args[2] >> 16) & 0xffff));
             else {
-                if (args[0] != args[1])
-                    tcg_out_mov (s, args[0], args[1]);
+                tcg_out_movi (s, TCG_TYPE_I32, 0, args[2]);
+                tcg_out32 (s, XOR | SAB (args[1], args[0], 0));
             }
         }
         else
@@ -1207,34 +1187,28 @@ static void tcg_out_op (TCGContext *s, int opc, const TCGArg *args,
 
     case INDEX_op_shl_i32:
         if (const_args[2]) {
-            if (args[2])
-                tcg_out32 (s, (RLWINM
-                               | RA (args[0])
-                               | RS (args[1])
-                               | SH (args[2])
-                               | MB (0)
-                               | ME (31 - args[2])
-                               )
-                    );
-            else
-                tcg_out_mov (s, args[0], args[1]);
+            tcg_out32 (s, (RLWINM
+                           | RA (args[0])
+                           | RS (args[1])
+                           | SH (args[2])
+                           | MB (0)
+                           | ME (31 - args[2])
+                           )
+                );
         }
         else
             tcg_out32 (s, SLW | SAB (args[1], args[0], args[2]));
         break;
     case INDEX_op_shr_i32:
         if (const_args[2]) {
-            if (args[2])
-                tcg_out32 (s, (RLWINM
-                               | RA (args[0])
-                               | RS (args[1])
-                               | SH (32 - args[2])
-                               | MB (args[2])
-                               | ME (31)
-                               )
-                    );
-            else
-                tcg_out_mov (s, args[0], args[1]);
+            tcg_out32 (s, (RLWINM
+                           | RA (args[0])
+                           | RS (args[1])
+                           | SH (32 - args[2])
+                           | MB (args[2])
+                           | ME (31)
+                           )
+                );
         }
         else
             tcg_out32 (s, SRW | SAB (args[1], args[0], args[2]));