public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/11264] LROTATE_EXPR/RROTATE_EXPR misexpanded by middle-end/back-end for bitfields
       [not found] <bug-11264-4@http.gcc.gnu.org/bugzilla/>
@ 2024-01-24  6:36 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-24  6:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11264

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|WORKSFORME                  |WONTFIX
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=34971,
                   |                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=32244

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I should note simplify_rotate in tree-ssa-forwprop.cc does not generate rotates
for types that don't have the same precision as the mode which was done since
that function was added and has the following comment:
  /* Only create rotates in complete modes.  Other cases are not
     expanded properly.  */


Oh fold_binary used to create these too.  But the fix for PR 34971 changed that
and added an assert to expand_expr_real_1 to assert this case.

I should note we should document that behavior though.

Changing this to won't fix as the middle-end is asserting that we can't handle
it now.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/11264] LROTATE_EXPR/RROTATE_EXPR misexpanded by middle-end/back-end for bitfields
       [not found] <bug-11264-1064@http.gcc.gnu.org/bugzilla/>
  2006-02-16 20:09 ` steven at gcc dot gnu dot org
  2006-02-20  8:18 ` mtodorov at alu dot hr
@ 2007-02-03 18:28 ` steven at gcc dot gnu dot org
  2 siblings, 0 replies; 8+ messages in thread
From: steven at gcc dot gnu dot org @ 2007-02-03 18:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from steven at gcc dot gnu dot org  2007-02-03 18:28 -------
Has been in WAITING status for almost a year. Punt.


-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |WORKSFORME


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11264


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/11264] LROTATE_EXPR/RROTATE_EXPR misexpanded by middle-end/back-end for bitfields
       [not found] <bug-11264-1064@http.gcc.gnu.org/bugzilla/>
  2006-02-16 20:09 ` steven at gcc dot gnu dot org
@ 2006-02-20  8:18 ` mtodorov at alu dot hr
  2007-02-03 18:28 ` steven at gcc dot gnu dot org
  2 siblings, 0 replies; 8+ messages in thread
From: mtodorov at alu dot hr @ 2006-02-20  8:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from mtodorov at alu dot hr  2006-02-20 08:18 -------
Subject: Re:  LROTATE_EXPR/RROTATE_EXPR misexpanded by
 middle-end/back-end for bitfields


On Thu, 16 Feb 2006, steven at gcc dot gnu dot org wrote:

>
>
> ------- Comment #3 from steven at gcc dot gnu dot org  2006-02-16 20:09 -------

> Do we know if this bug is still present?

Apparently no. I tried to test from GPC front-end, yet appears to be 
supporting only up to 3.4.4. I will do some more research and keep you 
informed soon.

Mirsad


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11264


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/11264] LROTATE_EXPR/RROTATE_EXPR misexpanded by middle-end/back-end for bitfields
       [not found] <bug-11264-1064@http.gcc.gnu.org/bugzilla/>
@ 2006-02-16 20:09 ` steven at gcc dot gnu dot org
  2006-02-20  8:18 ` mtodorov at alu dot hr
  2007-02-03 18:28 ` steven at gcc dot gnu dot org
  2 siblings, 0 replies; 8+ messages in thread
From: steven at gcc dot gnu dot org @ 2006-02-16 20:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from steven at gcc dot gnu dot org  2006-02-16 20:09 -------
Do we know if this bug is still present?


-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11264


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/11264] LROTATE_EXPR/RROTATE_EXPR misexpanded by middle-end/back-end for bitfields
  2003-06-20 13:43 [Bug middle-end/11264] New: LROTATE_EXPR/RROTATE_EXPR misexpanded by middle-end/back-end mtodorov at alu dot hr
                   ` (2 preceding siblings ...)
  2003-07-12 11:36 ` mtodorov at alu dot hr
@ 2003-11-02 22:34 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-02 22:34 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11264


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2003-11-02 22:34:11
               date|                            |


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/11264] LROTATE_EXPR/RROTATE_EXPR misexpanded by middle-end/back-end for bitfields
  2003-06-20 13:43 [Bug middle-end/11264] New: LROTATE_EXPR/RROTATE_EXPR misexpanded by middle-end/back-end mtodorov at alu dot hr
  2003-06-24 14:53 ` [Bug middle-end/11264] LROTATE_EXPR/RROTATE_EXPR misexpanded by middle-end/back-end for bitfields pinskia at physics dot uc dot edu
  2003-07-05  2:16 ` pinskia at physics dot uc dot edu
@ 2003-07-12 11:36 ` mtodorov at alu dot hr
  2003-11-02 22:34 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 8+ messages in thread
From: mtodorov at alu dot hr @ 2003-07-12 11:36 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11264



------- Additional Comments From mtodorov at alu dot hr  2003-07-12 11:36 -------

Little progress:
================

We've traced it down to this code, gcc/expmed.c, that's unchanges until
gcc-20030709 snapshot (please see bellow):

NOTE that GET_MODE_BITSIZE (mode) when calculating suplementary shift count
for rotation emulation can get only information about the size of the
"container" of the variable.

NBAE, it appears to me that information about the number of bits of bitfield
is by now lost, and that the next power of two (8, 32, 64) is used
when calculating i.e.

      ROR (A, N) = A >> N | A << (C - N)

where C equals 8, 16, 32 or 64.

This is of course incorrect for bitfields of size i.e. 11, or 42, when
*they* need to be rotated.

/* If you might think rotations aren't useful, they appear to be. Having
   the ability that back-end generates a single rotate instruction instead
   of emulating the above is a great advantage.

   However NOTE that the above EMULATION isn't correct by definition for
   N >= bitsize, where we'd naturally expect things to go circular.

   This prevents front-end from emitting efficient rotation code for GPC,
   since we have to double the amount of work by adding another N MOD P
   (P = precision), which can expand in something less useful.

   Ideally, back-end should do this N MOD P for us, then we'd have it only
   when it's really needed, and ROR (A, N) for 8-bit, 16-bit or 32-bit
   A would truly be expanded into a single ror (or vice versa rol).

   Sorry if this was lenghty */ 

-------------------------------------------------------------------------------
          else if (methods == OPTAB_LIB_WIDEN)
            {
              /* If we have been unable to open-code this by a rotation,
                 do it as the IOR of two shifts.  I.e., to rotate A
                 by N bits, compute (A << N) | ((unsigned) A >> (C - N))
                 where C is the bitsize of A.

                 It is theoretically possible that the target machine might
                 not be able to perform either shift and hence we would
                 be making two libcalls rather than just the one for the
                 shift (similarly if IOR could not be done).  We will allow
                 this extremely unlikely lossage to avoid complicating the
                 code below.  */

              rtx subtarget = target == shifted ? 0 : target;
              rtx temp1;
              tree type = TREE_TYPE (amount);
              tree new_amount = make_tree (type, op1);
              tree other_amount
                = fold (build (MINUS_EXPR, type,
                               convert (type,
                                        build_int_2 (GET_MODE_BITSIZE (mode),
                                                     0)),
                               amount));

              shifted = force_reg (mode, shifted);

              temp = expand_shift (left ? LSHIFT_EXPR : RSHIFT_EXPR,
                                   mode, shifted, new_amount, subtarget, 1);
              temp1 = expand_shift (left ? RSHIFT_EXPR : LSHIFT_EXPR,
                                    mode, shifted, other_amount, 0, 1);
              return expand_binop (mode, ior_optab, temp, temp1, target,
                                   unsignedp, methods);
            }


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/11264] LROTATE_EXPR/RROTATE_EXPR misexpanded by middle-end/back-end for bitfields
  2003-06-20 13:43 [Bug middle-end/11264] New: LROTATE_EXPR/RROTATE_EXPR misexpanded by middle-end/back-end mtodorov at alu dot hr
  2003-06-24 14:53 ` [Bug middle-end/11264] LROTATE_EXPR/RROTATE_EXPR misexpanded by middle-end/back-end for bitfields pinskia at physics dot uc dot edu
@ 2003-07-05  2:16 ` pinskia at physics dot uc dot edu
  2003-07-12 11:36 ` mtodorov at alu dot hr
  2003-11-02 22:34 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 8+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-07-05  2:16 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11264


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4                         |---


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/11264] LROTATE_EXPR/RROTATE_EXPR misexpanded by middle-end/back-end for bitfields
  2003-06-20 13:43 [Bug middle-end/11264] New: LROTATE_EXPR/RROTATE_EXPR misexpanded by middle-end/back-end mtodorov at alu dot hr
@ 2003-06-24 14:53 ` pinskia at physics dot uc dot edu
  2003-07-05  2:16 ` pinskia at physics dot uc dot edu
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-06-24 14:53 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11264


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|LROTATE_EXPR/RROTATE_EXPR   |LROTATE_EXPR/RROTATE_EXPR
                   |misexpanded by middle-      |misexpanded by middle-
                   |end/back-end                |end/back-end for bitfields


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-01-24  6:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-11264-4@http.gcc.gnu.org/bugzilla/>
2024-01-24  6:36 ` [Bug middle-end/11264] LROTATE_EXPR/RROTATE_EXPR misexpanded by middle-end/back-end for bitfields pinskia at gcc dot gnu.org
     [not found] <bug-11264-1064@http.gcc.gnu.org/bugzilla/>
2006-02-16 20:09 ` steven at gcc dot gnu dot org
2006-02-20  8:18 ` mtodorov at alu dot hr
2007-02-03 18:28 ` steven at gcc dot gnu dot org
2003-06-20 13:43 [Bug middle-end/11264] New: LROTATE_EXPR/RROTATE_EXPR misexpanded by middle-end/back-end mtodorov at alu dot hr
2003-06-24 14:53 ` [Bug middle-end/11264] LROTATE_EXPR/RROTATE_EXPR misexpanded by middle-end/back-end for bitfields pinskia at physics dot uc dot edu
2003-07-05  2:16 ` pinskia at physics dot uc dot edu
2003-07-12 11:36 ` mtodorov at alu dot hr
2003-11-02 22:34 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).