Architecture operations.
These members are single instructions of one architecture that the portable SIMD members cannot express: byte shuffles, saturating packs, dot products, and the AES, carry-less multiply, SHA-256 and SHA-1 instructions. Each lowers to exactly one LLVM intrinsic. The silk/simd/x86, silk/simd/aarch64 and silk/simd/wasm modules wrap them in functions that use the instruction where the profile enables it and portable code everywhere else.
Rules shared by every architecture member#
A call is admitted only when the selected target is the member's architecture and the instruction's CPU feature is enabled, by the profile or by the
@featuresdirective of the function that makes the call. A feature counts when an enabled feature implies it:avx2admits thessse3andsse4.1shapes, and on AArch64cryptoadmits theaesandsha2ones. Otherwise the call is SEM0241: "Intrinsic.x86ShuffleBytes needs x86_64 with ssse3, which this profile does not select; guard it withstatic if Target.hasCpuFeature(...)or list the feature in the function's@features(...)directive".A function with
@featuresmust be anunsafe fn, and each call to it is unsafe: running it on a CPU without the features is undefined behavior. Check first withCpuFeatures.detect()fromsilk/simd/cpu.The members themselves are safe once admitted. They read and write only their vector operands.
The first type argument is the first operand's vector type, and it selects one of the listed shapes. A shape the member does not take is SEM0239, and the message lists the shapes it takes. The shape is checked before the target, so a wrong shape is reported on any target.
Code for several targets puts each call under a
static ifonIntrinsic.targetArchitecture(), so that the other targets never see it.
The examples are checked for the architecture they name, not run, since the machine that runs the checks may lack the feature.
Intrinsic.x86ShuffleBytes#
fn x86ShuffleBytes<V>(table: V, indices: V) -> Vpshufb: lane i is table[indices[i] & 15] within each 128-bit half, or zero when bit 7 of indices[i] is set.
Shapes, with the x86_64 feature each needs:
simd<u8, 16>,simd<u8, 16>tosimd<u8, 16>withssse3;simd<u8, 32>,simd<u8, 32>tosimd<u8, 32>withavx2.Wrappers:
shuffleBytes,shuffleBytes256insilk/simd/x86, which fall back to portable code where the feature is missing.
@features("ssse3")
unsafe fn shuffleBytes(table: simd<u8, 16>, indices: simd<u8, 16>) -> simd<u8, 16> {
return Intrinsic.x86ShuffleBytes<simd<u8, 16>>(table, indices)
}
pub fn main() -> i32 {
let table = Intrinsic.simdSplat<simd<u8, 16>>(1)
let indices = Intrinsic.simdSplat<simd<u8, 16>>(1)
let result = unsafe shuffleBytes(table, indices)
drop result
return 0
}Intrinsic.x86MultiplyAddBytes#
fn x86MultiplyAddBytes<V>(left: V, right: W) -> Rpmaddubsw: unsigned bytes times signed bytes, adjacent products summed with signed saturation.
Shapes, with the x86_64 feature each needs:
simd<u8, 16>,simd<i8, 16>tosimd<i16, 8>withssse3;simd<u8, 32>,simd<i8, 32>tosimd<i16, 16>withavx2.Vis the first operand's type and selects the shape; the other operand and result types follow from it, as listed.Wrappers:
multiplyAddBytes,multiplyAddBytes256insilk/simd/x86, which fall back to portable code where the feature is missing.
@features("ssse3")
unsafe fn multiplyAddBytes(left: simd<u8, 16>, right: simd<i8, 16>) -> simd<i16, 8> {
return Intrinsic.x86MultiplyAddBytes<simd<u8, 16>>(left, right)
}
pub fn main() -> i32 {
let left = Intrinsic.simdSplat<simd<u8, 16>>(1)
let right = Intrinsic.simdSplat<simd<i8, 16>>(1)
let result = unsafe multiplyAddBytes(left, right)
drop result
return 0
}Intrinsic.x86MultiplyAddWords#
fn x86MultiplyAddWords<V>(left: V, right: V) -> Rpmaddwd: signed 16-bit products, adjacent pairs summed into 32-bit lanes.
Shapes, with the x86_64 feature each needs:
simd<i16, 8>,simd<i16, 8>tosimd<i32, 4>withsse2;simd<i16, 16>,simd<i16, 16>tosimd<i32, 8>withavx2.Vis the first operand's type and selects the shape; the other operand and result types follow from it, as listed.Wrappers:
multiplyAddWords,multiplyAddWords256insilk/simd/x86, which fall back to portable code where the feature is missing.
@features("sse2")
unsafe fn multiplyAddWords(left: simd<i16, 8>, right: simd<i16, 8>) -> simd<i32, 4> {
return Intrinsic.x86MultiplyAddWords<simd<i16, 8>>(left, right)
}
pub fn main() -> i32 {
let left = Intrinsic.simdSplat<simd<i16, 8>>(1)
let right = Intrinsic.simdSplat<simd<i16, 8>>(1)
let result = unsafe multiplyAddWords(left, right)
drop result
return 0
}Intrinsic.x86PackUnsignedSaturate#
fn x86PackUnsignedSaturate<V>(left: V, right: V) -> Rpackuswb and packusdw: both operands narrowed to half-width unsigned lanes with saturation, left first within each 128-bit half.
Shapes, with the x86_64 feature each needs:
simd<i16, 8>,simd<i16, 8>tosimd<u8, 16>withsse2;simd<i16, 16>,simd<i16, 16>tosimd<u8, 32>withavx2;simd<i32, 4>,simd<i32, 4>tosimd<u16, 8>withsse4.1.Vis the first operand's type and selects the shape; the other operand and result types follow from it, as listed.Wrappers:
packUnsigned16,packUnsigned16x256,packUnsigned32insilk/simd/x86, which fall back to portable code where the feature is missing.
@features("sse2")
unsafe fn packUnsignedSaturate(left: simd<i16, 8>, right: simd<i16, 8>) -> simd<u8, 16> {
return Intrinsic.x86PackUnsignedSaturate<simd<i16, 8>>(left, right)
}
pub fn main() -> i32 {
let left = Intrinsic.simdSplat<simd<i16, 8>>(1)
let right = Intrinsic.simdSplat<simd<i16, 8>>(1)
let result = unsafe packUnsignedSaturate(left, right)
drop result
return 0
}Intrinsic.x86PackSignedSaturate#
fn x86PackSignedSaturate<V>(left: V, right: V) -> Rpacksswb and packssdw: both operands narrowed to half-width signed lanes with saturation.
Shapes, with the x86_64 feature each needs:
simd<i16, 8>,simd<i16, 8>tosimd<i8, 16>withsse2;simd<i32, 4>,simd<i32, 4>tosimd<i16, 8>withsse2.Vis the first operand's type and selects the shape; the other operand and result types follow from it, as listed.Wrappers:
packSigned16,packSigned32insilk/simd/x86, which fall back to portable code where the feature is missing.
@features("sse2")
unsafe fn packSignedSaturate(left: simd<i16, 8>, right: simd<i16, 8>) -> simd<i8, 16> {
return Intrinsic.x86PackSignedSaturate<simd<i16, 8>>(left, right)
}
pub fn main() -> i32 {
let left = Intrinsic.simdSplat<simd<i16, 8>>(1)
let right = Intrinsic.simdSplat<simd<i16, 8>>(1)
let result = unsafe packSignedSaturate(left, right)
drop result
return 0
}Intrinsic.x86SumAbsoluteDifferences#
fn x86SumAbsoluteDifferences<V>(left: V, right: V) -> Rpsadbw: the sum of absolute byte differences of each 8-byte group.
Shapes, with the x86_64 feature each needs:
simd<u8, 16>,simd<u8, 16>tosimd<u64, 2>withsse2;simd<u8, 32>,simd<u8, 32>tosimd<u64, 4>withavx2.Vis the first operand's type and selects the shape; the other operand and result types follow from it, as listed.Wrappers:
sumAbsoluteDifferences,sumAbsoluteDifferences256insilk/simd/x86, which fall back to portable code where the feature is missing.
@features("sse2")
unsafe fn sumAbsoluteDifferences(left: simd<u8, 16>, right: simd<u8, 16>) -> simd<u64, 2> {
return Intrinsic.x86SumAbsoluteDifferences<simd<u8, 16>>(left, right)
}
pub fn main() -> i32 {
let left = Intrinsic.simdSplat<simd<u8, 16>>(1)
let right = Intrinsic.simdSplat<simd<u8, 16>>(1)
let result = unsafe sumAbsoluteDifferences(left, right)
drop result
return 0
}Intrinsic.aarch64TableLookup#
fn aarch64TableLookup<V>(table: V, indices: V) -> Vtbl: lane i is table[indices[i]], or zero when indices[i] is 16 or more.
Shapes, with the aarch64 feature each needs:
simd<u8, 16>,simd<u8, 16>tosimd<u8, 16>withneon.Wrapper:
tableLookupinsilk/simd/aarch64, which fall back to portable code where the feature is missing.
@features("neon")
unsafe fn tableLookup(table: simd<u8, 16>, indices: simd<u8, 16>) -> simd<u8, 16> {
return Intrinsic.aarch64TableLookup<simd<u8, 16>>(table, indices)
}
pub fn main() -> i32 {
let table = Intrinsic.simdSplat<simd<u8, 16>>(1)
let indices = Intrinsic.simdSplat<simd<u8, 16>>(1)
let result = unsafe tableLookup(table, indices)
drop result
return 0
}Intrinsic.aarch64DotProduct#
fn aarch64DotProduct<V>(sum: V, left: W, right: W) -> Vudot and sdot: each 32-bit lane of sum plus the dot product of its four byte lanes of left and right.
Shapes, with the aarch64 feature each needs:
simd<u32, 4>,simd<u8, 16>,simd<u8, 16>tosimd<u32, 4>withdotprod;simd<i32, 4>,simd<i8, 16>,simd<i8, 16>tosimd<i32, 4>withdotprod.Vis the first operand's type and selects the shape; the other operand and result types follow from it, as listed.Wrappers:
dotProduct,dotProductSignedinsilk/simd/aarch64, which fall back to portable code where the feature is missing.
@features("dotprod")
unsafe fn dotProduct(sum: simd<u32, 4>, left: simd<u8, 16>, right: simd<u8, 16>) -> simd<u32, 4> {
return Intrinsic.aarch64DotProduct<simd<u32, 4>>(sum, left, right)
}
pub fn main() -> i32 {
let sum = Intrinsic.simdSplat<simd<u32, 4>>(1)
let left = Intrinsic.simdSplat<simd<u8, 16>>(1)
let right = Intrinsic.simdSplat<simd<u8, 16>>(1)
let result = unsafe dotProduct(sum, left, right)
drop result
return 0
}Intrinsic.aarch64PairwiseAdd#
fn aarch64PairwiseAdd<V>(left: V, right: V) -> Vaddp: sums of adjacent lane pairs of left, then of right, wrapping.
Shapes, with the aarch64 feature each needs:
simd<u8, 16>,simd<u8, 16>tosimd<u8, 16>withneon;simd<u16, 8>,simd<u16, 8>tosimd<u16, 8>withneon;simd<u32, 4>,simd<u32, 4>tosimd<u32, 4>withneon.Wrappers:
pairwiseAdd8,pairwiseAdd16,pairwiseAdd32insilk/simd/aarch64, which fall back to portable code where the feature is missing.
@features("neon")
unsafe fn pairwiseAdd(left: simd<u8, 16>, right: simd<u8, 16>) -> simd<u8, 16> {
return Intrinsic.aarch64PairwiseAdd<simd<u8, 16>>(left, right)
}
pub fn main() -> i32 {
let left = Intrinsic.simdSplat<simd<u8, 16>>(1)
let right = Intrinsic.simdSplat<simd<u8, 16>>(1)
let result = unsafe pairwiseAdd(left, right)
drop result
return 0
}Intrinsic.wasmSwizzle#
fn wasmSwizzle<V>(table: V, indices: V) -> Vi8x16.swizzle: lane i is table[indices[i]], or zero when indices[i] is 16 or more.
Shapes, with the wasm32 feature each needs:
simd<u8, 16>,simd<u8, 16>tosimd<u8, 16>withsimd128.Wrapper:
swizzleinsilk/simd/wasm, which fall back to portable code where the feature is missing.
@features("simd128")
unsafe fn swizzle(table: simd<u8, 16>, indices: simd<u8, 16>) -> simd<u8, 16> {
return Intrinsic.wasmSwizzle<simd<u8, 16>>(table, indices)
}
pub fn main() -> i32 {
let table = Intrinsic.simdSplat<simd<u8, 16>>(1)
let indices = Intrinsic.simdSplat<simd<u8, 16>>(1)
let result = unsafe swizzle(table, indices)
drop result
return 0
}Intrinsic.wasmRelaxedSwizzle#
fn wasmRelaxedSwizzle<V>(table: V, indices: V) -> Vi8x16.relaxed_swizzle: as wasmSwizzle for indices below 16; other lanes are unspecified.
Shapes, with the wasm32 feature each needs:
simd<u8, 16>,simd<u8, 16>tosimd<u8, 16>withrelaxed-simd.Wrapper:
relaxedSwizzleinsilk/simd/wasm, which fall back to portable code where the feature is missing.
@features("relaxed-simd")
unsafe fn relaxedSwizzle(table: simd<u8, 16>, indices: simd<u8, 16>) -> simd<u8, 16> {
return Intrinsic.wasmRelaxedSwizzle<simd<u8, 16>>(table, indices)
}
pub fn main() -> i32 {
let table = Intrinsic.simdSplat<simd<u8, 16>>(1)
let indices = Intrinsic.simdSplat<simd<u8, 16>>(1)
let result = unsafe relaxedSwizzle(table, indices)
drop result
return 0
}Intrinsic.wasmDot#
fn wasmDot<V>(left: V, right: V) -> Ri32x4.dot_i16x8_s: signed 16-bit products, adjacent pairs summed into 32-bit lanes.
Shapes, with the wasm32 feature each needs:
simd<i16, 8>,simd<i16, 8>tosimd<i32, 4>withsimd128.Vis the first operand's type and selects the shape; the other operand and result types follow from it, as listed.Wrapper:
dotinsilk/simd/wasm, which fall back to portable code where the feature is missing.
@features("simd128")
unsafe fn dot(left: simd<i16, 8>, right: simd<i16, 8>) -> simd<i32, 4> {
return Intrinsic.wasmDot<simd<i16, 8>>(left, right)
}
pub fn main() -> i32 {
let left = Intrinsic.simdSplat<simd<i16, 8>>(1)
let right = Intrinsic.simdSplat<simd<i16, 8>>(1)
let result = unsafe dot(left, right)
drop result
return 0
}Intrinsic.wasmNarrowUnsigned#
fn wasmNarrowUnsigned<V>(left: V, right: V) -> Ri8x16.narrow_i16x8_u: both operands narrowed to unsigned bytes with saturation, left first.
Shapes, with the wasm32 feature each needs:
simd<i16, 8>,simd<i16, 8>tosimd<u8, 16>withsimd128.Vis the first operand's type and selects the shape; the other operand and result types follow from it, as listed.Wrapper:
narrowUnsignedinsilk/simd/wasm, which fall back to portable code where the feature is missing.
@features("simd128")
unsafe fn narrowUnsigned(left: simd<i16, 8>, right: simd<i16, 8>) -> simd<u8, 16> {
return Intrinsic.wasmNarrowUnsigned<simd<i16, 8>>(left, right)
}
pub fn main() -> i32 {
let left = Intrinsic.simdSplat<simd<i16, 8>>(1)
let right = Intrinsic.simdSplat<simd<i16, 8>>(1)
let result = unsafe narrowUnsigned(left, right)
drop result
return 0
}Intrinsic.wasmNarrowSigned#
fn wasmNarrowSigned<V>(left: V, right: V) -> Ri8x16.narrow_i16x8_s: both operands narrowed to signed bytes with saturation, left first.
Shapes, with the wasm32 feature each needs:
simd<i16, 8>,simd<i16, 8>tosimd<i8, 16>withsimd128.Vis the first operand's type and selects the shape; the other operand and result types follow from it, as listed.Wrapper:
narrowSignedinsilk/simd/wasm, which fall back to portable code where the feature is missing.
@features("simd128")
unsafe fn narrowSigned(left: simd<i16, 8>, right: simd<i16, 8>) -> simd<i8, 16> {
return Intrinsic.wasmNarrowSigned<simd<i16, 8>>(left, right)
}
pub fn main() -> i32 {
let left = Intrinsic.simdSplat<simd<i16, 8>>(1)
let right = Intrinsic.simdSplat<simd<i16, 8>>(1)
let result = unsafe narrowSigned(left, right)
drop result
return 0
}Intrinsic.x86AesEncrypt#
fn x86AesEncrypt<V>(state: V, key: V) -> Vaesenc: one AES encryption round of state with the round key key: ShiftRows, SubBytes and MixColumns, then the key added.
Shapes, with the x86_64 feature each needs:
simd<u64, 2>,simd<u64, 2>tosimd<u64, 2>withaes.Wrapper:
aesEncryptinsilk/simd/x86, which fall back to portable code where the feature is missing.
@features("aes")
unsafe fn aesEncrypt(state: simd<u64, 2>, key: simd<u64, 2>) -> simd<u64, 2> {
return Intrinsic.x86AesEncrypt<simd<u64, 2>>(state, key)
}
pub fn main() -> i32 {
let state = Intrinsic.simdSplat<simd<u64, 2>>(1)
let key = Intrinsic.simdSplat<simd<u64, 2>>(1)
let result = unsafe aesEncrypt(state, key)
drop result
return 0
}Intrinsic.x86AesEncryptLast#
fn x86AesEncryptLast<V>(state: V, key: V) -> Vaesenclast: the last AES encryption round, which skips MixColumns.
Shapes, with the x86_64 feature each needs:
simd<u64, 2>,simd<u64, 2>tosimd<u64, 2>withaes.Wrapper:
aesEncryptLastinsilk/simd/x86, which fall back to portable code where the feature is missing.
@features("aes")
unsafe fn aesEncryptLast(state: simd<u64, 2>, key: simd<u64, 2>) -> simd<u64, 2> {
return Intrinsic.x86AesEncryptLast<simd<u64, 2>>(state, key)
}
pub fn main() -> i32 {
let state = Intrinsic.simdSplat<simd<u64, 2>>(1)
let key = Intrinsic.simdSplat<simd<u64, 2>>(1)
let result = unsafe aesEncryptLast(state, key)
drop result
return 0
}Intrinsic.x86AesDecrypt#
fn x86AesDecrypt<V>(state: V, key: V) -> Vaesdec: one AES decryption round of the equivalent inverse cipher: InvShiftRows, InvSubBytes and InvMixColumns, then the key added.
Shapes, with the x86_64 feature each needs:
simd<u64, 2>,simd<u64, 2>tosimd<u64, 2>withaes.Wrapper:
aesDecryptinsilk/simd/x86, which fall back to portable code where the feature is missing.
@features("aes")
unsafe fn aesDecrypt(state: simd<u64, 2>, key: simd<u64, 2>) -> simd<u64, 2> {
return Intrinsic.x86AesDecrypt<simd<u64, 2>>(state, key)
}
pub fn main() -> i32 {
let state = Intrinsic.simdSplat<simd<u64, 2>>(1)
let key = Intrinsic.simdSplat<simd<u64, 2>>(1)
let result = unsafe aesDecrypt(state, key)
drop result
return 0
}Intrinsic.x86AesDecryptLast#
fn x86AesDecryptLast<V>(state: V, key: V) -> Vaesdeclast: the last AES decryption round, which skips InvMixColumns.
Shapes, with the x86_64 feature each needs:
simd<u64, 2>,simd<u64, 2>tosimd<u64, 2>withaes.Wrapper:
aesDecryptLastinsilk/simd/x86, which fall back to portable code where the feature is missing.
@features("aes")
unsafe fn aesDecryptLast(state: simd<u64, 2>, key: simd<u64, 2>) -> simd<u64, 2> {
return Intrinsic.x86AesDecryptLast<simd<u64, 2>>(state, key)
}
pub fn main() -> i32 {
let state = Intrinsic.simdSplat<simd<u64, 2>>(1)
let key = Intrinsic.simdSplat<simd<u64, 2>>(1)
let result = unsafe aesDecryptLast(state, key)
drop result
return 0
}Intrinsic.x86AesInverseMixColumns#
fn x86AesInverseMixColumns<V>(key: V) -> Vaesimc: InvMixColumns of one round key, for the decryption key schedule.
Shapes, with the x86_64 feature each needs:
simd<u64, 2>tosimd<u64, 2>withaes.Wrapper:
aesInverseMixColumnsinsilk/simd/x86, which fall back to portable code where the feature is missing.
@features("aes")
unsafe fn aesInverseMixColumns(key: simd<u64, 2>) -> simd<u64, 2> {
return Intrinsic.x86AesInverseMixColumns<simd<u64, 2>>(key)
}
pub fn main() -> i32 {
let key = Intrinsic.simdSplat<simd<u64, 2>>(1)
let result = unsafe aesInverseMixColumns(key)
drop result
return 0
}Intrinsic.x86CarrylessMultiply#
fn x86CarrylessMultiply<V>(left: V, right: V) -> Vpclmulqdq with selector 0: the 128-bit carry-less product of lane 0 of left and lane 0 of right, low half in lane 0.
Shapes, with the x86_64 feature each needs:
simd<u64, 2>,simd<u64, 2>tosimd<u64, 2>withpclmul.Wrapper:
carrylessMultiplyinsilk/simd/x86, which fall back to portable code where the feature is missing.
@features("pclmul")
unsafe fn carrylessMultiply(left: simd<u64, 2>, right: simd<u64, 2>) -> simd<u64, 2> {
return Intrinsic.x86CarrylessMultiply<simd<u64, 2>>(left, right)
}
pub fn main() -> i32 {
let left = Intrinsic.simdSplat<simd<u64, 2>>(1)
let right = Intrinsic.simdSplat<simd<u64, 2>>(1)
let result = unsafe carrylessMultiply(left, right)
drop result
return 0
}Intrinsic.aarch64AesEncrypt#
fn aarch64AesEncrypt<V>(state: V, key: V) -> Vaese: the key added to state, then ShiftRows and SubBytes.
Shapes, with the aarch64 feature each needs:
simd<u8, 16>,simd<u8, 16>tosimd<u8, 16>withaes.Wrapper:
aesEncryptinsilk/simd/aarch64, which fall back to portable code where the feature is missing.
@features("aes")
unsafe fn aesEncrypt(state: simd<u8, 16>, key: simd<u8, 16>) -> simd<u8, 16> {
return Intrinsic.aarch64AesEncrypt<simd<u8, 16>>(state, key)
}
pub fn main() -> i32 {
let state = Intrinsic.simdSplat<simd<u8, 16>>(1)
let key = Intrinsic.simdSplat<simd<u8, 16>>(1)
let result = unsafe aesEncrypt(state, key)
drop result
return 0
}Intrinsic.aarch64AesDecrypt#
fn aarch64AesDecrypt<V>(state: V, key: V) -> Vaesd: the key added to state, then InvShiftRows and InvSubBytes.
Shapes, with the aarch64 feature each needs:
simd<u8, 16>,simd<u8, 16>tosimd<u8, 16>withaes.Wrapper:
aesDecryptinsilk/simd/aarch64, which fall back to portable code where the feature is missing.
@features("aes")
unsafe fn aesDecrypt(state: simd<u8, 16>, key: simd<u8, 16>) -> simd<u8, 16> {
return Intrinsic.aarch64AesDecrypt<simd<u8, 16>>(state, key)
}
pub fn main() -> i32 {
let state = Intrinsic.simdSplat<simd<u8, 16>>(1)
let key = Intrinsic.simdSplat<simd<u8, 16>>(1)
let result = unsafe aesDecrypt(state, key)
drop result
return 0
}Intrinsic.aarch64AesMixColumns#
fn aarch64AesMixColumns<V>(state: V) -> Vaesmc: AES MixColumns.
Shapes, with the aarch64 feature each needs:
simd<u8, 16>tosimd<u8, 16>withaes.Wrapper:
aesMixColumnsinsilk/simd/aarch64, which fall back to portable code where the feature is missing.
@features("aes")
unsafe fn aesMixColumns(state: simd<u8, 16>) -> simd<u8, 16> {
return Intrinsic.aarch64AesMixColumns<simd<u8, 16>>(state)
}
pub fn main() -> i32 {
let state = Intrinsic.simdSplat<simd<u8, 16>>(1)
let result = unsafe aesMixColumns(state)
drop result
return 0
}Intrinsic.aarch64AesInverseMixColumns#
fn aarch64AesInverseMixColumns<V>(state: V) -> Vaesimc: AES InvMixColumns.
Shapes, with the aarch64 feature each needs:
simd<u8, 16>tosimd<u8, 16>withaes.Wrapper:
aesInverseMixColumnsinsilk/simd/aarch64, which fall back to portable code where the feature is missing.
@features("aes")
unsafe fn aesInverseMixColumns(state: simd<u8, 16>) -> simd<u8, 16> {
return Intrinsic.aarch64AesInverseMixColumns<simd<u8, 16>>(state)
}
pub fn main() -> i32 {
let state = Intrinsic.simdSplat<simd<u8, 16>>(1)
let result = unsafe aesInverseMixColumns(state)
drop result
return 0
}Intrinsic.aarch64PolynomialMultiply#
fn aarch64PolynomialMultiply<V>(left: V, right: V) -> Vpmull: the 128-bit carry-less product of lane 0 of left and lane 0 of right, low half in lane 0.
Shapes, with the aarch64 feature each needs:
simd<u64, 2>,simd<u64, 2>tosimd<u64, 2>withaes.Wrapper:
polynomialMultiplyinsilk/simd/aarch64, which fall back to portable code where the feature is missing.
@features("aes")
unsafe fn polynomialMultiply(left: simd<u64, 2>, right: simd<u64, 2>) -> simd<u64, 2> {
return Intrinsic.aarch64PolynomialMultiply<simd<u64, 2>>(left, right)
}
pub fn main() -> i32 {
let left = Intrinsic.simdSplat<simd<u64, 2>>(1)
let right = Intrinsic.simdSplat<simd<u64, 2>>(1)
let result = unsafe polynomialMultiply(left, right)
drop result
return 0
}Intrinsic.aarch64PolynomialMultiplyHigh#
fn aarch64PolynomialMultiplyHigh<V>(left: V, right: V) -> Vpmull2: the 128-bit carry-less product of lane 1 of left and lane 1 of right, low half in lane 0.
Shapes, with the aarch64 feature each needs:
simd<u64, 2>,simd<u64, 2>tosimd<u64, 2>withaes.Wrapper:
polynomialMultiplyHighinsilk/simd/aarch64, which fall back to portable code where the feature is missing.
@features("aes")
unsafe fn polynomialMultiplyHigh(left: simd<u64, 2>, right: simd<u64, 2>) -> simd<u64, 2> {
return Intrinsic.aarch64PolynomialMultiplyHigh<simd<u64, 2>>(left, right)
}
pub fn main() -> i32 {
let left = Intrinsic.simdSplat<simd<u64, 2>>(1)
let right = Intrinsic.simdSplat<simd<u64, 2>>(1)
let result = unsafe polynomialMultiplyHigh(left, right)
drop result
return 0
}Intrinsic.x86Sha256Rounds2#
fn x86Sha256Rounds2<V>(cdgh: V, abef: V, wk: V) -> Vsha256rnds2: two SHA-256 rounds. cdgh holds C, D, G and H in lanes 3, 2, 1 and 0, abef holds A, B, E and F the same way, and lanes 0 and 1 of wk are the two message words plus round constants; the result is the new A, B, E and F.
Shapes, with the x86_64 feature each needs:
simd<u32, 4>,simd<u32, 4>,simd<u32, 4>tosimd<u32, 4>withsha.Wrapper:
sha256Rounds2insilk/simd/x86, which fall back to portable code where the feature is missing.
@features("sha")
unsafe fn sha256Rounds2(cdgh: simd<u32, 4>, abef: simd<u32, 4>, wk: simd<u32, 4>) -> simd<u32, 4> {
return Intrinsic.x86Sha256Rounds2<simd<u32, 4>>(cdgh, abef, wk)
}
pub fn main() -> i32 {
let cdgh = Intrinsic.simdSplat<simd<u32, 4>>(1)
let abef = Intrinsic.simdSplat<simd<u32, 4>>(1)
let wk = Intrinsic.simdSplat<simd<u32, 4>>(1)
let result = unsafe sha256Rounds2(cdgh, abef, wk)
drop result
return 0
}Intrinsic.x86Sha256Message1#
fn x86Sha256Message1<V>(left: V, right: V) -> Vsha256msg1: the first step of four SHA-256 message words: lane i is W[i] + sigma0(W[i + 1]) over the eight lanes of left then right.
Shapes, with the x86_64 feature each needs:
simd<u32, 4>,simd<u32, 4>tosimd<u32, 4>withsha.Wrapper:
sha256Message1insilk/simd/x86, which fall back to portable code where the feature is missing.
@features("sha")
unsafe fn sha256Message1(left: simd<u32, 4>, right: simd<u32, 4>) -> simd<u32, 4> {
return Intrinsic.x86Sha256Message1<simd<u32, 4>>(left, right)
}
pub fn main() -> i32 {
let left = Intrinsic.simdSplat<simd<u32, 4>>(1)
let right = Intrinsic.simdSplat<simd<u32, 4>>(1)
let result = unsafe sha256Message1(left, right)
drop result
return 0
}Intrinsic.x86Sha256Message2#
fn x86Sha256Message2<V>(left: V, right: V) -> Vsha256msg2: the last step of four SHA-256 message words: lane i of left plus sigma1 of the word two before it, taken from lanes 2 and 3 of right and then from the result.
Shapes, with the x86_64 feature each needs:
simd<u32, 4>,simd<u32, 4>tosimd<u32, 4>withsha.Wrapper:
sha256Message2insilk/simd/x86, which fall back to portable code where the feature is missing.
@features("sha")
unsafe fn sha256Message2(left: simd<u32, 4>, right: simd<u32, 4>) -> simd<u32, 4> {
return Intrinsic.x86Sha256Message2<simd<u32, 4>>(left, right)
}
pub fn main() -> i32 {
let left = Intrinsic.simdSplat<simd<u32, 4>>(1)
let right = Intrinsic.simdSplat<simd<u32, 4>>(1)
let result = unsafe sha256Message2(left, right)
drop result
return 0
}Intrinsic.aarch64Sha256Hash#
fn aarch64Sha256Hash<V>(abcd: V, efgh: V, wk: V) -> Vsha256h: four SHA-256 rounds, returning the new A, B, C and D from abcd, efgh and the four words of wk.
Shapes, with the aarch64 feature each needs:
simd<u32, 4>,simd<u32, 4>,simd<u32, 4>tosimd<u32, 4>withsha2.Wrapper:
sha256Hashinsilk/simd/aarch64, which fall back to portable code where the feature is missing.
@features("sha2")
unsafe fn sha256Hash(abcd: simd<u32, 4>, efgh: simd<u32, 4>, wk: simd<u32, 4>) -> simd<u32, 4> {
return Intrinsic.aarch64Sha256Hash<simd<u32, 4>>(abcd, efgh, wk)
}
pub fn main() -> i32 {
let abcd = Intrinsic.simdSplat<simd<u32, 4>>(1)
let efgh = Intrinsic.simdSplat<simd<u32, 4>>(1)
let wk = Intrinsic.simdSplat<simd<u32, 4>>(1)
let result = unsafe sha256Hash(abcd, efgh, wk)
drop result
return 0
}Intrinsic.aarch64Sha256Hash2#
fn aarch64Sha256Hash2<V>(efgh: V, abcd: V, wk: V) -> Vsha256h2: the same four rounds, returning the new E, F, G and H from efgh, abcd and wk.
Shapes, with the aarch64 feature each needs:
simd<u32, 4>,simd<u32, 4>,simd<u32, 4>tosimd<u32, 4>withsha2.Wrapper:
sha256Hash2insilk/simd/aarch64, which fall back to portable code where the feature is missing.
@features("sha2")
unsafe fn sha256Hash2(efgh: simd<u32, 4>, abcd: simd<u32, 4>, wk: simd<u32, 4>) -> simd<u32, 4> {
return Intrinsic.aarch64Sha256Hash2<simd<u32, 4>>(efgh, abcd, wk)
}
pub fn main() -> i32 {
let efgh = Intrinsic.simdSplat<simd<u32, 4>>(1)
let abcd = Intrinsic.simdSplat<simd<u32, 4>>(1)
let wk = Intrinsic.simdSplat<simd<u32, 4>>(1)
let result = unsafe sha256Hash2(efgh, abcd, wk)
drop result
return 0
}Intrinsic.aarch64Sha256ScheduleUpdate0#
fn aarch64Sha256ScheduleUpdate0<V>(left: V, right: V) -> Vsha256su0: lane i is W[i] + sigma0(W[i + 1]) over the eight lanes of left then right.
Shapes, with the aarch64 feature each needs:
simd<u32, 4>,simd<u32, 4>tosimd<u32, 4>withsha2.Wrapper:
sha256ScheduleUpdate0insilk/simd/aarch64, which fall back to portable code where the feature is missing.
@features("sha2")
unsafe fn sha256ScheduleUpdate0(left: simd<u32, 4>, right: simd<u32, 4>) -> simd<u32, 4> {
return Intrinsic.aarch64Sha256ScheduleUpdate0<simd<u32, 4>>(left, right)
}
pub fn main() -> i32 {
let left = Intrinsic.simdSplat<simd<u32, 4>>(1)
let right = Intrinsic.simdSplat<simd<u32, 4>>(1)
let result = unsafe sha256ScheduleUpdate0(left, right)
drop result
return 0
}Intrinsic.aarch64Sha256ScheduleUpdate1#
fn aarch64Sha256ScheduleUpdate1<V>(partial: V, middle: V, last: V) -> Vsha256su1: the next four message words from the sha256su0 result and the words eight and twelve before them.
Shapes, with the aarch64 feature each needs:
simd<u32, 4>,simd<u32, 4>,simd<u32, 4>tosimd<u32, 4>withsha2.Wrapper:
sha256ScheduleUpdate1insilk/simd/aarch64, which fall back to portable code where the feature is missing.
@features("sha2")
unsafe fn sha256ScheduleUpdate1(partial: simd<u32, 4>, middle: simd<u32, 4>, last: simd<u32, 4>) -> simd<u32, 4> {
return Intrinsic.aarch64Sha256ScheduleUpdate1<simd<u32, 4>>(partial, middle, last)
}
pub fn main() -> i32 {
let partial = Intrinsic.simdSplat<simd<u32, 4>>(1)
let middle = Intrinsic.simdSplat<simd<u32, 4>>(1)
let last = Intrinsic.simdSplat<simd<u32, 4>>(1)
let result = unsafe sha256ScheduleUpdate1(partial, middle, last)
drop result
return 0
}Intrinsic.x86Sha1Rounds4Stage0#
fn x86Sha1Rounds4Stage0<V>(abcd: V, wk: V) -> Vsha1rnds4 with selector 0: four SHA-1 rounds of rounds 0 to 19 (Ch, K = 0x5a827999). abcd holds A, B, C and D in lanes 3 to 0, and wk holds W[t] + E, W[t+1], W[t+2] and W[t+3] the same way; the result is the new A, B, C and D.
Shapes, with the x86_64 feature each needs:
simd<u32, 4>,simd<u32, 4>tosimd<u32, 4>withsha.Wrapper:
sha1Rounds4Stage0insilk/simd/x86, which fall back to portable code where the feature is missing.
@features("sha")
unsafe fn sha1Rounds4Stage0(abcd: simd<u32, 4>, wk: simd<u32, 4>) -> simd<u32, 4> {
return Intrinsic.x86Sha1Rounds4Stage0<simd<u32, 4>>(abcd, wk)
}
pub fn main() -> i32 {
let abcd = Intrinsic.simdSplat<simd<u32, 4>>(1)
let wk = Intrinsic.simdSplat<simd<u32, 4>>(1)
let result = unsafe sha1Rounds4Stage0(abcd, wk)
drop result
return 0
}Intrinsic.x86Sha1Rounds4Stage1#
fn x86Sha1Rounds4Stage1<V>(abcd: V, wk: V) -> Vsha1rnds4 with selector 1: four rounds of rounds 20 to 39 (Parity, K = 0x6ed9eba1).
Shapes, with the x86_64 feature each needs:
simd<u32, 4>,simd<u32, 4>tosimd<u32, 4>withsha.Wrapper:
sha1Rounds4Stage1insilk/simd/x86, which fall back to portable code where the feature is missing.
@features("sha")
unsafe fn sha1Rounds4Stage1(abcd: simd<u32, 4>, wk: simd<u32, 4>) -> simd<u32, 4> {
return Intrinsic.x86Sha1Rounds4Stage1<simd<u32, 4>>(abcd, wk)
}
pub fn main() -> i32 {
let abcd = Intrinsic.simdSplat<simd<u32, 4>>(1)
let wk = Intrinsic.simdSplat<simd<u32, 4>>(1)
let result = unsafe sha1Rounds4Stage1(abcd, wk)
drop result
return 0
}Intrinsic.x86Sha1Rounds4Stage2#
fn x86Sha1Rounds4Stage2<V>(abcd: V, wk: V) -> Vsha1rnds4 with selector 2: four rounds of rounds 40 to 59 (Maj, K = 0x8f1bbcdc).
Shapes, with the x86_64 feature each needs:
simd<u32, 4>,simd<u32, 4>tosimd<u32, 4>withsha.Wrapper:
sha1Rounds4Stage2insilk/simd/x86, which fall back to portable code where the feature is missing.
@features("sha")
unsafe fn sha1Rounds4Stage2(abcd: simd<u32, 4>, wk: simd<u32, 4>) -> simd<u32, 4> {
return Intrinsic.x86Sha1Rounds4Stage2<simd<u32, 4>>(abcd, wk)
}
pub fn main() -> i32 {
let abcd = Intrinsic.simdSplat<simd<u32, 4>>(1)
let wk = Intrinsic.simdSplat<simd<u32, 4>>(1)
let result = unsafe sha1Rounds4Stage2(abcd, wk)
drop result
return 0
}Intrinsic.x86Sha1Rounds4Stage3#
fn x86Sha1Rounds4Stage3<V>(abcd: V, wk: V) -> Vsha1rnds4 with selector 3: four rounds of rounds 60 to 79 (Parity, K = 0xca62c1d6).
Shapes, with the x86_64 feature each needs:
simd<u32, 4>,simd<u32, 4>tosimd<u32, 4>withsha.Wrapper:
sha1Rounds4Stage3insilk/simd/x86, which fall back to portable code where the feature is missing.
@features("sha")
unsafe fn sha1Rounds4Stage3(abcd: simd<u32, 4>, wk: simd<u32, 4>) -> simd<u32, 4> {
return Intrinsic.x86Sha1Rounds4Stage3<simd<u32, 4>>(abcd, wk)
}
pub fn main() -> i32 {
let abcd = Intrinsic.simdSplat<simd<u32, 4>>(1)
let wk = Intrinsic.simdSplat<simd<u32, 4>>(1)
let result = unsafe sha1Rounds4Stage3(abcd, wk)
drop result
return 0
}Intrinsic.x86Sha1NextE#
fn x86Sha1NextE<V>(left: V, right: V) -> Vsha1nexte: lane 3 of right plus A of left (lane 3) rotated left by 30, with lanes 0 to 2 of right: the E of four rounds later added to the next message words.
Shapes, with the x86_64 feature each needs:
simd<u32, 4>,simd<u32, 4>tosimd<u32, 4>withsha.Wrapper:
sha1NextEinsilk/simd/x86, which fall back to portable code where the feature is missing.
@features("sha")
unsafe fn sha1NextE(left: simd<u32, 4>, right: simd<u32, 4>) -> simd<u32, 4> {
return Intrinsic.x86Sha1NextE<simd<u32, 4>>(left, right)
}
pub fn main() -> i32 {
let left = Intrinsic.simdSplat<simd<u32, 4>>(1)
let right = Intrinsic.simdSplat<simd<u32, 4>>(1)
let result = unsafe sha1NextE(left, right)
drop result
return 0
}Intrinsic.x86Sha1Message1#
fn x86Sha1Message1<V>(left: V, right: V) -> Vsha1msg1: with W[0..3] in lanes 3 to 0 of left and W[4], W[5] in lanes 3 and 2 of right, lanes 3 to 0 are W[0]^W[2], W[1]^W[3], W[2]^W[4] and W[3]^W[5].
Shapes, with the x86_64 feature each needs:
simd<u32, 4>,simd<u32, 4>tosimd<u32, 4>withsha.Wrapper:
sha1Message1insilk/simd/x86, which fall back to portable code where the feature is missing.
@features("sha")
unsafe fn sha1Message1(left: simd<u32, 4>, right: simd<u32, 4>) -> simd<u32, 4> {
return Intrinsic.x86Sha1Message1<simd<u32, 4>>(left, right)
}
pub fn main() -> i32 {
let left = Intrinsic.simdSplat<simd<u32, 4>>(1)
let right = Intrinsic.simdSplat<simd<u32, 4>>(1)
let result = unsafe sha1Message1(left, right)
drop result
return 0
}Intrinsic.x86Sha1Message2#
fn x86Sha1Message2<V>(left: V, right: V) -> Vsha1msg2: the next four SHA-1 message words from the partial sums in left and W[13..15] in lanes 2 to 0 of right.
Shapes, with the x86_64 feature each needs:
simd<u32, 4>,simd<u32, 4>tosimd<u32, 4>withsha.Wrapper:
sha1Message2insilk/simd/x86, which fall back to portable code where the feature is missing.
@features("sha")
unsafe fn sha1Message2(left: simd<u32, 4>, right: simd<u32, 4>) -> simd<u32, 4> {
return Intrinsic.x86Sha1Message2<simd<u32, 4>>(left, right)
}
pub fn main() -> i32 {
let left = Intrinsic.simdSplat<simd<u32, 4>>(1)
let right = Intrinsic.simdSplat<simd<u32, 4>>(1)
let result = unsafe sha1Message2(left, right)
drop result
return 0
}