This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RS6000] Don't expand strcmp and strncmp inline when -Os


The inline expansions are non-trivial, so aren't really appropriate
for -Os.

Bootstrapped and regression tested powerpc64le-linux.  OK to apply?

	* config/rs6000/rs6000.md (cmpstrnsi, cmpstrsi): Fail if
	optimizing for size.

diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 9ef3b11..d729f40 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -9102,7 +9102,8 @@ (define_expand "cmpstrnsi"
 	      (use (match_operand:SI 4))])]
   "TARGET_CMPB && (BYTES_BIG_ENDIAN || TARGET_LDBRX)"
 {
-  if (expand_strn_compare (operands, 0))
+  if (!optimize_insn_for_size_p ()
+      && expand_strn_compare (operands, 0))
     DONE;
   else	
     FAIL;
@@ -9121,7 +9122,8 @@ (define_expand "cmpstrsi"
 	      (use (match_operand:SI 3))])]
   "TARGET_CMPB && (BYTES_BIG_ENDIAN || TARGET_LDBRX)"
 {
-  if (expand_strn_compare (operands, 1))
+  if (!optimize_insn_for_size_p ()
+      && expand_strn_compare (operands, 1))
     DONE;
   else	
     FAIL;

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]