OSDN Git Service

gcc/
authorfroydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Jul 2010 17:43:06 +0000 (17:43 +0000)
committerfroydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Jul 2010 17:43:06 +0000 (17:43 +0000)
* config/rs6000/rs6000.opt (mblock-move-inline-limit): New option.
* config/rs6000/rs6000.c (rs6000_override_options): Set
rs6000_block_move_inline_limit appropriately.
(expand_block_move): Use rs6000_block_move_inline_limit.
* doc/invoke.texi (mblock-move-inline-limit): Document.

gcc/testsuite/
* gcc.target/powerpc/block-move-1.c: New test.
* gcc.target/powerpc/block-move-2.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162344 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/rs6000/rs6000.c
gcc/config/rs6000/rs6000.opt
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/block-move-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/block-move-2.c [new file with mode: 0644]

index 1ef6d93..bf46390 100644 (file)
@@ -1,3 +1,11 @@
+2010-07-20  Nathan Froyd  <froydnj@codesourcery.com>
+
+       * config/rs6000/rs6000.opt (mblock-move-inline-limit): New option.
+       * config/rs6000/rs6000.c (rs6000_override_options): Set
+       rs6000_block_move_inline_limit appropriately.
+       (expand_block_move): Use rs6000_block_move_inline_limit.
+       * doc/invoke.texi (mblock-move-inline-limit): Document.
+
 2010-07-20  Bernd Schmidt  <bernds@codesourcery.com>
 
        * postreload.c (fixup_debug_insns): Remove arg REGNO.  New args
index 3a8c707..130d1ac 100644 (file)
@@ -2696,6 +2696,18 @@ rs6000_override_options (const char *default_cpu)
   else if (TARGET_ALTIVEC)
     target_flags |= (MASK_PPC_GFXOPT & ~target_flags_explicit);
 
+  /* E500mc does "better" if we inline more aggressively.  Respect the
+     user's opinion, though.  */
+  if (rs6000_block_move_inline_limit == 0
+      && (rs6000_cpu == PROCESSOR_PPCE500MC
+         || rs6000_cpu == PROCESSOR_PPCE500MC64))
+    rs6000_block_move_inline_limit = 128;
+
+  /* store_one_arg depends on expand_block_move to handle at least the
+     size of reg_parm_stack_space.  */
+  if (rs6000_block_move_inline_limit < (TARGET_POWERPC64 ? 64 : 32))
+    rs6000_block_move_inline_limit = (TARGET_POWERPC64 ? 64 : 32);
+
   /* Set debug flags */
   if (rs6000_debug_name)
     {
@@ -13208,9 +13220,7 @@ expand_block_move (rtx operands[])
   if (bytes <= 0)
     return 1;
 
-  /* store_one_arg depends on expand_block_move to handle at least the size of
-     reg_parm_stack_space.  */
-  if (bytes > (TARGET_POWERPC64 ? 64 : 32))
+  if (bytes > rs6000_block_move_inline_limit)
     return 0;
 
   for (offset = 0; bytes > 0; offset += move_bytes, bytes -= move_bytes)
index e70172a..30f9b39 100644 (file)
@@ -245,6 +245,10 @@ mvrsave=
 Target RejectNegative Joined
 -mvrsave=yes/no        Deprecated option.  Use -mvrsave/-mno-vrsave instead
 
+mblock-move-inline-limit=
+Target Report Var(rs6000_block_move_inline_limit) Init(0) RejectNegative Joined UInteger
+Specify how many bytes should be moved inline before calling out to memcpy/memmove
+
 misel
 Target Report Mask(ISEL)
 Generate isel instructions
index 12855a4..9459ec2 100644 (file)
@@ -772,6 +772,7 @@ See RS/6000 and PowerPC Options.
 -mcall-sysv  -mcall-netbsd @gol
 -maix-struct-return  -msvr4-struct-return @gol
 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
+-mblock-move-inline-limit=@var{num} @gol
 -misel -mno-isel @gol
 -misel=yes  -misel=no @gol
 -mspe -mno-spe @gol
@@ -15626,6 +15627,13 @@ On embedded PowerPC systems, put all initialized global and static data
 in the @samp{.data} section, and all uninitialized data in the
 @samp{.bss} section.
 
+@item -mblock-move-inline-limit=@var{num}
+@opindex mblock-move-inline-limit
+Inline all block moves (such as calls to @code{memcpy} or structure
+copies) less than or equal to @var{num} bytes.  The minimum value for
+@var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
+targets.  The default value is target-specific.
+
 @item -G @var{num}
 @opindex G
 @cindex smaller data references (PowerPC)
index 902c9cd..9772252 100644 (file)
@@ -1,3 +1,8 @@
+2010-07-20  Nathan Froyd  <froydnj@codesourcery.com>
+
+       * gcc.target/powerpc/block-move-1.c: New test.
+       * gcc.target/powerpc/block-move-2.c: New test.
+
 2010-07-20  Jason Merrill  <jason@redhat.com>
 
        PR c++/44967
diff --git a/gcc/testsuite/gcc.target/powerpc/block-move-1.c b/gcc/testsuite/gcc.target/powerpc/block-move-1.c
new file mode 100644 (file)
index 0000000..7b6623f
--- /dev/null
@@ -0,0 +1,14 @@
+/* Test that we bump up low values of -mblock-move-inline-limit */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mblock-move-inline-limit=8" } */
+
+typedef __SIZE_TYPE__ size_t;
+extern void *memcpy (void *, const void *, size_t);
+
+void
+cpy16 (void *x, void *y)
+{
+  memcpy (x, y, 16);
+}
+
+/* { dg-final { scan-assembler-not "memcpy" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/block-move-2.c b/gcc/testsuite/gcc.target/powerpc/block-move-2.c
new file mode 100644 (file)
index 0000000..ffaf9ef
--- /dev/null
@@ -0,0 +1,14 @@
+/* Test that we honor -mblock-move-inline-limit.  */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mblock-move-inline-limit=128" } */
+
+typedef __SIZE_TYPE__ size_t;
+extern void *memcpy (void *, const void *, size_t);
+
+void
+cpy128 (void *x, void *y)
+{
+  memcpy (x, y, 128);
+}
+
+/* { dg-final { scan-assembler-not "memcpy" } } */