1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2 ; RUN: llc < %s -mtriple=i686-linux -mattr=+sse4.2 | FileCheck %s --check-prefix=X86 3 ; RUN: llc < %s -mtriple=x86_64-linux -mattr=+sse4.2 | FileCheck %s --check-prefix=X64 4 5 ; PR4891 6 7 ; Both loads should happen before either store. 8 9 define void @short2_int_swap(<2 x i16>* nocapture %b, i32* nocapture %c) nounwind { 10 ; X86-LABEL: short2_int_swap: 11 ; X86: # %bb.0: # %entry 12 ; X86-NEXT: pushl %esi 13 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax 14 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx 15 ; X86-NEXT: movl (%ecx), %edx 16 ; X86-NEXT: movl (%eax), %esi 17 ; X86-NEXT: movl %edx, (%eax) 18 ; X86-NEXT: movl %esi, (%ecx) 19 ; X86-NEXT: popl %esi 20 ; X86-NEXT: retl 21 ; 22 ; X64-LABEL: short2_int_swap: 23 ; X64: # %bb.0: # %entry 24 ; X64-NEXT: movl (%rsi), %eax 25 ; X64-NEXT: movl (%rdi), %ecx 26 ; X64-NEXT: movl %eax, (%rdi) 27 ; X64-NEXT: movl %ecx, (%rsi) 28 ; X64-NEXT: retq 29 entry: 30 %0 = load <2 x i16>, <2 x i16>* %b, align 2 ; <<2 x i16>> [#uses=1] 31 %1 = load i32, i32* %c, align 4 ; <i32> [#uses=1] 32 %tmp1 = bitcast i32 %1 to <2 x i16> ; <<2 x i16>> [#uses=1] 33 store <2 x i16> %tmp1, <2 x i16>* %b, align 2 34 %tmp5 = bitcast <2 x i16> %0 to <1 x i32> ; <<1 x i32>> [#uses=1] 35 %tmp3 = extractelement <1 x i32> %tmp5, i32 0 ; <i32> [#uses=1] 36 store i32 %tmp3, i32* %c, align 4 37 ret void 38 } 39