diff options
author | Roger Sayle <roger@nextmovesoftware.com> | 2022-05-24 14:29:27 +0100 |
---|---|---|
committer | Roger Sayle <roger@nextmovesoftware.com> | 2022-05-24 14:31:59 +0100 |
commit | 9e7a0e42a15eb53850496e91f2e484ed74ac3617 (patch) | |
tree | c246a1891935ff3cf148eb27e4064a7c495153b6 /gcc/config.gcc | |
parent | d0ef9e06197d14d7ba60404e37bd27c21791ba3d (diff) | |
download | gcc-9e7a0e42a15eb53850496e91f2e484ed74ac3617.zip gcc-9e7a0e42a15eb53850496e91f2e484ed74ac3617.tar.gz gcc-9e7a0e42a15eb53850496e91f2e484ed74ac3617.tar.bz2 |
Minor improvement to genpreds.cc
This simple patch implements Richard Biener's suggestion in comment #6
of PR tree-optimization/52171 (from February 2013) that the insn-preds
code generated by genpreds can avoid using strncmp when matching constant
strings of length one.
The effect of this patch is best explained by the diff of insn-preds.cc:
< if (!strncmp (str + 1, "g", 1))
---
> if (str[1] == 'g')
3104c3104
< if (!strncmp (str + 1, "m", 1))
---
> if (str[1] == 'm')
3106c3106
< if (!strncmp (str + 1, "c", 1))
---
> if (str[1] == 'c')
...
The equivalent optimization is performed by GCC (but perhaps not by the
host compiler), but generating simpler/smaller code may encourage further
optimizations (such as use of a switch statement).
2022-05-24 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
* genpreds.cc (write_lookup_constraint_1): Avoid generating a call
to strncmp for strings of length one.
Diffstat (limited to 'gcc/config.gcc')
0 files changed, 0 insertions, 0 deletions