[dev.simd] cmd/compile, simd: change AES op names and add missing size

This CL changed AESEncryptRound and AESDecryptRound to
AESEncryptOneRound and AESDecryptOneRound.

This CL also adds the 512-bit version of some AES instructions.

Change-Id: Ia851a008cce2145b1ff193a89e172862060a725d
Reviewed-on: https://go-review.googlesource.com/c/go/+/721280
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
Junyang Shao 2025-11-17 20:45:30 +00:00
parent 95871e4a00
commit 0978935a99
11 changed files with 197 additions and 38 deletions

View file

@ -178,12 +178,16 @@ func ssaGenSIMDValue(s *ssagen.State, v *ssa.Value) bool {
case ssa.OpAMD64VAESDECLAST128, case ssa.OpAMD64VAESDECLAST128,
ssa.OpAMD64VAESDECLAST256, ssa.OpAMD64VAESDECLAST256,
ssa.OpAMD64VAESDECLAST512,
ssa.OpAMD64VAESDEC128, ssa.OpAMD64VAESDEC128,
ssa.OpAMD64VAESDEC256, ssa.OpAMD64VAESDEC256,
ssa.OpAMD64VAESDEC512,
ssa.OpAMD64VAESENCLAST128, ssa.OpAMD64VAESENCLAST128,
ssa.OpAMD64VAESENCLAST256, ssa.OpAMD64VAESENCLAST256,
ssa.OpAMD64VAESENCLAST512,
ssa.OpAMD64VAESENC128, ssa.OpAMD64VAESENC128,
ssa.OpAMD64VAESENC256, ssa.OpAMD64VAESENC256,
ssa.OpAMD64VAESENC512,
ssa.OpAMD64VADDPS128, ssa.OpAMD64VADDPS128,
ssa.OpAMD64VADDPS256, ssa.OpAMD64VADDPS256,
ssa.OpAMD64VADDPS512, ssa.OpAMD64VADDPS512,

View file

@ -2,12 +2,16 @@
(AESDecryptLastRoundUint8x16 ...) => (VAESDECLAST128 ...) (AESDecryptLastRoundUint8x16 ...) => (VAESDECLAST128 ...)
(AESDecryptLastRoundUint8x32 ...) => (VAESDECLAST256 ...) (AESDecryptLastRoundUint8x32 ...) => (VAESDECLAST256 ...)
(AESDecryptRoundUint8x16 ...) => (VAESDEC128 ...) (AESDecryptLastRoundUint8x64 ...) => (VAESDECLAST512 ...)
(AESDecryptRoundUint8x32 ...) => (VAESDEC256 ...) (AESDecryptOneRoundUint8x16 ...) => (VAESDEC128 ...)
(AESDecryptOneRoundUint8x32 ...) => (VAESDEC256 ...)
(AESDecryptOneRoundUint8x64 ...) => (VAESDEC512 ...)
(AESEncryptLastRoundUint8x16 ...) => (VAESENCLAST128 ...) (AESEncryptLastRoundUint8x16 ...) => (VAESENCLAST128 ...)
(AESEncryptLastRoundUint8x32 ...) => (VAESENCLAST256 ...) (AESEncryptLastRoundUint8x32 ...) => (VAESENCLAST256 ...)
(AESEncryptRoundUint8x16 ...) => (VAESENC128 ...) (AESEncryptLastRoundUint8x64 ...) => (VAESENCLAST512 ...)
(AESEncryptRoundUint8x32 ...) => (VAESENC256 ...) (AESEncryptOneRoundUint8x16 ...) => (VAESENC128 ...)
(AESEncryptOneRoundUint8x32 ...) => (VAESENC256 ...)
(AESEncryptOneRoundUint8x64 ...) => (VAESENC512 ...)
(AESInvMixColumnsUint32x4 ...) => (VAESIMC128 ...) (AESInvMixColumnsUint32x4 ...) => (VAESIMC128 ...)
(AESRoundKeyGenAssistUint32x4 ...) => (VAESKEYGENASSIST128 ...) (AESRoundKeyGenAssistUint32x4 ...) => (VAESKEYGENASSIST128 ...)
(AbsInt8x16 ...) => (VPABSB128 ...) (AbsInt8x16 ...) => (VPABSB128 ...)

View file

@ -28,12 +28,16 @@ func simdAMD64Ops(v11, v21, v2k, vkv, v2kv, v2kk, v31, v3kv, vgpv, vgp, vfpv, vf
{name: "VADDSUBPS256", argLength: 2, reg: v21, asm: "VADDSUBPS", commutative: false, typ: "Vec256", resultInArg0: false}, {name: "VADDSUBPS256", argLength: 2, reg: v21, asm: "VADDSUBPS", commutative: false, typ: "Vec256", resultInArg0: false},
{name: "VAESDEC128", argLength: 2, reg: v21, asm: "VAESDEC", commutative: false, typ: "Vec128", resultInArg0: false}, {name: "VAESDEC128", argLength: 2, reg: v21, asm: "VAESDEC", commutative: false, typ: "Vec128", resultInArg0: false},
{name: "VAESDEC256", argLength: 2, reg: w21, asm: "VAESDEC", commutative: false, typ: "Vec256", resultInArg0: false}, {name: "VAESDEC256", argLength: 2, reg: w21, asm: "VAESDEC", commutative: false, typ: "Vec256", resultInArg0: false},
{name: "VAESDEC512", argLength: 2, reg: w21, asm: "VAESDEC", commutative: false, typ: "Vec512", resultInArg0: false},
{name: "VAESDECLAST128", argLength: 2, reg: v21, asm: "VAESDECLAST", commutative: false, typ: "Vec128", resultInArg0: false}, {name: "VAESDECLAST128", argLength: 2, reg: v21, asm: "VAESDECLAST", commutative: false, typ: "Vec128", resultInArg0: false},
{name: "VAESDECLAST256", argLength: 2, reg: w21, asm: "VAESDECLAST", commutative: false, typ: "Vec256", resultInArg0: false}, {name: "VAESDECLAST256", argLength: 2, reg: w21, asm: "VAESDECLAST", commutative: false, typ: "Vec256", resultInArg0: false},
{name: "VAESDECLAST512", argLength: 2, reg: w21, asm: "VAESDECLAST", commutative: false, typ: "Vec512", resultInArg0: false},
{name: "VAESENC128", argLength: 2, reg: v21, asm: "VAESENC", commutative: false, typ: "Vec128", resultInArg0: false}, {name: "VAESENC128", argLength: 2, reg: v21, asm: "VAESENC", commutative: false, typ: "Vec128", resultInArg0: false},
{name: "VAESENC256", argLength: 2, reg: w21, asm: "VAESENC", commutative: false, typ: "Vec256", resultInArg0: false}, {name: "VAESENC256", argLength: 2, reg: w21, asm: "VAESENC", commutative: false, typ: "Vec256", resultInArg0: false},
{name: "VAESENC512", argLength: 2, reg: w21, asm: "VAESENC", commutative: false, typ: "Vec512", resultInArg0: false},
{name: "VAESENCLAST128", argLength: 2, reg: v21, asm: "VAESENCLAST", commutative: false, typ: "Vec128", resultInArg0: false}, {name: "VAESENCLAST128", argLength: 2, reg: v21, asm: "VAESENCLAST", commutative: false, typ: "Vec128", resultInArg0: false},
{name: "VAESENCLAST256", argLength: 2, reg: w21, asm: "VAESENCLAST", commutative: false, typ: "Vec256", resultInArg0: false}, {name: "VAESENCLAST256", argLength: 2, reg: w21, asm: "VAESENCLAST", commutative: false, typ: "Vec256", resultInArg0: false},
{name: "VAESENCLAST512", argLength: 2, reg: w21, asm: "VAESENCLAST", commutative: false, typ: "Vec512", resultInArg0: false},
{name: "VAESIMC128", argLength: 1, reg: v11, asm: "VAESIMC", commutative: false, typ: "Vec128", resultInArg0: false}, {name: "VAESIMC128", argLength: 1, reg: v11, asm: "VAESIMC", commutative: false, typ: "Vec128", resultInArg0: false},
{name: "VBROADCASTSD256", argLength: 1, reg: v11, asm: "VBROADCASTSD", commutative: false, typ: "Vec256", resultInArg0: false}, {name: "VBROADCASTSD256", argLength: 1, reg: v11, asm: "VBROADCASTSD", commutative: false, typ: "Vec256", resultInArg0: false},
{name: "VBROADCASTSD512", argLength: 1, reg: w11, asm: "VBROADCASTSD", commutative: false, typ: "Vec512", resultInArg0: false}, {name: "VBROADCASTSD512", argLength: 1, reg: w11, asm: "VBROADCASTSD", commutative: false, typ: "Vec512", resultInArg0: false},

View file

@ -6,12 +6,16 @@ func simdGenericOps() []opData {
return []opData{ return []opData{
{name: "AESDecryptLastRoundUint8x16", argLength: 2, commutative: false}, {name: "AESDecryptLastRoundUint8x16", argLength: 2, commutative: false},
{name: "AESDecryptLastRoundUint8x32", argLength: 2, commutative: false}, {name: "AESDecryptLastRoundUint8x32", argLength: 2, commutative: false},
{name: "AESDecryptRoundUint8x16", argLength: 2, commutative: false}, {name: "AESDecryptLastRoundUint8x64", argLength: 2, commutative: false},
{name: "AESDecryptRoundUint8x32", argLength: 2, commutative: false}, {name: "AESDecryptOneRoundUint8x16", argLength: 2, commutative: false},
{name: "AESDecryptOneRoundUint8x32", argLength: 2, commutative: false},
{name: "AESDecryptOneRoundUint8x64", argLength: 2, commutative: false},
{name: "AESEncryptLastRoundUint8x16", argLength: 2, commutative: false}, {name: "AESEncryptLastRoundUint8x16", argLength: 2, commutative: false},
{name: "AESEncryptLastRoundUint8x32", argLength: 2, commutative: false}, {name: "AESEncryptLastRoundUint8x32", argLength: 2, commutative: false},
{name: "AESEncryptRoundUint8x16", argLength: 2, commutative: false}, {name: "AESEncryptLastRoundUint8x64", argLength: 2, commutative: false},
{name: "AESEncryptRoundUint8x32", argLength: 2, commutative: false}, {name: "AESEncryptOneRoundUint8x16", argLength: 2, commutative: false},
{name: "AESEncryptOneRoundUint8x32", argLength: 2, commutative: false},
{name: "AESEncryptOneRoundUint8x64", argLength: 2, commutative: false},
{name: "AESInvMixColumnsUint32x4", argLength: 1, commutative: false}, {name: "AESInvMixColumnsUint32x4", argLength: 1, commutative: false},
{name: "AbsInt8x16", argLength: 1, commutative: false}, {name: "AbsInt8x16", argLength: 1, commutative: false},
{name: "AbsInt8x32", argLength: 1, commutative: false}, {name: "AbsInt8x32", argLength: 1, commutative: false},

View file

@ -1269,12 +1269,16 @@ const (
OpAMD64VADDSUBPS256 OpAMD64VADDSUBPS256
OpAMD64VAESDEC128 OpAMD64VAESDEC128
OpAMD64VAESDEC256 OpAMD64VAESDEC256
OpAMD64VAESDEC512
OpAMD64VAESDECLAST128 OpAMD64VAESDECLAST128
OpAMD64VAESDECLAST256 OpAMD64VAESDECLAST256
OpAMD64VAESDECLAST512
OpAMD64VAESENC128 OpAMD64VAESENC128
OpAMD64VAESENC256 OpAMD64VAESENC256
OpAMD64VAESENC512
OpAMD64VAESENCLAST128 OpAMD64VAESENCLAST128
OpAMD64VAESENCLAST256 OpAMD64VAESENCLAST256
OpAMD64VAESENCLAST512
OpAMD64VAESIMC128 OpAMD64VAESIMC128
OpAMD64VBROADCASTSD256 OpAMD64VBROADCASTSD256
OpAMD64VBROADCASTSD512 OpAMD64VBROADCASTSD512
@ -5950,12 +5954,16 @@ const (
OpIsZeroVec OpIsZeroVec
OpAESDecryptLastRoundUint8x16 OpAESDecryptLastRoundUint8x16
OpAESDecryptLastRoundUint8x32 OpAESDecryptLastRoundUint8x32
OpAESDecryptRoundUint8x16 OpAESDecryptLastRoundUint8x64
OpAESDecryptRoundUint8x32 OpAESDecryptOneRoundUint8x16
OpAESDecryptOneRoundUint8x32
OpAESDecryptOneRoundUint8x64
OpAESEncryptLastRoundUint8x16 OpAESEncryptLastRoundUint8x16
OpAESEncryptLastRoundUint8x32 OpAESEncryptLastRoundUint8x32
OpAESEncryptRoundUint8x16 OpAESEncryptLastRoundUint8x64
OpAESEncryptRoundUint8x32 OpAESEncryptOneRoundUint8x16
OpAESEncryptOneRoundUint8x32
OpAESEncryptOneRoundUint8x64
OpAESInvMixColumnsUint32x4 OpAESInvMixColumnsUint32x4
OpAbsInt8x16 OpAbsInt8x16
OpAbsInt8x32 OpAbsInt8x32
@ -20873,6 +20881,20 @@ var opcodeTable = [...]opInfo{
}, },
}, },
}, },
{
name: "VAESDEC512",
argLen: 2,
asm: x86.AVAESDEC,
reg: regInfo{
inputs: []inputInfo{
{0, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31
{1, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31
},
outputs: []outputInfo{
{0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31
},
},
},
{ {
name: "VAESDECLAST128", name: "VAESDECLAST128",
argLen: 2, argLen: 2,
@ -20901,6 +20923,20 @@ var opcodeTable = [...]opInfo{
}, },
}, },
}, },
{
name: "VAESDECLAST512",
argLen: 2,
asm: x86.AVAESDECLAST,
reg: regInfo{
inputs: []inputInfo{
{0, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31
{1, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31
},
outputs: []outputInfo{
{0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31
},
},
},
{ {
name: "VAESENC128", name: "VAESENC128",
argLen: 2, argLen: 2,
@ -20929,6 +20965,20 @@ var opcodeTable = [...]opInfo{
}, },
}, },
}, },
{
name: "VAESENC512",
argLen: 2,
asm: x86.AVAESENC,
reg: regInfo{
inputs: []inputInfo{
{0, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31
{1, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31
},
outputs: []outputInfo{
{0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31
},
},
},
{ {
name: "VAESENCLAST128", name: "VAESENCLAST128",
argLen: 2, argLen: 2,
@ -20957,6 +21007,20 @@ var opcodeTable = [...]opInfo{
}, },
}, },
}, },
{
name: "VAESENCLAST512",
argLen: 2,
asm: x86.AVAESENCLAST,
reg: regInfo{
inputs: []inputInfo{
{0, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31
{1, 281474976645120}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31
},
outputs: []outputInfo{
{0, 281472829161472}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31
},
},
},
{ {
name: "VAESIMC128", name: "VAESIMC128",
argLen: 1, argLen: 1,
@ -85740,12 +85804,22 @@ var opcodeTable = [...]opInfo{
generic: true, generic: true,
}, },
{ {
name: "AESDecryptRoundUint8x16", name: "AESDecryptLastRoundUint8x64",
argLen: 2, argLen: 2,
generic: true, generic: true,
}, },
{ {
name: "AESDecryptRoundUint8x32", name: "AESDecryptOneRoundUint8x16",
argLen: 2,
generic: true,
},
{
name: "AESDecryptOneRoundUint8x32",
argLen: 2,
generic: true,
},
{
name: "AESDecryptOneRoundUint8x64",
argLen: 2, argLen: 2,
generic: true, generic: true,
}, },
@ -85760,12 +85834,22 @@ var opcodeTable = [...]opInfo{
generic: true, generic: true,
}, },
{ {
name: "AESEncryptRoundUint8x16", name: "AESEncryptLastRoundUint8x64",
argLen: 2, argLen: 2,
generic: true, generic: true,
}, },
{ {
name: "AESEncryptRoundUint8x32", name: "AESEncryptOneRoundUint8x16",
argLen: 2,
generic: true,
},
{
name: "AESEncryptOneRoundUint8x32",
argLen: 2,
generic: true,
},
{
name: "AESEncryptOneRoundUint8x64",
argLen: 2, argLen: 2,
generic: true, generic: true,
}, },

View file

@ -16,24 +16,36 @@ func rewriteValueAMD64(v *Value) bool {
case OpAESDecryptLastRoundUint8x32: case OpAESDecryptLastRoundUint8x32:
v.Op = OpAMD64VAESDECLAST256 v.Op = OpAMD64VAESDECLAST256
return true return true
case OpAESDecryptRoundUint8x16: case OpAESDecryptLastRoundUint8x64:
v.Op = OpAMD64VAESDECLAST512
return true
case OpAESDecryptOneRoundUint8x16:
v.Op = OpAMD64VAESDEC128 v.Op = OpAMD64VAESDEC128
return true return true
case OpAESDecryptRoundUint8x32: case OpAESDecryptOneRoundUint8x32:
v.Op = OpAMD64VAESDEC256 v.Op = OpAMD64VAESDEC256
return true return true
case OpAESDecryptOneRoundUint8x64:
v.Op = OpAMD64VAESDEC512
return true
case OpAESEncryptLastRoundUint8x16: case OpAESEncryptLastRoundUint8x16:
v.Op = OpAMD64VAESENCLAST128 v.Op = OpAMD64VAESENCLAST128
return true return true
case OpAESEncryptLastRoundUint8x32: case OpAESEncryptLastRoundUint8x32:
v.Op = OpAMD64VAESENCLAST256 v.Op = OpAMD64VAESENCLAST256
return true return true
case OpAESEncryptRoundUint8x16: case OpAESEncryptLastRoundUint8x64:
v.Op = OpAMD64VAESENCLAST512
return true
case OpAESEncryptOneRoundUint8x16:
v.Op = OpAMD64VAESENC128 v.Op = OpAMD64VAESENC128
return true return true
case OpAESEncryptRoundUint8x32: case OpAESEncryptOneRoundUint8x32:
v.Op = OpAMD64VAESENC256 v.Op = OpAMD64VAESENC256
return true return true
case OpAESEncryptOneRoundUint8x64:
v.Op = OpAMD64VAESENC512
return true
case OpAESInvMixColumnsUint32x4: case OpAESInvMixColumnsUint32x4:
v.Op = OpAMD64VAESIMC128 v.Op = OpAMD64VAESIMC128
return true return true

View file

@ -14,12 +14,16 @@ const simdPackage = "simd"
func simdIntrinsics(addF func(pkg, fn string, b intrinsicBuilder, archFamilies ...sys.ArchFamily)) { func simdIntrinsics(addF func(pkg, fn string, b intrinsicBuilder, archFamilies ...sys.ArchFamily)) {
addF(simdPackage, "Uint8x16.AESDecryptLastRound", opLen2(ssa.OpAESDecryptLastRoundUint8x16, types.TypeVec128), sys.AMD64) addF(simdPackage, "Uint8x16.AESDecryptLastRound", opLen2(ssa.OpAESDecryptLastRoundUint8x16, types.TypeVec128), sys.AMD64)
addF(simdPackage, "Uint8x32.AESDecryptLastRound", opLen2(ssa.OpAESDecryptLastRoundUint8x32, types.TypeVec256), sys.AMD64) addF(simdPackage, "Uint8x32.AESDecryptLastRound", opLen2(ssa.OpAESDecryptLastRoundUint8x32, types.TypeVec256), sys.AMD64)
addF(simdPackage, "Uint8x16.AESDecryptRound", opLen2(ssa.OpAESDecryptRoundUint8x16, types.TypeVec128), sys.AMD64) addF(simdPackage, "Uint8x64.AESDecryptLastRound", opLen2(ssa.OpAESDecryptLastRoundUint8x64, types.TypeVec512), sys.AMD64)
addF(simdPackage, "Uint8x32.AESDecryptRound", opLen2(ssa.OpAESDecryptRoundUint8x32, types.TypeVec256), sys.AMD64) addF(simdPackage, "Uint8x16.AESDecryptOneRound", opLen2(ssa.OpAESDecryptOneRoundUint8x16, types.TypeVec128), sys.AMD64)
addF(simdPackage, "Uint8x32.AESDecryptOneRound", opLen2(ssa.OpAESDecryptOneRoundUint8x32, types.TypeVec256), sys.AMD64)
addF(simdPackage, "Uint8x64.AESDecryptOneRound", opLen2(ssa.OpAESDecryptOneRoundUint8x64, types.TypeVec512), sys.AMD64)
addF(simdPackage, "Uint8x16.AESEncryptLastRound", opLen2(ssa.OpAESEncryptLastRoundUint8x16, types.TypeVec128), sys.AMD64) addF(simdPackage, "Uint8x16.AESEncryptLastRound", opLen2(ssa.OpAESEncryptLastRoundUint8x16, types.TypeVec128), sys.AMD64)
addF(simdPackage, "Uint8x32.AESEncryptLastRound", opLen2(ssa.OpAESEncryptLastRoundUint8x32, types.TypeVec256), sys.AMD64) addF(simdPackage, "Uint8x32.AESEncryptLastRound", opLen2(ssa.OpAESEncryptLastRoundUint8x32, types.TypeVec256), sys.AMD64)
addF(simdPackage, "Uint8x16.AESEncryptRound", opLen2(ssa.OpAESEncryptRoundUint8x16, types.TypeVec128), sys.AMD64) addF(simdPackage, "Uint8x64.AESEncryptLastRound", opLen2(ssa.OpAESEncryptLastRoundUint8x64, types.TypeVec512), sys.AMD64)
addF(simdPackage, "Uint8x32.AESEncryptRound", opLen2(ssa.OpAESEncryptRoundUint8x32, types.TypeVec256), sys.AMD64) addF(simdPackage, "Uint8x16.AESEncryptOneRound", opLen2(ssa.OpAESEncryptOneRoundUint8x16, types.TypeVec128), sys.AMD64)
addF(simdPackage, "Uint8x32.AESEncryptOneRound", opLen2(ssa.OpAESEncryptOneRoundUint8x32, types.TypeVec256), sys.AMD64)
addF(simdPackage, "Uint8x64.AESEncryptOneRound", opLen2(ssa.OpAESEncryptOneRoundUint8x64, types.TypeVec512), sys.AMD64)
addF(simdPackage, "Uint32x4.AESInvMixColumns", opLen1(ssa.OpAESInvMixColumnsUint32x4, types.TypeVec128), sys.AMD64) addF(simdPackage, "Uint32x4.AESInvMixColumns", opLen1(ssa.OpAESInvMixColumnsUint32x4, types.TypeVec128), sys.AMD64)
addF(simdPackage, "Uint32x4.AESRoundKeyGenAssist", opLen1Imm8(ssa.OpAESRoundKeyGenAssistUint32x4, types.TypeVec128, 0), sys.AMD64) addF(simdPackage, "Uint32x4.AESRoundKeyGenAssist", opLen1Imm8(ssa.OpAESRoundKeyGenAssistUint32x4, types.TypeVec128, 0), sys.AMD64)
addF(simdPackage, "Int8x16.Abs", opLen1(ssa.OpAbsInt8x16, types.TypeVec128), sys.AMD64) addF(simdPackage, "Int8x16.Abs", opLen1(ssa.OpAbsInt8x16, types.TypeVec128), sys.AMD64)

View file

@ -3,7 +3,7 @@
commutative: false commutative: false
documentation: !string |- documentation: !string |-
// NAME counts the leading zeros of each element in x. // NAME counts the leading zeros of each element in x.
- go: AESEncryptRound - go: AESEncryptOneRound
commutative: false commutative: false
documentation: !string |- documentation: !string |-
// NAME performs a series of operations in AES cipher algorithm defined in FIPS 197. // NAME performs a series of operations in AES cipher algorithm defined in FIPS 197.
@ -27,7 +27,7 @@
// result[1] = SubWord(x[1]) // result[1] = SubWord(x[1])
// result[2] = XOR(SubWord(RotWord(x[2])), r) // result[2] = XOR(SubWord(RotWord(x[2])), r)
// result[3] = SubWord(x[3]) // result[3] = SubWord(x[3])
- go: AESDecryptRound - go: AESDecryptOneRound
commutative: false commutative: false
documentation: !string |- documentation: !string |-
// NAME performs a series of operations in AES cipher algorithm defined in FIPS 197. // NAME performs a series of operations in AES cipher algorithm defined in FIPS 197.

View file

@ -6,7 +6,7 @@
go: $t go: $t
out: out:
- *any - *any
- go: AESEncryptRound - go: AESEncryptOneRound
asm: VAESENC asm: VAESENC
in: in:
- &uint8s - &uint8s
@ -33,7 +33,7 @@
name: rconVal name: rconVal
out: out:
- *uint32s - *uint32s
- go: AESDecryptRound - go: AESDecryptOneRound
asm: VAESDEC asm: VAESDEC
in: in:
- *uint8s - *uint8s

View file

@ -83,6 +83,17 @@ in: !repeat
- {class: vreg, go: Int64x4, base: "int", elemBits: 128, bits: 256, lanes: 4} - {class: vreg, go: Int64x4, base: "int", elemBits: 128, bits: 256, lanes: 4}
- {class: vreg, go: Uint64x4, base: "uint", elemBits: 128, bits: 256, lanes: 4} - {class: vreg, go: Uint64x4, base: "uint", elemBits: 128, bits: 256, lanes: 4}
# Special shapes just to make VAES(ENC|DEC)(LAST)?512 work.
# The elemBits field of these shapes are wrong, it would be overwritten by overwriteElemBits.
- {class: vreg, go: Int8x32, base: "int", elemBits: 128, bits: 512, lanes: 32}
- {class: vreg, go: Uint8x32, base: "uint", elemBits: 128, bits: 512, lanes: 32}
- {class: vreg, go: Int16x16, base: "int", elemBits: 128, bits: 512, lanes: 16}
- {class: vreg, go: Uint16x16, base: "uint", elemBits: 128, bits: 512, lanes: 16}
- {class: vreg, go: Int32x8, base: "int", elemBits: 128, bits: 512, lanes: 8}
- {class: vreg, go: Uint32x8, base: "uint", elemBits: 128, bits: 512, lanes: 8}
- {class: vreg, go: Int64x4, base: "int", elemBits: 128, bits: 512, lanes: 4}
- {class: vreg, go: Uint64x4, base: "uint", elemBits: 128, bits: 512, lanes: 4}
- {class: immediate, go: Immediate} # TODO: we only support imms that are not used as value -- usually as instruction semantic predicate like VPCMP as of now. - {class: immediate, go: Immediate} # TODO: we only support imms that are not used as value -- usually as instruction semantic predicate like VPCMP as of now.
inVariant: !repeat inVariant: !repeat
- *types - *types

View file

@ -22,23 +22,39 @@ func (x Uint8x16) AESDecryptLastRound(y Uint32x4) Uint8x16
// Asm: VAESDECLAST, CPU Feature: AVX512VAES // Asm: VAESDECLAST, CPU Feature: AVX512VAES
func (x Uint8x32) AESDecryptLastRound(y Uint32x8) Uint8x32 func (x Uint8x32) AESDecryptLastRound(y Uint32x8) Uint8x32
/* AESDecryptRound */ // AESDecryptLastRound performs a series of operations in AES cipher algorithm defined in FIPS 197.
// x is the state array, starting from low index to high are s00, s10, s20, s30, s01, ..., s33.
// y is the chunk of dw array in use.
// result = AddRoundKey(InvShiftRows(InvSubBytes(x)), y)
//
// Asm: VAESDECLAST, CPU Feature: AVX512VAES
func (x Uint8x64) AESDecryptLastRound(y Uint32x16) Uint8x64
// AESDecryptRound performs a series of operations in AES cipher algorithm defined in FIPS 197. /* AESDecryptOneRound */
// AESDecryptOneRound performs a series of operations in AES cipher algorithm defined in FIPS 197.
// x is the state array, starting from low index to high are s00, s10, s20, s30, s01, ..., s33. // x is the state array, starting from low index to high are s00, s10, s20, s30, s01, ..., s33.
// y is the chunk of dw array in use. // y is the chunk of dw array in use.
// result = AddRoundKey(InvMixColumns(InvShiftRows(InvSubBytes(x))), y) // result = AddRoundKey(InvMixColumns(InvShiftRows(InvSubBytes(x))), y)
// //
// Asm: VAESDEC, CPU Feature: AVX, AES // Asm: VAESDEC, CPU Feature: AVX, AES
func (x Uint8x16) AESDecryptRound(y Uint32x4) Uint8x16 func (x Uint8x16) AESDecryptOneRound(y Uint32x4) Uint8x16
// AESDecryptRound performs a series of operations in AES cipher algorithm defined in FIPS 197. // AESDecryptOneRound performs a series of operations in AES cipher algorithm defined in FIPS 197.
// x is the state array, starting from low index to high are s00, s10, s20, s30, s01, ..., s33. // x is the state array, starting from low index to high are s00, s10, s20, s30, s01, ..., s33.
// y is the chunk of dw array in use. // y is the chunk of dw array in use.
// result = AddRoundKey(InvMixColumns(InvShiftRows(InvSubBytes(x))), y) // result = AddRoundKey(InvMixColumns(InvShiftRows(InvSubBytes(x))), y)
// //
// Asm: VAESDEC, CPU Feature: AVX512VAES // Asm: VAESDEC, CPU Feature: AVX512VAES
func (x Uint8x32) AESDecryptRound(y Uint32x8) Uint8x32 func (x Uint8x32) AESDecryptOneRound(y Uint32x8) Uint8x32
// AESDecryptOneRound performs a series of operations in AES cipher algorithm defined in FIPS 197.
// x is the state array, starting from low index to high are s00, s10, s20, s30, s01, ..., s33.
// y is the chunk of dw array in use.
// result = AddRoundKey(InvMixColumns(InvShiftRows(InvSubBytes(x))), y)
//
// Asm: VAESDEC, CPU Feature: AVX512VAES
func (x Uint8x64) AESDecryptOneRound(y Uint32x16) Uint8x64
/* AESEncryptLastRound */ /* AESEncryptLastRound */
@ -58,23 +74,39 @@ func (x Uint8x16) AESEncryptLastRound(y Uint32x4) Uint8x16
// Asm: VAESENCLAST, CPU Feature: AVX512VAES // Asm: VAESENCLAST, CPU Feature: AVX512VAES
func (x Uint8x32) AESEncryptLastRound(y Uint32x8) Uint8x32 func (x Uint8x32) AESEncryptLastRound(y Uint32x8) Uint8x32
/* AESEncryptRound */ // AESEncryptLastRound performs a series of operations in AES cipher algorithm defined in FIPS 197.
// x is the state array, starting from low index to high are s00, s10, s20, s30, s01, ..., s33.
// y is the chunk of w array in use.
// result = AddRoundKey((ShiftRows(SubBytes(x))), y)
//
// Asm: VAESENCLAST, CPU Feature: AVX512VAES
func (x Uint8x64) AESEncryptLastRound(y Uint32x16) Uint8x64
// AESEncryptRound performs a series of operations in AES cipher algorithm defined in FIPS 197. /* AESEncryptOneRound */
// AESEncryptOneRound performs a series of operations in AES cipher algorithm defined in FIPS 197.
// x is the state array, starting from low index to high are s00, s10, s20, s30, s01, ..., s33. // x is the state array, starting from low index to high are s00, s10, s20, s30, s01, ..., s33.
// y is the chunk of w array in use. // y is the chunk of w array in use.
// result = AddRoundKey(MixColumns(ShiftRows(SubBytes(x))), y) // result = AddRoundKey(MixColumns(ShiftRows(SubBytes(x))), y)
// //
// Asm: VAESENC, CPU Feature: AVX, AES // Asm: VAESENC, CPU Feature: AVX, AES
func (x Uint8x16) AESEncryptRound(y Uint32x4) Uint8x16 func (x Uint8x16) AESEncryptOneRound(y Uint32x4) Uint8x16
// AESEncryptRound performs a series of operations in AES cipher algorithm defined in FIPS 197. // AESEncryptOneRound performs a series of operations in AES cipher algorithm defined in FIPS 197.
// x is the state array, starting from low index to high are s00, s10, s20, s30, s01, ..., s33. // x is the state array, starting from low index to high are s00, s10, s20, s30, s01, ..., s33.
// y is the chunk of w array in use. // y is the chunk of w array in use.
// result = AddRoundKey(MixColumns(ShiftRows(SubBytes(x))), y) // result = AddRoundKey(MixColumns(ShiftRows(SubBytes(x))), y)
// //
// Asm: VAESENC, CPU Feature: AVX512VAES // Asm: VAESENC, CPU Feature: AVX512VAES
func (x Uint8x32) AESEncryptRound(y Uint32x8) Uint8x32 func (x Uint8x32) AESEncryptOneRound(y Uint32x8) Uint8x32
// AESEncryptOneRound performs a series of operations in AES cipher algorithm defined in FIPS 197.
// x is the state array, starting from low index to high are s00, s10, s20, s30, s01, ..., s33.
// y is the chunk of w array in use.
// result = AddRoundKey(MixColumns(ShiftRows(SubBytes(x))), y)
//
// Asm: VAESENC, CPU Feature: AVX512VAES
func (x Uint8x64) AESEncryptOneRound(y Uint32x16) Uint8x64
/* AESInvMixColumns */ /* AESInvMixColumns */