Commit c29d0de4d67f09674f7070a5e9a648f1d5074d8e

Authored by aurel32
1 parent d2604285

tcg: optimize nor(X, Y, Y), used on PPC for not(X, Y)

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6798 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 18 additions and 10 deletions
tcg/tcg-op.h
@@ -1545,20 +1545,28 @@ static inline void tcg_gen_nand_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) @@ -1545,20 +1545,28 @@ static inline void tcg_gen_nand_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
1545 1545
1546 static inline void tcg_gen_nor_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) 1546 static inline void tcg_gen_nor_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
1547 { 1547 {
1548 - TCGv_i32 t0;  
1549 - t0 = tcg_temp_new_i32();  
1550 - tcg_gen_or_i32(t0, arg1, arg2);  
1551 - tcg_gen_not_i32(ret, t0);  
1552 - tcg_temp_free_i32(t0); 1548 + if (GET_TCGV_I32(arg1) != GET_TCGV_I32(arg2)) {
  1549 + TCGv_i32 t0;
  1550 + t0 = tcg_temp_new_i32();
  1551 + tcg_gen_or_i32(t0, arg1, arg2);
  1552 + tcg_gen_not_i32(ret, t0);
  1553 + tcg_temp_free_i32(t0);
  1554 + } else {
  1555 + tcg_gen_not_i32(ret, arg1);
  1556 + }
1553 } 1557 }
1554 1558
1555 static inline void tcg_gen_nor_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) 1559 static inline void tcg_gen_nor_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
1556 { 1560 {
1557 - TCGv_i64 t0;  
1558 - t0 = tcg_temp_new_i64();  
1559 - tcg_gen_or_i64(t0, arg1, arg2);  
1560 - tcg_gen_not_i64(ret, t0);  
1561 - tcg_temp_free_i64(t0); 1561 + if (GET_TCGV_I64(arg1) != GET_TCGV_I64(arg2)) {
  1562 + TCGv_i64 t0;
  1563 + t0 = tcg_temp_new_i64();
  1564 + tcg_gen_or_i64(t0, arg1, arg2);
  1565 + tcg_gen_not_i64(ret, t0);
  1566 + tcg_temp_free_i64(t0);
  1567 + } else {
  1568 + tcg_gen_not_i64(ret, arg1);
  1569 + }
1562 } 1570 }
1563 1571
1564 static inline void tcg_gen_orc_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) 1572 static inline void tcg_gen_orc_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)