Clang Project

clang_source_code/test/CodeGen/altivec-ct.c
1// RUN: %clang_cc1 -triple powerpc64le-linux-gnu -S -O0 -o - %s -target-feature +altivec -target-feature +vsx | FileCheck %s -check-prefix=CHECK -check-prefix=VSX
2// RUN: %clang_cc1 -triple powerpc-linux-gnu -S -O0 -o - %s -target-feature +altivec -target-feature -vsx | FileCheck %s
3
4// REQUIRES: powerpc-registered-target
5
6#include <altivec.h>
7
8// CHECK-LABEL: test1
9// CHECK: vcfsx
10vector float test1(vector int x) {
11  return vec_ctf(x, 0);
12}
13
14// CHECK-LABEL: test2
15// CHECK: vcfux
16vector float test2(vector unsigned int x) {
17  return vec_ctf(x, 0);
18}
19
20#ifdef __VSX__
21// VSX-LABEL: test3
22vector double test3(vector signed long long x) {
23  return vec_ctf(x, 0);
24}
25
26// VSX-LABEL: test4
27vector double test4(vector unsigned long long x) {
28  return vec_ctf(x, 0);
29}
30#endif
31
32// CHECK-LABEL: test5
33// CHECK: vcfsx
34vector float test5(vector int x) {
35  return vec_vcfsx(x, 0);
36}
37
38// CHECK-LABEL: test6
39// CHECK: vcfux
40vector float test6(vector unsigned int x) {
41  return vec_vcfux(x, 0);
42}
43
44// CHECK-LABEL: test7
45// CHECK: vctsxs
46vector int test7(vector float x) {
47  return vec_cts(x, 0);
48}
49
50#ifdef __VSX__
51// VSX-LABEL: test8
52vector signed long long test8(vector double x) {
53  return vec_cts(x, 0);
54}
55
56#endif
57
58// CHECK-LABEL: test9
59// CHECK: vctsxs
60vector int test9(vector float x) {
61  return vec_vctsxs(x, 0);
62}
63
64// CHECK-LABEL: test10
65// CHECK: vctuxs
66vector unsigned test10(vector float x) {
67  return vec_ctu(x, 0);
68}
69
70#ifdef __VSX__
71// VSX-LABEL: test11
72vector unsigned long long test11(vector double x) {
73  return vec_ctu(x, 0);
74}
75
76#endif
77
78// CHECK-LABEL: test12
79// CHECK: vctuxs
80vector unsigned test12(vector float x) {
81  return vec_vctuxs(x, 0);
82}
83