Re: [PATCH] fix TASK_STOPPED vs TASK_NONINTERACTIVE interaction

From: linux
Date: Mon Oct 03 2005 - 18:50:14 EST


> 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)"
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/