Skip to contentSkip to conversation

fix TASK_STOPPED vs TASK_NONINTERACTIVE interaction

PATCH [email protected] 1 participant 1 message Oct 3, 2005

lore
Share & tools
lore
#0 lore raw
Quoted 4 lines

Any CPU I can think of has a "and + compare against zero". x86 calls it "test", although a regular "and" will do it too. ppc has "andi.". alpha comparisons are against registers being zero or not, so again it's an "and".

About the only one for which "cmp" is faster than "test" is the 680x0. "cmp" is a subtract that doesn't write the result (except to the condition codes). "tst" (called "bit" on the VAX and 6502) is a similar AND.

The 68k doesn't have that. You have to obliterate one of the operands, and it can't be the immediate operand, so it's often two instructions.

The 68k does have an instruction called "test", but it just sets the condition codes based on a single operand (since it doesn't set the condition codes on a simple move).

It *does* have a single-bit test instruction, which evaluates "if (x & 1<<y)" in one cycle, but that doesn't help for multi-bit masks like "if (x % 4096 == 0)"