1; RUN: llc -stack-symbol-ordering=0 %s -o - -march=x86-64 -mattr=-avx -mtriple=x86_64-unknown-linux-gnu | FileCheck %s --check-prefix=SSE
2; RUN: llc -stack-symbol-ordering=0 %s -o - -march=x86-64 -mattr=+avx -mtriple=x86_64-unknown-linux-gnu | FileCheck %s --check-prefix=AVX
3; PR4891
4; PR5626
5
6; This load should be before the call, not after.
7
8; SSE: movaps    compl+128(%rip), %xmm0
9; SSE: movaps  %xmm0, (%rsp)
10; SSE: callq   killcommon
11
12; AVX: vmovaps    compl+128(%rip), %xmm0
13; AVX: vmovaps  %xmm0, (%rsp)
14; AVX: callq   killcommon
15
16@compl = linkonce global [20 x i64] zeroinitializer, align 64 ; <[20 x i64]*> [#uses=1]
17
18declare void @killcommon(i32* noalias)
19
20define void @reset(<2 x float>* noalias %garbage1) {
21"file complex.c, line 27, bb1":
22  %changed = alloca i32, align 4                  ; <i32*> [#uses=3]
23  br label %"file complex.c, line 27, bb13"
24
25"file complex.c, line 27, bb13":                  ; preds = %"file complex.c, line 27, bb1"
26  store i32 0, i32* %changed, align 4
27  %r2 = getelementptr float, float* bitcast ([20 x i64]* @compl to float*), i64 32 ; <float*> [#uses=1]
28  %r3 = bitcast float* %r2 to <2 x float>*        ; <<2 x float>*> [#uses=1]
29  %r4 = load <2 x float>, <2 x float>* %r3, align 4            ; <<2 x float>> [#uses=1]
30  call void @killcommon(i32* %changed)
31  br label %"file complex.c, line 34, bb4"
32
33"file complex.c, line 34, bb4":                   ; preds = %"file complex.c, line 27, bb13"
34  %r5 = load i32, i32* %changed, align 4               ; <i32> [#uses=1]
35  %r6 = icmp eq i32 %r5, 0                        ; <i1> [#uses=1]
36  %r7 = zext i1 %r6 to i32                        ; <i32> [#uses=1]
37  %r8 = icmp ne i32 %r7, 0                        ; <i1> [#uses=1]
38  br i1 %r8, label %"file complex.c, line 34, bb7", label %"file complex.c, line 27, bb5"
39
40"file complex.c, line 27, bb5":                   ; preds = %"file complex.c, line 34, bb4"
41  br label %"file complex.c, line 35, bb6"
42
43"file complex.c, line 35, bb6":                   ; preds = %"file complex.c, line 27, bb5"
44  %r11 = ptrtoint <2 x float>* %garbage1 to i64   ; <i64> [#uses=1]
45  %r12 = inttoptr i64 %r11 to <2 x float>*        ; <<2 x float>*> [#uses=1]
46  store <2 x float> %r4, <2 x float>* %r12, align 4
47  br label %"file complex.c, line 34, bb7"
48
49"file complex.c, line 34, bb7":                   ; preds = %"file complex.c, line 35, bb6", %"file complex.c, line 34, bb4"
50  ret void
51}
52