1 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse4.2 | FileCheck %s
3 ; widen a v3i1 to v4i1 to do a vector load/store. We would previously
4 ; reconstruct the said v3i1 from the first element of the vector by filling all
5 ; the lanes of the vector with that first element, which was obviously wrong.
6 ; This was done in the type-legalizing of the DAG, when legalizing the load.
8 ; Function Attrs: argmemonly nounwind readonly
9 declare <3 x i32> @llvm.masked.load.v3i32.p1v3i32(<3 x i32> addrspace(1)*, i32, <3 x i1>, <3 x i32>)
11 ; Function Attrs: argmemonly nounwind
12 declare void @llvm.masked.store.v3i32.p1v3i32(<3 x i32>, <3 x i32> addrspace(1)*, i32, <3 x i1>)
14 define <3 x i32> @masked_load_v3(i32 addrspace(1)*, <3 x i1>) {
16 %2 = bitcast i32 addrspace(1)* %0 to <3 x i32> addrspace(1)*
17 %3 = call <3 x i32> @llvm.masked.load.v3i32.p1v3i32(<3 x i32> addrspace(1)* %2, i32 4, <3 x i1> %1, <3 x i32> undef)
21 define void @masked_store4_v3(<3 x i32>, i32 addrspace(1)*, <3 x i1>) {
23 %3 = bitcast i32 addrspace(1)* %1 to <3 x i32> addrspace(1)*
24 call void @llvm.masked.store.v3i32.p1v3i32(<3 x i32> %0, <3 x i32> addrspace(1)* %3, i32 4, <3 x i1> %2)
28 define void @local_load_v3i1(i32 addrspace(1)* %out, i32 addrspace(1)* %in, <3 x i1>* %predicate_ptr) nounwind {
29 ; CHECK-LABEL: local_load_v3i1:
31 ; CHECK-NEXT: pushq %rbp
32 ; CHECK-NEXT: pushq %r15
33 ; CHECK-NEXT: pushq %r14
34 ; CHECK-NEXT: pushq %rbx
35 ; CHECK-NEXT: pushq %rax
36 ; CHECK-NEXT: movq %rdi, %r14
37 ; CHECK-NEXT: movzbl (%rdx), %ebp
38 ; CHECK-NEXT: movl %ebp, %eax
39 ; CHECK-NEXT: shrl %eax
40 ; CHECK-NEXT: andl $1, %eax
41 ; CHECK-NEXT: movl %ebp, %ecx
42 ; CHECK-NEXT: andl $1, %ecx
43 ; CHECK-NEXT: movd %ecx, %xmm0
44 ; CHECK-NEXT: pinsrd $1, %eax, %xmm0
45 ; CHECK-NEXT: shrl $2, %ebp
46 ; CHECK-NEXT: andl $1, %ebp
47 ; CHECK-NEXT: pinsrd $2, %ebp, %xmm0
48 ; CHECK-NEXT: movd %xmm0, %ebx
49 ; CHECK-NEXT: pextrd $1, %xmm0, %r15d
50 ; CHECK-NEXT: movq %rsi, %rdi
51 ; CHECK-NEXT: movl %ebx, %esi
52 ; CHECK-NEXT: movl %r15d, %edx
53 ; CHECK-NEXT: movl %ebp, %ecx
54 ; CHECK-NEXT: callq masked_load_v3
55 ; CHECK-NEXT: movq %r14, %rdi
56 ; CHECK-NEXT: movl %ebx, %esi
57 ; CHECK-NEXT: movl %r15d, %edx
58 ; CHECK-NEXT: movl %ebp, %ecx
59 ; CHECK-NEXT: callq masked_store4_v3
60 ; CHECK-NEXT: addq $8, %rsp
61 ; CHECK-NEXT: popq %rbx
62 ; CHECK-NEXT: popq %r14
63 ; CHECK-NEXT: popq %r15
64 ; CHECK-NEXT: popq %rbp
66 %predicate = load <3 x i1>, <3 x i1>* %predicate_ptr
67 %load1 = call <3 x i32> @masked_load_v3(i32 addrspace(1)* %in, <3 x i1> %predicate)
68 call void @masked_store4_v3(<3 x i32> %load1, i32 addrspace(1)* %out, <3 x i1> %predicate)