aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2008-05-22 13:25:14 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2008-05-22 13:25:14 +0000
commit34151a20ea237dd21dc1e39a0c25d715ed39d989 (patch)
tree218cb34225a91d4f3324f69d23a6470ce31becd7 /tcg/tcg-op.h
parentoptimization of shifts by a constant (diff)
downloadqemu-kvm-34151a20ea237dd21dc1e39a0c25d715ed39d989.tar.gz
qemu-kvm-34151a20ea237dd21dc1e39a0c25d715ed39d989.tar.bz2
qemu-kvm-34151a20ea237dd21dc1e39a0c25d715ed39d989.zip
small shift opts
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4525 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'tcg/tcg-op.h')
-rw-r--r--tcg/tcg-op.h36
1 files changed, 30 insertions, 6 deletions
diff --git a/tcg/tcg-op.h b/tcg/tcg-op.h
index 8bc0b84a2..b354100e6 100644
--- a/tcg/tcg-op.h
+++ b/tcg/tcg-op.h
@@ -404,7 +404,11 @@ static inline void tcg_gen_shl_i32(TCGv ret, TCGv arg1, TCGv arg2)
static inline void tcg_gen_shli_i32(TCGv ret, TCGv arg1, int32_t arg2)
{
- tcg_gen_shl_i32(ret, arg1, tcg_const_i32(arg2));
+ if (arg2 == 0) {
+ tcg_gen_mov_i32(ret, arg1);
+ } else {
+ tcg_gen_shl_i32(ret, arg1, tcg_const_i32(arg2));
+ }
}
static inline void tcg_gen_shr_i32(TCGv ret, TCGv arg1, TCGv arg2)
@@ -414,7 +418,11 @@ static inline void tcg_gen_shr_i32(TCGv ret, TCGv arg1, TCGv arg2)
static inline void tcg_gen_shri_i32(TCGv ret, TCGv arg1, int32_t arg2)
{
- tcg_gen_shr_i32(ret, arg1, tcg_const_i32(arg2));
+ if (arg2 == 0) {
+ tcg_gen_mov_i32(ret, arg1);
+ } else {
+ tcg_gen_shr_i32(ret, arg1, tcg_const_i32(arg2));
+ }
}
static inline void tcg_gen_sar_i32(TCGv ret, TCGv arg1, TCGv arg2)
@@ -424,7 +432,11 @@ static inline void tcg_gen_sar_i32(TCGv ret, TCGv arg1, TCGv arg2)
static inline void tcg_gen_sari_i32(TCGv ret, TCGv arg1, int32_t arg2)
{
- tcg_gen_sar_i32(ret, arg1, tcg_const_i32(arg2));
+ if (arg2 == 0) {
+ tcg_gen_mov_i32(ret, arg1);
+ } else {
+ tcg_gen_sar_i32(ret, arg1, tcg_const_i32(arg2));
+ }
}
static inline void tcg_gen_brcond_i32(int cond, TCGv arg1, TCGv arg2,
@@ -862,7 +874,11 @@ static inline void tcg_gen_shl_i64(TCGv ret, TCGv arg1, TCGv arg2)
static inline void tcg_gen_shli_i64(TCGv ret, TCGv arg1, int64_t arg2)
{
- tcg_gen_shl_i64(ret, arg1, tcg_const_i64(arg2));
+ if (arg2 == 0) {
+ tcg_gen_mov_i64(ret, arg1);
+ } else {
+ tcg_gen_shl_i64(ret, arg1, tcg_const_i64(arg2));
+ }
}
static inline void tcg_gen_shr_i64(TCGv ret, TCGv arg1, TCGv arg2)
@@ -872,7 +888,11 @@ static inline void tcg_gen_shr_i64(TCGv ret, TCGv arg1, TCGv arg2)
static inline void tcg_gen_shri_i64(TCGv ret, TCGv arg1, int64_t arg2)
{
- tcg_gen_shr_i64(ret, arg1, tcg_const_i64(arg2));
+ if (arg2 == 0) {
+ tcg_gen_mov_i64(ret, arg1);
+ } else {
+ tcg_gen_shr_i64(ret, arg1, tcg_const_i64(arg2));
+ }
}
static inline void tcg_gen_sar_i64(TCGv ret, TCGv arg1, TCGv arg2)
@@ -882,7 +902,11 @@ static inline void tcg_gen_sar_i64(TCGv ret, TCGv arg1, TCGv arg2)
static inline void tcg_gen_sari_i64(TCGv ret, TCGv arg1, int64_t arg2)
{
- tcg_gen_sar_i64(ret, arg1, tcg_const_i64(arg2));
+ if (arg2 == 0) {
+ tcg_gen_mov_i64(ret, arg1);
+ } else {
+ tcg_gen_sar_i64(ret, arg1, tcg_const_i64(arg2));
+ }
}
static inline void tcg_gen_brcond_i64(int cond, TCGv arg1, TCGv arg2,