Black Lives Matter. Support the Equal Justice Initiative.

Text file src/runtime/internal/sys/intrinsics_386.s

Documentation: runtime/internal/sys

     1  // Copyright 2016 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  #include "textflag.h"
     6  
     7  TEXT runtime∕internal∕sys·Ctz64(SB), NOSPLIT, $0-12
     8  	// Try low 32 bits.
     9  	MOVL	x_lo+0(FP), AX
    10  	BSFL	AX, AX
    11  	JZ	tryhigh
    12  	MOVL	AX, ret+8(FP)
    13  	RET
    14  
    15  tryhigh:
    16  	// Try high 32 bits.
    17  	MOVL	x_hi+4(FP), AX
    18  	BSFL	AX, AX
    19  	JZ	none
    20  	ADDL	$32, AX
    21  	MOVL	AX, ret+8(FP)
    22  	RET
    23  
    24  none:
    25  	// No bits are set.
    26  	MOVL	$64, ret+8(FP)
    27  	RET
    28  
    29  TEXT runtime∕internal∕sys·Ctz32(SB), NOSPLIT, $0-8
    30  	MOVL	x+0(FP), AX
    31  	BSFL	AX, AX
    32  	JNZ	2(PC)
    33  	MOVL	$32, AX
    34  	MOVL	AX, ret+4(FP)
    35  	RET
    36  
    37  TEXT runtime∕internal∕sys·Ctz8(SB), NOSPLIT, $0-8
    38  	MOVBLZX	x+0(FP), AX
    39  	BSFL	AX, AX
    40  	JNZ	2(PC)
    41  	MOVL	$8, AX
    42  	MOVL	AX, ret+4(FP)
    43  	RET
    44  
    45  TEXT runtime∕internal∕sys·Bswap64(SB), NOSPLIT, $0-16
    46  	MOVL	x_lo+0(FP), AX
    47  	MOVL	x_hi+4(FP), BX
    48  	BSWAPL	AX
    49  	BSWAPL	BX
    50  	MOVL	BX, ret_lo+8(FP)
    51  	MOVL	AX, ret_hi+12(FP)
    52  	RET
    53  
    54  TEXT runtime∕internal∕sys·Bswap32(SB), NOSPLIT, $0-8
    55  	MOVL	x+0(FP), AX
    56  	BSWAPL	AX
    57  	MOVL	AX, ret+4(FP)
    58  	RET
    59  

View as plain text