On Friday 26 October 2007 01:32:53 Linus Torvalds wrote:That is not what gcc did in that case. I don't think it tracks sets of values over function calls (or even inside functions) at all. The generated code was cmpl $1, %eax ; test res movl acquires_count, %edx ; load adcl $0, %edx ; maybe add 1 movl %edx, acquires_count ; store So it just added the result of a comparison into a variable by (ab)using carry for this. In theory such things can be done with CMOV too by redirecting a store into a dummy variable to cancel it, but gcc doesn't do that on its own. The conditional add/sub using carry trick is not generally bogus. It's just bogus for memory addresses not pretty much guaranteed in L1 [aka small stack frame] because there the pipeline benefit is unlikely to offset the memory costs (and of course poor quality of implementation because of the missing thread safety). But for registers it's a fine optimization. -Andi -
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| Ingo Molnar | [git pull] x86 arch updates for v2.6.25 |
| Anton Salikhmetov | [PATCH -v8 2/4] Update ctime and mtime for memory-mapped files |
git: | |
| Patrick McHardy | Re: [GIT]: Networking |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Gerrit Renker | [PATCH 16/37] dccp: API to query the current TX/RX CCID |
| Andrew Morton | Re: [BUG] New Kernel Bugs |
