1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -march=x86-64 -mcpu=nehalem | FileCheck %s 3 4 define <4 x float> @a(<4 x float>* %y) nounwind { 5 ; CHECK-LABEL: a: 6 ; CHECK: # BB#0: 7 ; CHECK-NEXT: movups (%rdi), %xmm0 8 ; CHECK-NEXT: shufps {{.*#+}} xmm0 = xmm0[3,2,1,0] 9 ; CHECK-NEXT: retq 10 %x = load <4 x float>, <4 x float>* %y, align 4 11 %a = extractelement <4 x float> %x, i32 0 12 %b = extractelement <4 x float> %x, i32 1 13 %c = extractelement <4 x float> %x, i32 2 14 %d = extractelement <4 x float> %x, i32 3 15 %p = insertelement <4 x float> undef, float %d, i32 0 16 %q = insertelement <4 x float> %p, float %c, i32 1 17 %r = insertelement <4 x float> %q, float %b, i32 2 18 %s = insertelement <4 x float> %r, float %a, i32 3 19 ret <4 x float> %s 20 } 21 22 define <4 x float> @b(<4 x float>* %y, <4 x float> %z) nounwind { 23 ; CHECK-LABEL: b: 24 ; CHECK: # BB#0: 25 ; CHECK-NEXT: movups (%rdi), %xmm1 26 ; CHECK-NEXT: unpckhps {{.*#+}} xmm0 = xmm0[2],xmm1[2],xmm0[3],xmm1[3] 27 ; CHECK-NEXT: retq 28 %x = load <4 x float>, <4 x float>* %y, align 4 29 %a = extractelement <4 x float> %x, i32 2 30 %b = extractelement <4 x float> %x, i32 3 31 %c = extractelement <4 x float> %z, i32 2 32 %d = extractelement <4 x float> %z, i32 3 33 %p = insertelement <4 x float> undef, float %c, i32 0 34 %q = insertelement <4 x float> %p, float %a, i32 1 35 %r = insertelement <4 x float> %q, float %d, i32 2 36 %s = insertelement <4 x float> %r, float %b, i32 3 37 ret <4 x float> %s 38 } 39 40 define <2 x double> @c(<2 x double>* %y) nounwind { 41 ; CHECK-LABEL: c: 42 ; CHECK: # BB#0: 43 ; CHECK-NEXT: movupd (%rdi), %xmm0 44 ; CHECK-NEXT: shufpd {{.*#+}} xmm0 = xmm0[1,0] 45 ; CHECK-NEXT: retq 46 %x = load <2 x double>, <2 x double>* %y, align 8 47 %a = extractelement <2 x double> %x, i32 0 48 %c = extractelement <2 x double> %x, i32 1 49 %p = insertelement <2 x double> undef, double %c, i32 0 50 %r = insertelement <2 x double> %p, double %a, i32 1 51 ret <2 x double> %r 52 } 53 54 define <2 x double> @d(<2 x double>* %y, <2 x double> %z) nounwind { 55 ; CHECK-LABEL: d: 56 ; CHECK: # BB#0: 57 ; CHECK-NEXT: movupd (%rdi), %xmm1 58 ; CHECK-NEXT: unpckhpd {{.*#+}} xmm0 = xmm0[1],xmm1[1] 59 ; CHECK-NEXT: retq 60 %x = load <2 x double>, <2 x double>* %y, align 8 61 %a = extractelement <2 x double> %x, i32 1 62 %c = extractelement <2 x double> %z, i32 1 63 %p = insertelement <2 x double> undef, double %c, i32 0 64 %r = insertelement <2 x double> %p, double %a, i32 1 65 ret <2 x double> %r 66 } 67