public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/22093] New: Unaligned access to HI values causes unrecognizable insn error
@ 2005-06-16 18:17 nenad at intrepid dot com
  2005-06-16 18:28 ` [Bug target/22093] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: nenad at intrepid dot com @ 2005-06-16 18:17 UTC (permalink / raw)
  To: gcc-bugs

I am enclosing a small test case. This is on Cray T3E, big endian alpha. 

---- source code ----

#define SHARED_PTR_SIZE           128
#define SHARED_PTR_PHASE_SIZE     48
#define SHARED_PTR_THREAD_SIZE    16
#define SHARED_PTR_VIRTADDR_SIZE  64
 
typedef struct shared_ptr_struct
  {
    unsigned long phase  : SHARED_PTR_PHASE_SIZE;
    unsigned thread : SHARED_PTR_THREAD_SIZE;
    void *addr;
  } shared_ptr_t;
typedef shared_ptr_t *shared_ptr_p;
 
shared_ptr_t x;
 
main ()
{
   x.thread = 2;
}

----- error reported -----

> gcc -da -c alpha_bug.c 
alpha_bug.c: In function `main':
alpha_bug.c:21: error: unrecognizable insn:
(insn 14 13 15 0 (set (reg:DI 73)
        (plus:DI (plus:DI (reg/f:DI 71)
                (const_int 6 [0x6]))
            (const_int 1 [0x1]))) -1 (nil)
    (nil))
alpha_bug.c:21: internal compiler error: in ?, at recog.c:2083
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.intrepid.com/upc/bugs.html> for instructions.

----- alpha.c/md code that produces RTL in question -----

The following call to get_unaligned_address returns

(plus:DI (reg/f:DI 71)
  (const_int 6 [0x6]))

which is passed as the first argument of the gen_unaligned_storehi()

  2929  /* Expand a non-bwx QImode or HImode move instruction;
  2930     return true if all work is done.  */
  2931
  2932  bool
  2933  alpha_expand_mov_nobwx (enum machine_mode mode, rtx *operands)
  2934  {
  ...

  3040            rtx temp1 = gen_reg_rtx (DImode);
  3041            rtx temp2 = gen_reg_rtx (DImode);
  3042            rtx temp3 = gen_reg_rtx (DImode);
  3043            rtx seq = ((mode == QImode
  3044                        ? gen_unaligned_storeqi
  3045                        : gen_unaligned_storehi)
  3046                       (get_unaligned_address (operands[0], 0),
  3047                        operands[1], temp1, temp2, temp3));
  3048
  3049            alpha_set_memflags (seq, operands[0]);
  3050            emit_insn (seq);
  3051          }

Later on, gen_unaligned_storehi() creates the offending unrecognizable INSN with
the 
following code:

(define_expand "unaligned_storehi_be"
  [(set (match_operand:DI 3 "register_operand" "")
        (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
                        (const_int -8))))
   (set (match_operand:DI 2 "register_operand" "")
        (plus:DI (match_dup 0) (const_int 1)))        <<<<<<<<======= 
   (set (match_dup 3)
        (and:DI (not:DI (ashift:DI
                          (const_int 65535)
                          (minus:DI (const_int 56)
                                    (ashift:DI (match_dup 2) (const_int 3)))))
                (match_dup 3)))
   (set (match_operand:DI 4 "register_operand" "")
        (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" ""))
                   (minus:DI (const_int 56)
                             (ashift:DI (match_dup 2) (const_int 3)))))
   (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
   (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
        (match_dup 4))]
  "WORDS_BIG_ENDIAN"
  "")

If I change line 3043 in alpha.c to load unaligned address of operand[0] into the
register and pass it to unaligned_storehi() everything works.

----- RTL dump 01.rtl -----

;; Function main
 
(note 2 0 3 NOTE_INSN_DELETED)
 
(note 3 2 4 NOTE_INSN_FUNCTION_BEG)
 
(note 4 3 5 NOTE_INSN_DELETED)
 
(insn 5 4 6 (set (reg:DI 70)
        (symbol_ref:DI ("__main") [flags 0x41])) -1 (nil)
    (nil))
 
(insn 6 5 7 (set (reg:DI 25 $25)
        (unspec:DI [
                (const_int 0 [0x0])
            ] 9)) -1 (nil)
    (nil))
 
(call_insn 7 6 8 (parallel [
            (call (mem:DI (reg:DI 70) [0 S8 A64])
                (unspec:DI [
                        (const_int 0 [0x0])
                    ] 9))
            (use (reg:DI 25 $25))
            (clobber (reg:DI 26 $26))
        ]) -1 (nil)
    (expr_list:REG_EH_REGION (const_int 0 [0x0])
        (nil))
    (nil))
 
(note 8 7 9 40007161440 NOTE_INSN_BLOCK_BEG)
 
(note 9 8 11 NOTE_INSN_DELETED)
 
(insn 11 9 12 (set (reg/f:DI 71)
        (symbol_ref:DI ("x") [flags 0x2] <var_decl 40014626060 x>)) -1 (nil)
    (nil))
 
(insn 12 11 13 (set (reg:HI 72)
        (const_int 2 [0x2])) -1 (nil)
    (nil))
 
(insn 13 12 14 (set (reg:DI 74)
        (mem/s:DI (and:DI (plus:DI (reg/f:DI 71)
                    (const_int 6 [0x6]))
                (const_int -8 [0xfffffffffffffff8])) [0 S8 A64])) -1 (nil)
    (nil))
 
(insn 14 13 15 (set (reg:DI 73)
        (plus:DI (plus:DI (reg/f:DI 71)
                (const_int 6 [0x6]))
            (const_int 1 [0x1]))) -1 (nil)
    (nil))
 
(insn 15 14 16 (set (reg:DI 74)
        (and:DI (not:DI (ashift:DI (const_int 65535 [0xffff])
                    (minus:DI (const_int 56 [0x38])
                        (ashift:DI (reg:DI 73)
                            (const_int 3 [0x3])))))
            (reg:DI 74))) -1 (nil)
    (nil))
 
(insn 16 15 17 (set (reg:DI 75)
        (ashift:DI (zero_extend:DI (reg:HI 72))
            (minus:DI (const_int 56 [0x38])
                (ashift:DI (reg:DI 73)
                    (const_int 3 [0x3]))))) -1 (nil)
    (nil))
 
(insn 17 16 18 (set (reg:DI 75)
        (ior:DI (reg:DI 75)
            (reg:DI 74))) -1 (nil)
    (nil))
 
(insn 18 17 19 (set (mem:DI (and:DI (plus:DI (reg/f:DI 71)
                    (const_int 6 [0x6]))
                (const_int -8 [0xfffffffffffffff8])) [0 S8 A64])
        (reg:DI 75)) -1 (nil)
    (nil))
 
(note 19 18 20 40007161440 NOTE_INSN_BLOCK_END)
 
(note 20 19 24 NOTE_INSN_FUNCTION_END)
 
(insn 24 20 25 (clobber (reg/i:DI 0 $0)) -1 (nil)
    (nil))
 
(insn 25 24 22 (clobber (reg:DI 69 [ <result> ])) -1 (nil)
    (nil))
 
(code_label 22 25 23 1 "" [0 uses])
 
(insn 23 22 26 (set (reg/i:DI 0 $0)
        (reg:DI 69 [ <result> ])) -1 (nil)
    (nil))
 
(insn 26 23 0 (use (reg/i:DI 0 $0)) -1 (nil)
    (nil))

-- 
           Summary: Unaligned access to HI values causes unrecognizable insn
                    error
           Product: gcc
           Version: 3.4.5
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: nenad at intrepid dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: alphaev5-cray-unicosmk2.0.6.X
  GCC host triplet: alphaev5-cray-unicosmk2.0.6.X
GCC target triplet: alphaev5-cray-unicosmk2.0.6.X


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


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

* [Bug target/22093] Unaligned access to HI values causes unrecognizable insn error
  2005-06-16 18:17 [Bug c/22093] New: Unaligned access to HI values causes unrecognizable insn error nenad at intrepid dot com
@ 2005-06-16 18:28 ` pinskia at gcc dot gnu dot org
  2005-06-19 23:02 ` pinskia at gcc dot gnu dot org
  2005-08-20 21:27 ` falk at debian dot org
  2 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-16 18:28 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |target
  GCC build triplet|alphaev5-cray-              |
                   |unicosmk2.0.6.X             |
   GCC host triplet|alphaev5-cray-              |
                   |unicosmk2.0.6.X             |
           Keywords|                            |ice-on-valid-code


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


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

* [Bug target/22093] Unaligned access to HI values causes unrecognizable insn error
  2005-06-16 18:17 [Bug c/22093] New: Unaligned access to HI values causes unrecognizable insn error nenad at intrepid dot com
  2005-06-16 18:28 ` [Bug target/22093] " pinskia at gcc dot gnu dot org
@ 2005-06-19 23:02 ` pinskia at gcc dot gnu dot org
  2005-08-20 21:27 ` falk at debian dot org
  2 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-19 23:02 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal


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


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

* [Bug target/22093] Unaligned access to HI values causes unrecognizable insn error
  2005-06-16 18:17 [Bug c/22093] New: Unaligned access to HI values causes unrecognizable insn error nenad at intrepid dot com
  2005-06-16 18:28 ` [Bug target/22093] " pinskia at gcc dot gnu dot org
  2005-06-19 23:02 ` pinskia at gcc dot gnu dot org
@ 2005-08-20 21:27 ` falk at debian dot org
  2 siblings, 0 replies; 10+ messages in thread
From: falk at debian dot org @ 2005-08-20 21:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From falk at debian dot org  2005-08-20 21:10 -------
(In reply to comment #0)

> If I change line 3043 in alpha.c to load unaligned address of operand[0] into the
> register and pass it to unaligned_storehi() everything works.

That seems like the right thing to do. Can you please send a patch to
gcc-patches, preferably with test suite results?


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1


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


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

* [Bug target/22093] Unaligned access to HI values causes unrecognizable insn error
       [not found] <bug-22093-10840@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2009-09-30 18:23 ` uros at gcc dot gnu dot org
@ 2009-09-30 18:24 ` ubizjak at gmail dot com
  5 siblings, 0 replies; 10+ messages in thread
From: ubizjak at gmail dot com @ 2009-09-30 18:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from ubizjak at gmail dot com  2009-09-30 18:24 -------
Fixed.


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.5


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


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

* [Bug target/22093] Unaligned access to HI values causes unrecognizable insn error
       [not found] <bug-22093-10840@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2009-09-30 18:03 ` uros at gcc dot gnu dot org
@ 2009-09-30 18:23 ` uros at gcc dot gnu dot org
  2009-09-30 18:24 ` ubizjak at gmail dot com
  5 siblings, 0 replies; 10+ messages in thread
From: uros at gcc dot gnu dot org @ 2009-09-30 18:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from uros at gcc dot gnu dot org  2009-09-30 18:23 -------
Subject: Bug 22093

Author: uros
Date: Wed Sep 30 18:22:48 2009
New Revision: 152344

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152344
Log:
        PR target/22093
        * config/alpha/alpha.md (unaligned_storehi_be): Force operand
        of plus RTX into register.

testsuite/ChangeLog:

        PR target/22093
        * gcc.target/alpha/pr22093.c: New test.


Added:
    branches/gcc-4_3-branch/gcc/testsuite/gcc.target/alpha/pr22093.c
Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/config/alpha/alpha.md
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug target/22093] Unaligned access to HI values causes unrecognizable insn error
       [not found] <bug-22093-10840@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2009-09-30  7:13 ` uros at gcc dot gnu dot org
@ 2009-09-30 18:03 ` uros at gcc dot gnu dot org
  2009-09-30 18:23 ` uros at gcc dot gnu dot org
  2009-09-30 18:24 ` ubizjak at gmail dot com
  5 siblings, 0 replies; 10+ messages in thread
From: uros at gcc dot gnu dot org @ 2009-09-30 18:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from uros at gcc dot gnu dot org  2009-09-30 18:03 -------
Subject: Bug 22093

Author: uros
Date: Wed Sep 30 18:03:17 2009
New Revision: 152343

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152343
Log:
        PR target/22093
        * config/alpha/alpha.md (unaligned_storehi_be): Force operand
        of plus RTX into register.

testsuite/ChangeLog:

        PR target/22093
        * gcc.target/alpha/pr22093.c: New test.


Added:
    branches/gcc-4_4-branch/gcc/testsuite/gcc.target/alpha/pr22093.c
Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/config/alpha/alpha.md
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug target/22093] Unaligned access to HI values causes unrecognizable insn error
       [not found] <bug-22093-10840@http.gcc.gnu.org/bugzilla/>
  2007-12-23 17:49 ` tbm at cyrius dot com
  2007-12-23 21:46 ` falk at debian dot org
@ 2009-09-30  7:13 ` uros at gcc dot gnu dot org
  2009-09-30 18:03 ` uros at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: uros at gcc dot gnu dot org @ 2009-09-30  7:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from uros at gcc dot gnu dot org  2009-09-30 07:13 -------
Subject: Bug 22093

Author: uros
Date: Wed Sep 30 07:13:20 2009
New Revision: 152322

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152322
Log:
        PR target/22093
        * config/alpha/alpha.md (unaligned_storehi_be): Force operand
        of plus RTX into register.

testsuite/ChangeLog:

        PR target/22093
        * gcc.target/alpha/pr22093.c: New test.


Added:
    trunk/gcc/testsuite/gcc.target/alpha/pr22093.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/alpha/alpha.md
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug target/22093] Unaligned access to HI values causes unrecognizable insn error
       [not found] <bug-22093-10840@http.gcc.gnu.org/bugzilla/>
  2007-12-23 17:49 ` tbm at cyrius dot com
@ 2007-12-23 21:46 ` falk at debian dot org
  2009-09-30  7:13 ` uros at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: falk at debian dot org @ 2007-12-23 21:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from falk at debian dot org  2007-12-23 21:46 -------
(In reply to comment #2)
> Falk, do you think you could check if this is still an issue?

It's very unlikely to be fixed. The fix mentioned seems to be right, but
without a big-endian Alpha system to test the patch on I wouldn't want to
commit it (big-endian Alpha is a pretty weird configuration, I think the only
one is the Cray T3E supercomputer).


-- 


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


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

* [Bug target/22093] Unaligned access to HI values causes unrecognizable insn error
       [not found] <bug-22093-10840@http.gcc.gnu.org/bugzilla/>
@ 2007-12-23 17:49 ` tbm at cyrius dot com
  2007-12-23 21:46 ` falk at debian dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: tbm at cyrius dot com @ 2007-12-23 17:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from tbm at cyrius dot com  2007-12-23 17:48 -------
Falk, do you think you could check if this is still an issue?


-- 

tbm at cyrius dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |falk at debian dot org


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


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

end of thread, other threads:[~2009-09-30 18:24 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-16 18:17 [Bug c/22093] New: Unaligned access to HI values causes unrecognizable insn error nenad at intrepid dot com
2005-06-16 18:28 ` [Bug target/22093] " pinskia at gcc dot gnu dot org
2005-06-19 23:02 ` pinskia at gcc dot gnu dot org
2005-08-20 21:27 ` falk at debian dot org
     [not found] <bug-22093-10840@http.gcc.gnu.org/bugzilla/>
2007-12-23 17:49 ` tbm at cyrius dot com
2007-12-23 21:46 ` falk at debian dot org
2009-09-30  7:13 ` uros at gcc dot gnu dot org
2009-09-30 18:03 ` uros at gcc dot gnu dot org
2009-09-30 18:23 ` uros at gcc dot gnu dot org
2009-09-30 18:24 ` ubizjak at gmail dot com

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).