bmi2

package
v0.0.0-...-3878f85 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2017 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

THESE PACKAGES ARE FOR DEMONSTRATION PURPOSES ONLY!

THEY DO NOT NOT CONTAIN WORKING INTRINSICS!

See https://github.com/klauspost/intrinsics

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BzhiU32

func BzhiU32(a uint32, index uint32) uint32

BzhiU32: Copy all bits from unsigned 32-bit integer 'a' to 'dst', and reset (set to 0) the high bits in 'dst' starting at 'index'.

n := index[7:0]
dst := a
IF (n < 32)
	dst[31:n] := 0
FI

Instruction: 'BZHI'. Intrinsic: '_bzhi_u32'. Requires BMI2.

func BzhiU64

func BzhiU64(a uint64, index uint32) uint64

BzhiU64: Copy all bits from unsigned 64-bit integer 'a' to 'dst', and reset (set to 0) the high bits in 'dst' starting at 'index'.

n := index[7:0]
dst := a
IF (n < 64)
	dst[63:n] := 0
FI

Instruction: 'BZHI'. Intrinsic: '_bzhi_u64'. Requires BMI2.

func PdepU32

func PdepU32(a uint32, mask uint32) uint32

PdepU32: Deposit contiguous low bits from unsigned 32-bit integer 'a' to 'dst' at the corresponding bit locations specified by 'mask'; all other bits in 'dst' are set to zero.

tmp := a
dst := 0
m := 0
k := 0
DO WHILE m < 32
	IF mask[m] = 1
		dst[m] := tmp[k]
		k := k + 1
	FI
	m := m + 1
OD

Instruction: 'PDEP'. Intrinsic: '_pdep_u32'. Requires BMI2.

func PdepU64

func PdepU64(a uint64, mask uint64) uint64

PdepU64: Deposit contiguous low bits from unsigned 64-bit integer 'a' to 'dst' at the corresponding bit locations specified by 'mask'; all other bits in 'dst' are set to zero.

tmp := a
dst := 0
m := 0
k := 0
DO WHILE m < 64
	IF mask[m] = 1
		dst[m] := tmp[k]
		k := k + 1
	FI
	m := m + 1
OD

Instruction: 'PDEP'. Intrinsic: '_pdep_u64'. Requires BMI2.

func PextU32

func PextU32(a uint32, mask uint32) uint32

PextU32: Extract bits from unsigned 32-bit integer 'a' at the corresponding bit locations specified by 'mask' to contiguous low bits in 'dst'; the remaining upper bits in 'dst' are set to zero.

tmp := a
dst := 0
m := 0
k := 0
DO WHILE m < 32
	IF mask[m] = 1
		dst[k] := tmp[m]
		k := k + 1
	FI
	m := m + 1
OD

Instruction: 'PEXT'. Intrinsic: '_pext_u32'. Requires BMI2.

func PextU64

func PextU64(a uint64, mask uint64) uint64

PextU64: Extract bits from unsigned 64-bit integer 'a' at the corresponding bit locations specified by 'mask' to contiguous low bits in 'dst'; the remaining upper bits in 'dst' are set to zero.

tmp := a
dst := 0
m := 0
k := 0
DO WHILE m < 64
	IF mask[m] = 1
		dst[k] := tmp[m]
		k := k + 1
	FI
	m := m + 1
OD

Instruction: 'PEXT'. Intrinsic: '_pext_u64'. Requires BMI2.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL