[RISCV][VLOPT] Add vector narrowing integer right shift instructions to isSupportedIn...
[llvm-project.git] / clang / test / CodeGen / convertvector.c
bloba534b85a4239462691f709a02a6de21068846f82
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
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)));
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
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>
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>
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>
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>
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>
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>
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>
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>
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>
69 #ifdef __cplusplus
71 #endif
74 #ifdef __cplusplus
75 template<typename T>
76 T int_toT(vector8long x) {
77 return __builtin_convertvector(x, T);
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);
87 #else
88 vector8double int_toT_fp(vector8long x) {
89 return __builtin_convertvector(x, vector8double);
91 #endif