public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/66144] New: vector element operator produces very bad code
@ 2015-05-14 15:43 mkg at us dot ibm.com
2015-05-14 15:47 ` [Bug target/66144] " pinskia at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: mkg at us dot ibm.com @ 2015-05-14 15:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66144
Bug ID: 66144
Summary: vector element operator produces very bad code
Product: gcc
Version: tree-ssa
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: mkg at us dot ibm.com
Target Milestone: ---
Compiling the following input
#include <altivec.h>
vector char
test( vector char a, vector char b)
{
return a == b;
}
generates the following output with gcc from from trunk/head with -O3
test:
vcmpequb 2,2,3
xxlxor 32,32,32
vspltisw 1,-1
xxsel 34,32,33,34
blr
The original first instruction already has the right answer, then it's
recomputed!
The inverted condition
#include <altivec.h>
vector char
test( vector char a, vector char b)
{
return a != b;
}
produces
test:
vcmpequb 2,2,3
xxlxor 33,33,33
vspltisw 0,-1
xxsel 34,32,33,34
blr
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/66144] vector element operator produces very bad code
2015-05-14 15:43 [Bug target/66144] New: vector element operator produces very bad code mkg at us dot ibm.com
@ 2015-05-14 15:47 ` pinskia at gcc dot gnu.org
2015-05-14 15:50 ` pinskia at gcc dot gnu.org
2015-05-14 20:36 ` segher at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-05-14 15:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66144
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|tree-ssa |4.9.0
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I suspect a == b is all equals and not element by element equals.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/66144] vector element operator produces very bad code
2015-05-14 15:43 [Bug target/66144] New: vector element operator produces very bad code mkg at us dot ibm.com
2015-05-14 15:47 ` [Bug target/66144] " pinskia at gcc dot gnu.org
@ 2015-05-14 15:50 ` pinskia at gcc dot gnu.org
2015-05-14 20:36 ` segher at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-05-14 15:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66144
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> I suspect a == b is all equals and not element by element equals.
I am wrong.
>From the manual:
Vector comparison is supported with standard comparison operators: ==, !=, <,
<=, >, >=. Comparison operands can be vector expressions of integer-type or
real-type. Comparison between integer-type vectors and real-type vectors are
not supported. The result of the comparison is a vector of the same width and
number of elements as the comparison operands with a signed integral element
type.
Vectors are compared element-wise producing 0 when comparison is false and -1
(constant of the appropriate type where all bits are set) otherwise. Consider
the following example.
typedef int v4si __attribute__ ((vector_size (16)));
v4si a = {1,2,3,4};
v4si b = {3,2,1,4};
v4si c;
c = a > b; /* The result would be {0, 0,-1, 0} */
c = a == b; /* The result would be {0,-1, 0,-1} */
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/66144] vector element operator produces very bad code
2015-05-14 15:43 [Bug target/66144] New: vector element operator produces very bad code mkg at us dot ibm.com
2015-05-14 15:47 ` [Bug target/66144] " pinskia at gcc dot gnu.org
2015-05-14 15:50 ` pinskia at gcc dot gnu.org
@ 2015-05-14 20:36 ` segher at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: segher at gcc dot gnu.org @ 2015-05-14 20:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66144
Segher Boessenkool <segher at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-05-14
CC| |segher at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #3 from Segher Boessenkool <segher at gcc dot gnu.org> ---
Confirmed. This code is generated by rs6000_emit_vector_cond_expr
and combine doesn't know how to simplify it (it tries though).
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-05-14 20:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-14 15:43 [Bug target/66144] New: vector element operator produces very bad code mkg at us dot ibm.com
2015-05-14 15:47 ` [Bug target/66144] " pinskia at gcc dot gnu.org
2015-05-14 15:50 ` pinskia at gcc dot gnu.org
2015-05-14 20:36 ` segher 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).