xref: /llvm-project/llvm/test/CodeGen/SystemZ/vec-abi-align.ll (revision a1710eb3cd5823c5d14899112ca3086acbdbe9cb)
1; Verify that a struct as generated by the frontend is correctly accessed in
2; both cases of enabling/disabling the vector facility.
3;
4; RUN: llc < %s -mtriple=s390x-linux-gnu | \
5; RUN:   FileCheck -check-prefixes=CHECK,CHECK-NOVECTOR %s
6; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=generic | \
7; RUN:   FileCheck -check-prefixes=CHECK,CHECK-NOVECTOR %s
8; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | \
9; RUN:   FileCheck -check-prefixes=CHECK,CHECK-NOVECTOR %s
10; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z196 | \
11; RUN:   FileCheck -check-prefixes=CHECK,CHECK-NOVECTOR %s
12; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=zEC12 | \
13; RUN:   FileCheck -check-prefixes=CHECK,CHECK-NOVECTOR %s
14; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | \
15; RUN:   FileCheck -check-prefixes=CHECK,CHECK-VECTOR %s
16
17; RUN: llc < %s -mtriple=s390x-linux-gnu -mattr=vector | \
18; RUN:   FileCheck -check-prefixes=CHECK,CHECK-VECTOR %s
19; RUN: llc < %s -mtriple=s390x-linux-gnu -mattr=+vector | \
20; RUN:   FileCheck -check-prefixes=CHECK,CHECK-VECTOR %s
21; RUN: llc < %s -mtriple=s390x-linux-gnu -mattr=-vector,vector | \
22; RUN:   FileCheck -check-prefixes=CHECK,CHECK-VECTOR %s
23; RUN: llc < %s -mtriple=s390x-linux-gnu -mattr=-vector,+vector | \
24; RUN:   FileCheck -check-prefixes=CHECK,CHECK-VECTOR %s
25; RUN: llc < %s -mtriple=s390x-linux-gnu -mattr=-vector | \
26; RUN:   FileCheck -check-prefixes=CHECK,CHECK-NOVECTOR %s
27; RUN: llc < %s -mtriple=s390x-linux-gnu -mattr=vector,-vector | \
28; RUN:   FileCheck -check-prefixes=CHECK,CHECK-NOVECTOR %s
29; RUN: llc < %s -mtriple=s390x-linux-gnu -mattr=+vector,-vector | \
30; RUN:   FileCheck -check-prefixes=CHECK,CHECK-NOVECTOR %s
31
32; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 -mattr=-vector | \
33; RUN:   FileCheck -check-prefixes=CHECK,CHECK-NOVECTOR %s
34
35; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 -mattr=+soft-float | \
36; RUN:   FileCheck -check-prefixes=CHECK,CHECK-NOVECTOR %s
37; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 \
38; RUN:   -mattr=soft-float,-soft-float | \
39; RUN:   FileCheck -check-prefixes=CHECK,CHECK-VECTOR %s
40; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 \
41; RUN:   -mattr=-soft-float,soft-float | \
42; RUN:   FileCheck -check-prefixes=CHECK,CHECK-NOVECTOR %s
43
44%struct.S_vx = type { i8, <2 x i64> }
45%struct.S_novx = type { i8, [15 x i8], <2 x i64> }
46
47define void @fun_vx(ptr %s) nounwind {
48; CHECK-LABEL: @fun_vx
49;
50; CHECK-VECTOR: vl %v0, 8(%r2)
51; CHECK-VECTOR: vst %v0, 8(%r2), 3
52;
53; CHECK-NOVECTOR-DAG: agsi 16(%r2), 1
54; CHECK-NOVECTOR-DAG: agsi 8(%r2), 1
55  %ptr = getelementptr %struct.S_vx, ptr %s, i64 0, i32 1
56  %vec = load <2 x i64>, ptr %ptr
57  %add = add <2 x i64> %vec, <i64 1, i64 1>
58  store <2 x i64> %add, ptr %ptr
59  ret void
60}
61
62define void @fun_novx(ptr %s) nounwind {
63; CHECK-LABEL: @fun_novx
64;
65; CHECK-VECTOR: vl  %v0, 16(%r2), 3
66; CHECK-VECTOR: vst %v0, 16(%r2), 3
67;
68; CHECK-NOVECTOR-DAG: agsi 16(%r2), 1
69; CHECK-NOVECTOR-DAG: agsi 24(%r2), 1
70  %ptr = getelementptr %struct.S_novx, ptr %s, i64 0, i32 2
71  %vec = load <2 x i64>, ptr %ptr
72  %add = add <2 x i64> %vec, <i64 1, i64 1>
73  store <2 x i64> %add, ptr %ptr
74  ret void
75}
76
77