diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 92a72da8373..a37923d374c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Sun Feb 1 02:50:46 1998 John Carr + + * combine.c (simplify_shift_const): (lshiftrt (truncate (lshiftrt))) + is (truncate (lshiftrt)). + Sun Feb 1 01:06:53 1998 Richard Henderson * alpha.c (alpha_expand_unaligned_load): Use expand_binop properly. diff --git a/gcc/combine.c b/gcc/combine.c index 3bcea7deb3c..017cf12715e 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -8787,6 +8787,28 @@ simplify_shift_const (x, code, result_mode, varop, count) continue; } break; + + case TRUNCATE: + /* Change (lshiftrt (truncate (lshiftrt))) to (truncate (lshiftrt)) + if the truncate does not affect the value. */ + if (code == LSHIFTRT + && GET_CODE (XEXP (varop, 0)) == LSHIFTRT + && GET_CODE (XEXP (XEXP (varop, 0), 1)) == CONST_INT + && (INTVAL (XEXP (XEXP (varop, 0), 1)) + >= (GET_MODE_BITSIZE (GET_MODE (XEXP (varop, 0))) - GET_MODE_BITSIZE (varop)))) + { + rtx varop_inner = XEXP (varop, 0); + + varop_inner = gen_rtx_combine (LSHIFTRT, + GET_MODE (varop_inner), + XEXP (varop_inner, 0), + GEN_INT (count + INTVAL (XEXP (varop_inner, 1)))); + varop = gen_rtx_combine (TRUNCATE, GET_MODE (varop), + varop_inner); + count = 0; + continue; + } + break; default: break;