testcase for shared DR alignment
authorRichard Biener <rguenther@suse.de>
Fri, 12 Jun 2020 11:02:56 +0000 (13:02 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 12 Jun 2020 11:05:30 +0000 (13:05 +0200)
This adds a reduced C testcase from libgomp.fortran/examples-4/target-1.f90
and libgomp.fortran/examples-4/target_data-1.f90 FAILs, showing a case
of SLP instance stmt sharing that affects the shared dataref alignment
info.

2020-06-12  Richard Biener  <rguenther@suse.de>

* gcc.dg/vect/bb-slp-44.c: New testcase.

gcc/testsuite/gcc.dg/vect/bb-slp-44.c [new file with mode: 0644]

diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-44.c b/gcc/testsuite/gcc.dg/vect/bb-slp-44.c
new file mode 100644 (file)
index 0000000..dfa0a5e
--- /dev/null
@@ -0,0 +1,41 @@
+/* { dg-do run } */
+
+typedef struct {
+    unsigned long a;
+    unsigned long b;
+    unsigned long c;
+} data_o;
+typedef struct {
+    unsigned long c;
+    unsigned long gap1;
+    unsigned long b;
+    unsigned long gap2;
+    unsigned long a;
+    unsigned long x;
+} data_i;
+
+volatile unsigned long gx;
+void __attribute__((noipa))
+bar(unsigned long x)
+{
+  gx = x;
+}
+
+void __attribute__((noipa))
+foo(data_o *o, data_i *i)
+{
+  o->a = i->a;
+  o->b = i->b;
+  o->c = i->c;
+  bar (i->x);
+}
+
+int main()
+{
+  unsigned long data[9];
+  if ((__UINTPTR_TYPE__)data & 15 != 0)
+    foo ((data_o *)&data[6], (data_i *)data);
+  else
+    foo ((data_o *)data, (data_i *)&data[3]);
+  return 0;
+}