Data processing (scalar floating-point and Advanced SIMD)
fixed bit field field the encoding fixes should be
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| 1 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | Rn | Rd | ||||||||
1100111011000000100001xxxxxxxxxx
if not_bool(HaveSM4Ext()) then {
throw(Error_Undefined())
};
let 'd = UInt(Rd);
let 'n = UInt(Rn);
execute_aarch64_instrs_vector_crypto_sm4_sm4enc(d, n)
AArch64_CheckFPAdvSIMDEnabled();
let Vn : bits(128) = V_read(n, 128);
intval : bits(32) = undefined;
roundkey : bits(32) = undefined;
roundresult : bits(128) = V_read(d, 128);
foreach (index from 0 to 3 by 1 in inc) {
roundkey = Elem_read(Vn, index, 32);
intval = EOR(EOR(EOR(roundresult[127 .. 96], roundresult[95 .. 64]), roundresult[63 .. 32]), roundkey);
foreach (i from 0 to 3 by 1 in inc) {
intval = Elem_set(intval, i, 8, Sbox(Elem_read(intval, i, 8)))
};
intval = EOR(EOR(EOR(EOR(intval, ROL(intval, 2)), ROL(intval, 10)), ROL(intval, 18)), ROL(intval, 24));
intval = EOR(intval, roundresult[31 .. 0]);
roundresult[31 .. 0] = roundresult[63 .. 32];
roundresult[63 .. 32] = roundresult[95 .. 64];
roundresult[95 .. 64] = roundresult[127 .. 96];
roundresult[127 .. 96] = intval
};
V_set(d, 128) = roundresult
Made from ScarletNX's Sail at 166ad3910f80. sail-arm's definitions are Arm's ASL in Sail (BSD 3-Clause Clear, license); ScarletNX's fixups are GPL-3.0-or-later.