From c29d0de4d67f09674f7070a5e9a648f1d5074d8e Mon Sep 17 00:00:00 2001 From: aurel32 Date: Mon, 9 Mar 2009 22:35:22 +0000 Subject: [PATCH] tcg: optimize nor(X, Y, Y), used on PPC for not(X, Y) Signed-off-by: Aurelien Jarno git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6798 c046a42c-6fe2-441c-8c8c-71466251a162 --- tcg/tcg-op.h | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/tcg/tcg-op.h b/tcg/tcg-op.h index 1cf8b15e36..32440d0c00 100644 --- a/tcg/tcg-op.h +++ b/tcg/tcg-op.h @@ -1545,20 +1545,28 @@ static inline void tcg_gen_nand_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) static inline void tcg_gen_nor_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) { - TCGv_i32 t0; - t0 = tcg_temp_new_i32(); - tcg_gen_or_i32(t0, arg1, arg2); - tcg_gen_not_i32(ret, t0); - tcg_temp_free_i32(t0); + if (GET_TCGV_I32(arg1) != GET_TCGV_I32(arg2)) { + TCGv_i32 t0; + t0 = tcg_temp_new_i32(); + tcg_gen_or_i32(t0, arg1, arg2); + tcg_gen_not_i32(ret, t0); + tcg_temp_free_i32(t0); + } else { + tcg_gen_not_i32(ret, arg1); + } } static inline void tcg_gen_nor_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) { - TCGv_i64 t0; - t0 = tcg_temp_new_i64(); - tcg_gen_or_i64(t0, arg1, arg2); - tcg_gen_not_i64(ret, t0); - tcg_temp_free_i64(t0); + if (GET_TCGV_I64(arg1) != GET_TCGV_I64(arg2)) { + TCGv_i64 t0; + t0 = tcg_temp_new_i64(); + tcg_gen_or_i64(t0, arg1, arg2); + tcg_gen_not_i64(ret, t0); + tcg_temp_free_i64(t0); + } else { + tcg_gen_not_i64(ret, arg1); + } } static inline void tcg_gen_orc_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) -- 2.11.4.GIT