On Jul 6, 2004, Richard Henderson wrote: > (1) Rename the existing rtl movstr patterns to movmem. Can do. Patch is attached. Will test i686-pc-linux-gnu native overnight. Ok to install if it passes? > (2) Create new movstr patterns that mirror how cmpstr patterns operate. > (3) Expand strcpy/strpcpy like we do strcmp elsewhere in builtins.c. At first I'd got the impression h8sx didn't have an actual stpcpy instruction but, as it turns out, Richard Sandiford actually introduced a pattern that uses movsd and a conditional branch for that. On second thought, I realized I'm not sure how to best approach introducing movstr. I suppose on most machines that can use these patterns, we'd have some register modified in such a way that at least movstr is pretty close to the requirements of stpcpy(), and implementing strcpy() in terms of that would be quite trivial (just refrain from using the modified register, and use the original one). However, even if it's close to stpcpy(), some arches will have the final register point one-past the NUL terminator, whereas others might have it point to the NUL terminator itself. I suppose we should probably model movstr exactly after stpcpy(), even if that takes an additional increment/decrement instruction to get the right value. This will make the pattern useful for stpcpy and strcpy, and the additional instruction will likely be optimized away if unneeded, or combined with other insns, unless it has the needed effect anyway. So, should movstr be modeled exactly after stpcpy()? With a single output operand for end-of-dest, or another for end-of-src? I don't see that end-of-src could be used with the code we have today, but it might if we could somehow tell GCC that the register that scanned src got modified similarly to the one that scanned dest. Does it sound like it might be useful to add an output operand for end-of-src to the standard pattern? E.g.: (define_expand "movstrsi" ;; intuitive notion of the implementation: [(set (match_operand:BLK 0 "" "") ;; dest (match_operand:BLK 1 "" "")) ;; src ;; wouldn't it be so nice if :P was a valid mode? :-) (clobber (match_operand:P 2 "" "")) ;; end-of-dest (clobber (match_operand:P 3 "" "")) ;; end-of-src ] ...) Should we perhaps make operands 3, and maybe even 2, optional?