public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/68165] New: Not constant-folding setting vector element
@ 2015-10-30 17:41 alalaw01 at gcc dot gnu.org
2015-10-30 19:47 ` [Bug tree-optimization/68165] " glisse at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: alalaw01 at gcc dot gnu.org @ 2015-10-30 17:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68165
Bug ID: 68165
Summary: Not constant-folding setting vector element
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: alalaw01 at gcc dot gnu.org
Target Milestone: ---
I believe these two C functions are equivalent:
typedef float __attribute__((__vector_size__ (2 * sizeof(float))))
float32x2_t;
float32x2_t
test_cprop ()
{
float32x2_t vec = {0.0, 0.0};
vec[0] = 3.14f;
vec[1] = 2.71f;
return vec * ((float32x2_t) { 1.5f, 4.5f });
}
float32x2_t
test_cprop2 ()
{
float32x2_t vec = {3.14f, 2.71f};
return vec * ((float32x2_t) { 1.5f, 4.5f });
}
at -O3 -fdump-tree-optimized, on AArch64:
=====
;; Function test_cprop (test_cprop, funcdef_no=0, decl_uid=2603, cgraph_uid=0,
symbol_order=0)
test_cprop ()
{
float32x2_t vec;
vector(2) float vec.0_5;
float32x2_t _6;
<bb 2>:
vec = { 0.0, 0.0 };
BIT_FIELD_REF <vec, 32, 0> = 3.1400001049041748046875e+0;
BIT_FIELD_REF <vec, 32, 32> = 2.71000003814697265625e+0;
vec.0_5 = vec;
_6 = vec.0_5 * { 1.5e+0, 4.5e+0 };
vec ={v} {CLOBBER};
return _6;
}
;; Function test_cprop2 (test_cprop2, funcdef_no=1, decl_uid=2607,
cgraph_uid=1, symbol_order=1)
test_cprop2 ()
{
<bb 2>:
return { 4.71000003814697265625e+0, 1.219499969482421875e+1 };
}
=====
x86 is identical for test_cprop2, worse in test_cprop:
=====
test_cprop ()
{
float32x2_t vec;
vector(2) float vec.0_5;
float32x2_t _6;
float _8;
float _9;
float _10;
float _11;
<bb 2>:
vec = { 0.0, 0.0 };
BIT_FIELD_REF <vec, 32, 0> = 3.1400001049041748046875e+0;
BIT_FIELD_REF <vec, 32, 32> = 2.71000003814697265625e+0;
vec.0_5 = vec;
_8 = BIT_FIELD_REF <vec.0_5, 32, 0>;
_9 = _8 * 1.5e+0;
_10 = BIT_FIELD_REF <vec.0_5, 32, 32>;
_11 = _10 * 4.5e+0;
_6 = {_9, _11};
vec ={v} {CLOBBER};
return _6;
}
=====
i.e. we are not understanding the result of assigning to the BIT_FIELD_REF on
the whole vector, although we can resolve individual elements:
float32x2_t
test_cprop3 ()
{
float32x2_t vec = {0.0, 0.0};
vec[0] = 3.14f;
vec[1] = 2.71f;
return (float32x2_t) {vec[0], vec[1]} * ((float32x2_t) { 1.5f, 4.5f });
}
produces
=====
test_cprop3 ()
{
<bb 2>:
return { 4.71000003814697265625e+0, 1.219499969482421875e+1 };
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug tree-optimization/68165] Not constant-folding setting vector element
2015-10-30 17:41 [Bug tree-optimization/68165] New: Not constant-folding setting vector element alalaw01 at gcc dot gnu.org
@ 2015-10-30 19:47 ` glisse at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: glisse at gcc dot gnu.org @ 2015-10-30 19:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68165
--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
See also PR 56118.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-30 19:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-30 17:41 [Bug tree-optimization/68165] New: Not constant-folding setting vector element alalaw01 at gcc dot gnu.org
2015-10-30 19:47 ` [Bug tree-optimization/68165] " glisse 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).