[X86] Added SSE4.2 CRC32 memory folding patterns + tests

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234013 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Simon Pilgrim 2015-04-03 14:24:40 +00:00
parent 1c4b6de5ed
commit be149a8148
2 changed files with 29 additions and 0 deletions

View File

@ -952,6 +952,8 @@ X86InstrInfo::X86InstrInfo(X86Subtarget &STI)
{ X86::CMPPSrri, X86::CMPPSrmi, TB_ALIGN_16 },
{ X86::CMPSDrr, X86::CMPSDrm, 0 },
{ X86::CMPSSrr, X86::CMPSSrm, 0 },
{ X86::CRC32r32r32, X86::CRC32r32m32, 0 },
{ X86::CRC32r64r64, X86::CRC32r64m64, 0 },
{ X86::DIVPDrr, X86::DIVPDrm, TB_ALIGN_16 },
{ X86::DIVPSrr, X86::DIVPSrm, TB_ALIGN_16 },
{ X86::DIVSDrr, X86::DIVSDrm, 0 },

View File

@ -62,6 +62,33 @@ define <2 x i64> @stack_fold_aeskeygenassist(<2 x i64> %a0) {
}
declare <2 x i64> @llvm.x86.aesni.aeskeygenassist(<2 x i64>, i8) nounwind readnone
;TODO stack_fold_crc32_32_8
declare i32 @llvm.x86.sse42.crc32.32.8(i32, i8) nounwind
;TODO stack_fold_crc32_32_16
declare i32 @llvm.x86.sse42.crc32.32.16(i32, i16) nounwind
define i32 @stack_fold_crc32_32_32(i32 %a0, i32 %a1) {
;CHECK-LABEL: stack_fold_crc32_32_32
;CHECK: crc32l {{-?[0-9]*}}(%rsp), %eax {{.*#+}} 4-byte Folded Reload
%1 = tail call <2 x i64> asm sideeffect "nop", "=x,~{rbx},~{rcx},~{rdx},~{rsi},~{rdi},~{rbp},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15}"()
%2 = call i32 @llvm.x86.sse42.crc32.32.32(i32 %a0, i32 %a1)
ret i32 %2
}
declare i32 @llvm.x86.sse42.crc32.32.32(i32, i32) nounwind
;TODO stack_fold_crc32_64_8
declare i64 @llvm.x86.sse42.crc32.64.8(i64, i8) nounwind
define i64 @stack_fold_crc32_64_64(i64 %a0, i64 %a1) {
;CHECK-LABEL: stack_fold_crc32_64_64
;CHECK: crc32q {{-?[0-9]*}}(%rsp), %rax {{.*#+}} 8-byte Folded Reload
%1 = tail call <2 x i64> asm sideeffect "nop", "=x,~{rbx},~{rcx},~{rdx},~{rsi},~{rdi},~{rbp},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15}"()
%2 = call i64 @llvm.x86.sse42.crc32.64.64(i64 %a0, i64 %a1)
ret i64 %2
}
declare i64 @llvm.x86.sse42.crc32.64.64(i64, i64) nounwind
define <4 x i32> @stack_fold_movd_load(i32 %a0) {
;CHECK-LABEL: stack_fold_movd_load
;CHECK: movd {{-?[0-9]*}}(%rsp), {{%xmm[0-9][0-9]*}} {{.*#+}} 4-byte Folded Reload