github.com/riscv/riscv-go@v0.0.0-20200123204226-124ebd6fcc8e/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-16 8 MOVL $0, ret_hi+12(FP) 9 10 // Try low 32 bits. 11 MOVL x_lo+0(FP), AX 12 BSFL AX, AX 13 JZ tryhigh 14 MOVL AX, ret_lo+8(FP) 15 RET 16 17 tryhigh: 18 // Try high 32 bits. 19 MOVL x_hi+4(FP), AX 20 BSFL AX, AX 21 JZ none 22 ADDL $32, AX 23 MOVL AX, ret_lo+8(FP) 24 RET 25 26 none: 27 // No bits are set. 28 MOVL $64, ret_lo+8(FP) 29 RET 30 31 TEXT runtime∕internal∕sys·Ctz32(SB), NOSPLIT, $0-8 32 MOVL x+0(FP), AX 33 BSFL AX, AX 34 JNZ 2(PC) 35 MOVL $32, AX 36 MOVL AX, ret+4(FP) 37 RET 38 39 TEXT runtime∕internal∕sys·Bswap64(SB), NOSPLIT, $0-16 40 MOVL x_lo+0(FP), AX 41 MOVL x_hi+4(FP), BX 42 BSWAPL AX 43 BSWAPL BX 44 MOVL BX, ret_lo+8(FP) 45 MOVL AX, ret_hi+12(FP) 46 RET 47 48 TEXT runtime∕internal∕sys·Bswap32(SB), NOSPLIT, $0-8 49 MOVL x+0(FP), AX 50 BSWAPL AX 51 MOVL AX, ret+4(FP) 52 RET