Under any known preconditions, there are more efficient (in terms of speed) tricks than the 3-byte push8 / pop rax solution.
There mov eax, 1are many advantages to speed , because it does not have any input dependencies, and this is just one instruction. An unscheduled performance can begin with it (and everything that depends on it), without waiting for other things. (See Agner Fog Handbook and the x86 tag wiki).
, , 32- , REX OP. ( , xor rax,rax Silvermont. xor- 32- , eax r10d, rax r10.)
,
lea eax, [rcx+1] ; 3 bytes: opcode + ModRM + disp8
disp8 -128 +127.
eax, and eax, 1 3 .
32- inc eax , inc/dec opupodes REX AMD64. , xor eax,eax/inc eax 4 x86-64, 3 32- . , 1 mov eax,1 , LEA AND , , push/pop.