Skip to content

Commit c8b85ad

Browse files
committed
[X86] extractelement-load.ll - add test case for #85419
1 parent 3140d13 commit c8b85ad

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

llvm/test/CodeGen/X86/extractelement-load.ll

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,47 @@ entry:
283283
ret float %cond
284284
}
285285

286+
define i32 @PR85419(ptr %p0) {
287+
; X86-SSE2-LABEL: PR85419:
288+
; X86-SSE2: # %bb.0:
289+
; X86-SSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
290+
; X86-SSE2-NEXT: movdqa (%eax), %xmm0
291+
; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
292+
; X86-SSE2-NEXT: movd %xmm1, %ecx
293+
; X86-SSE2-NEXT: xorl %edx, %edx
294+
; X86-SSE2-NEXT: orl (%eax), %ecx
295+
; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[2,3,2,3]
296+
; X86-SSE2-NEXT: movd %xmm0, %eax
297+
; X86-SSE2-NEXT: cmovel %edx, %eax
298+
; X86-SSE2-NEXT: retl
299+
;
300+
; X64-SSSE3-LABEL: PR85419:
301+
; X64-SSSE3: # %bb.0:
302+
; X64-SSSE3-NEXT: xorl %ecx, %ecx
303+
; X64-SSSE3-NEXT: cmpq $0, (%rdi)
304+
; X64-SSSE3-NEXT: pshufd {{.*#+}} xmm0 = mem[2,3,2,3]
305+
; X64-SSSE3-NEXT: movd %xmm0, %eax
306+
; X64-SSSE3-NEXT: cmovel %ecx, %eax
307+
; X64-SSSE3-NEXT: retq
308+
;
309+
; X64-AVX-LABEL: PR85419:
310+
; X64-AVX: # %bb.0:
311+
; X64-AVX-NEXT: xorl %eax, %eax
312+
; X64-AVX-NEXT: cmpq $0, (%rdi)
313+
; X64-AVX-NEXT: je .LBB8_2
314+
; X64-AVX-NEXT: # %bb.1:
315+
; X64-AVX-NEXT: movl 8(%rdi), %eax
316+
; X64-AVX-NEXT: .LBB8_2:
317+
; X64-AVX-NEXT: retq
318+
%load = load <2 x i64>, ptr %p0, align 16
319+
%vecext.i = extractelement <2 x i64> %load, i64 0
320+
%cmp = icmp eq i64 %vecext.i, 0
321+
%.cast = bitcast <2 x i64> %load to <4 x i32>
322+
%vecext.i2 = extractelement <4 x i32> %.cast, i64 2
323+
%retval.0 = select i1 %cmp, i32 0, i32 %vecext.i2
324+
ret i32 %retval.0
325+
}
326+
286327
; Test for bad extractions from a VBROADCAST_LOAD of the <2 x i16> non-uniform constant bitcast as <4 x i32>.
287328
define void @subextract_broadcast_load_constant(ptr nocapture %0, ptr nocapture %1, ptr nocapture %2) nounwind {
288329
; X86-SSE2-LABEL: subextract_broadcast_load_constant:

0 commit comments

Comments
 (0)