github.com/epfl-dcsl/gotee@v0.0.0-20200909122901-014b35f5e5e9/src/runtime/internal/sys/intrinsics_386.s (about)

     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·Bswap64(SB), NOSPLIT, $0-16
    38  	MOVL	x_lo+0(FP), AX
    39  	MOVL	x_hi+4(FP), BX
    40  	BSWAPL	AX
    41  	BSWAPL	BX
    42  	MOVL	BX, ret_lo+8(FP)
    43  	MOVL	AX, ret_hi+12(FP)
    44  	RET
    45  
    46  TEXT runtime∕internal∕sys·Bswap32(SB), NOSPLIT, $0-8
    47  	MOVL	x+0(FP), AX
    48  	BSWAPL	AX
    49  	MOVL	AX, ret+4(FP)
    50  	RET