Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.iecc.com!nerds-end From: glen herrmannsfeldt Newsgroups: comp.compilers Subject: Re: How to eliminate redundant constant move instructions Date: Fri, 4 Nov 2011 21:19:14 +0000 (UTC) Organization: Aioe.org NNTP Server Lines: 38 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <11-11-024@comp.compilers> References: <11-10-019@comp.compilers> <11-11-004@comp.compilers> <11-11-005@comp.compilers> <11-11-014@comp.compilers> <11-11-018@comp.compilers> <11-11-023@comp.compilers> NNTP-Posting-Host: news.iecc.com X-Trace: leila.iecc.com 1320641325 82738 64.57.183.58 (7 Nov 2011 04:48:45 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Mon, 7 Nov 2011 04:48:45 +0000 (UTC) Keywords: optimize Posted-Date: 06 Nov 2011 23:48:45 EST 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:326 George Neuner wrote: (snip) > Yes. But the original question involve 2 registers both being loaded > with the same constant value. The OP asked why use a 2nd register. I > gave a couple of reasons why that might be, and then Glen brought up > renaming. I brought up register renaming when someone else brought up out-of-order execution. > We haven't seen the actual code, but from the description it appears > that the compiler could have reused the original register but instead > chose to use a different one. There are many possible reasons. For IA32, some registers have special uses, such that not all can be reused. > We also don't know what CPU, but regardless, renaming only might > have been done if the compiler had used a copy instruction. I do hope that it doesn't load an actual zero from memory. Also, some zeros should be optimized away. If, for example, something was then added to the zero. > With the use of constant loads there was no possibility of renaming > being performed. I don't know about others, but the 360/91 can rename loads from the same address, or store followed by load. Mostly that was needed with the goal of running unmodified S/360 code, and the small number of floating point registers. Is there any machine without a one instruction way to zero a register? -- glen