Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 376445
b: refs/heads/master
c: 2baad61
h: refs/heads/master
i:
  376443: f3285d4
v: v3
  • Loading branch information
Jan Beulich authored and H. Peter Anvin committed May 30, 2013
1 parent 2444369 commit 9665061
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e9d0626ed43a41a3fc526d1df06122b0d4eac174
refs/heads/master: 2baad6121e2b2fa3428ee6cb2298107be11ab23a
2 changes: 1 addition & 1 deletion trunk/arch/x86/crypto/crc32-pclmul_asm.S
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ fold_64:
pand %xmm3, %xmm1
PCLMULQDQ 0x00, CONSTANT, %xmm1
pxor %xmm2, %xmm1
pextrd $0x01, %xmm1, %eax
PEXTRD 0x01, %xmm1, %eax

ret
ENDPROC(crc32_pclmul_le_16)
74 changes: 72 additions & 2 deletions trunk/arch/x86/include/asm/inst.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,68 @@

#define REG_NUM_INVALID 100

#define REG_TYPE_R64 0
#define REG_TYPE_XMM 1
#define REG_TYPE_R32 0
#define REG_TYPE_R64 1
#define REG_TYPE_XMM 2
#define REG_TYPE_INVALID 100

.macro R32_NUM opd r32
\opd = REG_NUM_INVALID
.ifc \r32,%eax
\opd = 0
.endif
.ifc \r32,%ecx
\opd = 1
.endif
.ifc \r32,%edx
\opd = 2
.endif
.ifc \r32,%ebx
\opd = 3
.endif
.ifc \r32,%esp
\opd = 4
.endif
.ifc \r32,%ebp
\opd = 5
.endif
.ifc \r32,%esi
\opd = 6
.endif
.ifc \r32,%edi
\opd = 7
.endif
#ifdef CONFIG_X86_64
.ifc \r32,%r8d
\opd = 8
.endif
.ifc \r32,%r9d
\opd = 9
.endif
.ifc \r32,%r10d
\opd = 10
.endif
.ifc \r32,%r11d
\opd = 11
.endif
.ifc \r32,%r12d
\opd = 12
.endif
.ifc \r32,%r13d
\opd = 13
.endif
.ifc \r32,%r14d
\opd = 14
.endif
.ifc \r32,%r15d
\opd = 15
.endif
#endif
.endm

.macro R64_NUM opd r64
\opd = REG_NUM_INVALID
#ifdef CONFIG_X86_64
.ifc \r64,%rax
\opd = 0
.endif
Expand Down Expand Up @@ -63,6 +119,7 @@
.ifc \r64,%r15
\opd = 15
.endif
#endif
.endm

.macro XMM_NUM opd xmm
Expand Down Expand Up @@ -118,10 +175,13 @@
.endm

.macro REG_TYPE type reg
R32_NUM reg_type_r32 \reg
R64_NUM reg_type_r64 \reg
XMM_NUM reg_type_xmm \reg
.if reg_type_r64 <> REG_NUM_INVALID
\type = REG_TYPE_R64
.elseif reg_type_r32 <> REG_NUM_INVALID
\type = REG_TYPE_R32
.elseif reg_type_xmm <> REG_NUM_INVALID
\type = REG_TYPE_XMM
.else
Expand Down Expand Up @@ -162,6 +222,16 @@
.byte \imm8
.endm

.macro PEXTRD imm8 xmm gpr
R32_NUM extrd_opd1 \gpr
XMM_NUM extrd_opd2 \xmm
PFX_OPD_SIZE
PFX_REX extrd_opd1 extrd_opd2
.byte 0x0f, 0x3a, 0x16
MODRM 0xc0 extrd_opd1 extrd_opd2
.byte \imm8
.endm

.macro AESKEYGENASSIST rcon xmm1 xmm2
XMM_NUM aeskeygen_opd1 \xmm1
XMM_NUM aeskeygen_opd2 \xmm2
Expand Down

0 comments on commit 9665061

Please sign in to comment.