Code: Select all
static inline sillyCopy(int* __restrict dest, const int* __restrict src, int size)
{
for (int i = 0; i < size; ++i)
{
dest[i+0] = src[i+0];
dest[i+1] = src[i+1];
dest[i+2] = src[i+0];
dest[i+3] = src[i+1];
}
}
int* data;
int* data2;
void main()
{
sillyCopy(data2,data,200);
}
(compile with: ee-gcc -O2 -S -std=c99 -o out.s in.c)
Oh, and the patch in question. This patch is derived from looking on why the cell-toolchain managed to inline code that normal GCC didn't.
Code: Select all
--- gcc-3.2.2-base/gcc/integrate.c 2003-02-03 21:56:29.000000000 +0100
+++ gcc-3.2.2/gcc/integrate.c 2006-02-06 18:10:07.000000000 +0100
@@ -358,12 +358,18 @@
/* Copy the declaration. */
if (TREE_CODE (decl) == PARM_DECL || TREE_CODE (decl) == RESULT_DECL)
{
+ tree type;
+ type = TREE_TYPE(decl);
+
/* For a parameter, we must make an equivalent VAR_DECL, not a
new PARM_DECL. */
copy = build_decl (VAR_DECL, DECL_NAME (decl), TREE_TYPE (decl));
TREE_ADDRESSABLE (copy) = TREE_ADDRESSABLE (decl);
TREE_READONLY (copy) = TREE_READONLY (decl);
TREE_THIS_VOLATILE (copy) = TREE_THIS_VOLATILE (decl);
+
+ if (TYPE_RESTRICT(type))
+ DECL_POINTER_ALIAS_SET (copy) = -2;
}
else
{