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