[llvm] r344303 - [x86] add tests for extract_element; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 11 15:04:36 PDT 2018
Author: spatel
Date: Thu Oct 11 15:04:36 2018
New Revision: 344303
URL: http://llvm.org/viewvc/llvm-project?rev=344303&view=rev
Log:
[x86] add tests for extract_element; NFC
The transform for this pattern has an unnecessary one-use limitation.
Modified:
llvm/trunk/test/CodeGen/X86/extract-insert.ll
Modified: llvm/trunk/test/CodeGen/X86/extract-insert.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/extract-insert.ll?rev=344303&r1=344302&r2=344303&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/extract-insert.ll (original)
+++ llvm/trunk/test/CodeGen/X86/extract-insert.ll Thu Oct 11 15:04:36 2018
@@ -12,3 +12,47 @@ define i32 @extractelt_undef_insertelt(i
ret i32 %d
}
+define i8 @extractelt_bitcast(i32 %x) nounwind {
+; X86-LABEL: extractelt_bitcast:
+; X86: # %bb.0:
+; X86-NEXT: movb {{[0-9]+}}(%esp), %al
+; X86-NEXT: retl
+;
+; X64-LABEL: extractelt_bitcast:
+; X64: # %bb.0:
+; X64-NEXT: movl %edi, %eax
+; X64-NEXT: # kill: def $al killed $al killed $eax
+; X64-NEXT: retq
+ %bc = bitcast i32 %x to <4 x i8>
+ %ext = extractelement <4 x i8> %bc, i32 0
+ ret i8 %ext
+}
+
+define i8 @extractelt_bitcast_extra_use(i32 %x, <4 x i8>* %p) nounwind {
+; X86-LABEL: extractelt_bitcast_extra_use:
+; X86: # %bb.0:
+; X86-NEXT: pushl %eax
+; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT: movd %eax, %xmm0
+; X86-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
+; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT: movl %eax, (%ecx)
+; X86-NEXT: movd %xmm0, %eax
+; X86-NEXT: # kill: def $al killed $al killed $eax
+; X86-NEXT: popl %ecx
+; X86-NEXT: retl
+;
+; X64-LABEL: extractelt_bitcast_extra_use:
+; X64: # %bb.0:
+; X64-NEXT: movd %edi, %xmm0
+; X64-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
+; X64-NEXT: movl %edi, (%rsi)
+; X64-NEXT: movd %xmm0, %eax
+; X64-NEXT: # kill: def $al killed $al killed $eax
+; X64-NEXT: retq
+ %bc = bitcast i32 %x to <4 x i8>
+ store <4 x i8> %bc, <4 x i8>* %p
+ %ext = extractelement <4 x i8> %bc, i32 0
+ ret i8 %ext
+}
+
More information about the llvm-commits
mailing list