Added PCLMULQDQ ([DYNAREC] Too, using PMULL if present) extension (improve a lot AES-XTS score of Geekbench 5)

This commit is contained in:
ptitSeb 2022-09-30 19:13:47 +02:00
parent 7692371ccb
commit 7b67bbe698
12 changed files with 187 additions and 8 deletions

View File

@ -1764,7 +1764,7 @@
#define SQDMULHQ_16(Vd, Vn, Vm) EMIT(QDMULH_vector(1, 0, 0b01, Vm, Vn, Vd)) #define SQDMULHQ_16(Vd, Vn, Vm) EMIT(QDMULH_vector(1, 0, 0b01, Vm, Vn, Vd))
#define SQDMULHQ_32(Vd, Vn, Vm) EMIT(QDMULH_vector(1, 0, 0b10, Vm, Vn, Vd)) #define SQDMULHQ_32(Vd, Vn, Vm) EMIT(QDMULH_vector(1, 0, 0b10, Vm, Vn, Vd))
// AES extensions // AES extension
#define AES_gen(D, Rn, Rd) (0b01001110<<24 | 0b00<<22 | 0b10100<<17 | 0b0010<<13 | (D)<<12 | 0b10<<10 | (Rn)<<5 | (Rd)) #define AES_gen(D, Rn, Rd) (0b01001110<<24 | 0b00<<22 | 0b10100<<17 | 0b0010<<13 | (D)<<12 | 0b10<<10 | (Rn)<<5 | (Rd))
#define AESD(Vd, Vn) EMIT(AES_gen(1, Vn, Vd)) #define AESD(Vd, Vn) EMIT(AES_gen(1, Vn, Vd))
#define AESE(Vd, Vn) EMIT(AES_gen(0, Vn, Vd)) #define AESE(Vd, Vn) EMIT(AES_gen(0, Vn, Vd))
@ -1773,4 +1773,11 @@
#define AESIMC(Vd, Vn) EMIT(AESMC_gen(1, Vn, Vd)) #define AESIMC(Vd, Vn) EMIT(AESMC_gen(1, Vn, Vd))
#define AESMC(Vd, Vn) EMIT(AESMC_gen(0, Vn, Vd)) #define AESMC(Vd, Vn) EMIT(AESMC_gen(0, Vn, Vd))
// PMULL extension is PMULL_128
#define PMULL_gen(Q, size, Rm, Rn, Rd) (0<<31 | (Q)<<30 | 0b001110<<24 | (size)<<22 | 1<<21 | (Rm)<<16 | 0b1110<<12 | (Rn)<<5 | (Rd))
#define PMULL(Rd, Rn, Rm) EMIT(PMULL_gen(0, 0b00, Rm, Rn, Rd))
#define PMULL2(Rd, Rn, Rm) EMIT(PMULL_gen(1, 0b00, Rm, Rn, Rd))
#define PMULL_128(Rd, Rn, Rm) EMIT(PMULL_gen(0, 0b11, Rm, Rn, Rd))
#define PMULL2_128(Rd, Rn, Rm) EMIT(PMULL_gen(1, 0b11, Rm, Rn, Rd))
#endif //__ARM64_EMITTER_H__ #endif //__ARM64_EMITTER_H__

View File

@ -1351,6 +1351,17 @@ const char* arm64_print(uint32_t opcode, uintptr_t addr)
snprintf(buff, sizeof(buff), "AES%sMC V%d.16B, V%d.16B", sf?"I":"", Rd, Rn); snprintf(buff, sizeof(buff), "AES%sMC V%d.16B, V%d.16B", sf?"I":"", Rd, Rn);
return buff; return buff;
} }
// PMULL
if(isMask(opcode, "0Q001110ff1mmmmm111000nnnnnddddd", &a)) {
const char* Y[] = {"8B", "16B", "??", "??", "??", "??", "1D", "2D"};
const char* Z[] = {"8H", "??", "??", "1Q"};
int sz = sf;
const char* Vn = Y[(sz<<1)|a.Q];
const char* Vd = Z[sz];
snprintf(buff, sizeof(buff), "PMULL%s V%d.%s, V%d.%s, V%d.%s", a.Q?"2":"", Rd, Vd, Rn, Vn, Rm, Vn);
return buff;
}
// DMB ISH // DMB ISH
if(isMask(opcode, "11010101000000110011nnnn10111111", &a)) { if(isMask(opcode, "11010101000000110011nnnn10111111", &a)) {
snprintf(buff, sizeof(buff), "DMB %s", (Rn==0b1011)?"ISH":"???"); snprintf(buff, sizeof(buff), "DMB %s", (Rn==0b1011)?"ISH":"???");

View File

@ -676,6 +676,51 @@ uintptr_t dynarec64_660F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int n
} }
break; break;
case 0x44:
INST_NAME("PCLMULQDQ Gx, Ex, Ib");
nextop = F8;
if(arm64_pmull) {
GETGX(q0, 1);
GETEX(q1, 0, 1);
u8 = F8;
switch (u8&0b00010001) {
case 0b00000000:
PMULL_128(q0, q0, q1);
break;
case 0b00010001:
PMULL2_128(q0, q0, q1);
break;
case 0b00000001:
VEXTQ_8(q0, q0, q0, 8); // Swap Up/Lower 64bits parts
PMULL_128(q0, q0, q1);
break;
case 0b00010000:
VEXTQ_8(q0, q0, q0, 8); // Swap Up/Lower 64bits parts
PMULL2_128(q0, q0, q1);
break;
}
} else {
GETG;
sse_forget_reg(dyn, ninst, gd);
MOV32w(x1, gd); // gx
if(MODREG) {
ed = (nextop&7)+(rex.b<<3);
sse_forget_reg(dyn, ninst, ed);
MOV32w(x2, ed);
MOV32w(x3, 0); //p = NULL
} else {
MOV32w(x2, 0);
addr = geted(dyn, addr, ninst, nextop, &ed, x3, &fixedaddress, 0, 0, rex, NULL, 0, 1);
if(ed!=x3) {
MOVx_REG(x3, ed);
}
}
u8 = F8;
MOV32w(x4, u8);
CALL(arm_pclmul, -1);
}
break;
case 0xDF: case 0xDF:
INST_NAME("AESKEYGENASSIST Gx, Ex, Ib"); // AES-NI INST_NAME("AESKEYGENASSIST Gx, Ex, Ib"); // AES-NI
nextop = F8; nextop = F8;

View File

@ -332,6 +332,22 @@ void arm_aeskeygenassist(x64emu_t* emu, int gx, int ex, void* p, uint32_t u8)
GX->ud[3] ^= u8; GX->ud[3] ^= u8;
} }
void arm_pclmul(x64emu_t* emu, int gx, int ex, void* p, uint32_t u8)
{
sse_regs_t *EX = p?((sse_regs_t*)p):&emu->xmm[ex];
sse_regs_t *GX = &emu->xmm[gx];
int g = (u8&1)?1:0;
int e = (u8&0b10000)?1:0;
__int128 result = 0;
__int128 op2 = EX->q[e];
for (int i=0; i<64; ++i)
if(GX->q[g]&(1LL<<i))
result ^= (op2<<i);
GX->q[0] = result&0xffffffffffffffffLL;
GX->q[1] = (result>>64)&0xffffffffffffffffLL;
}
void arm_clflush(x64emu_t* emu, void* p) void arm_clflush(x64emu_t* emu, void* p)
{ {
cleanDBFromAddressRange((uintptr_t)p, 8, 0); cleanDBFromAddressRange((uintptr_t)p, 8, 0);

View File

@ -35,6 +35,7 @@ void arm_aesdlast(x64emu_t* emu, int xmm);
void arm_aeselast(x64emu_t* emu, int xmm); void arm_aeselast(x64emu_t* emu, int xmm);
void arm_aesimc(x64emu_t* emu, int xmm); void arm_aesimc(x64emu_t* emu, int xmm);
void arm_aeskeygenassist(x64emu_t* emu, int gx, int ex, void* p, uint32_t u8); void arm_aeskeygenassist(x64emu_t* emu, int gx, int ex, void* p, uint32_t u8);
void arm_pclmul(x64emu_t* emu, int gx, int ex, void* p, uint32_t u8);
void arm_clflush(x64emu_t* emu, void* p); void arm_clflush(x64emu_t* emu, void* p);

View File

@ -797,6 +797,25 @@ uintptr_t Run660F(x64emu_t *emu, rex_t rex, uintptr_t addr)
GX->f[i] = (tmp8u&(1<<i))?tmpf:0.0f; GX->f[i] = (tmp8u&(1<<i))?tmpf:0.0f;
break; break;
case 0x44: /* PCLMULQDQ Gx, Ex, Ib */
nextop = F8;
GETEX(1);
GETGX;
tmp8u = F8;
{
int g = (tmp8u&1)?1:0;
int e = (tmp8u&0b10000)?1:0;
__int128 result = 0;
__int128 op2 = EX->q[e];
for (int i=0; i<64; ++i)
if(GX->q[g]&(1LL<<i))
result ^= (op2<<i);
GX->q[0] = result&0xffffffffffffffffLL;
GX->q[1] = (result>>64)&0xffffffffffffffffLL;
}
break;
case 0xDF: // AESKEYGENASSIST Gx, Ex, u8 case 0xDF: // AESKEYGENASSIST Gx, Ex, u8
nextop = F8; nextop = F8;
GETEX(1); GETEX(1);

View File

@ -155,12 +155,18 @@ void SetupInitialStack(x64emu_t *emu)
Push(emu, real_getauxval(13)); Push(emu, 13); //AT_GID(13) Push(emu, real_getauxval(13)); Push(emu, 13); //AT_GID(13)
Push(emu, real_getauxval(14)); Push(emu, 14); //AT_EGID(14) Push(emu, real_getauxval(14)); Push(emu, 14); //AT_EGID(14)
Push(emu, p_x86_64); Push(emu, 15); //AT_PLATFORM(15)=&"x86_64" Push(emu, p_x86_64); Push(emu, 15); //AT_PLATFORM(15)=&"x86_64"
// Push HWCAP: // Push HWCAP: same as CPUID 1.EDX
// FPU: 1<<0 ; VME: 1<<1 ; DE : 1<<2 ; PSE: 1<<3 ; TSC: 1<<4 ; MSR: 1<<5 ; PAE: 1<<6 ; MCE: 1<<7 Push(emu, 1 // fpu
// CX8: 1<<8 ; APIC:1<<9 ; SEP: 1<<11; MTRR:1<<12; PGE: 1<<13; MCA: 1<<14; CMOV:1<<15 | 1<<4 // rdtsc
// FCMOV:1<<16; ; MMX: 1<<23 | 1<<8 // cmpxchg8
// OSFXR:1<<24; XMM: 1<<25;XMM2: 1<<26; AMD3D:1<<31 | 1<<11 // sep (sysenter & sysexit)
Push(emu, (1<<0) | (1<<1) | (1<<2) | (1<<3) | (1<<4) | (1<<8) | (1<<15) | (1<<16) | (1<<23) | (1<<25) | (1<<26)); | 1<<15 // cmov
| 1<<19 // clflush (seems to be with SSE2)
| 1<<23 // mmx
| 1<<24 // fxsr (fxsave, fxrestore)
| 1<<25 // SSE
| 1<<26 // SSE2
);
Push(emu, 16); //AT_HWCAP(16)=... Push(emu, 16); //AT_HWCAP(16)=...
//Push(emu, sysconf(_SC_CLK_TCK)); Push(emu, 17); //AT_CLKTCK(17)=times() frequency //Push(emu, sysconf(_SC_CLK_TCK)); Push(emu, 17); //AT_CLKTCK(17)=times() frequency
Push(emu, real_getauxval(23)); Push(emu, 23); //AT_SECURE(23) Push(emu, real_getauxval(23)); Push(emu, 23); //AT_SECURE(23)

View File

@ -61,6 +61,7 @@ void my_cpuid(x64emu_t* emu, uint32_t tmp32u)
| 1<<26 // SSE2 | 1<<26 // SSE2
; ;
R_ECX = 1<<0 // SSE3 R_ECX = 1<<0 // SSE3
| 1<<1 // PCLMULQDQ
| 1<<9 // SSSE3 | 1<<9 // SSSE3
| 1<<12 // fma | 1<<12 // fma
| 1<<13 // cx16 (cmpxchg16) | 1<<13 // cx16 (cmpxchg16)

View File

@ -1392,7 +1392,7 @@ void CreateCPUInfoFile(int fd)
P; P;
sprintf(buff, "bogomips\t: %g\n", bogoMips); sprintf(buff, "bogomips\t: %g\n", bogoMips);
P; P;
sprintf(buff, "flags\t\t: fpu cx8 sep cmov clflush mmx sse sse2 syscall tsc lahf_lm ssse3 ht tm lm fma fxsr cpuid cx16 aes movbe pni\n"); sprintf(buff, "flags\t\t: fpu cx8 sep cmov clflush mmx sse sse2 syscall tsc lahf_lm ssse3 ht tm lm fma fxsr cpuid pclmulqdq cx16 aes movbe pni\n");
P; P;
sprintf(buff, "address sizes\t: 46 bits physical, 48 bits virtual\n"); sprintf(buff, "address sizes\t: 46 bits physical, 48 bits virtual\n");
P; P;

View File

@ -72,6 +72,10 @@ keygenassist(0x00000000000000000000000000000000, 0x38) = 0x6363635B6363636363636
keygenassist(0x00000000000000000000000000000000, 0x4F) = 0x6363632C636363636363632C63636363 keygenassist(0x00000000000000000000000000000000, 0x4F) = 0x6363632C636363636363632C63636363
keygenassist(0x00000000000000000000000000000000, 0xFF) = 0x6363639C636363636363639C63636363 keygenassist(0x00000000000000000000000000000000, 0xFF) = 0x6363639C636363636363639C63636363
imc (0x00000000000000000000000000000000) = 0x00000000000000000000000000000000 imc (0x00000000000000000000000000000000) = 0x00000000000000000000000000000000
pclmul(0x00000000000000000000000000000000, 0x00) = 0x00000000000000000000000000000000
pclmul(0x00000000000000000000000000000000, 0x01) = 0x00000000000000000000000000000000
pclmul(0x00000000000000000000000000000000, 0x10) = 0x00000000000000000000000000000000
pclmul(0x00000000000000000000000000000000, 0xFF) = 0x00000000000000000000000000000000
enc (0x10000000000000001111000000001111, 0x00000000000000000000000000000000) = 0x635B82BABA5B82826363636312622B13 enc (0x10000000000000001111000000001111, 0x00000000000000000000000000000000) = 0x635B82BABA5B82826363636312622B13
enclast(0x10000000000000001111000000001111, 0x00000000000000000000000000000000) = 0x638282638263636363636363CA636382 enclast(0x10000000000000001111000000001111, 0x00000000000000000000000000000000) = 0x638282638263636363636363CA636382
dec (0x10000000000000001111000000001111, 0x00000000000000000000000000000000) = 0x1C2665EEDD4BAF17EE1C266511D9A068 dec (0x10000000000000001111000000001111, 0x00000000000000000000000000000000) = 0x1C2665EEDD4BAF17EE1C266511D9A068
@ -146,6 +150,10 @@ keygenassist(0x10000000000000001111000000001111, 0x38) = 0x63CA635BCA63636363828
keygenassist(0x10000000000000001111000000001111, 0x4F) = 0x63CA632CCA6363636382822C82826363 keygenassist(0x10000000000000001111000000001111, 0x4F) = 0x63CA632CCA6363636382822C82826363
keygenassist(0x10000000000000001111000000001111, 0xFF) = 0x63CA639CCA6363636382829C82826363 keygenassist(0x10000000000000001111000000001111, 0xFF) = 0x63CA639CCA6363636382829C82826363
imc (0x10000000000000001111000000001111) = 0xE0B0D090000000007755664466447755 imc (0x10000000000000001111000000001111) = 0xE0B0D090000000007755664466447755
pclmul(0x10000000000000001111000000001111, 0x00) = 0x065DF10EFFF108ACF75DFFF10EF10653
pclmul(0x10000000000000001111000000001111, 0x01) = 0x065933390A333F59356A0A3339000653
pclmul(0x10000000000000001111000000001111, 0x10) = 0x06382826382826363000000000000000
pclmul(0x10000000000000001111000000001111, 0xFF) = 0x063CA6363CA636363000000000000000
enc (0x20000000000000002222000000002222, 0x00000000000000000000000000000000) = 0x636893989868939363636363DBF4474C enc (0x20000000000000002222000000002222, 0x00000000000000000000000000000000) = 0x636893989868939363636363DBF4474C
enclast(0x20000000000000002222000000002222, 0x00000000000000000000000000000000) = 0x639393639363636363636363B7636393 enclast(0x20000000000000002222000000002222, 0x00000000000000000000000000000000) = 0x639393639363636363636363B7636393
dec (0x20000000000000002222000000002222, 0x00000000000000000000000000000000) = 0xFE9A69CB76687C64CBFE9A69A1F06736 dec (0x20000000000000002222000000002222, 0x00000000000000000000000000000000) = 0xFE9A69CB76687C64CBFE9A69A1F06736
@ -220,6 +228,10 @@ keygenassist(0x20000000000000002222000000002222, 0x38) = 0x63B7635BB763636363939
keygenassist(0x20000000000000002222000000002222, 0x4F) = 0x63B7632CB76363636393932C93936363 keygenassist(0x20000000000000002222000000002222, 0x4F) = 0x63B7632CB76363636393932C93936363
keygenassist(0x20000000000000002222000000002222, 0xFF) = 0x63B7639CB76363636393939C93936363 keygenassist(0x20000000000000002222000000002222, 0xFF) = 0x63B7639CB76363636393939C93936363
imc (0x20000000000000002222000000002222) = 0xDB7BBB3B00000000EEAACC88CC88EEAA imc (0x20000000000000002222000000002222) = 0xDB7BBB3B00000000EEAACC88CC88EEAA
pclmul(0x20000000000000002222000000002222, 0x00) = 0x0CB9E01FFFE01359ECB9FFE01FE00CA6
pclmul(0x20000000000000002222000000002222, 0x01) = 0x0CBD33281B3324BD3F8E1B3328000CA6
pclmul(0x20000000000000002222000000002222, 0x10) = 0x0C72726C72726C6C6000000000000000
pclmul(0x20000000000000002222000000002222, 0xFF) = 0x0C76EC6C76EC6C6C6000000000000000
enc (0x30000000000000003333000000003333, 0x00000000000000000000000000000000) = 0x6398C3383898C3C363636363566AA45F enc (0x30000000000000003333000000003333, 0x00000000000000000000000000000000) = 0x6398C3383898C3C363636363566AA45F
enclast(0x30000000000000003333000000003333, 0x00000000000000000000000000000000) = 0x63C3C363C363636363636363046363C3 enclast(0x30000000000000003333000000003333, 0x00000000000000000000000000000000) = 0x63C3C363C363636363636363046363C3
dec (0x30000000000000003333000000003333, 0x00000000000000000000000000000000) = 0xDD51B50D735A9DEE0DDD51B5B6EA82DE dec (0x30000000000000003333000000003333, 0x00000000000000000000000000000000) = 0xDD51B50D735A9DEE0DDD51B5B6EA82DE
@ -294,6 +306,10 @@ keygenassist(0x30000000000000003333000000003333, 0x38) = 0x6304635B0463636363C3C
keygenassist(0x30000000000000003333000000003333, 0x4F) = 0x6304632C0463636363C3C32CC3C36363 keygenassist(0x30000000000000003333000000003333, 0x4F) = 0x6304632C0463636363C3C32CC3C36363
keygenassist(0x30000000000000003333000000003333, 0xFF) = 0x6304639C0463636363C3C39CC3C36363 keygenassist(0x30000000000000003333000000003333, 0xFF) = 0x6304639C0463636363C3C39CC3C36363
imc (0x30000000000000003333000000003333) = 0x3BCB6BAB0000000099FFAACCAACC99FF imc (0x30000000000000003333000000003333) = 0x3BCB6BAB0000000099FFAACCAACC99FF
pclmul(0x30000000000000003333000000003333, 0x00) = 0x0AEAE01FFFE0150AEAEAFFE01FE00AF5
pclmul(0x30000000000000003333000000003333, 0x01) = 0x0AFF33390A3333FF39CC0A3339000AF5
pclmul(0x30000000000000003333000000003333, 0x10) = 0x0A44445A44445A5A5000000000000000
pclmul(0x30000000000000003333000000003333, 0xFF) = 0x0A50CA5A50CA5A5A5000000000000000
enc (0x40000000000000004444000000004444, 0x00000000000000000000000000000000) = 0x63EB1B9393EB1B1B636363633FA571F9 enc (0x40000000000000004444000000004444, 0x00000000000000000000000000000000) = 0x63EB1B9393EB1B1B636363633FA571F9
enclast(0x40000000000000004444000000004444, 0x00000000000000000000000000000000) = 0x631B1B631B636363636363630963631B enclast(0x40000000000000004444000000004444, 0x00000000000000000000000000000000) = 0x631B1B631B636363636363630963631B
dec (0x40000000000000004444000000004444, 0x00000000000000000000000000000000) = 0x7C66CF018929E969017C66CFFB9C2F48 dec (0x40000000000000004444000000004444, 0x00000000000000000000000000000000) = 0x7C66CF018929E969017C66CFFB9C2F48
@ -368,6 +384,10 @@ keygenassist(0x40000000000000004444000000004444, 0x38) = 0x6309635B09636363631B1
keygenassist(0x40000000000000004444000000004444, 0x4F) = 0x6309632C09636363631B1B2C1B1B6363 keygenassist(0x40000000000000004444000000004444, 0x4F) = 0x6309632C09636363631B1B2C1B1B6363
keygenassist(0x40000000000000004444000000004444, 0xFF) = 0x6309639C09636363631B1B9C1B1B6363 keygenassist(0x40000000000000004444000000004444, 0xFF) = 0x6309639C09636363631B1B9C1B1B6363
imc (0x40000000000000004444000000004444) = 0xADF66D7600000000C74F830B830BC74F imc (0x40000000000000004444000000004444) = 0xADF66D7600000000C74F830B830BC74F
pclmul(0x40000000000000004444000000004444, 0x00) = 0x1953E01FFFE006B3F953FFE01FE0194C
pclmul(0x40000000000000004444000000004444, 0x01) = 0x195733281B3331572A641B332800194C
pclmul(0x40000000000000004444000000004444, 0x10) = 0x18C6C6D8C6C6D8D8C000000000000000
pclmul(0x40000000000000004444000000004444, 0xFF) = 0x18C258D8C258D8D8C000000000000000
enc (0x50000000000000005555000000005555, 0x00000000000000000000000000000000) = 0x63D9FC4646D9FCFC63636363B9ACCC76 enc (0x50000000000000005555000000005555, 0x00000000000000000000000000000000) = 0x63D9FC4646D9FCFC63636363B9ACCC76
enclast(0x50000000000000005555000000005555, 0x00000000000000000000000000000000) = 0x63FCFC63FC63636363636363536363FC enclast(0x50000000000000005555000000005555, 0x00000000000000000000000000000000) = 0x63FCFC63FC63636363636363536363FC
dec (0x50000000000000005555000000005555, 0x00000000000000000000000000000000) = 0x627207A83DFB7F87A862720727FD9842 dec (0x50000000000000005555000000005555, 0x00000000000000000000000000000000) = 0x627207A83DFB7F87A862720727FD9842
@ -442,6 +462,10 @@ keygenassist(0x50000000000000005555000000005555, 0x38) = 0x6353635B5363636363FCF
keygenassist(0x50000000000000005555000000005555, 0x4F) = 0x6353632C5363636363FCFC2CFCFC6363 keygenassist(0x50000000000000005555000000005555, 0x4F) = 0x6353632C5363636363FCFC2CFCFC6363
keygenassist(0x50000000000000005555000000005555, 0xFF) = 0x6353639C5363636363FCFC9CFCFC6363 keygenassist(0x50000000000000005555000000005555, 0xFF) = 0x6353639C5363636363FCFC9CFCFC6363
imc (0x50000000000000005555000000005555) = 0x4D46BDE600000000B01AE54FE54FB01A imc (0x50000000000000005555000000005555) = 0x4D46BDE600000000B01AE54FE54FB01A
pclmul(0x50000000000000005555000000005555, 0x00) = 0x1F33D32CFFD333E0CC33FFD32CD31F1F
pclmul(0x50000000000000005555000000005555, 0x01) = 0x1F10FFF00FFFEF10E0EF0FFFF0001F1F
pclmul(0x50000000000000005555000000005555, 0x10) = 0x1EC0F0DEC0F0DEEEF000000000000000
pclmul(0x50000000000000005555000000005555, 0xFF) = 0x1EE1EEEEE1EEEEEEF000000000000000
enc (0x60000000000000006666000000006666, 0x00000000000000000000000000000000) = 0x639333C3C393333363636363EEFD8070 enc (0x60000000000000006666000000006666, 0x00000000000000000000000000000000) = 0x639333C3C393333363636363EEFD8070
enclast(0x60000000000000006666000000006666, 0x00000000000000000000000000000000) = 0x633333633363636363636363D0636333 enclast(0x60000000000000006666000000006666, 0x00000000000000000000000000000000) = 0x633333633363636363636363D0636333
dec (0x60000000000000006666000000006666, 0x00000000000000000000000000000000) = 0xB71DAE85A245FFDA85B71DAEE17960F8 dec (0x60000000000000006666000000006666, 0x00000000000000000000000000000000) = 0xB71DAE85A245FFDA85B71DAEE17960F8
@ -516,6 +540,10 @@ keygenassist(0x60000000000000006666000000006666, 0x38) = 0x63D0635BD063636363333
keygenassist(0x60000000000000006666000000006666, 0x4F) = 0x63D0632CD06363636333332C33336363 keygenassist(0x60000000000000006666000000006666, 0x4F) = 0x63D0632CD06363636333332C33336363
keygenassist(0x60000000000000006666000000006666, 0xFF) = 0x63D0639CD06363636333339C33336363 keygenassist(0x60000000000000006666000000006666, 0xFF) = 0x63D0639CD06363636333339C33336363
imc (0x60000000000000006666000000006666) = 0x768DD64D0000000029E54F834F8329E5 imc (0x60000000000000006666000000006666) = 0x768DD64D0000000029E54F834F8329E5
pclmul(0x60000000000000006666000000006666, 0x00) = 0x15F5E01FFFE00A15F5F5FFE01FE015EA
pclmul(0x60000000000000006666000000006666, 0x01) = 0x15D3330A39331FD326E039330A0015EA
pclmul(0x60000000000000006666000000006666, 0x10) = 0x14AAAAB4AAAAB4B4A000000000000000
pclmul(0x60000000000000006666000000006666, 0xFF) = 0x148E14B48E14B4B4A000000000000000
enc (0x70000000000000007777000000007777, 0x00000000000000000000000000000000) = 0x63C2F55454C2F5F563636363A6A3C766 enc (0x70000000000000007777000000007777, 0x00000000000000000000000000000000) = 0x63C2F55454C2F5F563636363A6A3C766
enclast(0x70000000000000007777000000007777, 0x00000000000000000000000000000000) = 0x63F5F563F563636363636363516363F5 enclast(0x70000000000000007777000000007777, 0x00000000000000000000000000000000) = 0x63F5F563F563636363636363516363F5
dec (0x70000000000000007777000000007777, 0x00000000000000000000000000000000) = 0xB41F14EF0FB392ACEFB41F1459A909F9 dec (0x70000000000000007777000000007777, 0x00000000000000000000000000000000) = 0xB41F14EF0FB392ACEFB41F1459A909F9
@ -590,6 +618,10 @@ keygenassist(0x70000000000000007777000000007777, 0x38) = 0x6351635B5163636363F5F
keygenassist(0x70000000000000007777000000007777, 0x4F) = 0x6351632C5163636363F5F52CF5F56363 keygenassist(0x70000000000000007777000000007777, 0x4F) = 0x6351632C5163636363F5F52CF5F56363
keygenassist(0x70000000000000007777000000007777, 0xFF) = 0x6351639C5163636363F5F59CF5F56363 keygenassist(0x70000000000000007777000000007777, 0xFF) = 0x6351639C5163636363F5F59CF5F56363
imc (0x70000000000000007777000000007777) = 0x963D06DD000000005EB029C729C75EB0 imc (0x70000000000000007777000000007777) = 0x963D06DD000000005EB029C729C75EB0
pclmul(0x70000000000000007777000000007777, 0x00) = 0x1384C23DFFC22E46D184FFC23DC213B9
pclmul(0x70000000000000007777000000007777, 0x01) = 0x13B0777E09776DB064C709777E0013B9
pclmul(0x70000000000000007777000000007777, 0x10) = 0x12BC9CA2BC9CA2829000000000000000
pclmul(0x70000000000000007777000000007777, 0xFF) = 0x128B62828B6282829000000000000000
enc (0x80000000000000008888000000008888, 0x00000000000000000000000000000000) = 0x6391C4363691C4C463636363D62D6A98 enc (0x80000000000000008888000000008888, 0x00000000000000000000000000000000) = 0x6391C4363691C4C463636363D62D6A98
enclast(0x80000000000000008888000000008888, 0x00000000000000000000000000000000) = 0x63C4C463C463636363636363CD6363C4 enclast(0x80000000000000008888000000008888, 0x00000000000000000000000000000000) = 0x63C4C463C463636363636363CD6363C4
dec (0x80000000000000008888000000008888, 0x00000000000000000000000000000000) = 0xE58874DC5487EC57DCE58874AEFA6B3F dec (0x80000000000000008888000000008888, 0x00000000000000000000000000000000) = 0xE58874DC5487EC57DCE58874AEFA6B3F
@ -664,6 +696,10 @@ keygenassist(0x80000000000000008888000000008888, 0x38) = 0x63CD635BCD63636363C4C
keygenassist(0x80000000000000008888000000008888, 0x4F) = 0x63CD632CCD63636363C4C42CC4C46363 keygenassist(0x80000000000000008888000000008888, 0x4F) = 0x63CD632CCD63636363C4C42CC4C46363
keygenassist(0x80000000000000008888000000008888, 0xFF) = 0x63CD639CCD63636363C4C49CC4C46363 keygenassist(0x80000000000000008888000000008888, 0xFF) = 0x63CD639CCD63636363C4C49CC4C46363
imc (0x80000000000000008888000000008888) = 0x41F7DAEC00000000959E1D161D16959E imc (0x80000000000000008888000000008888) = 0x41F7DAEC00000000959E1D161D16959E
pclmul(0x80000000000000008888000000008888, 0x00) = 0x32CEB856EEB864768ACEEEB856B83298
pclmul(0x80000000000000008888000000008888, 0x01) = 0x32CA2270522242CA10E8522270003298
pclmul(0x80000000000000008888000000008888, 0x10) = 0x31E26231E26231B18000000000000000
pclmul(0x80000000000000008888000000008888, 0xFF) = 0x31E6B1B1E6B1B1B18000000000000000
enc (0x90000000000000009999000000009999, 0x00000000000000000000000000000000) = 0x63EFEE6262EFEEEE63636363E9EBED61 enc (0x90000000000000009999000000009999, 0x00000000000000000000000000000000) = 0x63EFEE6262EFEEEE63636363E9EBED61
enclast(0x90000000000000009999000000009999, 0x00000000000000000000000000000000) = 0x63EEEE63EE63636363636363606363EE enclast(0x90000000000000009999000000009999, 0x00000000000000000000000000000000) = 0x63EEEE63EE63636363636363606363EE
dec (0x90000000000000009999000000009999, 0x00000000000000000000000000000000) = 0xD6AA9B4C867FD1EC4CD6AA9B6385C82E dec (0x90000000000000009999000000009999, 0x00000000000000000000000000000000) = 0xD6AA9B4C867FD1EC4CD6AA9B6385C82E
@ -738,6 +774,10 @@ keygenassist(0x90000000000000009999000000009999, 0x38) = 0x6360635B6063636363EEE
keygenassist(0x90000000000000009999000000009999, 0x4F) = 0x6360632C6063636363EEEE2CEEEE6363 keygenassist(0x90000000000000009999000000009999, 0x4F) = 0x6360632C6063636363EEEE2CEEEE6363
keygenassist(0x90000000000000009999000000009999, 0xFF) = 0x6360639C6063636363EEEE9CEEEE6363 keygenassist(0x90000000000000009999000000009999, 0xFF) = 0x6360639C6063636363EEEE9CEEEE6363
imc (0x90000000000000009999000000009999) = 0xA1470A7C00000000E2CB7B527B52E2CB imc (0x90000000000000009999000000009999) = 0xA1470A7C00000000E2CB7B527B52E2CB
pclmul(0x90000000000000009999000000009999, 0x00) = 0x3481B54AFFB57E348181FFB54AB534CB
pclmul(0x90000000000000009999000000009999, 0x01) = 0x34CAAAAB01AA9FCA9E6001AAAB0034CB
pclmul(0x90000000000000009999000000009999, 0x10) = 0x37C999D7C999D787B000000000000000
pclmul(0x90000000000000009999000000009999, 0xFF) = 0x3786378786378787B000000000000000
enc (0xA000000000000000AAAA00000000AAAA, 0x00000000000000000000000000000000) = 0x6329ACE6E629ACAC6363636334322F65 enc (0xA000000000000000AAAA00000000AAAA, 0x00000000000000000000000000000000) = 0x6329ACE6E629ACAC6363636334322F65
enclast(0xA000000000000000AAAA00000000AAAA, 0x00000000000000000000000000000000) = 0x63ACAC63AC63636363636363E06363AC enclast(0xA000000000000000AAAA00000000AAAA, 0x00000000000000000000000000000000) = 0x63ACAC63AC63636363636363E06363AC
dec (0xA000000000000000AAAA00000000AAAA, 0x00000000000000000000000000000000) = 0xF969993984C5BBEF39F96999A2F292C2 dec (0xA000000000000000AAAA00000000AAAA, 0x00000000000000000000000000000000) = 0xF969993984C5BBEF39F96999A2F292C2
@ -812,6 +852,10 @@ keygenassist(0xA000000000000000AAAA00000000AAAA, 0x38) = 0x63E0635BE063636363ACA
keygenassist(0xA000000000000000AAAA00000000AAAA, 0x4F) = 0x63E0632CE063636363ACAC2CACAC6363 keygenassist(0xA000000000000000AAAA00000000AAAA, 0x4F) = 0x63E0632CE063636363ACAC2CACAC6363
keygenassist(0xA000000000000000AAAA00000000AAAA, 0xFF) = 0x63E0639CE063636363ACAC9CACAC6363 keygenassist(0xA000000000000000AAAA00000000AAAA, 0xFF) = 0x63E0639CE063636363ACAC9CACAC6363
imc (0xA000000000000000AAAA00000000AAAA) = 0x9A8C61D7000000007B34D19ED19E7B34 imc (0xA000000000000000AAAA00000000AAAA) = 0x9A8C61D7000000007B34D19ED19E7B34
pclmul(0xA000000000000000AAAA00000000AAAA, 0x00) = 0x3E478679FF8647C1B847FF8679863E3E
pclmul(0xA000000000000000AAAA00000000AAAA, 0x01) = 0x3E6AAAFE54AAC06A94C054AAFE003E3E
pclmul(0xA000000000000000AAAA00000000AAAA, 0x10) = 0x3DA3C3BDA3C3BDDDE000000000000000
pclmul(0xA000000000000000AAAA00000000AAAA, 0xFF) = 0x3D8C3DDD8C3DDDDDE000000000000000
enc (0xB000000000000000BBBB00000000BBBB, 0x00000000000000000000000000000000) = 0x63E3EA6A6AE3EAEA63636363F07D6EEE enc (0xB000000000000000BBBB00000000BBBB, 0x00000000000000000000000000000000) = 0x63E3EA6A6AE3EAEA63636363F07D6EEE
enclast(0xB000000000000000BBBB00000000BBBB, 0x00000000000000000000000000000000) = 0x63EAEA63EA63636363636363E76363EA enclast(0xB000000000000000BBBB00000000BBBB, 0x00000000000000000000000000000000) = 0x63EAEA63EA63636363636363E76363EA
dec (0xB000000000000000BBBB00000000BBBB, 0x00000000000000000000000000000000) = 0xE980AA6F9CBC75FB6FE980AA7897D43B dec (0xB000000000000000BBBB00000000BBBB, 0x00000000000000000000000000000000) = 0xE980AA6F9CBC75FB6FE980AA7897D43B
@ -886,6 +930,10 @@ keygenassist(0xB000000000000000BBBB00000000BBBB, 0x38) = 0x63E7635BE763636363EAE
keygenassist(0xB000000000000000BBBB00000000BBBB, 0x4F) = 0x63E7632CE763636363EAEA2CEAEA6363 keygenassist(0xB000000000000000BBBB00000000BBBB, 0x4F) = 0x63E7632CE763636363EAEA2CEAEA6363
keygenassist(0xB000000000000000BBBB00000000BBBB, 0xFF) = 0x63E7639CE763636363EAEA9CEAEA6363 keygenassist(0xB000000000000000BBBB00000000BBBB, 0xFF) = 0x63E7639CE763636363EAEA9CEAEA6363
imc (0xB000000000000000BBBB00000000BBBB) = 0x7A3CB147000000000C61B7DAB7DA0C61 imc (0xB000000000000000BBBB00000000BBBB) = 0x7A3CB147000000000C61B7DAB7DA0C61
pclmul(0xB000000000000000BBBB00000000BBBB, 0x00) = 0x3835E358BBE360D6DB35BBE358E3386D
pclmul(0xB000000000000000BBBB00000000BBBB, 0x01) = 0x3832336C5F3354320B015F336C00386D
pclmul(0xB000000000000000BBBB00000000BBBB, 0x10) = 0x3BB686DBB686DBEBD000000000000000
pclmul(0xB000000000000000BBBB00000000BBBB, 0xFF) = 0x3BB12BEBB12BEBEBD000000000000000
enc (0xC000000000000000CCCC00000000CCCC, 0x00000000000000000000000000000000) = 0x631B4B33331B4B4B63636363B23B92EA enc (0xC000000000000000CCCC00000000CCCC, 0x00000000000000000000000000000000) = 0x631B4B33331B4B4B63636363B23B92EA
enclast(0xC000000000000000CCCC00000000CCCC, 0x00000000000000000000000000000000) = 0x634B4B634B63636363636363BA63634B enclast(0xC000000000000000CCCC00000000CCCC, 0x00000000000000000000000000000000) = 0x634B4B634B63636363636363BA63634B
dec (0xC000000000000000CCCC00000000CCCC, 0x00000000000000000000000000000000) = 0xA2F2486DB9DB6E416DA2F248E8779D02 dec (0xC000000000000000CCCC00000000CCCC, 0x00000000000000000000000000000000) = 0xA2F2486DB9DB6E416DA2F248E8779D02
@ -960,6 +1008,10 @@ keygenassist(0xC000000000000000CCCC00000000CCCC, 0x38) = 0x63BA635BBA636363634B4
keygenassist(0xC000000000000000CCCC00000000CCCC, 0x4F) = 0x63BA632CBA636363634B4B2C4B4B6363 keygenassist(0xC000000000000000CCCC00000000CCCC, 0x4F) = 0x63BA632CBA636363634B4B2C4B4B6363
keygenassist(0xC000000000000000CCCC00000000CCCC, 0xFF) = 0x63BA639CBA636363634B4B9C4B4B6363 keygenassist(0xC000000000000000CCCC00000000CCCC, 0xFF) = 0x63BA639CBA636363634B4B9C4B4B6363
imc (0xC000000000000000CCCC00000000CCCC) = 0xEC01B79A0000000052D19E1D9E1D52D1 imc (0xC000000000000000CCCC00000000CCCC) = 0xEC01B79A0000000052D19E1D9E1D52D1
pclmul(0xC000000000000000CCCC00000000CCCC, 0x00) = 0x2BCBE01FFFE0342BCBCBFFE01FE02BD4
pclmul(0xC000000000000000CCCC00000000CCCC, 0x01) = 0x2B8B336C5F33478B18B85F336C002BD4
pclmul(0xC000000000000000CCCC00000000CCCC, 0x10) = 0x29777769777769694000000000000000
pclmul(0xC000000000000000CCCC00000000CCCC, 0xFF) = 0x2933A96933A969694000000000000000
enc (0xD000000000000000DDDD00000000DDDD, 0x00000000000000000000000000000000) = 0x639EC13C3C9EC1C163636363B8F4D22F enc (0xD000000000000000DDDD00000000DDDD, 0x00000000000000000000000000000000) = 0x639EC13C3C9EC1C163636363B8F4D22F
enclast(0xD000000000000000DDDD00000000DDDD, 0x00000000000000000000000000000000) = 0x63C1C163C163636363636363706363C1 enclast(0xD000000000000000DDDD00000000DDDD, 0x00000000000000000000000000000000) = 0x63C1C163C163636363636363706363C1
dec (0xD000000000000000DDDD00000000DDDD, 0x00000000000000000000000000000000) = 0x7D915027758F23EB277D9150932508BE dec (0xD000000000000000DDDD00000000DDDD, 0x00000000000000000000000000000000) = 0x7D915027758F23EB277D9150932508BE
@ -1034,6 +1086,10 @@ keygenassist(0xD000000000000000DDDD00000000DDDD, 0x38) = 0x6370635B7063636363C1C
keygenassist(0xD000000000000000DDDD00000000DDDD, 0x4F) = 0x6370632C7063636363C1C12CC1C16363 keygenassist(0xD000000000000000DDDD00000000DDDD, 0x4F) = 0x6370632C7063636363C1C12CC1C16363
keygenassist(0xD000000000000000DDDD00000000DDDD, 0xFF) = 0x6370639C7063636363C1C19CC1C16363 keygenassist(0xD000000000000000DDDD00000000DDDD, 0xFF) = 0x6370639C7063636363C1C19CC1C16363
imc (0xD000000000000000DDDD00000000DDDD) = 0x0CB1670A000000002584F859F8592584 imc (0xD000000000000000DDDD00000000DDDD) = 0x0CB1670A000000002584F859F8592584
pclmul(0xD000000000000000DDDD00000000DDDD, 0x00) = 0x2DF39A74EE9A5969B7F3EE9A749A2D87
pclmul(0xD000000000000000DDDD00000000DDDD, 0x01) = 0x2D8BBBB70CBB9A8B96300CBBB7002D87
pclmul(0xD000000000000000DDDD00000000DDDD, 0x10) = 0x2F2C8CFF2C8CFF5F7000000000000000
pclmul(0xD000000000000000DDDD00000000DDDD, 0xFF) = 0x2F532F5F532F5F5F7000000000000000
enc (0xE000000000000000EEEE00000000EEEE, 0x00000000000000000000000000000000) = 0x63BE28F5F5BE282863636363A1B5AA77 enc (0xE000000000000000EEEE00000000EEEE, 0x00000000000000000000000000000000) = 0x63BE28F5F5BE282863636363A1B5AA77
enclast(0xE000000000000000EEEE00000000EEEE, 0x00000000000000000000000000000000) = 0x632828632863636363636363E1636328 enclast(0xE000000000000000EEEE00000000EEEE, 0x00000000000000000000000000000000) = 0x632828632863636363636363E1636328
dec (0xE000000000000000EEEE00000000EEEE, 0x00000000000000000000000000000000) = 0x9BDC169A998E94719A9BDC1698DE5315 dec (0xE000000000000000EEEE00000000EEEE, 0x00000000000000000000000000000000) = 0x9BDC169A998E94719A9BDC1698DE5315
@ -1108,6 +1164,10 @@ keygenassist(0xE000000000000000EEEE00000000EEEE, 0x38) = 0x63E1635BE163636363282
keygenassist(0xE000000000000000EEEE00000000EEEE, 0x4F) = 0x63E1632CE16363636328282C28286363 keygenassist(0xE000000000000000EEEE00000000EEEE, 0x4F) = 0x63E1632CE16363636328282C28286363
keygenassist(0xE000000000000000EEEE00000000EEEE, 0xFF) = 0x63E1639CE16363636328289C28286363 keygenassist(0xE000000000000000EEEE00000000EEEE, 0xFF) = 0x63E1639CE16363636328289C28286363
imc (0xE000000000000000EEEE00000000EEEE) = 0x377A0CA100000000BC7B52955295BC7B imc (0xE000000000000000EEEE00000000EEEE) = 0x377A0CA100000000BC7B52955295BC7B
pclmul(0xE000000000000000EEEE00000000EEEE, 0x00) = 0x274FC23DFFC21A8DE54FFFC23DC22772
pclmul(0xE000000000000000EEEE00000000EEEE, 0x01) = 0x2704AADC76AAFB048DAE76AADC002772
pclmul(0xE000000000000000EEEE00000000EEEE, 0x10) = 0x253B1B253B1B25052000000000000000
pclmul(0xE000000000000000EEEE00000000EEEE, 0xFF) = 0x2574C50574C505052000000000000000
enc (0xF000000000000000FFFF00000000FFFF, 0x00000000000000000000000000000000) = 0x63FC168989FC161663636363393CF966 enc (0xF000000000000000FFFF00000000FFFF, 0x00000000000000000000000000000000) = 0x63FC168989FC161663636363393CF966
enclast(0xF000000000000000FFFF00000000FFFF, 0x00000000000000000000000000000000) = 0x6316166316636363636363638C636316 enclast(0xF000000000000000FFFF00000000FFFF, 0x00000000000000000000000000000000) = 0x6316166316636363636363638C636316
dec (0xF000000000000000FFFF00000000FFFF, 0x00000000000000000000000000000000) = 0x1ED340A2C9830609A21ED340C1B0EE9F dec (0xF000000000000000FFFF00000000FFFF, 0x00000000000000000000000000000000) = 0x1ED340A2C9830609A21ED340C1B0EE9F
@ -1182,3 +1242,7 @@ keygenassist(0xF000000000000000FFFF00000000FFFF, 0x38) = 0x638C635B8C63636363161
keygenassist(0xF000000000000000FFFF00000000FFFF, 0x4F) = 0x638C632C8C6363636316162C16166363 keygenassist(0xF000000000000000FFFF00000000FFFF, 0x4F) = 0x638C632C8C6363636316162C16166363
keygenassist(0xF000000000000000FFFF00000000FFFF, 0xFF) = 0x638C639C8C6363636316169C16166363 keygenassist(0xF000000000000000FFFF00000000FFFF, 0xFF) = 0x638C639C8C6363636316169C16166363
imc (0xF000000000000000FFFF00000000FFFF) = 0xD7CADC3100000000CB2E34D134D1CB2E imc (0xF000000000000000FFFF00000000FFFF) = 0xD7CADC3100000000CB2E34D134D1CB2E
pclmul(0xF000000000000000FFFF00000000FFFF, 0x00) = 0x210DD32CFFD30DDEF20DFFD32CD32121
pclmul(0xF000000000000000FFFF00000000FFFF, 0x01) = 0x217BFFA55AFF847BDE845AFFA5002121
pclmul(0xF000000000000000FFFF00000000FFFF, 0x10) = 0x231D2D031D2D03331000000000000000
pclmul(0xF000000000000000FFFF00000000FFFF, 0xFF) = 0x236C63336C6333331000000000000000

Binary file not shown.

View File

@ -56,5 +56,14 @@ int main() {
printf("keygenassist(0x%016llX%016llX, 0xFF) = 0x%016llX%016llX\n", x.v[1], x.v[0], keygenassistFF.v[1], keygenassistFF.v[0]); printf("keygenassist(0x%016llX%016llX, 0xFF) = 0x%016llX%016llX\n", x.v[1], x.v[0], keygenassistFF.v[1], keygenassistFF.v[0]);
mm128i imc = { .m = _mm_aesimc_si128(x.m) }; mm128i imc = { .m = _mm_aesimc_si128(x.m) };
printf("imc (0x%016llX%016llX) = 0x%016llX%016llX\n", x.v[1], x.v[0], imc.v[1], imc.v[0]); printf("imc (0x%016llX%016llX) = 0x%016llX%016llX\n", x.v[1], x.v[0], imc.v[1], imc.v[0]);
mm128i pclmul00 = { .m = _mm_clmulepi64_si128(keygenassist00.m, x.m, 0) };
printf("pclmul(0x%016llX%016llX, 0x00) = 0x%016llX%016llX\n", x.v[1], x.v[0], pclmul00.v[1], pclmul00.v[0]);
mm128i pclmul01 = { .m = _mm_clmulepi64_si128(keygenassist00.m, x.m, 0x01) };
printf("pclmul(0x%016llX%016llX, 0x01) = 0x%016llX%016llX\n", x.v[1], x.v[0], pclmul01.v[1], pclmul01.v[0]);
mm128i pclmul10 = { .m = _mm_clmulepi64_si128(keygenassist00.m, x.m, 0x10) };
printf("pclmul(0x%016llX%016llX, 0x10) = 0x%016llX%016llX\n", x.v[1], x.v[0], pclmul10.v[1], pclmul10.v[0]);
mm128i pclmul11 = { .m = _mm_clmulepi64_si128(keygenassist00.m, x.m, 0x11) };
printf("pclmul(0x%016llX%016llX, 0xFF) = 0x%016llX%016llX\n", x.v[1], x.v[0], pclmul11.v[1], pclmul11.v[0]);
} while (!need_stop(&x)); } while (!need_stop(&x));
} }