1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mcpu=btver2 %s -o - | FileCheck %s
3 ; Test desc: two functions (foo, bar) with byval arguments, should not have
4 ; reads/writes from/to byval storage re-ordered.
5 ; When broken, five "1" constants are written into the byval %struct.face,
6 ; but the subsequent byval read of that struct (call to bar) gets re-ordered
7 ; before those writes, illegally.
8 source_filename = "test.c"
9 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
10 target triple = "x86_64-pc-linux-gnu"
12 %struct.face = type { [7 x i32] }
14 ; Function Attrs: noinline nounwind uwtable
15 declare void @bar(ptr byval(%struct.face) nocapture readonly align 8);
17 ; Function Attrs: noinline nounwind uwtable
18 define void @foo(ptr byval(%struct.face) nocapture align 8) local_unnamed_addr {
21 ; CHECK-NEXT: subq $40, %rsp
22 ; CHECK-NEXT: .cfi_def_cfa_offset 48
23 ; CHECK-NEXT: vbroadcastss {{.*#+}} xmm0 = [1,1,1,1]
24 ; CHECK-NEXT: vmovaps %xmm0, {{[0-9]+}}(%rsp)
25 ; CHECK-NEXT: movl $1, {{[0-9]+}}(%rsp)
26 ; CHECK-NEXT: vmovups {{[0-9]+}}(%rsp), %xmm0
27 ; CHECK-NEXT: vmovups %xmm0, {{[0-9]+}}(%rsp)
28 ; CHECK-NEXT: vmovaps {{[0-9]+}}(%rsp), %xmm0
29 ; CHECK-NEXT: vmovups %xmm0, (%rsp)
30 ; CHECK-NEXT: callq bar@PLT
31 ; CHECK-NEXT: addq $40, %rsp
32 ; CHECK-NEXT: .cfi_def_cfa_offset 8
34 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %0, align 8
35 %2 = getelementptr inbounds %struct.face, ptr %0, i64 0, i32 0, i64 4
36 store i32 1, ptr %2, align 8
37 call void @bar(ptr byval(%struct.face) nonnull align 8 %0)