CMOV (Developers)
(yeah, probably all irrelevant to the thread since the subject was mostly 16-bit only CPUs. But I originally started to answer from a size perspective, so just conclude this subthread)
I researched a bit more, and there seem several separate issues:
- cmov has a latency of 1 (AMD) or 2 (Intel) cycles, so if it forms a dependency chain with instructions coming after it. In that case the branched form might be more worthwhile if correct predicted and the opcodes are sufficiently fused.
- I found some references that using branches might confuse the branch-predictor, without many details, except a general advise to minimize branches.
- the older the cpu (superscalar ones, so p6+), the less inputs a single uop can have. Since cmov also depends on flags (it has two arguments + flags), in older CPUs (before Sandy Bridge) many combinations couldn't be a single uop. Even now there are more problems with e.g. indexed version (which take another input register). Probably Sandy Bridge raised that to 3 inputs because of the three-address AVX instructions.
- the exact dependencies depend also on the form (the used flags). Carry and other flags combined are separate dependencies, so if you need carry and another flag, uop fusion probably won't happen.
The current opinion seems to be to use cmov instructions unless there is a very clear dependency chain. Cmov seems to be put in the same group as the adc instruction.
Complete thread:
- rebuilding NASM 0.98.39 (2005) for 16-bit 8086 host - Rugxulo, 14.03.2020, 08:13 (Developers)
- rebuilding NASM 0.98.39 (2005) for 16-bit 8086 host - Rugxulo, 16.03.2020, 01:24
- rebuilding NASM 0.98.39 (2005) for 16-bit 8086 host - rr, 16.03.2020, 15:22
- rebuilding NASM 0.98.39 (without MMX/3DNOW/686/SSE) - Rugxulo, 17.03.2020, 05:20
- rebuilding NASM 0.98.39 (without MMX/3DNOW/686/SSE) - ecm, 17.03.2020, 06:58
- rebuilding NASM 0.98.39 (without MMX/3DNOW/686/SSE) - Rugxulo, 22.03.2020, 00:48
- rebuilding NASM 0.98.39 (without MMX/3DNOW/686/SSE) - ecm, 22.03.2020, 10:13
- rebuilding NASM 2.09 and NASM compatibility - ecm, 22.03.2020, 11:45
- rebuilding NASM 0.98.39 (without MMX/3DNOW/686/SSE) - ecm, 06.09.2020, 23:09
- rebuilding NASM 0.98.39 (without MMX/3DNOW/686/SSE) - ecm, 22.03.2020, 10:13
- rebuilding NASM 0.98.39 (without MMX/3DNOW/686/SSE) - Rugxulo, 22.03.2020, 00:48
- rebuilding NASM 0.98.39 (without MMX/3DNOW/686/SSE) - Rugxulo, 22.03.2020, 00:42
- rebuilding NASM 0.98.39 (without MMX/3DNOW/686/SSE) - marcov, 22.03.2020, 13:08
- CMOV - ecm, 22.03.2020, 14:26
- CMOV - marcov, 22.03.2020, 18:32
- CMOV - marcov, 23.03.2020, 12:52
- CMOV - marcov, 22.03.2020, 18:32
- rebuilding NASM 0.98.39 (without MMX/3DNOW/686/SSE) - Rugxulo, 23.03.2020, 04:27
- NASM 0.98.39 (MSC 7, "286", not full instruction support) - Rugxulo, 24.03.2020, 20:36
- NASM 0.98.39 (not full instruction support) - Rugxulo, 24.03.2020, 21:16
- NASM 0.98.39 (not full instruction support) - ecm, 24.03.2020, 22:55
- NASM 0.98.39 (not full instruction support) - Rugxulo, 24.03.2020, 23:17
- NASM 0.98.39 (not full instruction support) ... LOADALL - Rugxulo, 31.03.2020, 20:07
- NASM 0.98.39 (not full instruction support) - ecm, 24.03.2020, 22:55
- NASM 0.98.39 (not full instruction support) - Rugxulo, 24.03.2020, 21:16
- rebuilding NASM 0.98.39 (without MMX/3DNOW/686/SSE) - Rugxulo, 13.04.2020, 07:16
- NASM 0.98.39 (MSC 7, "286", not full instruction support) - Rugxulo, 24.03.2020, 20:36
- deprecated MMX and obsolete 3DNow! - Rugxulo, 24.03.2020, 17:54
- CMOV - ecm, 22.03.2020, 14:26
- rebuilding NASM 0.98.39 (without MMX/3DNOW/686/SSE) - marcov, 22.03.2020, 13:08
- rebuilding NASM 0.98.39 (without MMX/3DNOW/686/SSE) - ecm, 17.03.2020, 06:58
- rebuilding NASM 0.98.39 (without MMX/3DNOW/686/SSE) - Rugxulo, 17.03.2020, 05:20
- rebuilding NASM 0.98.39 (2005) for 16-bit 8086 host - rr, 16.03.2020, 15:22
- rebuilding NASM 0.98.39 (2005) for 16-bit 8086 host - Rugxulo, 16.03.2020, 01:24