Commit b6268016 by Richard Sandiford

optabs: Don't use scalar conversions for vectors [PR93843]

In this PR we had a conversion between two integer vectors that
both had scalar integer modes.  We then tried to implement the
conversion using the scalar optab for those modes, instead of
doing the conversion elementwise.

I wondered about letting through scalar modes for single-element
vectors, but I don't have any evidence that that's useful/necessary,
so it seemed better to keep things simple.

2020-02-26  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	PR middle-end/93843
	* optabs-tree.c (supportable_convert_operation): Reject types with
	scalar modes.

gcc/testsuite/
	PR middle-end/93843
	* gcc.dg/vect/pr93843-1.c: New test.
	* gcc.dg/vect/pr93843-2.c: Likewise.
parent 67fa274c
2020-02-26 Richard Sandiford <richard.sandiford@arm.com>
PR middle-end/93843
* optabs-tree.c (supportable_convert_operation): Reject types with
scalar modes.
2020-02-26 David Malcolm <dmalcolm@redhat.com>
* Makefile.in (ANALYZER_OBJS): Add analyzer/bar-chart.o.
......
......@@ -284,9 +284,14 @@ supportable_convert_operation (enum tree_code code,
machine_mode m1,m2;
bool truncp;
gcc_assert (VECTOR_TYPE_P (vectype_out) && VECTOR_TYPE_P (vectype_in));
m1 = TYPE_MODE (vectype_out);
m2 = TYPE_MODE (vectype_in);
if (!VECTOR_MODE_P (m1) || !VECTOR_MODE_P (m2))
return false;
/* First check if we can done conversion directly. */
if ((code == FIX_TRUNC_EXPR
&& can_fix_p (m1,m2,TYPE_UNSIGNED (vectype_out), &truncp)
......
2020-02-26 Richard Sandiford <richard.sandiford@arm.com>
PR middle-end/93843
* gcc.dg/vect/pr93843-1.c: New test.
* gcc.dg/vect/pr93843-2.c: Likewise.
2020-02-26 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/93820
......
char a;
struct S { short b, c; } d;
__attribute__((noipa)) void
foo (int x)
{
if (x != 4)
__builtin_abort ();
}
int
main ()
{
short *g = &d.c, *h = &d.b;
char e = 4 - a;
int f;
*h = *g = e;
for (f = 0; f < 2; f++)
foo (d.c);
return 0;
}
char in[2] = {2, 2};
short out[2] = {};
int
main()
{
for (int i = 0; i < 2; ++i)
out[i] = in[i];
asm("":::"memory");
if (out[0] != 2) __builtin_abort();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment