1 // REQUIRES: powerpc-registered-target
2 // RUN: %clang_cc1 -faltivec -target-feature +vsx -triple powerpc64-unknown-unknown -emit-llvm %s -o - | FileCheck %s
3
4 vector unsigned char vuc = { 8, 9, 10, 11, 12, 13, 14, 15,
5 0, 1, 2, 3, 4, 5, 6, 7};
6 vector float vf = { -1.5, 2.5, -3.5, 4.5 };
7 vector double vd = { 3.5, -7.5 };
8 vector signed int vsi = { -1, 2, -3, 4 };
9 vector unsigned int vui = { 0, 1, 2, 3 };
10 vector signed long long vsll = { 255LL, -937LL };
11 vector unsigned long long vull = { 1447LL, 2894LL };
12 double d = 23.4;
13
14 vector float res_vf;
15 vector double res_vd;
16 vector signed int res_vsi;
17 vector unsigned int res_vui;
18 vector signed long long res_vsll;
19 vector unsigned long long res_vull;
20 double res_d;
21
test1()22 void test1() {
23 // CHECK-LABEL: define void @test1
24
25 /* vec_div */
26 res_vf = vec_div(vf, vf);
27 // CHECK: @llvm.ppc.vsx.xvdivsp
28
29 res_vd = vec_div(vd, vd);
30 // CHECK: @llvm.ppc.vsx.xvdivdp
31
32 /* vec_max */
33 res_vf = vec_max(vf, vf);
34 // CHECK: @llvm.ppc.vsx.xvmaxsp
35
36 res_vd = vec_max(vd, vd);
37 // CHECK: @llvm.ppc.vsx.xvmaxdp
38
39 res_vf = vec_vmaxfp(vf, vf);
40 // CHECK: @llvm.ppc.vsx.xvmaxsp
41
42 /* vec_min */
43 res_vf = vec_min(vf, vf);
44 // CHECK: @llvm.ppc.vsx.xvminsp
45
46 res_vd = vec_min(vd, vd);
47 // CHECK: @llvm.ppc.vsx.xvmindp
48
49 res_vf = vec_vminfp(vf, vf);
50 // CHECK: @llvm.ppc.vsx.xvminsp
51
52 res_d = __builtin_vsx_xsmaxdp(d, d);
53 // CHECK: @llvm.ppc.vsx.xsmaxdp
54
55 res_d = __builtin_vsx_xsmindp(d, d);
56 // CHECK: @llvm.ppc.vsx.xsmindp
57
58 /* vec_perm */
59 res_vsll = vec_perm(vsll, vsll, vuc);
60 // CHECK: @llvm.ppc.altivec.vperm
61
62 res_vull = vec_perm(vull, vull, vuc);
63 // CHECK: @llvm.ppc.altivec.vperm
64
65 res_vd = vec_perm(vd, vd, vuc);
66 // CHECK: @llvm.ppc.altivec.vperm
67
68 res_vsll = vec_vperm(vsll, vsll, vuc);
69 // CHECK: @llvm.ppc.altivec.vperm
70
71 res_vull = vec_vperm(vull, vull, vuc);
72 // CHECK: @llvm.ppc.altivec.vperm
73
74 res_vd = vec_vperm(vd, vd, vuc);
75 // CHECK: @llvm.ppc.altivec.vperm
76
77 /* vec_vsx_ld */
78
79 res_vsi = vec_vsx_ld(0, &vsi);
80 // CHECK: @llvm.ppc.vsx.lxvw4x
81
82 res_vui = vec_vsx_ld(0, &vui);
83 // CHECK: @llvm.ppc.vsx.lxvw4x
84
85 res_vf = vec_vsx_ld (0, &vf);
86 // CHECK: @llvm.ppc.vsx.lxvw4x
87
88 res_vsll = vec_vsx_ld(0, &vsll);
89 // CHECK: @llvm.ppc.vsx.lxvd2x
90
91 res_vull = vec_vsx_ld(0, &vull);
92 // CHECK: @llvm.ppc.vsx.lxvd2x
93
94 res_vd = vec_vsx_ld(0, &vd);
95 // CHECK: @llvm.ppc.vsx.lxvd2x
96
97 /* vec_vsx_st */
98
99 vec_vsx_st(vsi, 0, &res_vsi);
100 // CHECK: @llvm.ppc.vsx.stxvw4x
101
102 vec_vsx_st(vui, 0, &res_vui);
103 // CHECK: @llvm.ppc.vsx.stxvw4x
104
105 vec_vsx_st(vf, 0, &res_vf);
106 // CHECK: @llvm.ppc.vsx.stxvw4x
107
108 vec_vsx_st(vsll, 0, &res_vsll);
109 // CHECK: @llvm.ppc.vsx.stxvd2x
110
111 vec_vsx_st(vull, 0, &res_vull);
112 // CHECK: @llvm.ppc.vsx.stxvd2x
113
114 vec_vsx_st(vd, 0, &res_vd);
115 // CHECK: @llvm.ppc.vsx.stxvd2x
116 }
117