1 ; RUN: llc < %s -mtriple i386-apple-darwin -mcpu=yonah | FileCheck %s 2 3 target datalayout = "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128" 4 5 ; Make sure we don't break load/store ordering when turning an extractelement 6 ; into loads, off the stack or a previous store. 7 ; Be very explicit about the ordering/stack offsets. 8 9 ; CHECK-LABEL: test_extractelement_legalization_storereuse: 10 ; CHECK: # BB#0 11 ; CHECK-NEXT: pushl %ebx 12 ; CHECK-NEXT: pushl %edi 13 ; CHECK-NEXT: pushl %esi 14 ; CHECK-NEXT: movl 16(%esp), %eax 15 ; CHECK-NEXT: movl 24(%esp), %ecx 16 ; CHECK-NEXT: movl 20(%esp), %edx 17 ; CHECK-NEXT: paddd (%edx), %xmm0 18 ; CHECK-NEXT: movdqa %xmm0, (%edx) 19 ; CHECK-NEXT: shll $4, %ecx 20 ; CHECK-NEXT: movl (%ecx,%edx), %esi 21 ; CHECK-NEXT: movl 12(%ecx,%edx), %edi 22 ; CHECK-NEXT: movl 8(%ecx,%edx), %ebx 23 ; CHECK-NEXT: movl 4(%ecx,%edx), %edx 24 ; CHECK-NEXT: movl %esi, 12(%eax,%ecx) 25 ; CHECK-NEXT: movl %edx, (%eax,%ecx) 26 ; CHECK-NEXT: movl %ebx, 8(%eax,%ecx) 27 ; CHECK-NEXT: movl %edi, 4(%eax,%ecx) 28 ; CHECK-NEXT: popl %esi 29 ; CHECK-NEXT: popl %edi 30 ; CHECK-NEXT: popl %ebx 31 ; CHECK-NEXT: retl 32 define void @test_extractelement_legalization_storereuse(<4 x i32> %a, i32* nocapture %x, i32* nocapture readonly %y, i32 %i) #0 { 33 entry: 34 %0 = bitcast i32* %y to <4 x i32>* 35 %1 = load <4 x i32>, <4 x i32>* %0, align 16 36 %am = add <4 x i32> %a, %1 37 store <4 x i32> %am, <4 x i32>* %0, align 16 38 %ip0 = shl nsw i32 %i, 2 39 %ip1 = or i32 %ip0, 1 40 %ip2 = or i32 %ip0, 2 41 %ip3 = or i32 %ip0, 3 42 %vecext = extractelement <4 x i32> %am, i32 %ip0 43 %arrayidx = getelementptr inbounds i32, i32* %x, i32 %ip3 44 store i32 %vecext, i32* %arrayidx, align 4 45 %vecext5 = extractelement <4 x i32> %am, i32 %ip1 46 %arrayidx8 = getelementptr inbounds i32, i32* %x, i32 %ip0 47 store i32 %vecext5, i32* %arrayidx8, align 4 48 %vecext11 = extractelement <4 x i32> %am, i32 %ip2 49 %arrayidx14 = getelementptr inbounds i32, i32* %x, i32 %ip2 50 store i32 %vecext11, i32* %arrayidx14, align 4 51 %vecext17 = extractelement <4 x i32> %am, i32 %ip3 52 %arrayidx20 = getelementptr inbounds i32, i32* %x, i32 %ip1 53 store i32 %vecext17, i32* %arrayidx20, align 4 54 ret void 55 } 56 57 attributes #0 = { nounwind } 58