diff mbox

Fix PR target/65730

Message ID 1432092719-10784-1-git-send-email-jcmvbkbc@gmail.com
State New
Headers show

Commit Message

Max Filippov May 20, 2015, 3:31 a.m. UTC
2015-05-20  Max Filippov  <jcmvbkbc@gmail.com>
gcc/
	* config/xtensa/xtensa.c (init_alignment_context): Replace MULT
	by BITS_PER_UNIT with ASHIFT by exact_log2 (BITS_PER_UNIT).
---
 gcc/config/xtensa/xtensa.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

augustine.sterling@gmail.com May 20, 2015, 4:36 p.m. UTC | #1
On Tue, May 19, 2015 at 8:31 PM, Max Filippov <jcmvbkbc@gmail.com> wrote:
> 2015-05-20  Max Filippov  <jcmvbkbc@gmail.com>
> gcc/
>         * config/xtensa/xtensa.c (init_alignment_context): Replace MULT
>         by BITS_PER_UNIT with ASHIFT by exact_log2 (BITS_PER_UNIT).

Approved, please apply.
Max Filippov May 20, 2015, 6:59 p.m. UTC | #2
On Wed, May 20, 2015 at 7:36 PM, augustine.sterling@gmail.com
<augustine.sterling@gmail.com> wrote:
> On Tue, May 19, 2015 at 8:31 PM, Max Filippov <jcmvbkbc@gmail.com> wrote:
>> 2015-05-20  Max Filippov  <jcmvbkbc@gmail.com>
>> gcc/
>>         * config/xtensa/xtensa.c (init_alignment_context): Replace MULT
>>         by BITS_PER_UNIT with ASHIFT by exact_log2 (BITS_PER_UNIT).
>
> Approved, please apply.

Applied to trunk. Thanks!

-- Max
diff mbox

Patch

diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
index eb039ba..7296e36 100644
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
@@ -1461,8 +1461,9 @@  init_alignment_context (struct alignment_context *ac, rtx mem)
   if (ac->shift != NULL_RTX)
     {
       /* Shift is the byte count, but we need the bitcount.  */
-      ac->shift = expand_simple_binop (SImode, MULT, ac->shift,
-				       GEN_INT (BITS_PER_UNIT),
+      gcc_assert (exact_log2 (BITS_PER_UNIT) >= 0);
+      ac->shift = expand_simple_binop (SImode, ASHIFT, ac->shift,
+				       GEN_INT (exact_log2 (BITS_PER_UNIT)),
 				       NULL_RTX, 1, OPTAB_DIRECT);
       ac->modemask = expand_simple_binop (SImode, ASHIFT,
 					  GEN_INT (GET_MODE_MASK (mode)),