SM3PARTW2 (vector)

Data processing (scalar floating-point and Advanced SIMD)

fixed bit field field the encoding fixes should be

Vector crypto sm3 sm3partw2

313029282726252423222120191817161514131211109876543210
11001110011Rm110001RnRd

11001110011xxxxx110001xxxxxxxxxx

Decode Sail

if not_bool(HaveSM3Ext()) then {
    throw(Error_Undefined())
};
let 'd = UInt(Rd);
let 'n = UInt(Rn);
let 'm = UInt(Rm);
execute_aarch64_instrs_vector_crypto_sm3_sm3partw2(d, m, n)

Operation Sail

AArch64_CheckFPAdvSIMDEnabled();
let Vm : bits(128) = V_read(m, 128);
let Vn : bits(128) = V_read(n, 128);
let Vd : bits(128) = V_read(d, 128);
result : bits(128) = undefined;
tmp : bits(128) = undefined;
tmp[127 .. 0] = EOR(Vn, ((ROL(Vm[127 .. 96], 7) @ ROL(Vm[95 .. 64], 7)) @ ROL(Vm[63 .. 32], 7)) @ ROL(Vm[31 .. 0], 7));
result[127 .. 0] = EOR(Vd[127 .. 0], tmp[127 .. 0]);
tmp2 : bits(32) = ROL(tmp[31 .. 0], 15);
let tmp2 : bits(32) = EOR(EOR(tmp2, ROL(tmp2, 15)), ROL(tmp2, 23));
result[127 .. 96] = EOR(result[127 .. 96], tmp2);
V_set(d, 128) = result

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.