public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug middle-end/28367] New: accessing via union on a vector does not cause vec_extract to be used @ 2006-07-13 2:43 pinskia at gcc dot gnu dot org 2006-07-13 5:37 ` [Bug middle-end/28367] " pinskia at gcc dot gnu dot org ` (3 more replies) 0 siblings, 4 replies; 8+ messages in thread From: pinskia at gcc dot gnu dot org @ 2006-07-13 2:43 UTC (permalink / raw) To: gcc-bugs Take the following code and compile with -O2 -m64 -maltivec -mabi=altivec: #define vector __attribute__((vector_size(16))) float f(vector float t) { union { vector float t1; float t2[4]; }t5; t5.t1 = t; return t5.t2[0]; } Currently we get: addi 12,1,-32 stvx 2,0,12 ld 11,0(12) srdi 9,11,32 stw 9,-16(1) lfs 1,-16(1) blr Which is bad for at least the Cell as we now hit two store load hazards. We can remove one if the compile uses the vec_extract patterns causing us to use stvewx and lfs. This does not effect x86 as the union is recorded as BLKmode but x86_64 has the same issue, maybe even worse as there is no need to go through memory there. X86_64 produces: f: .LFB2: movaps %xmm0, -24(%rsp) movss -24(%rsp), %xmm0 ret When really it should produce just a ret. -- Summary: accessing via union on a vector does not cause vec_extract to be used Product: gcc Version: 4.2.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pinskia at gcc dot gnu dot org GCC target triplet: powerpc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28367 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/28367] accessing via union on a vector does not cause vec_extract to be used 2006-07-13 2:43 [Bug middle-end/28367] New: accessing via union on a vector does not cause vec_extract to be used pinskia at gcc dot gnu dot org @ 2006-07-13 5:37 ` pinskia at gcc dot gnu dot org 2006-07-14 7:58 ` pinskia at gcc dot gnu dot org ` (2 subsequent siblings) 3 siblings, 0 replies; 8+ messages in thread From: pinskia at gcc dot gnu dot org @ 2006-07-13 5:37 UTC (permalink / raw) To: gcc-bugs ------- Comment #1 from pinskia at gcc dot gnu dot org 2006-07-13 05:37 ------- Note a related testcase is: #define vector __attribute__((vector_size(16))) float f(vector float t) { return *(float*)(&t); } Which is only mentioned here in get_alias_set in the GCC sources as being not violating aliasing rules (see also http://gcc.gnu.org/ml/gcc/2006-07/msg00250.html). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28367 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/28367] accessing via union on a vector does not cause vec_extract to be used 2006-07-13 2:43 [Bug middle-end/28367] New: accessing via union on a vector does not cause vec_extract to be used pinskia at gcc dot gnu dot org 2006-07-13 5:37 ` [Bug middle-end/28367] " pinskia at gcc dot gnu dot org @ 2006-07-14 7:58 ` pinskia at gcc dot gnu dot org 2006-07-19 14:46 ` pinskia at gcc dot gnu dot org 2006-08-26 4:48 ` pinskia at gcc dot gnu dot org 3 siblings, 0 replies; 8+ messages in thread From: pinskia at gcc dot gnu dot org @ 2006-07-14 7:58 UTC (permalink / raw) To: gcc-bugs ------- Comment #2 from pinskia at gcc dot gnu dot org 2006-07-14 07:58 ------- (In reply to comment #1) > Note a related testcase is: I have a patch to fix that related testcase and also fix some other issues related to BIT_FIELD_EXPR expansion with vec_extract (and why vec_set is still unused after my patch too). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28367 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/28367] accessing via union on a vector does not cause vec_extract to be used 2006-07-13 2:43 [Bug middle-end/28367] New: accessing via union on a vector does not cause vec_extract to be used pinskia at gcc dot gnu dot org 2006-07-13 5:37 ` [Bug middle-end/28367] " pinskia at gcc dot gnu dot org 2006-07-14 7:58 ` pinskia at gcc dot gnu dot org @ 2006-07-19 14:46 ` pinskia at gcc dot gnu dot org 2006-08-26 4:48 ` pinskia at gcc dot gnu dot org 3 siblings, 0 replies; 8+ messages in thread From: pinskia at gcc dot gnu dot org @ 2006-07-19 14:46 UTC (permalink / raw) To: gcc-bugs ------- Comment #3 from pinskia at gcc dot gnu dot org 2006-07-19 14:46 ------- (In reply to comment #2) > I have a patch to fix that related testcase and also fix some other issues > related to BIT_FIELD_EXPR expansion with vec_extract (and why vec_set is still > unused after my patch too). And I filed it as PR 28436. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28367 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/28367] accessing via union on a vector does not cause vec_extract to be used 2006-07-13 2:43 [Bug middle-end/28367] New: accessing via union on a vector does not cause vec_extract to be used pinskia at gcc dot gnu dot org ` (2 preceding siblings ...) 2006-07-19 14:46 ` pinskia at gcc dot gnu dot org @ 2006-08-26 4:48 ` pinskia at gcc dot gnu dot org 3 siblings, 0 replies; 8+ messages in thread From: pinskia at gcc dot gnu dot org @ 2006-08-26 4:48 UTC (permalink / raw) To: gcc-bugs ------- Comment #4 from pinskia at gcc dot gnu dot org 2006-08-26 04:48 ------- This is not target specific. -- pinskia at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 GCC target triplet|powerpc-linux-gnu | Last reconfirmed|0000-00-00 00:00:00 |2006-08-26 04:48:03 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28367 ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <bug-28367-4@http.gcc.gnu.org/bugzilla/>]
* [Bug middle-end/28367] accessing via union on a vector does not cause vec_extract to be used [not found] <bug-28367-4@http.gcc.gnu.org/bugzilla/> @ 2011-03-16 11:58 ` rguenth at gcc dot gnu.org 2014-10-10 0:25 ` glisse at gcc dot gnu.org 2014-11-24 9:03 ` rguenth at gcc dot gnu.org 2 siblings, 0 replies; 8+ messages in thread From: rguenth at gcc dot gnu.org @ 2011-03-16 11:58 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28367 Richard Guenther <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED AssignedTo|unassigned at gcc dot |rguenth at gcc dot gnu.org |gnu.org | --- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-03-16 11:41:03 UTC --- comment #1 is fixed, the original problem persists. optimized dump: ;; Function f (f) f (vector(4) float t) { union { vector(4) float t1; float t2[4]; } t5; float D.2687; <bb 2>: t5.t1 = t_1(D); D.2687_2 = t5.t2[0]; return D.2687_2; } FRE does not know how to handle different sizes in its support for type-punning stores/loads (visit_reference_op_load). Mine. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/28367] accessing via union on a vector does not cause vec_extract to be used [not found] <bug-28367-4@http.gcc.gnu.org/bugzilla/> 2011-03-16 11:58 ` rguenth at gcc dot gnu.org @ 2014-10-10 0:25 ` glisse at gcc dot gnu.org 2014-11-24 9:03 ` rguenth at gcc dot gnu.org 2 siblings, 0 replies; 8+ messages in thread From: glisse at gcc dot gnu.org @ 2014-10-10 0:25 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=28367 Marc Glisse <glisse at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |glisse at gcc dot gnu.org --- Comment #6 from Marc Glisse <glisse at gcc dot gnu.org> --- Created attachment 33674 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33674&action=edit rough patch It needs more work (seems more complicated than it should be), but at least it managed to produce what I expected for: #include <x86intrin.h> union u { __v4sf v; float a[4]; }; float f(__v4sf x){ u t; t.v=x; return t.a[2]; } ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/28367] accessing via union on a vector does not cause vec_extract to be used [not found] <bug-28367-4@http.gcc.gnu.org/bugzilla/> 2011-03-16 11:58 ` rguenth at gcc dot gnu.org 2014-10-10 0:25 ` glisse at gcc dot gnu.org @ 2014-11-24 9:03 ` rguenth at gcc dot gnu.org 2 siblings, 0 replies; 8+ messages in thread From: rguenth at gcc dot gnu.org @ 2014-11-24 9:03 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=28367 --- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> --- Yeah, something along that line would be needed. The issue is that the partial value is not "available" (as in: it doesn't have a SSA name) and thus there is nothing to CSE the load to. I suppose that we should generalize this support for real-/imag-part of complex values as well. Not sure if it is worth using BIT_FIELD_REF for getting at pieces of scalar registers (maybe it would pay off for targets that can efficiently compute lowpart subregs). ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-11-24 9:03 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2006-07-13 2:43 [Bug middle-end/28367] New: accessing via union on a vector does not cause vec_extract to be used pinskia at gcc dot gnu dot org 2006-07-13 5:37 ` [Bug middle-end/28367] " pinskia at gcc dot gnu dot org 2006-07-14 7:58 ` pinskia at gcc dot gnu dot org 2006-07-19 14:46 ` pinskia at gcc dot gnu dot org 2006-08-26 4:48 ` pinskia at gcc dot gnu dot org [not found] <bug-28367-4@http.gcc.gnu.org/bugzilla/> 2011-03-16 11:58 ` rguenth at gcc dot gnu.org 2014-10-10 0:25 ` glisse at gcc dot gnu.org 2014-11-24 9:03 ` rguenth at gcc dot gnu.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).