-
Enhancement
-
Resolution: Fixed
-
P4
-
17, 21, 22
-
b15
-
x86
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8320425 | 21.0.2 | Aleksey Shipilev | P4 | Resolved | Fixed | b08 |
Noticed this when looking at C1 profiling code. There are plenty of usages for `cmp reg, 0` in C1 x86 code, both in generic `LIR_Assembler::comp_op`, and in some profiling paths.
`test reg, reg` is a denser idiom for this comparison. The difference between `cmp` and `test` on x86 seems to be only with AF (aux carry flag). For ubiquitous int/pointer comparisons, this distinction is irrelevant. C2 already does this transformation in .ad match rules.
`test reg, reg` is a denser idiom for this comparison. The difference between `cmp` and `test` on x86 seems to be only with AF (aux carry flag). For ubiquitous int/pointer comparisons, this distinction is irrelevant. C2 already does this transformation in .ad match rules.
- backported by
-
JDK-8320425 C1: Replace "cmp reg, 0" with "test reg, reg" on x86
-
- Resolved
-