This is the mail archive of the
mailing list for the GCC project.
[PATCH] Fix PR25500, pessimization on SSE code caused by count_type_elements (expr.c)
- From: Paolo Bonzini <paolo dot bonzini at lu dot unisi dot ch>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Andrew Pinski <pinskia at physics dot uc dot edu>
- Date: Mon, 07 Aug 2006 13:53:14 +0200
- Subject: [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
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?
2006-08-07 Paolo Bonzini <email@example.com>
* expr.c (count_type_elements): Treat non-BLKmode vectors as a
--- expr.c (revision 115990)
+++ expr.c (working copy)
@@ -4763,7 +4763,7 @@ count_type_elements (tree type, bool all
- return TYPE_VECTOR_SUBPARTS (type);
+ return TYPE_MODE (type) == BLKmode ? TYPE_VECTOR_SUBPARTS (type) : 1;