1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc < %s -mtriple=i686-- -mattr=+sse2 | FileCheck %s -check-prefix=X86 3; RUN: llc < %s -mtriple=x86_64-- -mattr=+sse2 | FileCheck %s -check-prefix=X64 4 5define <2 x i64> @_mm_insert_epi16(<2 x i64> %a, i32 %b, i32 %imm) nounwind readnone { 6; X86-LABEL: _mm_insert_epi16: 7; X86: # %bb.0: # %entry 8; X86-NEXT: pushl %ebp 9; X86-NEXT: movl %esp, %ebp 10; X86-NEXT: andl $-16, %esp 11; X86-NEXT: subl $32, %esp 12; X86-NEXT: movzwl 8(%ebp), %eax 13; X86-NEXT: movl 12(%ebp), %ecx 14; X86-NEXT: andl $7, %ecx 15; X86-NEXT: movaps %xmm0, (%esp) 16; X86-NEXT: movw %ax, (%esp,%ecx,2) 17; X86-NEXT: movaps (%esp), %xmm0 18; X86-NEXT: movl %ebp, %esp 19; X86-NEXT: popl %ebp 20; X86-NEXT: retl 21; 22; X64-LABEL: _mm_insert_epi16: 23; X64: # %bb.0: # %entry 24; X64-NEXT: # kill: def $esi killed $esi def $rsi 25; X64-NEXT: andl $7, %esi 26; X64-NEXT: movaps %xmm0, -{{[0-9]+}}(%rsp) 27; X64-NEXT: movw %di, -24(%rsp,%rsi,2) 28; X64-NEXT: movaps -{{[0-9]+}}(%rsp), %xmm0 29; X64-NEXT: retq 30entry: 31 %conv = bitcast <2 x i64> %a to <8 x i16> ; <<8 x i16>> [#uses=1] 32 %conv2 = trunc i32 %b to i16 ; <i16> [#uses=1] 33 %and = and i32 %imm, 7 ; <i32> [#uses=1] 34 %vecins = insertelement <8 x i16> %conv, i16 %conv2, i32 %and ; <<8 x i16>> [#uses=1] 35 %conv6 = bitcast <8 x i16> %vecins to <2 x i64> ; <<2 x i64>> [#uses=1] 36 ret <2 x i64> %conv6 37} 38