[PATCH 3/6] powerpc sstep: Add cnttzw, cnttzd instruction emulation

Segher Boessenkool segher at kernel.crashing.org
Wed Sep 5 07:12:07 AEST 2018


On Mon, Sep 03, 2018 at 08:49:35PM +0530, Sandipan Das wrote:
> +		case 538:	/* cnttzw */
> +			if (!cpu_has_feature(CPU_FTR_ARCH_300))
> +				return -1;
> +			val = (unsigned int) regs->gpr[rd];
> +			op->val = ( val ? __builtin_ctz(val) : 32 );
> +			goto logical_done;
> +#ifdef __powerpc64__
> +		case 570:	/* cnttzd */
> +			if (!cpu_has_feature(CPU_FTR_ARCH_300))
> +				return -1;
> +			val = regs->gpr[rd];
> +			op->val = ( val ? __builtin_ctzl(val) : 64 );
> +			goto logical_done;

__builtin_ctz(val) is undefined for val == 0.


Segher


More information about the Linuxppc-dev mailing list