The result doesn't look strange to me. However, it's not a realistic usage of these instructions. Usually a "test ax,ax", "and ax,ax" or "or ax,ax" is followed by a conditional jump. I guess with the jump there's almost no difference in timings.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I did some of these test a long time ago, and I think the result was that "or" was slightly faster than "and" for some reason.
I write most code using pascal (or stdcall) to avoid the "add (e)sp,args" which destroyes the flags on return.
invoke func(strcmp,s1,s2)
jz is_equal
Most of the conditional jumps are from these function calls; so returning flag in all library (and local) functions reduces code size and time. If not done in this way, the test must be repeated on all calls.
From the (old) 8086/80486 - Intel 8086 Family Architecture:
Clocks Size
Operands 808x 286 386 486 Bytes
test reg,reg 3 2 1 1 2
or reg,reg 3 2 2 1 2
and reg,reg 3 2 2 1 2
Same byte size, so why is "or" and "and" preferred?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Some strange test results: (.if ax)
The result doesn't look strange to me. However, it's not a realistic usage of these instructions. Usually a "test ax,ax", "and ax,ax" or "or ax,ax" is followed by a conditional jump. I guess with the jump there's almost no difference in timings.
I did some of these test a long time ago, and I think the result was that "or" was slightly faster than "and" for some reason.
I write most code using pascal (or stdcall) to avoid the "add (e)sp,args" which destroyes the flags on return.
Most of the conditional jumps are from these function calls; so returning flag in all library (and local) functions reduces code size and time. If not done in this way, the test must be repeated on all calls.
From the (old) 8086/80486 - Intel 8086 Family Architecture:
Same byte size, so why is "or" and "and" preferred?
> so why is "or" and "and" preferred?
jwasm does it because Masm does it.