Make comparison IR ops layout agnostic
[hiphop-php.git] / hphp / runtime / base / string-data-x64.S
blobe9f0dd949dcdf68f0af35d828ad763f6d16d4760
1 #include "hphp/runtime/base/string-data-macros.h"
2 #include "hphp/util/etch-helpers.h"
4 #if defined(__SSE4_2__) && !defined(NO_HWCRC) && defined(NO_M_DATA) && \
5     !defined(_MSC_VER)
7         .file     "hphp/runtime/base/string-data-x64.S"
9 /*
10  * HPHP::StringData::hashHelper() is defined here only when SSE4.2 is explicitly
11  * specified, and NO_M_DATA is used in StringData.
12  */
14 ETCH_SECTION(_ZNK4HPHP10StringData10hashHelperEv)
15 .globl    _ZNK4HPHP10StringData10hashHelperEv
16 ETCH_TYPE(_ZNK4HPHP10StringData10hashHelperEv, @function)
17 _ZNK4HPHP10StringData10hashHelperEv:
18         CFI(startproc)
19         mov     SD_LEN(%rdi), %ecx
20         or      $-1, %eax
21         lea     SD_DATA(%rdi, %rcx), %rdx
22         neg     %rcx
23         jnz     ETCH_LABEL(hheader)
24         jmp     ETCH_LABEL(hend)
26 ETCH_LABEL(hloop):
27         crc32q  %rsi, %rax
28 ETCH_LABEL(hheader):
29         movabs  $0xdfdfdfdfdfdfdfdf, %rsi
30         and     (%rdx, %rcx), %rsi
31         add     $8, %rcx
32         jnc     ETCH_LABEL(hloop)
34         shl     $3, %ecx
35         shl     %cl, %rsi
36         crc32q  %rsi, %rax
38 ETCH_LABEL(hend):
39         shr     %eax
40         or      %eax, SD_HASH(%rdi)
41         ret
42         CFI(endproc)
43 ETCH_SIZE(_ZNK4HPHP10StringData10hashHelperEv)
45 #endif