shithub: snippets

ref: 6c5f25a2fd0da669d735d457d0e7c04d2dc2efcc
dir: /c_builtins_amd64.s/

View raw version
TEXT __builtin_ctz(SB),1,$0
	BSFL RARG, AX
	RET

TEXT __builtin_clz(SB),1,$0
	BSRL RARG, AX
	XORL $31, AX
	RET

TEXT __builtin_clzll(SB),1,$0
	BSRQ RARG, AX
	XORL $63, AX
	RET