Home | History | Annotate | Download | only in X86
      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=X32
      3 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+sse4.1 | FileCheck %s --check-prefix=X64
      4 
      5 ; tests variable insert and extract of a 4 x i32
      6 
      7 define <4 x i32> @var_insert(<4 x i32> %x, i32 %val, i32 %idx) nounwind {
      8 ; X32-LABEL: var_insert:
      9 ; X32:       # %bb.0: # %entry
     10 ; X32-NEXT:    pushl %ebp
     11 ; X32-NEXT:    movl %esp, %ebp
     12 ; X32-NEXT:    andl $-16, %esp
     13 ; X32-NEXT:    subl $32, %esp
     14 ; X32-NEXT:    movl 12(%ebp), %eax
     15 ; X32-NEXT:    andl $3, %eax
     16 ; X32-NEXT:    movl 8(%ebp), %ecx
     17 ; X32-NEXT:    movaps %xmm0, (%esp)
     18 ; X32-NEXT:    movl %ecx, (%esp,%eax,4)
     19 ; X32-NEXT:    movaps (%esp), %xmm0
     20 ; X32-NEXT:    movl %ebp, %esp
     21 ; X32-NEXT:    popl %ebp
     22 ; X32-NEXT:    retl
     23 ;
     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
     31 ; X64-NEXT:    retq
     32 entry:
     33   %tmp3 = insertelement <4 x i32> %x, i32 %val, i32 %idx
     34   ret <4 x i32> %tmp3
     35 }
     36 
     37 define i32 @var_extract(<4 x i32> %x, i32 %idx) nounwind {
     38 ; X32-LABEL: var_extract:
     39 ; X32:       # %bb.0: # %entry
     40 ; X32-NEXT:    pushl %ebp
     41 ; X32-NEXT:    movl %esp, %ebp
     42 ; X32-NEXT:    andl $-16, %esp
     43 ; X32-NEXT:    subl $32, %esp
     44 ; X32-NEXT:    movl 8(%ebp), %eax
     45 ; X32-NEXT:    andl $3, %eax
     46 ; X32-NEXT:    movaps %xmm0, (%esp)
     47 ; X32-NEXT:    movl (%esp,%eax,4), %eax
     48 ; X32-NEXT:    movl %ebp, %esp
     49 ; X32-NEXT:    popl %ebp
     50 ; X32-NEXT:    retl
     51 ;
     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
     58 ; X64-NEXT:    retq
     59 entry:
     60   %tmp3 = extractelement <4 x i32> %x, i32 %idx
     61   ret i32 %tmp3
     62 }
     63