nelhage / gojit

JIT code-generation in Go!
MIT License
338 stars 34 forks source link

Optimization: Prefer ADD and SUB to INC and DEC. #2

Closed alex closed 10 years ago

alex commented 10 years ago

INC and DEC are generally not preferred anymore (at least, not on Intel chips). Though they have shorter encodings, they introduce a false dependency on the carry flag, and thus lead to worse performance.

nelhage commented 10 years ago

Good call. I'm probably going to the trivial peephole optimizer at some point, which will necessitate this optimization anyways. I'll figure out the Addb and Decb encodings, too -- it should be straightforward.

alex commented 10 years ago

Awesome!

On Sun, Apr 27, 2014 at 9:28 AM, Nelson Elhage notifications@github.comwrote:

Good call. I'm probably going to the trivial peephole optimizer at some point, which will necessitate this optimization anyways. I'll figure out the Addb and Decb encodings, too -- it should be straightforward.

— Reply to this email directly or view it on GitHubhttps://github.com/nelhage/gojit/pull/2#issuecomment-41501190 .

"I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire) "The people's good is the highest law." -- Cicero GPG Key fingerprint: 125F 5C67 DFE9 4084