xref: /aosp_15_r20/external/clang/test/CodeGen/ppc64-qpx-vector.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s -check-prefix=ALL -check-prefix=NORMAL
2*67e74705SXin Li // RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -emit-llvm -o - -target-abi elfv1-qpx %s | FileCheck %s -check-prefix=ALL -check-prefix=QPX
3*67e74705SXin Li 
4*67e74705SXin Li typedef float v4sf __attribute__((vector_size(16)));
5*67e74705SXin Li typedef double v4df __attribute__((vector_size(32)));
6*67e74705SXin Li 
7*67e74705SXin Li struct ssf { v4sf v; };
8*67e74705SXin Li struct sdf { v4df v; };
9*67e74705SXin Li 
10*67e74705SXin Li struct ssf2 { v4sf v[2]; };
11*67e74705SXin Li struct sdf2 { v4df v[2]; };
12*67e74705SXin Li 
foo1(struct ssf a,v4sf b,struct ssf2 c)13*67e74705SXin Li v4sf foo1(struct ssf a, v4sf b, struct ssf2 c) {
14*67e74705SXin Li   return a.v + b;
15*67e74705SXin Li }
16*67e74705SXin Li 
17*67e74705SXin Li // ALL-LABEL: define <4 x float> @foo1(<4 x float> inreg %a.coerce, <4 x float> %b, [2 x i128] %c.coerce)
18*67e74705SXin Li // ALL: ret <4 x float>
19*67e74705SXin Li 
foo2(struct sdf a,v4df b,struct sdf2 c)20*67e74705SXin Li v4df foo2(struct sdf a, v4df b, struct sdf2 c) {
21*67e74705SXin Li   return a.v + b;
22*67e74705SXin Li }
23*67e74705SXin Li 
24*67e74705SXin Li // QPX-LABEL: define <4 x double> @foo2(<4 x double> inreg %a.coerce, <4 x double> %b, [2 x i256] %c.coerce)
25*67e74705SXin Li // QPX: ret <4 x double>
26*67e74705SXin Li 
27*67e74705SXin Li // NORMAL-LABEL: define void @foo2(<4 x double>* noalias sret %agg.result, [2 x i128] %a.coerce, <4 x double>*, [4 x i128] %c.coerce)
28*67e74705SXin Li // NORMAL: ret void
29*67e74705SXin Li 
30