|
|
@@ -15,7 +15,17 @@ namespace ARMeilleure.Instructions
|
|
|
Operand d = GetVecA32(op.Qd);
|
|
|
Operand n = GetVecA32(op.Qm);
|
|
|
|
|
|
- context.Copy(d, context.Call(new _V128_V128_V128(SoftFallback.Decrypt), d, n));
|
|
|
+ Operand res;
|
|
|
+ if (Optimizations.UseAesni)
|
|
|
+ {
|
|
|
+ res = context.AddIntrinsic(Intrinsic.X86Aesdeclast, context.AddIntrinsic(Intrinsic.X86Xorpd, d, n), context.VectorZero());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ res = context.Call(new _V128_V128_V128(SoftFallback.Decrypt), d, n);
|
|
|
+ }
|
|
|
+
|
|
|
+ context.Copy(d, res);
|
|
|
}
|
|
|
|
|
|
public static void Aese_V(ArmEmitterContext context)
|
|
|
@@ -25,7 +35,17 @@ namespace ARMeilleure.Instructions
|
|
|
Operand d = GetVecA32(op.Qd);
|
|
|
Operand n = GetVecA32(op.Qm);
|
|
|
|
|
|
- context.Copy(d, context.Call(new _V128_V128_V128(SoftFallback.Encrypt), d, n));
|
|
|
+ Operand res;
|
|
|
+ if (Optimizations.UseAesni)
|
|
|
+ {
|
|
|
+ res = context.AddIntrinsic(Intrinsic.X86Aesenclast, context.AddIntrinsic(Intrinsic.X86Xorpd, d, n), context.VectorZero());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ res = context.Call(new _V128_V128_V128(SoftFallback.Encrypt), d, n);
|
|
|
+ }
|
|
|
+
|
|
|
+ context.Copy(d, res);
|
|
|
}
|
|
|
|
|
|
public static void Aesimc_V(ArmEmitterContext context)
|
|
|
@@ -34,7 +54,17 @@ namespace ARMeilleure.Instructions
|
|
|
|
|
|
Operand n = GetVecA32(op.Qm);
|
|
|
|
|
|
- context.Copy(GetVec(op.Qd), context.Call(new _V128_V128(SoftFallback.InverseMixColumns), n));
|
|
|
+ Operand res;
|
|
|
+ if (Optimizations.UseAesni)
|
|
|
+ {
|
|
|
+ res = context.AddIntrinsic(Intrinsic.X86Aesimc, n);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ res = context.Call(new _V128_V128(SoftFallback.InverseMixColumns), n);
|
|
|
+ }
|
|
|
+
|
|
|
+ context.Copy(GetVecA32(op.Qd), res);
|
|
|
}
|
|
|
|
|
|
public static void Aesmc_V(ArmEmitterContext context)
|
|
|
@@ -43,7 +73,23 @@ namespace ARMeilleure.Instructions
|
|
|
|
|
|
Operand n = GetVecA32(op.Qm);
|
|
|
|
|
|
- context.Copy(GetVec(op.Qd), context.Call(new _V128_V128(SoftFallback.MixColumns), n));
|
|
|
+ Operand res;
|
|
|
+ if (Optimizations.UseAesni)
|
|
|
+ {
|
|
|
+ Operand roundKey = context.VectorZero();
|
|
|
+
|
|
|
+ // Inverse Shift Rows, Inverse Sub Bytes, xor 0 so nothing happens.
|
|
|
+ res = context.AddIntrinsic(Intrinsic.X86Aesdeclast, n, roundKey);
|
|
|
+
|
|
|
+ // Shift Rows, Sub Bytes, Mix Columns (!), xor 0 so nothing happens.
|
|
|
+ res = context.AddIntrinsic(Intrinsic.X86Aesenc, res, roundKey);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ res = context.Call(new _V128_V128(SoftFallback.MixColumns), n);
|
|
|
+ }
|
|
|
+
|
|
|
+ context.Copy(GetVecA32(op.Qd), res);
|
|
|
}
|
|
|
}
|
|
|
}
|