misc

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 AddcarryU32

func AddcarryU32(c_in uint8, a uint32, b uint32, out *uint32) uint8

AddcarryU32: Add unsigned 32-bit integers 'a' and 'b' with unsigned 8-bit carry-in 'c_in' (carry flag), and store the unsigned 32-bit result in 'out', and the carry-out in 'dst' (carry or overflow flag).

dst:out[31:0] := a[31:0] + b[31:0] + c_in;

Instruction: 'ADC'. Intrinsic: '_addcarry_u32'.

FIXME: Will likely need to be reworked (has pointer parameter).

func AddcarryU64

func AddcarryU64(c_in uint8, a uint64, b uint64, out *uint64) uint8

AddcarryU64: Add unsigned 64-bit integers 'a' and 'b' with unsigned 8-bit carry-in 'c_in' (carry flag), and store the unsigned 64-bit result in 'out', and the carry-out in 'dst' (carry or overflow flag).

dst:out[63:0] := a[63:0] + b[63:0] + c_in;

Instruction: 'ADC'. Intrinsic: '_addcarry_u64'.

FIXME: Will likely need to be reworked (has pointer parameter).

func AllowCpuFeatures

func AllowCpuFeatures(a uint64)

AllowCpuFeatures: Treat the processor-specific feature(s) specified in 'a' as available. Multiple features may be OR'd together. See the valid feature flags below:

_FEATURE_GENERIC_IA32
_FEATURE_FPU
_FEATURE_CMOV
_FEATURE_MMX
_FEATURE_FXSAVE
_FEATURE_SSE
_FEATURE_SSE2
_FEATURE_SSE3
_FEATURE_SSSE3
_FEATURE_SSE4_1
_FEATURE_SSE4_2
_FEATURE_MOVBE
_FEATURE_POPCNT
_FEATURE_PCLMULQDQ
_FEATURE_AES
_FEATURE_F16C
_FEATURE_AVX
_FEATURE_RDRND
_FEATURE_FMA
_FEATURE_BMI
_FEATURE_LZCNT
_FEATURE_HLE
_FEATURE_RTM
_FEATURE_AVX2
_FEATURE_KNCNI
_FEATURE_AVX512F
_FEATURE_ADX
_FEATURE_RDSEED
_FEATURE_AVX512ER
_FEATURE_AVX512PF
_FEATURE_AVX512CD
_FEATURE_SHA
_FEATURE_MPX

Instruction: '...'. Intrinsic: '_allow_cpu_features'.

func BitScanForward

func BitScanForward(a int) int

BitScanForward: Set 'dst' to the index of the lowest set bit in 32-bit integer 'a'. If no bits are set in 'a' then 'dst' is undefined.

tmp := 0
IF a = 0
	dst := undefined
ELSE
	DO WHILE ((tmp < 32) AND a[tmp] = 0)
		tmp := tmp + 1
		dst := tmp
	OD
FI

Instruction: 'BSF'. Intrinsic: '_bit_scan_forward'.

func BitScanForward2

func BitScanForward2(index *uint32, mask uint32) uint8

BitScanForward2: Set 'index' to the index of the lowest set bit in 32-bit integer 'mask'. If no bits are set in 'mask', then set 'dst' to 0, otherwise set 'dst' to 1.

tmp := 0
IF mask = 0
	dst := 0
ELSE
	DO WHILE ((tmp < 32) AND mask[tmp] = 0)
		tmp := tmp + 1
		index := tmp
		dst := 1
	OD
FI

Instruction: 'BSF'. Intrinsic: '_BitScanForward'.

FIXME: Will likely need to be reworked (has pointer parameter).

func BitScanForward64

func BitScanForward64(index *uint32, mask uint64) uint8

BitScanForward64: Set 'index' to the index of the lowest set bit in 64-bit integer 'mask'. If no bits are set in 'mask', then set 'dst' to 0, otherwise set 'dst' to 1.

tmp := 0
IF mask = 0
	dst := 0
ELSE
	DO WHILE ((tmp < 64) AND mask[tmp] = 0)
		tmp := tmp + 1
		index := tmp
		dst := 1
	OD
FI

Instruction: 'BSF'. Intrinsic: '_BitScanForward64'.

FIXME: Will likely need to be reworked (has pointer parameter).

func BitScanReverse

func BitScanReverse(a int) int

BitScanReverse: Set 'dst' to the index of the highest set bit in 32-bit integer 'a'. If no bits are set in 'a' then 'dst' is undefined.

tmp := 31
IF a = 0
	dst := undefined
ELSE
	DO WHILE ((tmp > 0) AND a[tmp] = 0)
		tmp := tmp - 1
		dst := tmp
	OD
FI

Instruction: 'BSR'. Intrinsic: '_bit_scan_reverse'.

func BitScanReverse2

func BitScanReverse2(index *uint32, mask uint32) uint8

BitScanReverse2: Set 'index' to the index of the highest set bit in 32-bit integer 'mask'. If no bits are set in 'mask', then set 'dst' to 0, otherwise set 'dst' to 1.

tmp := 31
IF mask = 0
	dst := 0
ELSE
	DO WHILE ((tmp > 0) AND mask[tmp] = 0)
		tmp := tmp - 1
		index := tmp
		dst := 1
	OD
FI

Instruction: 'BSR'. Intrinsic: '_BitScanReverse'.

FIXME: Will likely need to be reworked (has pointer parameter).

func BitScanReverse64

func BitScanReverse64(index *uint32, mask uint64) uint8

BitScanReverse64: Set 'index' to the index of the highest set bit in 64-bit integer 'mask'. If no bits are set in 'mask', then set 'dst' to 0, otherwise set 'dst' to 1.

tmp := 31
IF mask = 0
	dst := 0
ELSE
	DO WHILE ((tmp > 0) AND mask[tmp] = 0)
		tmp := tmp - 1
		index := tmp
		dst := 1
	OD
FI

Instruction: 'BSR'. Intrinsic: '_BitScanReverse64'.

FIXME: Will likely need to be reworked (has pointer parameter).

func Bittest

func Bittest(a *int32, b int32) uint8

Bittest: Return the bit at index 'b' of 32-bit integer 'a'.

dst := a[b]

Instruction: 'BT'. Intrinsic: '_bittest'.

FIXME: Will likely need to be reworked (has pointer parameter).

func Bittest64

func Bittest64(a *int64, b int64) uint8

Bittest64: Return the bit at index 'b' of 64-bit integer 'a'.

dst := a[b]

Instruction: 'BT'. Intrinsic: '_bittest64'.

FIXME: Will likely need to be reworked (has pointer parameter).

func Bittestandcomplement

func Bittestandcomplement(a *int32, b int32) uint8

Bittestandcomplement: Return the bit at index 'b' of 32-bit integer 'a', and set that bit to its complement.

dst := a[b]
a[b] := ~a[b]

Instruction: 'BTC'. Intrinsic: '_bittestandcomplement'.

FIXME: Will likely need to be reworked (has pointer parameter).

func Bittestandcomplement64

func Bittestandcomplement64(a *int64, b int64) uint8

Bittestandcomplement64: Return the bit at index 'b' of 64-bit integer 'a', and set that bit to its complement.

dst := a[b]
a[b] := ~a[b]

Instruction: 'BTC'. Intrinsic: '_bittestandcomplement64'.

FIXME: Will likely need to be reworked (has pointer parameter).

func Bittestandreset

func Bittestandreset(a *int32, b int32) uint8

Bittestandreset: Return the bit at index 'b' of 32-bit integer 'a', and set that bit to zero.

dst := a[b]
a[b] := 0

Instruction: 'BTR'. Intrinsic: '_bittestandreset'.

FIXME: Will likely need to be reworked (has pointer parameter).

func Bittestandreset64

func Bittestandreset64(a *int64, b int64) uint8

Bittestandreset64: Return the bit at index 'b' of 64-bit integer 'a', and set that bit to zero.

dst := a[b]
a[b] := 0

Instruction: 'BTR'. Intrinsic: '_bittestandreset64'.

FIXME: Will likely need to be reworked (has pointer parameter).

func Bittestandset

func Bittestandset(a *int32, b int32) uint8

Bittestandset: Return the bit at index 'b' of 32-bit integer 'a', and set that bit to one.

dst := a[b]
a[b] := 1

Instruction: 'BTS'. Intrinsic: '_bittestandset'.

FIXME: Will likely need to be reworked (has pointer parameter).

func Bittestandset64

func Bittestandset64(a *int64, b int64) uint8

Bittestandset64: Return the bit at index 'b' of 64-bit integer 'a', and set that bit to one.

dst := a[b]
a[b] := 1

Instruction: 'BTS'. Intrinsic: '_bittestandset64'.

FIXME: Will likely need to be reworked (has pointer parameter).

func Bswap

func Bswap(a int) int

Bswap: Reverse the byte order of 32-bit integer 'a', and store the result in 'dst'. This intrinsic is provided for conversion between little and big endian values.

dst[7:0] := a[31:24]
dst[15:8] := a[23:16]
dst[23:16] := a[15:8]
dst[31:24] := a[7:0]

Instruction: 'BSWAP'. Intrinsic: '_bswap'.

func Bswap64

func Bswap64(a int64) int64

Bswap64: Reverse the byte order of 64-bit integer 'a', and store the result in 'dst'. This intrinsic is provided for conversion between little and big endian values.

dst[7:0] := a[63:56]
dst[15:8] := a[55:48]
dst[23:16] := a[47:40]
dst[31:24] := a[39:32]
dst[39:32] := a[31:24]
dst[47:40] := a[23:16]
dst[55:48] := a[15:8]
dst[63:56] := a[7:0]

Instruction: 'BSWAP'. Intrinsic: '_bswap64'.

func Castf32U32

func Castf32U32(a float32) uint32

Castf32U32: Cast from type float to type unsigned __int32 without conversion.

This intrinsic is only used for compilation and does not generate any

instructions, thus it has zero latency.

Instruction: ”. Intrinsic: '_castf32_u32'.

func Castf64U64

func Castf64U64(a float64) uint64

Castf64U64: Cast from type double to type unsigned __int64 without conversion.

This intrinsic is only used for compilation and does not generate any

instructions, thus it has zero latency.

Instruction: ”. Intrinsic: '_castf64_u64'.

func Castu32F32

func Castu32F32(a uint32) float32

Castu32F32: Cast from type unsigned __int32 to type float without conversion.

This intrinsic is only used for compilation and does not generate any

instructions, thus it has zero latency.

Instruction: ”. Intrinsic: '_castu32_f32'.

func Castu64F64

func Castu64F64(a uint64) float64

Castu64F64: Cast from type unsigned __int64 to type double without conversion.

This intrinsic is only used for compilation and does not generate any

instructions, thus it has zero latency.

Instruction: ”. Intrinsic: '_castu64_f64'.

func CvtshSs

func CvtshSs(a uint16) float32

CvtshSs: Convert the half-precision (16-bit) floating-point value 'a' to a single-precision (32-bit) floating-point value, and store the result in 'dst'.

dst[31:0] := Convert_FP16_To_FP32(a[15:0])

Instruction: '...'. Intrinsic: '_cvtsh_ss'.

func CvtssSh

func CvtssSh(a float32, imm8 byte) uint16

CvtssSh: Convert the single-precision (32-bit) floating-point value 'a' to a half-precision (16-bit) floating-point value, and store the result in 'dst'.

dst[15:0] := Convert_FP32_To_FP16(a[31:0])

Instruction: '...'. Intrinsic: '_cvtss_sh'.

FIXME: Requires compiler support (has immediate)

func Lrotl

func Lrotl(a uint32, shift int) uint32

Lrotl: Shift the bits of unsigned 64-bit integer 'a' left by the number of bits specified in 'shift', rotating the most-significant bit to the least-significant bit location, and store the unsigned result in 'dst'.

dst := a
count := shift BITWISE AND 63
DO WHILE (count > 0)
	tmp[0] := dst[63]
	dst := (dst << 1) OR tmp[0]
	count := count - 1
OD

Instruction: 'ROL'. Intrinsic: '_lrotl'.

func Lrotr

func Lrotr(a uint32, shift int) uint32

Lrotr: Shift the bits of unsigned 64-bit integer 'a' right by the number of bits specified in 'shift', rotating the least-significant bit to the most-significant bit location, and store the unsigned result in 'dst'.

dst := a
count := shift BITWISE AND 63
DO WHILE (count > 0)
	tmp[63] := dst[0]
	dst := (dst >> 1) OR tmp[63]
	count := count - 1
OD

Instruction: 'ROR'. Intrinsic: '_lrotr'.

func MayIUseCpuFeature

func MayIUseCpuFeature(a uint64) int

MayIUseCpuFeature: Dynamically query the processor to determine if the processor-specific feature(s) specified in 'a' are available, and return true or false (1 or 0) if the set of features is available. Multiple features may be OR'd together. This intrinsic does not check the processor vendor. See the valid feature flags below:

_FEATURE_GENERIC_IA32
_FEATURE_FPU
_FEATURE_CMOV
_FEATURE_MMX
_FEATURE_FXSAVE
_FEATURE_SSE
_FEATURE_SSE2
_FEATURE_SSE3
_FEATURE_SSSE3
_FEATURE_SSE4_1
_FEATURE_SSE4_2
_FEATURE_MOVBE
_FEATURE_POPCNT
_FEATURE_PCLMULQDQ
_FEATURE_AES
_FEATURE_F16C
_FEATURE_AVX
_FEATURE_RDRND
_FEATURE_FMA
_FEATURE_BMI
_FEATURE_LZCNT
_FEATURE_HLE
_FEATURE_RTM
_FEATURE_AVX2
_FEATURE_KNCNI
_FEATURE_AVX512F
_FEATURE_ADX
_FEATURE_RDSEED
_FEATURE_AVX512ER
_FEATURE_AVX512PF
_FEATURE_AVX512CD
_FEATURE_SHA
_FEATURE_MPX

Instruction: '...'. Intrinsic: '_may_i_use_cpu_feature'.

func Rdpmc

func Rdpmc(a int) int64

Rdpmc: Read the Performance Monitor Counter (PMC) specified by 'a', and store up to 64-bits in 'dst'. The width of performance counters is implementation specific.

dst[63:0] := ReadPMC(a)

Instruction: 'RDPMC'. Intrinsic: '_rdpmc'.

func Rotl

func Rotl(a uint32, shift int) uint32

Rotl: Shift the bits of unsigned 32-bit integer 'a' left by the number of bits specified in 'shift', rotating the most-significant bit to the least-significant bit location, and store the unsigned result in 'dst'.

dst := a
count := shift BITWISE AND 31
DO WHILE (count > 0)
	tmp[0] := dst[31]
	dst := (dst << 1) OR tmp[0]
	count := count - 1
OD

Instruction: 'ROL'. Intrinsic: '_rotl'.

func Rotr

func Rotr(a uint32, shift int) uint32

Rotr: Shift the bits of unsigned 32-bit integer 'a' right by the number of bits specified in 'shift', rotating the least-significant bit to the most-significant bit location, and store the unsigned result in 'dst'.

dst := a
count := shift BITWISE AND 31
DO WHILE (count > 0)
	tmp[31] := dst[0]
	dst := (dst >> 1) OR tmp[31]
	count := count - 1
OD

Instruction: 'ROR'. Intrinsic: '_rotr'.

func Rotwl

func Rotwl(a uint16, shift int) uint16

Rotwl: Shift the bits of unsigned 16-bit integer 'a' left by the number of bits specified in 'shift', rotating the most-significant bit to the least-significant bit location, and store the unsigned result in 'dst'.

dst := a
count := shift BITWISE AND 15
DO WHILE (count > 0)
	tmp[0] := dst[15]
	dst := (dst << 1) OR tmp[0]
	count := count - 1
OD

Instruction: 'ROL'. Intrinsic: '_rotwl'.

func Rotwr

func Rotwr(a uint16, shift int) uint16

Rotwr: Shift the bits of unsigned 16-bit integer 'a' right by the number of bits specified in 'shift', rotating the least-significant bit to the most-significant bit location, and store the unsigned result in 'dst'.

dst := a
count := shift BITWISE AND 15
DO WHILE (count > 0)
	tmp[15] := dst[0]
	dst := (dst >> 1) OR tmp[15]
	count := count - 1
OD

Instruction: 'ROR'. Intrinsic: '_rotwr'.

func SubborrowU32

func SubborrowU32(b_in uint8, a uint32, b uint32, out *uint32) uint8

SubborrowU32: Add unsigned 8-bit borrow 'b_in' (carry flag) to unsigned 32-bit integer 'a', and subtract the result from unsigned 32-bit integer 'b'. Store the unsigned 32-bit result in 'out', and the carry-out in 'dst' (carry or overflow flag).

dst:out[31:0] := (b[31:0] - (a[31:0] + b_in));

Instruction: 'SBB'. Intrinsic: '_subborrow_u32'.

FIXME: Will likely need to be reworked (has pointer parameter).

func SubborrowU64

func SubborrowU64(b_in uint8, a uint64, b uint64, out *uint64) uint8

SubborrowU64: Add unsigned 8-bit borrow 'b_in' (carry flag) to unsigned 64-bit integer 'a', and subtract the result from unsigned 64-bit integer 'b'. Store the unsigned 64-bit result in 'out', and the carry-out in 'dst' (carry or overflow flag).

dst:out[63:0] := (b[63:0] - (a[63:0] + b_in));

Instruction: 'SBB'. Intrinsic: '_subborrow_u64'.

FIXME: Will likely need to be reworked (has pointer parameter).

Types

This section is empty.

Jump to

Keyboard shortcuts

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