1*67e74705SXin Li // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -target-cpu corei7-avx -emit-llvm %s -o - | FileCheck %s
2*67e74705SXin Li // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -target-cpu corei7-avx -emit-llvm -x c++ %s -o - | FileCheck %s
3*67e74705SXin Li
4*67e74705SXin Li typedef double vector8double __attribute__((__vector_size__(64)));
5*67e74705SXin Li typedef float vector8float __attribute__((__vector_size__(32)));
6*67e74705SXin Li typedef long vector8long __attribute__((__vector_size__(64)));
7*67e74705SXin Li typedef short vector8short __attribute__((__vector_size__(16)));
8*67e74705SXin Li typedef unsigned long vector8ulong __attribute__((__vector_size__(64)));
9*67e74705SXin Li typedef unsigned short vector8ushort __attribute__((__vector_size__(16)));
10*67e74705SXin Li
11*67e74705SXin Li #ifdef __cplusplus
12*67e74705SXin Li extern "C" {
13*67e74705SXin Li #endif
14*67e74705SXin Li
flt_trunc(vector8double x)15*67e74705SXin Li vector8float flt_trunc(vector8double x) {
16*67e74705SXin Li return __builtin_convertvector(x, vector8float);
17*67e74705SXin Li // CHECK-LABEL: @flt_trunc
18*67e74705SXin Li // CHECK: fptrunc <8 x double> %{{[^ ]}} to <8 x float>
19*67e74705SXin Li }
20*67e74705SXin Li
flt_ext(vector8float x)21*67e74705SXin Li vector8double flt_ext(vector8float x) {
22*67e74705SXin Li return __builtin_convertvector(x, vector8double);
23*67e74705SXin Li // CHECK-LABEL: @flt_ext
24*67e74705SXin Li // CHECK: fpext <8 x float> %{{[^ ]}} to <8 x double>
25*67e74705SXin Li }
26*67e74705SXin Li
flt_tosi(vector8float x)27*67e74705SXin Li vector8long flt_tosi(vector8float x) {
28*67e74705SXin Li return __builtin_convertvector(x, vector8long);
29*67e74705SXin Li // CHECK-LABEL: @flt_tosi
30*67e74705SXin Li // CHECK: fptosi <8 x float> %{{[^ ]}} to <8 x i64>
31*67e74705SXin Li }
32*67e74705SXin Li
flt_toui(vector8float x)33*67e74705SXin Li vector8ulong flt_toui(vector8float x) {
34*67e74705SXin Li return __builtin_convertvector(x, vector8ulong);
35*67e74705SXin Li // CHECK-LABEL: @flt_toui
36*67e74705SXin Li // CHECK: fptoui <8 x float> %{{[^ ]}} to <8 x i64>
37*67e74705SXin Li }
38*67e74705SXin Li
fltd_toui(vector8double x)39*67e74705SXin Li vector8ulong fltd_toui(vector8double x) {
40*67e74705SXin Li return __builtin_convertvector(x, vector8ulong);
41*67e74705SXin Li // CHECK-LABEL: @fltd_toui
42*67e74705SXin Li // CHECK: fptoui <8 x double> %{{[^ ]}} to <8 x i64>
43*67e74705SXin Li }
44*67e74705SXin Li
int_zext(vector8ushort x)45*67e74705SXin Li vector8ulong int_zext(vector8ushort x) {
46*67e74705SXin Li return __builtin_convertvector(x, vector8ulong);
47*67e74705SXin Li // CHECK-LABEL: @int_zext
48*67e74705SXin Li // CHECK: zext <8 x i16> %{{[^ ]}} to <8 x i64>
49*67e74705SXin Li }
50*67e74705SXin Li
int_sext(vector8short x)51*67e74705SXin Li vector8long int_sext(vector8short x) {
52*67e74705SXin Li return __builtin_convertvector(x, vector8long);
53*67e74705SXin Li // CHECK-LABEL: @int_sext
54*67e74705SXin Li // CHECK: sext <8 x i16> %{{[^ ]}} to <8 x i64>
55*67e74705SXin Li }
56*67e74705SXin Li
int_tofp(vector8short x)57*67e74705SXin Li vector8float int_tofp(vector8short x) {
58*67e74705SXin Li return __builtin_convertvector(x, vector8float);
59*67e74705SXin Li // CHECK-LABEL: @int_tofp
60*67e74705SXin Li // CHECK: sitofp <8 x i16> %{{[^ ]}} to <8 x float>
61*67e74705SXin Li }
62*67e74705SXin Li
uint_tofp(vector8ushort x)63*67e74705SXin Li vector8float uint_tofp(vector8ushort x) {
64*67e74705SXin Li return __builtin_convertvector(x, vector8float);
65*67e74705SXin Li // CHECK-LABEL: @uint_tofp
66*67e74705SXin Li // CHECK: uitofp <8 x i16> %{{[^ ]}} to <8 x float>
67*67e74705SXin Li }
68*67e74705SXin Li
69*67e74705SXin Li #ifdef __cplusplus
70*67e74705SXin Li }
71*67e74705SXin Li #endif
72*67e74705SXin Li
73*67e74705SXin Li
74*67e74705SXin Li #ifdef __cplusplus
75*67e74705SXin Li template<typename T>
int_toT(vector8long x)76*67e74705SXin Li T int_toT(vector8long x) {
77*67e74705SXin Li return __builtin_convertvector(x, T);
78*67e74705SXin Li }
79*67e74705SXin Li
80*67e74705SXin Li extern "C" {
int_toT_fp(vector8long x)81*67e74705SXin Li vector8double int_toT_fp(vector8long x) {
82*67e74705SXin Li // CHECK-LABEL: @int_toT_fp
83*67e74705SXin Li // CHECK: sitofp <8 x i64> %{{[^ ]}} to <8 x double>
84*67e74705SXin Li return int_toT<vector8double>(x);
85*67e74705SXin Li }
86*67e74705SXin Li }
87*67e74705SXin Li #else
int_toT_fp(vector8long x)88*67e74705SXin Li vector8double int_toT_fp(vector8long x) {
89*67e74705SXin Li return __builtin_convertvector(x, vector8double);
90*67e74705SXin Li }
91*67e74705SXin Li #endif
92*67e74705SXin Li
93