On Sun, Nov 6, 2016 at 5:32 AM, Aaron Sawdey <acsaw...@linux.vnet.ibm.com> wrote: > On Fri, 2016-11-04 at 20:43 -0600, Jeff Law wrote: >> So what's the motivation here? When we don't have any constants >> then >> I'd think we'd be better off punting into the library. > > When none of the args to strncmp are constant, I'd be inclined to > agree. However the current state of affairs is that strncmp is not > expanded in the case where the length is a constant but the strings are > not. This patch allows the expansion to be attempted. > > The target's cmpstrnsi pattern can then make the decision of which > cases to expand and which cases to punt to the library. For instance RX > might always want to expand this for all cases as that target has an > instruction that is intended to map to strncmp. > > My particular motivation is that I'm working on a cmpstrnsi pattern for > powerpc64 and I want to have access to the case where the strings are > not constant but the length is.
Your patchset doesn't contain a testcase so I really wonder which case we know the string length but it is not constant. Yes, there's COND_EXPR handling in c_strlen but that should be mostly dead code -- the real code should be using get_maxval_strlen or get_range_strlen but c_strlen does not use those. Ideally the str optabs would get profile data and alignment similar to the mem ones. Care to share a testcase? Thanks, Richard. > Thanks, > Aaron > > -- > Aaron Sawdey, Ph.D. acsaw...@linux.vnet.ibm.com > 050-2/C113 (507) 253-7520 home: 507/263-0782 > IBM Linux Technology Center - PPC Toolchain >