This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/53652] New: *andn* isn't used for vectorization
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 13 Jun 2012 06:49:06 +0000
- Subject: [Bug rtl-optimization/53652] New: *andn* isn't used for vectorization
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53652
Bug #: 53652
Summary: *andn* isn't used for vectorization
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: jakub@gcc.gnu.org
CC: uros@gcc.gnu.org
Target: x86_64-linux
#define N 1024
long a[N], b[N], c[N];
int d[N], e[N], f[N];
void
foo (void)
{
int i;
for (i = 0; i < N; i++)
a[i] = b[i] & ~c[i];
}
void
bar (void)
{
int i;
for (i = 0; i < N; i++)
d[i] = e[i] & ~f[i];
}
doesn't use *andn* insns (e.g. vandnp[sd] for -O3 -mavx). The problem is that
combiner doesn't help here, because
(insn 42 18 33 2 (set (reg:V4DI 94)
(mem/u/c:V4DI (symbol_ref/u:DI ("*.LC0") [flags 0x2]) [2 S32 A256])) -1
(expr_list:REG_EQUAL (const_vector:V4DI [
(const_int -1 [0xffffffffffffffff])
(const_int -1 [0xffffffffffffffff])
(const_int -1 [0xffffffffffffffff])
(const_int -1 [0xffffffffffffffff])
])
(nil)))
is before the loop and thus in a different bb,
so the combiner doesn't substitute the all ones constant into the xor (which
should fail, i?86 doesn't have a *not* SSE/AVX insn) and later on when the xor
is substituted into the and (at that point it could figure that and (xor x -1)
y
is andn). Wonder if we should change the combiner somehow for the cases where
REG_N_SETS == 1 pseudo has REG_EQUAL note, or if we want instead to handle this
during expansion (introduce optional andnotM3 standard patterns?).