This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[RS6000] Don't expand strcmp and strncmp inline when -Os
- From: Alan Modra <amodra at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Segher Boessenkool <segher at kernel dot crashing dot org>
- Date: Thu, 19 Jan 2017 22:47:12 +1030
- Subject: [RS6000] Don't expand strcmp and strncmp inline when -Os
- Authentication-results: sourceware.org; auth=none
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