brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · a534b85 Raw
93 lines · c
1// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -target-cpu corei7-avx -emit-llvm %s -o - | FileCheck %s2// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -target-cpu corei7-avx -emit-llvm -x c++ %s -o - | FileCheck %s3 4typedef double vector8double __attribute__((__vector_size__(64)));5typedef float  vector8float  __attribute__((__vector_size__(32)));6typedef long   vector8long   __attribute__((__vector_size__(64)));7typedef short  vector8short  __attribute__((__vector_size__(16)));8typedef unsigned long   vector8ulong   __attribute__((__vector_size__(64)));9typedef unsigned short  vector8ushort  __attribute__((__vector_size__(16)));10 11#ifdef __cplusplus12extern "C" {13#endif14 15vector8float flt_trunc(vector8double x) {16  return __builtin_convertvector(x, vector8float);17  // CHECK-LABEL: @flt_trunc18  // CHECK: fptrunc <8 x double> %{{[^ ]}} to <8 x float>19}20 21vector8double flt_ext(vector8float x) {22  return __builtin_convertvector(x, vector8double);23  // CHECK-LABEL: @flt_ext24  // CHECK: fpext <8 x float> %{{[^ ]}} to <8 x double>25}26 27vector8long flt_tosi(vector8float x) {28  return __builtin_convertvector(x, vector8long);29  // CHECK-LABEL: @flt_tosi30  // CHECK: fptosi <8 x float> %{{[^ ]}} to <8 x i64>31}32 33vector8ulong flt_toui(vector8float x) {34  return __builtin_convertvector(x, vector8ulong);35  // CHECK-LABEL: @flt_toui36  // CHECK: fptoui <8 x float> %{{[^ ]}} to <8 x i64>37}38 39vector8ulong fltd_toui(vector8double x) {40  return __builtin_convertvector(x, vector8ulong);41  // CHECK-LABEL: @fltd_toui42  // CHECK: fptoui <8 x double> %{{[^ ]}} to <8 x i64>43}44 45vector8ulong int_zext(vector8ushort x) {46  return __builtin_convertvector(x, vector8ulong);47  // CHECK-LABEL: @int_zext48  // CHECK: zext <8 x i16> %{{[^ ]}} to <8 x i64>49}50 51vector8long int_sext(vector8short x) {52  return __builtin_convertvector(x, vector8long);53  // CHECK-LABEL: @int_sext54  // CHECK: sext <8 x i16> %{{[^ ]}} to <8 x i64>55}56 57vector8float int_tofp(vector8short x) {58  return __builtin_convertvector(x, vector8float);59  // CHECK-LABEL: @int_tofp60  // CHECK: sitofp <8 x i16> %{{[^ ]}} to <8 x float>61}62 63vector8float uint_tofp(vector8ushort x) {64  return __builtin_convertvector(x, vector8float);65  // CHECK-LABEL: @uint_tofp66  // CHECK: uitofp <8 x i16> %{{[^ ]}} to <8 x float>67}68 69#ifdef __cplusplus70}71#endif72 73 74#ifdef __cplusplus75template<typename T>76T int_toT(vector8long x) {77  return __builtin_convertvector(x, T);78}79 80extern "C" {81  vector8double int_toT_fp(vector8long x) {82    // CHECK-LABEL: @int_toT_fp83    // CHECK: sitofp <8 x i64> %{{[^ ]}} to <8 x double>84    return int_toT<vector8double>(x);85  }86}87#else88vector8double int_toT_fp(vector8long x) {89  return __builtin_convertvector(x, vector8double);90}91#endif92 93