Use test instead of cmp for comparison against zero.
For comparisons test r, r and cmp r, $0 are interchangeable at least on x86.
However using test leads to slightly smaller code. (Saves a byte per comparison).
A good starting point is stmtToInstrs in compiler/nativeGen/X86/CodeGen starting with how CmmCondBranch is compiled to Instructions.
From there it should be not too hard to track down the required changes.
Trac metadata
| Trac field | Value |
|---|---|
| Version | |
| Type | Task |
| TypeOfFailure | OtherFailure |
| Priority | low |
| Resolution | Unresolved |
| Component | Compiler (NCG) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |