This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR25500, pessimization on SSE code caused by count_type_elements (expr.c)


In this PR, the reporter is wrapping the intrinsics for SSE with a struct. SRA then unwraps the struct, but the code it generates is pessimized because it chooses to use block copies.

While Andrew Pinski reports in the PR that he has a patch to never use block copies for structs with a single element, the problem is that the middle-end does not think that the structure has a single element: this because it contains a vector. Since count_type_elements is only used in heuristics, it makes sense to treat vectors as a single element (rather than TYPE_VECTOR_SUBPARTS (type) elements) if a machine register can hold them.

With this change, SRA's heuristics kick in and generate element-by-element copies for the struct.

Bootstrapped/regtested i686-pc-linux-gnu. Ok for mainline and 4.1?

Paolo

2006-08-07  Paolo Bonzini  <bonzini@gnu.org>

	PR tree-optimization/25500
	* expr.c (count_type_elements): Treat non-BLKmode vectors as a
	single element.

Index: expr.c
===================================================================
--- expr.c      (revision 115990)
+++ expr.c      (working copy)
@@ -4763,7 +4763,7 @@ count_type_elements (tree type, bool all
       return 2;

     case VECTOR_TYPE:
-      return TYPE_VECTOR_SUBPARTS (type);
+      return TYPE_MODE (type) == BLKmode ? TYPE_VECTOR_SUBPARTS (type) : 1;

     case INTEGER_TYPE:
     case REAL_TYPE:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]