1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i386-unknown -mattr=+sse4.1 | FileCheck %s --check-prefix=X86
3 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+sse4.1 | FileCheck %s --check-prefix=X64
5 ; tests variable insert and extract of a 4 x i32
7 define <4 x i32> @var_insert(<4 x i32> %x, i32 %val, i32 %idx) nounwind {
8 ; X86-LABEL: var_insert:
9 ; X86: # %bb.0: # %entry
10 ; X86-NEXT: pushl %ebp
11 ; X86-NEXT: movl %esp, %ebp
12 ; X86-NEXT: andl $-16, %esp
13 ; X86-NEXT: subl $32, %esp
14 ; X86-NEXT: movl 12(%ebp), %eax
15 ; X86-NEXT: andl $3, %eax
16 ; X86-NEXT: movl 8(%ebp), %ecx
17 ; X86-NEXT: movaps %xmm0, (%esp)
18 ; X86-NEXT: movl %ecx, (%esp,%eax,4)
19 ; X86-NEXT: movaps (%esp), %xmm0
20 ; X86-NEXT: movl %ebp, %esp
24 ; X64-LABEL: var_insert:
25 ; X64: # %bb.0: # %entry
26 ; X64-NEXT: # kill: def $esi killed $esi def $rsi
27 ; X64-NEXT: movaps %xmm0, -{{[0-9]+}}(%rsp)
28 ; X64-NEXT: andl $3, %esi
29 ; X64-NEXT: movl %edi, -24(%rsp,%rsi,4)
30 ; X64-NEXT: movaps -{{[0-9]+}}(%rsp), %xmm0
33 %tmp3 = insertelement <4 x i32> %x, i32 %val, i32 %idx
37 define i32 @var_extract(<4 x i32> %x, i32 %idx) nounwind {
38 ; X86-LABEL: var_extract:
39 ; X86: # %bb.0: # %entry
40 ; X86-NEXT: pushl %ebp
41 ; X86-NEXT: movl %esp, %ebp
42 ; X86-NEXT: andl $-16, %esp
43 ; X86-NEXT: subl $32, %esp
44 ; X86-NEXT: movl 8(%ebp), %eax
45 ; X86-NEXT: andl $3, %eax
46 ; X86-NEXT: movaps %xmm0, (%esp)
47 ; X86-NEXT: movl (%esp,%eax,4), %eax
48 ; X86-NEXT: movl %ebp, %esp
52 ; X64-LABEL: var_extract:
53 ; X64: # %bb.0: # %entry
54 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
55 ; X64-NEXT: movaps %xmm0, -{{[0-9]+}}(%rsp)
56 ; X64-NEXT: andl $3, %edi
57 ; X64-NEXT: movl -24(%rsp,%rdi,4), %eax
60 %tmp3 = extractelement <4 x i32> %x, i32 %idx