lkml.org 
[lkml]   [2009]   [Nov]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH -v4] crypto: Add PCLMULQDQ accelerated GHASH implementation
    On 11/03/2009 01:03 AM, Ingo Molnar wrote:
    >>
    >> .macro xmm_num opd xmm
    >> .ifc \xmm,%xmm0
    >> \opd = 0
    >> .endif
    >> .ifc \xmm,%xmm1
    >> \opd = 1
    >> .endif
    >> .ifc \xmm,%xmm2
    >> \opd = 2
    >> .endif
    >> .ifc \xmm,%xmm3
    >> \opd = 3
    >> .endif
    >> .ifc \xmm,%xmm4
    >> \opd = 4
    >> .endif
    >> .ifc \xmm,%xmm5
    >> \opd = 5
    >> .endif
    >> .ifc \xmm,%xmm6
    >> \opd = 6
    >> .endif
    >> .ifc \xmm,%xmm7
    >> \opd = 7
    >> .endif
    >> .ifc \xmm,%xmm8
    >> \opd = 8
    >> .endif
    >> .ifc \xmm,%xmm9
    >> \opd = 9
    >> .endif
    >> .ifc \xmm,%xmm10
    >> \opd = 10
    >> .endif
    >> .ifc \xmm,%xmm11
    >> \opd = 11
    >> .endif
    >> .ifc \xmm,%xmm12
    >> \opd = 12
    >> .endif
    >> .ifc \xmm,%xmm13
    >> \opd = 13
    >> .endif
    >> .ifc \xmm,%xmm14
    >> \opd = 14
    >> .endif
    >> .ifc \xmm,%xmm15
    >> \opd = 15
    >> .endif
    >> .endm
    >>
    >> .macro PSHUFB_XMM xmm1 xmm2
    >> xmm_num pshufb_opd1 \xmm1
    >> xmm_num pshufb_opd2 \xmm2
    >> .if (pshufb_opd1 < 8) && (pshufb_opd2 < 8)
    >> .byte 0x66, 0x0f, 0x38, 0x00, 0xc0 | pshufb_opd1 | (pshufb_opd2<<3)
    >> .elseif (pshufb_opd1 >= 8) && (pshufb_opd2 < 8)
    >> .byte 0x66, 0x41, 0x0f, 0x38, 0x00, 0xc0 | (pshufb_opd1-8) | (pshufb_opd2<<3)
    >> .elseif (pshufb_opd1 < 8) && (pshufb_opd2 >= 8)
    >> .byte 0x66, 0x44, 0x0f, 0x38, 0x00, 0xc0 | pshufb_opd1 | ((pshufb_opd2-8)<<3)
    >> .else
    >> .byte 0x66, 0x45, 0x0f, 0x38, 0x00, 0xc0 | (pshufb_opd1-8) | ((pshufb_opd2-8)<<3)
    >> .endif
    >> .endm
    >
    > Looks far too clever, i like it :-) We have quite a few assembly macros
    > in arch/x86/include/asm/. The above one could be put into calling.h for
    > example.
    >

    I would really like to see something like that, with only one minor
    tweak: please use submacros to generate the REX and MODRM bytes, since
    we are *guaranteed* to want to do the same thing again.

    -hpa

    --
    H. Peter Anvin, Intel Open Source Technology Center
    I work for Intel. I don't speak on their behalf.



    \
     
     \ /
      Last update: 2009-11-04 02:09    [W:5.699 / U:0.000 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site