xref: /llvm-project/clang/test/CodeGen/SystemZ/vec-abi-gnuattr-24.c (revision 0eff46f87f16772f93bdc584865e945162aff170)
1 // RUN: %clang_cc1 -triple s390x-ibm-linux -emit-llvm -fzvector -o - %s 2>&1 \
2 // RUN:   | FileCheck  %s
3 //
4 // Test that the "s390x-visible-vector-ABI" module flag is not emitted.
5 
6 // Use of va_arg with a scalar type.
7 #include <stdarg.h>
fun0(va_list vl)8 int fun0(va_list vl) {
9   return va_arg(vl, int);
10 }
11 
12 typedef __attribute__((vector_size(16))) int v4i32;
13 
14 // Declaring unused global function with vector argument and return values;
15 v4i32 globfun(v4i32 Arg);
16 
17 // Declaring global scalar variable used below.
18 int GlobVal;
19 
20 // Declaring extern global scalar variable used below.
21 extern int GlobExtVar;
22 
23 // Local vector variable used below.
24 static v4i32 Var;
25 
26 // Local function with vector argument and return values;
foo(v4i32 Arg)27 static v4i32 foo(v4i32 Arg) {
28   Var = Var + Arg;
29   return Var;
30 }
31 
fun1()32 int fun1() {
33   v4i32 V = {1, 2, 3, 4};
34   return foo(V)[0] + GlobVal + GlobExtVar;
35 }
36 
37 // Globally visible vector variable less than 16 bytes in size.
38 typedef __attribute__((vector_size(8))) int v2i32;
39 v2i32 NarrowVecVar;
40 
41 // Global function taking narrow vector array and pointer.
bar(v2i32 VArr[4],v2i32 * Dst)42 void bar(v2i32 VArr[4], v2i32 *Dst) { *Dst = VArr[3]; }
43 
44 // Wide vector parameters via "hidden" pointers.
45 typedef __attribute__((vector_size(32))) int v8i32;
bar2(v8i32 Arg)46 v8i32 bar2(v8i32 Arg) { return Arg; }
47 
48 // Same but with a single element struct.
49 struct SingleElStruct { v8i32 B; };
bar3(struct SingleElStruct Arg)50 struct SingleElStruct bar3(struct SingleElStruct Arg) { return Arg; }
51 
52 
53 //CHECK-NOT: !{i32 2, !"s390x-visible-vector-ABI", i32 1}
54