xref: /llvm-project/clang/test/CodeGen/PowerPC/altivec-ct.c (revision a9ddb7d54e34533ff4af32d720d69177ef0c605d)
1 // RUN: %clang_cc1 -flax-vector-conversions=none -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 -flax-vector-conversions=none -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
test1(vector int x)10 vector float test1(vector int x) {
11   return vec_ctf(x, 0);
12 }
13 
14 // CHECK-LABEL: test2
15 // CHECK: vcfux
test2(vector unsigned int x)16 vector float test2(vector unsigned int x) {
17   return vec_ctf(x, 0);
18 }
19 
20 #ifdef __VSX__
21 // VSX-LABEL: test3
test3(vector signed long long x)22 vector float test3(vector signed long long x) {
23   return vec_ctf(x, 0);
24 }
25 
26 // VSX-LABEL: test4
test4(vector unsigned long long x)27 vector float test4(vector unsigned long long x) {
28   return vec_ctf(x, 0);
29 }
30 #endif
31 
32 // CHECK-LABEL: test5
33 // CHECK: vcfsx
test5(vector int x)34 vector float test5(vector int x) {
35   return vec_vcfsx(x, 0);
36 }
37 
38 // CHECK-LABEL: test6
39 // CHECK: vcfux
test6(vector unsigned int x)40 vector float test6(vector unsigned int x) {
41   return vec_vcfux(x, 0);
42 }
43 
44 // CHECK-LABEL: test7
45 // CHECK: vctsxs
test7(vector float x)46 vector int test7(vector float x) {
47   return vec_cts(x, 0);
48 }
49 
50 #ifdef __VSX__
51 // VSX-LABEL: test8
test8(vector double x)52 vector 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
test9(vector float x)60 vector int test9(vector float x) {
61   return vec_vctsxs(x, 0);
62 }
63 
64 // CHECK-LABEL: test10
65 // CHECK: vctuxs
test10(vector float x)66 vector unsigned test10(vector float x) {
67   return vec_ctu(x, 0);
68 }
69 
70 #ifdef __VSX__
71 // VSX-LABEL: test11
test11(vector double x)72 vector 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
test12(vector float x)80 vector unsigned test12(vector float x) {
81   return vec_vctuxs(x, 0);
82 }
83