public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/59471] [4.9 Regression] ICE using vector extensions (non-top-level BIT_FIELD_REF, IMAGPART_EXPR or REALPART_EXPR)
Date: Fri, 20 Dec 2013 14:26:00 -0000	[thread overview]
Message-ID: <bug-59471-4-Bt87nd2GJZ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-59471-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
Testing

Index: gimplify.c                                                               
===================================================================             
--- gimplify.c  (revision 205891)                                               
+++ gimplify.c  (working copy)                                                  
@@ -7358,12 +7358,22 @@ gimplify_expr (tree *expr_p, gimple_seq                 
                                        TREE_TYPE (*expr_p));                   
          break;                                                                

+       case VIEW_CONVERT_EXPR:                                                 
+         if (is_gimple_reg_type (TREE_TYPE (*expr_p))                          
+             && is_gimple_reg_type (TREE_TYPE (TREE_OPERAND (*expr_p, 0))))    
+           {                                                                   
+             ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p,           
+                                  post_p, is_gimple_val, fb_rvalue);           
+             recalculate_side_effects (*expr_p);                               
+             break;                                                            
+           }                                                                   
+         /* Fallthru.  */                                                      
+                                                                               
        case ARRAY_REF:                                                         
        case ARRAY_RANGE_REF:                                                   
        case REALPART_EXPR:                                                     
        case IMAGPART_EXPR:                                                     
        case COMPONENT_REF:                                                     
-       case VIEW_CONVERT_EXPR:                                                 
          ret = gimplify_compound_lval (expr_p, pre_p, post_p,                  
                                        fallback ? fallback : fb_rvalue);       
          break;                                                                
@@ -7709,10 +7719,17 @@ gimplify_expr (tree *expr_p, gimple_seq                 
          break;                                                                

        case BIT_FIELD_REF:                                                     
-         ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p,               
-                              post_p, is_gimple_lvalue, fb_either);            
-         recalculate_side_effects (*expr_p);                                   
-         break;                                                                
+         {                                                                     
+           if (is_gimple_reg_type (TREE_TYPE (*expr_p))                        
+               && is_gimple_reg_type (TREE_TYPE (TREE_OPERAND (*expr_p, 0))))  
+             ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p,           
+                                  post_p, is_gimple_val, fb_rvalue);           
+           else                                                                
+             ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p,           
+                                  post_p, is_gimple_lvalue, fb_either);        
+           recalculate_side_effects (*expr_p);                                 
+           break;                                                              
+         }                                                                     

        case TARGET_MEM_REF:                                                    
          {                                                      


code-generation for the testcase is awkward though:

foo:
.LFB0:  
        .cfi_startproc
        movaps  %xmm0, -24(%rsp)
        movq    -24(%rsp), %rax
        movq    %rax, -24(%rsp)
        movq    -24(%rsp), %xmm0
        ret

not sure why RTL cannot recover here, we expand from

foo (uint16x8_t x)
{
  vector(2) long unsigned int _2;
  long unsigned int _3;
  uint8x8_t _4;

  <bb 2>:
  _2 = VIEW_CONVERT_EXPR<vector(2) long unsigned int>(x_5(D));
  _3 = BIT_FIELD_REF <_2, 64, 0>;
  _4 = VIEW_CONVERT_EXPR<uint8x8_t>(_3);
  return _4;

with forwprop we could re-write this into

  _4 = BIT_FIELD_REF <x_5(D), 64, 0>;

as BIT_FIELD_REF is allowed to select uint8x8_t from uint16x8_t directly.


  parent reply	other threads:[~2013-12-20 14:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-11 15:28 [Bug tree-optimization/59471] New: " jgreenhalgh at gcc dot gnu.org
2013-12-13 10:54 ` [Bug middle-end/59471] [4.9 Regression] " rguenth at gcc dot gnu.org
2013-12-17  9:48 ` jakub at gcc dot gnu.org
2013-12-17 20:54 ` glisse at gcc dot gnu.org
2013-12-17 20:56 ` jakub at gcc dot gnu.org
2013-12-17 21:10 ` glisse at gcc dot gnu.org
2013-12-19 13:04 ` rguenth at gcc dot gnu.org
2013-12-19 13:04 ` rguenth at gcc dot gnu.org
2013-12-19 13:05 ` rguenth at gcc dot gnu.org
2013-12-20 14:26 ` rguenth at gcc dot gnu.org [this message]
2014-01-08  8:59 ` rguenth at gcc dot gnu.org
2014-01-08  9:00 ` rguenth at gcc dot gnu.org
2014-01-08 22:33 ` jakub at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-59471-4-Bt87nd2GJZ@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).