===================================================================
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-loweraddr" } */
+struct x
+{
+ int a[16];
+ int b[16];
+ int c[16];
+};
+
+extern void foo (int, int, int);
+
+void
+f (struct x *p, unsigned int n)
+{
+ foo (p->a[n], p->c[n], p->b[n]);
+ if (n > 3)
+ foo (p->a[n], p->c[n], p->b[n]);
+ if (n > 89)
+ foo (p->b[n], p->a[n], p->c[n]);
+}
+
+/* { dg-final { scan-tree-dump-times "= MEM\\\[\\(struct x \\*\\)D\.\[0-9_\]\+\\\];" 3 "loweraddr" } } */
+/* { dg-final { cleanup-tree-dump "loweraddr" } } */
===================================================================
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-loweraddr" } */
+struct x
+{
+ int a[16];
+ int b[16];
+ int c[16];
+};
+
+void
+f (struct x *p, unsigned int n)
+{
+ p->a[n] = n;
+ p->c[n] = n + 2;
+ p->b[n] = n + 1;
+ if (n > 3)
+ {
+ p->a[n] = n + 3;
+ p->c[n] = n + 9;
+ p->b[n] = n + 6;
+ }
+ if (n < 89)
+ {
+ p->b[n] = n + 5;
+ p->a[n] = n + 15;
+ p->c[n] = n + 10;
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "MEM\\\[\\(struct x \\*\\)D\.\[0-9_\]\+\\\] =" 3 "loweraddr" } } */
+/* { dg-final { cleanup-tree-dump "loweraddr" } } */
===================================================================
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-loweraddr" } */
+struct x
+{
+ int a[16];
+ int b[16];
+ int c[16];
+};
+
+void
+f (struct x *p, struct x *q, struct x *r, struct x *s, unsigned int n)
+{
+ p->a[n] = q->a[n];
+ p->c[n] = q->c[n];
+ p->b[n] = q->b[n];
+ if (n > 3)
+ {
+ p->a[n] = r->a[n];
+ p->c[n] = r->c[n];
+ p->b[n] = r->b[n];
+ }
+ if (n < 89)
+ {
+ p->b[n] = s->b[n];
+ p->a[n] = s->a[n];
+ p->c[n] = s->c[n];
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "= MEM\\\[\\(struct x \\*\\)D\.\[0-9_\]\+\\\];" 3 "loweraddr" } } */
+/* { dg-final { scan-tree-dump-times "MEM\\\[\\(struct x \\*\\)D\.\[0-9_\]\+\\\] =" 3 "loweraddr" } } */
+/* { dg-final { cleanup-tree-dump "loweraddr" } } */
===================================================================
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-loweraddr" } */
+/* { dg-skip-if "" { ilp32 } { "-m32" } { "" } } */
+struct x
+{
+ int a[16];
+ int b[16];
+ int c[16];
+};
+
+extern void foo (int, int, int);
+
+void
+f (int pp, unsigned int n)
+{
+ struct x *p = (struct x *)pp; /* { dg-warning "cast to pointer from integer of different size" } */
+
+ foo (p->a[n], p->c[n], p->b[n]);
+ if (n > 3)
+ foo (p->a[n], p->c[n], p->b[n]);
+ if (n > 89)
+ foo (p->b[n], p->a[n], p->c[n]);
+}
+
+/* { dg-final { scan-tree-dump-times "= MEM" 9 "loweraddr" } } */
+/* { dg-final { scan-tree-dump-times "base: " 6 "loweraddr" } } */
+/* { dg-final { scan-tree-dump-times "index: " 0 "loweraddr" } } */
+/* { dg-final { scan-tree-dump-times "offset: " 6 "loweraddr" } } */
+/* { dg-final { cleanup-tree-dump "loweraddr" } } */
===================================================================
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 " } */
+/* { dg-skip-if "" { "powerpc*-*-*" } { "-m32" } { "" } } */
+
+typedef struct
+{
+ unsigned char c1;
+ unsigned char c2;
+ unsigned char c3;
+ unsigned char c4;
+} foo_t;
+
+int
+foo (foo_t x)
+{
+ return x.c2 != 0;
+}
+
+/* { dg-final { scan-assembler-not "std " } } */
+/* { dg-final { scan-assembler-not "stw " } } */
+/* { dg-final { scan-assembler-not "stb " } } */
+/* { dg-final { scan-assembler-not "ld " } } */
+/* { dg-final { scan-assembler-not "lwz " } } */
+/* { dg-final { scan-assembler-not "lbz " } } */
===================================================================
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 " } */
+/* { dg-skip-if "" { "powerpc*-*-*" } { "-m64" } { "" } } */
+
+typedef struct
+{
+ unsigned char c1;
+ unsigned char c2;
+ unsigned char c3;
+ unsigned char c4;
+} foo_t;
+
+int
+foo (foo_t x)
+{
+ return x.c2 != 0;
+}
+
+/* { dg-final { scan-assembler-not "std " } } */
+/* { dg-final { scan-assembler-not "stw " } } */
+/* { dg-final { scan-assembler-not "stb " } } */
+/* { dg-final { scan-assembler-not "ld " } } */
+/* { dg-final { scan-assembler-not "lwz " } } */
+/* { dg-final { scan-assembler-times "lbz " 1 } } */
===================================================================
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-loweraddr" } */
+struct x
+{
+ int a[16];
+ int b[16];
+ int c[16];
+};
+
+extern void foo (int, int, int);
+
+void
+f (struct x *p, unsigned int n)
+{
+ foo (p->a[n], p->c[n], p->b[n]);
+ if (n > 3)
+ foo (p->a[n], p->c[n], p->b[n]);
+ if (n > 89)
+ foo (p->b[n], p->a[n], p->c[n]);
+}
+
+/* { dg-final { scan-assembler-times "lw. 3,0\\(\[0-9\]\+\\)" 1 { target powerpc*-*-* } } } */
+/* { dg-final { scan-assembler-times "lw. 4,0\\(\[0-9\]\+\\)" 1 { target powerpc*-*-* } } } */
+/* { dg-final { cleanup-tree-dump "loweraddr" } } */
===================================================================
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O -fdump-rtl-expand" } */
+/* { dg-options "-O -fdump-rtl-expand -fno-lower-addr" } */
struct S {
int l;
===================================================================
@@ -14,7 +14,7 @@ function test(a)
end
! { dg-final { scan-tree-dump "b = 5" "original" } }
-! { dg-final { scan-tree-dump "c_. = .a" "optimized" } }
+! { dg-final { scan-tree-dump "c_. = MEM\\\[base: a_." "optimized" } }
! { dg-final { scan-tree-dump "return c_.;" "optimized" } }
! { dg-final { cleanup-tree-dump "original" } }
! { dg-final { cleanup-tree-dump "optimized" } }
===================================================================
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-rtl-cse1" } */
+
+extern void abort(void);
+
+typedef unsigned int uint32;
+typedef unsigned long long uint64;
+
+typedef union {
+ uint32 i32[2];
+ uint64 i64;
+} u64;
+
+void foo(void)
+{
+ u64 data;
+ data.i64 = 1;
+ if (data.i32[1] != 1)
+ abort ();
+}
+
+/* { dg-final { scan-rtl-dump-not "abort" "cse1" { target powerpc64-*-* } } } */
+/* { dg-final { cleanup-rtl-dump "cse1" } } */
===================================================================
@@ -10,7 +10,7 @@ int f(int *p)
return *p == a;
}
-/* { dg-final { scan-tree-dump-times "\\\*p" 2 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "base: p" 2 "optimized" } } */
/* { dg-final { scan-tree-dump-not "return 1" "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
===================================================================
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fdump-tree-optimized" } */
+/* { dg-skip-if "" { "*-*-*" } { "-O0" } { "" } } */
struct hardware {
int parm1:8;
@@ -21,5 +22,5 @@ void f1(volatile struct hardware *ptr)
*ptr = h;
}
-/* { dg-final { scan-tree-dump-times "\\*ptr" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "base: ptr" 1 "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
===================================================================
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fdump-tree-optimized" } */
+/* { dg-skip-if "" { "*-*-*" } { "-O0" } { "" } } */
struct hardware {
int parm1:8;
@@ -19,5 +20,5 @@ void f1(volatile struct hardware *ptr)
};
}
-/* { dg-final { scan-tree-dump-times "\\*ptr" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "base: ptr" 1 "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
===================================================================
@@ -9,5 +9,5 @@ void a(s *s1, s *s2)
}
/* Struct copies should not be split into members. */
-/* { dg-final { scan-tree-dump "\\\*s1_.\\\(D\\\) = \\\*s2" "optimized"} } */
+/* { dg-final { scan-tree-dump "MEM\\\[base: s1_.\\\(D\\\), offset: 0B\\\] = MEM\\\[base: s2_.\\\(D\\\), offset: 0B\\\];" "optimized"} } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
===================================================================
@@ -16,5 +16,5 @@ void testcase(void)
/* We have to make sure that alias analysis treats sp as pointing
to globals and thus the store not optimized away. */
-/* { dg-final { scan-tree-dump "->preempt_count =" "optimized" } } */
+/* { dg-final { scan-tree-dump "MEM\\\[\\(struct thread_info \\*\\)D.*\\\] =" "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
===================================================================
@@ -12,5 +12,5 @@ int test()
}
/* The load from p->addr should not disappear. */
-/* { dg-final { scan-tree-dump-times "\->addr" 1 "optimized"} } */
+/* { dg-final { scan-tree-dump-times "base: p.0" 1 "optimized"} } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
===================================================================
@@ -41,7 +41,8 @@ get_alias_set (t)
/* There should be precisely one load of ->decl.rtl. If there is
more than, then the dominator optimizations failed. */
-/* { dg-final { scan-tree-dump-times "->decl\\.rtl" 1 "cddce2"} } */
+/* With addition of tree-ssa-lower-addr.c, this is expanded to a mem_ref. */
+/* { dg-final { scan-tree-dump-times "base: t" 1 "cddce2"} } */
/* There should be no loads of .rtmem since the complex return statement
is just "return 0". */
===================================================================
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-loweraddr" } */
+struct x
+{
+ int a[16];
+ int b[16];
+ int c[16];
+};
+
+void
+f (struct x *p)
+{
+ struct x y;
+
+ p->a[4] = y.a[8];
+ p->b[4] = y.b[8];
+ p->c[4] = y.c[8];
+}
+
+/* { dg-final { scan-tree-dump-times "= y\..\\\[8\\\];" 3 "loweraddr" } } */
+/* { dg-final { cleanup-tree-dump "loweraddr" } } */
===================================================================
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-loweraddr" } */
+struct x
+{
+ int a[16];
+ int b[16];
+ int c[16];
+};
+
+extern void foo (int, int, int);
+
+void
+f (struct x *p, int n)
+{
+ foo (p->a[n], p->c[n], p->b[n]);
+ if (n > 3)
+ foo (p->a[n], p->c[n], p->b[n]);
+ if (n > 89)
+ foo (p->b[n], p->a[n], p->c[n]);
+}
+
+/* { dg-final { scan-tree-dump-times "= MEM" 9 "loweraddr" } } */
+/* { dg-final { scan-tree-dump-times "base: " 6 "loweraddr" } } */
+/* { dg-final { scan-tree-dump-times "index: " 0 "loweraddr" } } */
+/* { dg-final { scan-tree-dump-times "offset: " 6 "loweraddr" } } */
+/* { dg-final { cleanup-tree-dump "loweraddr" } } */
===================================================================
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-loweraddr" } */
+/* { dg-skip-if "" { lp64 } { "*" } { "-m32" } } */
+/* { dg-skip-if "" { llp64 } { "*" } { "-m32" } } */
+struct x
+{
+ int a[16];
+ int b[16];
+ int c[16];
+};
+
+extern void foo (int, int, int);
+
+void
+f (int pp, unsigned int n)
+{
+ struct x *p = (struct x *)pp;
+
+ foo (p->a[n], p->c[n], p->b[n]);
+ if (n > 3)
+ foo (p->a[n], p->c[n], p->b[n]);
+ if (n > 89)
+ foo (p->b[n], p->a[n], p->c[n]);
+}
+
+/* { dg-final { scan-tree-dump-times "= MEM" 9 "loweraddr" } } */
+/* { dg-final { scan-tree-dump-times "base: " 6 "loweraddr" } } */
+/* { dg-final { scan-tree-dump-times "index: " 0 "loweraddr" } } */
+/* { dg-final { scan-tree-dump-times "offset: " 6 "loweraddr" } } */
+/* { dg-final { cleanup-tree-dump "loweraddr" } } */
===================================================================
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-cddce2" } */
+struct x
+{
+ int a[16];
+ int b[16];
+ int c[16];
+};
+
+extern void foo (int, int, int);
+
+void
+f (struct x *p, unsigned int n, unsigned int m)
+{
+ foo (p->a[n << m], p->c[n % 3], p->b[n | 0xa]);
+ if (n > 3)
+ foo (p->a[n << m], p->c[n % 3], p->b[n | 0xa]);
+ if (n > 89)
+ foo (p->b[n | 0xa], p->a[n << m], p->c[n % 3]);
+}
+
+/* { dg-final { scan-tree-dump-times "<< m" 1 "cddce2" } } */
+/* { dg-final { scan-tree-dump-times "% 3" 1 "cddce2" } } */
+/* { dg-final { scan-tree-dump-times "\\| 10" 1 "cddce2" } } */
+/* { dg-final { cleanup-tree-dump "cddce2" } } */
===================================================================
@@ -56,6 +56,6 @@ void keyboard_set_repeat(void)
intcall(0x16, &ireg, ((void *)0));
}
-/* { dg-final { scan-tree-dump-times "ireg.*ax" 1 "optimized"} } */
+/* { dg-final { scan-tree-dump-times "&ireg \\+ 28B" 1 "optimized"} } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
===================================================================
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-cddce2" } */
+struct x
+{
+ int a[16];
+ int b[16];
+ int c[16];
+};
+
+extern void foo (int, int, int);
+
+void
+f (struct x *p, unsigned int n, unsigned int m)
+{
+ foo (p->a[n >> m], p->c[n / 3], p->b[n & 0xa]);
+ if (n > 3)
+ foo (p->a[n >> m], p->c[n / 3], p->b[n & 0xa]);
+ if (n > 89)
+ foo (p->b[n & 0xa], p->a[n >> m], p->c[n / 3]);
+}
+
+/* { dg-final { scan-tree-dump-times ">> m" 1 "cddce2" } } */
+/* { dg-final { scan-tree-dump-times "/ 3" 1 "cddce2" } } */
+/* { dg-final { scan-tree-dump-times "& 10" 1 "cddce2" } } */
+/* { dg-final { cleanup-tree-dump "cddce2" } } */
===================================================================
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-cddce2" } */
+struct x
+{
+ int a[16];
+ int b[16];
+ int c[16];
+};
+
+extern void foo (int, int, int);
+
+void
+f (struct x *p, unsigned int n)
+{
+ foo (p->a[~n], p->c[16 - n], p->b[n ^ 0xa]);
+ if (n > 3)
+ foo (p->a[~n], p->c[16 - n], p->b[n ^ 0xa]);
+ if (n > 89)
+ foo (p->b[n ^ 0xa], p->a[~n], p->c[16 - n]);
+}
+
+/* { dg-final { scan-tree-dump-times "\\^ 10" 1 "cddce2" } } */
+/* { dg-final { cleanup-tree-dump "cddce2" } } */
===================================================================
@@ -16,6 +16,6 @@ int bar(void)
/* We need to have both: a load from "a[0]" and a load from "*p.a",
the latter can be an ssa temporary. */
-/* { dg-final { scan-tree-dump "= a.0.;" "optimized" } } */
-/* { dg-final { scan-tree-dump "= \\*\[pD\]" "optimized" } } */
+/* { dg-final { scan-tree-dump "= MEM\\\[\\(int\\\[2\\\] \\*\\)&a\\\];" "optimized" } } */
+/* { dg-final { scan-tree-dump "base: \[pD\]" "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
===================================================================
@@ -16,6 +16,6 @@ int bar(void)
/* We need to have both: a load from "a[0]" and a load from "*p.a",
the latter can be an ssa temporary. */
-/* { dg-final { scan-tree-dump "= a.0.;" "optimized" } } */
-/* { dg-final { scan-tree-dump "= \\*\[pD\]" "optimized" } } */
+/* { dg-final { scan-tree-dump "= MEM\\\[\\(int\\\[32\\\] \\*\\)&a\\\];" "optimized" } } */
+/* { dg-final { scan-tree-dump "base: \[pD\]" "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
===================================================================
@@ -16,5 +16,5 @@ extern void assign( long& variable, long v )
}
/* { dg-final { scan-tree-dump-times ";; Function" 2 "optimized" } } */
-/* { dg-final { scan-tree-dump-times "variable_..D. = v_..D." 2 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "MEM\\\[base: variable_..D., offset: 0B\\\] = v_..D.;" 2 "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
===================================================================
@@ -17,5 +17,5 @@ int foo(Foo& f)
return f.get();
}
-/* { dg-final { scan-tree-dump "f_..D.->x;" "optimized" } } */
+/* { dg-final { scan-tree-dump "MEM\\\[base: f" "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
===================================================================
@@ -18,5 +18,4 @@ double bar(long i)
}
/* { dg-final { scan-tree-dump "a\\\[.*i.*\\\]\\\[0\\\]" "optimized" { xfail *-*-* } } } */
-/* { dg-final { scan-tree-dump "b\\\[.*i.*\\\].x" "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
===================================================================
@@ -9,5 +9,5 @@ int f(int *a)
}
/* There should be only one dereferencing of a. */
-/* { dg-final { scan-tree-dump-times "\\*a" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "base: a" 1 "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
===================================================================
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -Wuninitialized -fno-ivopts" } */
+/* { dg-options "-O2 -Wuninitialized -fno-ivopts -fno-lower-addr" } */
inline int foo(int x)
{