Message ID | CAAgBjMkvfoaqo8cwMck17S9-wuC6tT_v-EjJYg22P5+WdF+xRw@mail.gmail.com |
---|---|
State | New |
Headers | show |
On Fri, 5 Aug 2016, Prathamesh Kulkarni wrote: > Ah, the mail failed to be delivered to gcc-patches, sorry for the double-post. > On 5 August 2016 at 01:26, Prathamesh Kulkarni > <prathamesh.kulkarni@linaro.org> wrote: > > Hi, > > Is the attached patch OK ? > > Since we want to extend based on signop, I removed ORing with wi::mask(). > > Bootstrap+test passes on x86_64-unknown-linux-gnu. > > Cross-test in progress on arm*-*-* and aarch64*-*-*. > > Ok for trunk ? Ok if you adjust the extend_mask function comment accordingly. Thanks, Richard.
On 5 August 2016 at 13:52, Richard Biener <rguenther@suse.de> wrote: > On Fri, 5 Aug 2016, Prathamesh Kulkarni wrote: > >> Ah, the mail failed to be delivered to gcc-patches, sorry for the double-post. >> On 5 August 2016 at 01:26, Prathamesh Kulkarni >> <prathamesh.kulkarni@linaro.org> wrote: >> > Hi, >> > Is the attached patch OK ? >> > Since we want to extend based on signop, I removed ORing with wi::mask(). >> > Bootstrap+test passes on x86_64-unknown-linux-gnu. >> > Cross-test in progress on arm*-*-* and aarch64*-*-*. >> > Ok for trunk ? > > Ok if you adjust the extend_mask function comment accordingly. Thanks, committed as r239212 after adjusting the comment and verifying bootstrap+test passes on aarch64-linux-gnu and ppc64le-linux-gnu. Thanks, Prathamesh > > Thanks, > Richard.
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index ae120a8..06e2905 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -234,10 +234,9 @@ debug_lattice_value (ccp_prop_value_t val) /* Extend NONZERO_BITS to a full mask, with the upper bits being set. */ static widest_int -extend_mask (const wide_int &nonzero_bits) +extend_mask (const wide_int &nonzero_bits, signop sgn) { - return (wi::mask <widest_int> (wi::get_precision (nonzero_bits), true) - | widest_int::from (nonzero_bits, UNSIGNED)); + return widest_int::from (nonzero_bits, sgn); } /* Compute a default value for variable VAR and store it in the @@ -287,7 +286,7 @@ get_default_value (tree var) { val.lattice_val = CONSTANT; val.value = build_zero_cst (TREE_TYPE (var)); - val.mask = extend_mask (nonzero_bits); + val.mask = extend_mask (nonzero_bits, TYPE_SIGN (TREE_TYPE (var))); } } } @@ -1937,7 +1936,7 @@ evaluate_stmt (gimple *stmt) { val.lattice_val = CONSTANT; val.value = build_zero_cst (TREE_TYPE (lhs)); - val.mask = extend_mask (nonzero_bits); + val.mask = extend_mask (nonzero_bits, TYPE_SIGN (TREE_TYPE (lhs))); is_constant = true; } else @@ -1948,7 +1947,8 @@ evaluate_stmt (gimple *stmt) if (nonzero_bits == 0) val.mask = 0; else - val.mask = val.mask & extend_mask (nonzero_bits); + val.mask = val.mask & extend_mask (nonzero_bits, + TYPE_SIGN (TREE_TYPE (lhs))); } } }