diff mbox

[x86] Fix pblendv expand.

Message ID CAOvf_xxPh=ROwvoYmmCrq4C2Q=YvQbUJ0xarV8ePs7fW8Gf11g@mail.gmail.com
State New
Headers show

Commit Message

Evgeny Stupachenko Dec. 9, 2014, 9:33 p.m. UTC
I've added the reproducer to the patch.

is it ok?

ChangeLog:

2014-12-10  Evgeny Stupachenko  <evstupac@gmail.com>

gcc/testsuite
        * gcc.target/i386/blend.c: New.

gcc/
        * config/i386/i386.c (expand_vec_perm_pblendv): Gen new rtx for
        expand_vec_perm_1 target.




On Tue, Dec 9, 2014 at 7:38 PM, Evgeny Stupachenko <evstupac@gmail.com> wrote:
> I mean that there are a lot of people tracking spec2006 stability and
> therefore the issue should be on track in future.
> And that I can create the test case, but it would be as big as several
> GCC functions.
> Will work on reducing the test case.
>
>
> On Tue, Dec 9, 2014 at 7:20 PM, Richard Henderson <rth@redhat.com> wrote:
>> On 12/09/2014 07:59 AM, Evgeny Stupachenko wrote:
>>> However patch is fixing spec2006 benchmark. Shouldn't that be enough
>>> for regression testing?
>>>
>>
>> No.  Spec is not free.
>>
>>
>> r~

Comments

Jakub Jelinek Dec. 9, 2014, 9:54 p.m. UTC | #1
On Wed, Dec 10, 2014 at 12:33:52AM +0300, Evgeny Stupachenko wrote:
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/i386/blend.c
> @@ -0,0 +1,61 @@
> +/* Test correctness of size 3 store groups permutation.  */
> +/* { dg-do run } */
> +/* { dg-options "-O3" } */
> +
> +#define N 50
> +
> +enum num3
> +{
> +  a, b, c
> +};
> +
> +struct flags
> +{
> +  enum num3 f;

Does this really has to be an enum?  Doesn't unsigned int there work the
same?

> +int main()
> +{
> +  int i;
> +  long long *rr = (long long *)q[0].a;
> +  bar(2, q);
> +  for (i = 0; i < N * 2; i += 2)
> +    if (rr[i] == -1 && rr[i + 1] == -1)

This is aliasing violation, can't you avoid that?  I mean, just
check the individual struct flags fields?  And with the aliasing violation
fixed, is there anything i?86 specific left in the testcase (i.e. shouldn't
it go either to gcc.dg/ or gcc.c-torture/execute/ instead?)?

	Jakub
diff mbox

Patch

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index eafc15a..5a914ad 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -47546,6 +47546,7 @@  expand_vec_perm_pblendv (struct expand_vec_perm_d *d)
     dcopy.op0 = dcopy.op1 = d->op1;
   else
     dcopy.op0 = dcopy.op1 = d->op0;
+  dcopy.target = gen_reg_rtx (vmode);
   dcopy.one_operand_p = true;

   for (i = 0; i < nelt; ++i)
diff --git a/gcc/testsuite/gcc.target/i386/blend.c
b/gcc/testsuite/gcc.target/i386/blend.c
new file mode 100644
index 0000000..d03bdbb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/blend.c
@@ -0,0 +1,61 @@ 
+/* Test correctness of size 3 store groups permutation.  */
+/* { dg-do run } */
+/* { dg-options "-O3" } */
+
+#define N 50
+
+enum num3
+{
+  a, b, c
+};
+
+struct flags
+{
+  enum num3 f;
+  unsigned int c;
+  unsigned int p;
+};
+
+struct flagsN
+{
+  struct flags a[N];
+};
+
+void
+bar (int n, struct flagsN *ff)
+{
+  struct flagsN *fc;
+  for (fc = ff + 1; fc < (ff + n); fc++)
+    {
+      int i;
+      for (i = 0; i < N; ++i)
+       {
+         ff->a[i].f = 0;
+         ff->a[i].c = i;
+         ff->a[i].p = -1;
+       }
+      for (i = 0; i < n; i++)
+       {
+         int j;
+         for (j = 0; j < N - n; ++j)
+           {
+             fc->a[i + j].f = 0;
+             fc->a[i + j].c = j + i;
+             fc->a[i + j].p = -1;
+           }
+       }
+    }
+}
+
+struct flagsN q[2];
+
+int main()
+{
+  int i;
+  long long *rr = (long long *)q[0].a;
+  bar(2, q);
+  for (i = 0; i < N * 2; i += 2)
+    if (rr[i] == -1 && rr[i + 1] == -1)
+      return 1;
+  return 0;
+}