brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · 3f2bc00 Raw
72 lines · c
1/*===---- velintrin.h - VEL intrinsics for VE ------------------------------===2 *3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4 * See https://llvm.org/LICENSE.txt for license information.5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6 *7 *===-----------------------------------------------------------------------===8 */9#ifndef __VEL_INTRIN_H__10#define __VEL_INTRIN_H__11 12// Vector registers13typedef double __vr __attribute__((__vector_size__(2048)));14 15// Vector mask registers16#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L17// For C9918typedef _Bool __vm    __attribute__((ext_vector_type(256)));19typedef _Bool __vm256 __attribute__((ext_vector_type(256)));20typedef _Bool __vm512 __attribute__((ext_vector_type(512)));21#else22#ifdef __cplusplus23// For C++24typedef bool __vm    __attribute__((ext_vector_type(256)));25typedef bool __vm256 __attribute__((ext_vector_type(256)));26typedef bool __vm512 __attribute__((ext_vector_type(512)));27#else28#error need C++ or C99 to use vector intrinsics for VE29#endif30#endif31 32enum VShuffleCodes {33  VE_VSHUFFLE_YUYU = 0,34  VE_VSHUFFLE_YUYL = 1,35  VE_VSHUFFLE_YUZU = 2,36  VE_VSHUFFLE_YUZL = 3,37  VE_VSHUFFLE_YLYU = 4,38  VE_VSHUFFLE_YLYL = 5,39  VE_VSHUFFLE_YLZU = 6,40  VE_VSHUFFLE_YLZL = 7,41  VE_VSHUFFLE_ZUYU = 8,42  VE_VSHUFFLE_ZUYL = 9,43  VE_VSHUFFLE_ZUZU = 10,44  VE_VSHUFFLE_ZUZL = 11,45  VE_VSHUFFLE_ZLYU = 12,46  VE_VSHUFFLE_ZLYL = 13,47  VE_VSHUFFLE_ZLZU = 14,48  VE_VSHUFFLE_ZLZL = 15,49};50 51// Use generated intrinsic name definitions52#include <velintrin_gen.h>53 54// Use helper functions55#include <velintrin_approx.h>56 57// pack58 59#define _vel_pack_f32p __builtin_ve_vl_pack_f32p60#define _vel_pack_f32a __builtin_ve_vl_pack_f32a61 62static inline unsigned long int _vel_pack_i32(unsigned int a, unsigned int b) {63  return (((unsigned long int)a) << 32) | b;64}65 66#define _vel_extract_vm512u(vm) __builtin_ve_vl_extract_vm512u(vm)67#define _vel_extract_vm512l(vm) __builtin_ve_vl_extract_vm512l(vm)68#define _vel_insert_vm512u(vm512, vm) __builtin_ve_vl_insert_vm512u(vm512, vm)69#define _vel_insert_vm512l(vm512, vm) __builtin_ve_vl_insert_vm512l(vm512, vm)70 71#endif72