I am about to put up a patch to make a change to the way builtins.c/expand_builtin_strncmp does things. At present it will only expand if one of the strings is a constant, and the length it passes in is MIN(len, strlen(constant string)+1). I want to change it so that it will also attempt to expand strncmp where neither of the input strings is a constant.
What I ran into is that the i386 target cmpstrnsi pattern uses repz cmpsb which does not check for the zero byte and thus depends on expand_builtin_strncmp to arrange things so the length is not past the end of both strings. SH and RX are the other two targets that have cmpstrnsi patterns. My reading of sh_expand_cmpnstr() in sh-mem.cc is that the code that it emits will both look for a zero byte and compare the strings so it will not have trouble with this change to expand_builtin_strncmp. It also looks to me like rx.md emits the "scmpu" instruction to do the comparison. The RX manual I found showed pseudocode for scmpu that shows it both checks for zero byte as well as comparing the strings. If this isn't correct, please let me know here or on the patch itself. 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