[llvm] r321958 - [X86] Add the 16 and 8-bit CRC32 instructions to the load folding tables.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 6 22:48:20 PST 2018


Author: ctopper
Date: Sat Jan  6 22:48:20 2018
New Revision: 321958

URL: http://llvm.org/viewvc/llvm-project?rev=321958&view=rev
Log:
[X86] Add the 16 and 8-bit CRC32 instructions to the load folding tables.

Modified:
    llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
    llvm/trunk/test/CodeGen/X86/sse42-intrinsics-fast-isel.ll
    llvm/trunk/test/CodeGen/X86/stack-folding-int-sse42.ll

Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=321958&r1=321957&r2=321958&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Sat Jan  6 22:48:20 2018
@@ -1217,8 +1217,11 @@ X86InstrInfo::X86InstrInfo(X86Subtarget
     { X86::CMPSDrr_Int,     X86::CMPSDrm_Int,   TB_NO_REVERSE },
     { X86::CMPSSrr,         X86::CMPSSrm,       0 },
     { X86::CMPSSrr_Int,     X86::CMPSSrm_Int,   TB_NO_REVERSE },
+    { X86::CRC32r32r16,     X86::CRC32r32m16,   0 },
     { X86::CRC32r32r32,     X86::CRC32r32m32,   0 },
+    { X86::CRC32r32r8,      X86::CRC32r32m8,    0 },
     { X86::CRC32r64r64,     X86::CRC32r64m64,   0 },
+    { X86::CRC32r64r8,      X86::CRC32r64m8,    0 },
     { X86::CVTSD2SSrr_Int,  X86::CVTSD2SSrm_Int,      TB_NO_REVERSE },
     { X86::CVTSS2SDrr_Int,  X86::CVTSS2SDrm_Int,      TB_NO_REVERSE },
     { X86::DIVPDrr,         X86::DIVPDrm,       TB_ALIGN_16 },

Modified: llvm/trunk/test/CodeGen/X86/sse42-intrinsics-fast-isel.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/sse42-intrinsics-fast-isel.ll?rev=321958&r1=321957&r2=321958&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/sse42-intrinsics-fast-isel.ll (original)
+++ llvm/trunk/test/CodeGen/X86/sse42-intrinsics-fast-isel.ll Sat Jan  6 22:48:20 2018
@@ -354,9 +354,8 @@ declare i32 @llvm.x86.sse42.pcmpistriz12
 define i32 @test_mm_crc32_u8(i32 %a0, i8 %a1) {
 ; X32-LABEL: test_mm_crc32_u8:
 ; X32:       # %bb.0:
-; X32-NEXT:    movb {{[0-9]+}}(%esp), %cl
 ; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax
-; X32-NEXT:    crc32b %cl, %eax
+; X32-NEXT:    crc32b {{[0-9]+}}(%esp), %eax
 ; X32-NEXT:    retl
 ;
 ; X64-LABEL: test_mm_crc32_u8:
@@ -372,9 +371,8 @@ declare i32 @llvm.x86.sse42.crc32.32.8(i
 define i32 @test_mm_crc32_u16(i32 %a0, i16 %a1) {
 ; X32-LABEL: test_mm_crc32_u16:
 ; X32:       # %bb.0:
-; X32-NEXT:    movzwl {{[0-9]+}}(%esp), %ecx
 ; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax
-; X32-NEXT:    crc32w %cx, %eax
+; X32-NEXT:    crc32w {{[0-9]+}}(%esp), %eax
 ; X32-NEXT:    retl
 ;
 ; X64-LABEL: test_mm_crc32_u16:

Modified: llvm/trunk/test/CodeGen/X86/stack-folding-int-sse42.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/stack-folding-int-sse42.ll?rev=321958&r1=321957&r2=321958&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/stack-folding-int-sse42.ll (original)
+++ llvm/trunk/test/CodeGen/X86/stack-folding-int-sse42.ll Sat Jan  6 22:48:20 2018
@@ -62,10 +62,22 @@ define <2 x i64> @stack_fold_aeskeygenas
 }
 declare <2 x i64> @llvm.x86.aesni.aeskeygenassist(<2 x i64>, i8) nounwind readnone
 
-;TODO stack_fold_crc32_32_8
+define i32 @stack_fold_crc32_32_8(i32 %a0, i8 %a1) {
+  ;CHECK-LABEL: stack_fold_crc32_32_8
+  ;CHECK:       crc32b {{-?[0-9]*}}(%rsp), %eax {{.*#+}} 1-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.8(i32 %a0, i8 %a1)
+  ret i32 %2
+}
 declare i32 @llvm.x86.sse42.crc32.32.8(i32, i8) nounwind
 
-;TODO stack_fold_crc32_32_16
+define i32 @stack_fold_crc32_32_16(i32 %a0, i16 %a1) {
+  ;CHECK-LABEL: stack_fold_crc32_32_16
+  ;CHECK:       crc32w {{-?[0-9]*}}(%rsp), %eax {{.*#+}} 2-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.16(i32 %a0, i16 %a1)
+  ret i32 %2
+}
 declare i32 @llvm.x86.sse42.crc32.32.16(i32, i16) nounwind
 
 define i32 @stack_fold_crc32_32_32(i32 %a0, i32 %a1) {
@@ -77,9 +89,6 @@ define i32 @stack_fold_crc32_32_32(i32 %
 }
 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




More information about the llvm-commits mailing list