target/riscv: Use aesdec_IMC

This implements the AES64IM instruction.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2023-06-02 02:29:40 -07:00
parent 7a70583a41
commit 607a5f9d62
1 changed files with 5 additions and 10 deletions

View File

@ -272,17 +272,12 @@ target_ulong HELPER(aes64ks1i)(target_ulong rs1, target_ulong rnum)
target_ulong HELPER(aes64im)(target_ulong rs1) target_ulong HELPER(aes64im)(target_ulong rs1)
{ {
uint64_t RS1 = rs1; AESState t;
uint32_t col_0 = RS1 & 0xFFFFFFFF;
uint32_t col_1 = RS1 >> 32;
target_ulong result;
col_0 = AES_INVMIXCOLUMN(col_0); t.d[HOST_BIG_ENDIAN] = rs1;
col_1 = AES_INVMIXCOLUMN(col_1); t.d[!HOST_BIG_ENDIAN] = 0;
aesdec_IMC(&t, &t, false);
result = ((uint64_t)col_1 << 32) | col_0; return t.d[HOST_BIG_ENDIAN];
return result;
} }
target_ulong HELPER(sm4ed)(target_ulong rs1, target_ulong rs2, target_ulong HELPER(sm4ed)(target_ulong rs1, target_ulong rs2,