Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!novia!news-out.readnews.com!news-xxxfer.readnews.com!news.misty.com!news.iecc.com!lnews.iecc.com!nerds-end From: George Neuner Newsgroups: comp.compilers Subject: Re: How to eliminate redundant constant move instructions Date: Wed, 02 Nov 2011 12:38:56 -0400 Organization: A noiseless patient Spider Lines: 26 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <11-11-014@comp.compilers> References: <11-10-019@comp.compilers> <11-11-004@comp.compilers> <11-11-005@comp.compilers> NNTP-Posting-Host: lnews.iecc.com X-Trace: gal.iecc.com 1320288217 6065 64.57.183.34 (3 Nov 2011 02:43:37 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Thu, 3 Nov 2011 02:43:37 +0000 (UTC) Keywords: optimize Posted-Date: 02 Nov 2011 22:43:37 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: x330-a1.tempe.blueboxinc.net comp.compilers:316 On Tue, 1 Nov 2011 22:35:04 +0000 (UTC), glen herrmannsfeldt wrote: >George Neuner wrote: > >(big snip on optimization and register loads) > >> You might be asking "if the value already is in a register, why not >> just use it rather than load a second register?" The answer to that >> likely is a scheduling issue which depends on the use of the first >> register. You have to remember that many CPUs can execute multiple >> instructions in parallel, and those parallel instruction streams may >> be executed out of order with respect to a program listing. > >That is what register renaming is for. Usually using more than >the architecturally specified number of registers, the CPU >internally remaps the registers such that it can keep one value >in a register while an instruction is being executed out of order. Yes. But the compiler can't count on register renaming ... it can see only the architectural named registers. If the code in question had copied Rx-> Ry then renaming would have been possible, but instead the code performed a constant load to each register. No possibility of rename sharing there. George