Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools@v0.0.0-20201105173854-bc9fc8d8c4bc / container / intsets / popcnt_amd64.s
1 // Copyright 2015 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 // +build amd64,!appengine,!gccgo
6
7 #include "textflag.h"
8
9 // func havePOPCNT() bool
10 TEXT ·havePOPCNT(SB),4,$0
11         MOVQ    $1, AX
12         CPUID
13         SHRQ    $23, CX
14         ANDQ    $1, CX
15         MOVB    CX, ret+0(FP)
16         RET
17
18 // func popcnt(word) int
19 TEXT ·popcnt(SB),NOSPLIT,$0-8
20         XORQ    AX, AX
21         MOVQ    x+0(FP), SI
22         // POPCNT (SI), AX is not recognized by Go assembler,
23         // so we assemble it ourselves.
24         BYTE    $0xf3
25         BYTE    $0x48
26         BYTE    $0x0f
27         BYTE    $0xb8
28         BYTE    $0xc6
29         MOVQ    AX, ret+8(FP)
30         RET