clang 20.0.0git
riscv_corev_alu.h
Go to the documentation of this file.
1/*===---- riscv_corev_alu.h - CORE-V ALU intrinsics ------------------------===
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-exception
6 *
7 *===-----------------------------------------------------------------------===
8 */
9
10#ifndef __RISCV_COREV_ALU_H
11#define __RISCV_COREV_ALU_H
12
13#include <stdint.h>
14
15#if defined(__cplusplus)
16extern "C" {
17#endif
18
19#if defined(__riscv_xcvalu)
20
21#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
22
23static __inline__ long __DEFAULT_FN_ATTRS __riscv_cv_abs(long a) {
24 return __builtin_abs(a);
25}
26
27static __inline__ long __DEFAULT_FN_ATTRS __riscv_cv_alu_slet(long a, long b) {
28 return __builtin_riscv_cv_alu_slet(a, b);
29}
30
31static __inline__ long __DEFAULT_FN_ATTRS
32__riscv_cv_alu_sletu(unsigned long a, unsigned long b) {
33 return __builtin_riscv_cv_alu_sletu(a, b);
34}
35
36static __inline__ long __DEFAULT_FN_ATTRS __riscv_cv_alu_min(long a, long b) {
37 return __builtin_elementwise_min(a, b);
38}
39
40static __inline__ unsigned long __DEFAULT_FN_ATTRS
41__riscv_cv_alu_minu(unsigned long a, unsigned long b) {
42 return __builtin_elementwise_min(a, b);
43}
44
45static __inline__ long __DEFAULT_FN_ATTRS __riscv_cv_alu_max(long a, long b) {
46 return __builtin_elementwise_max(a, b);
47}
48
49static __inline__ unsigned long __DEFAULT_FN_ATTRS
50__riscv_cv_alu_maxu(unsigned long a, unsigned long b) {
51 return __builtin_elementwise_max(a, b);
52}
53
54static __inline__ long __DEFAULT_FN_ATTRS __riscv_cv_alu_exths(int16_t a) {
55 return __builtin_riscv_cv_alu_exths(a);
56}
57
58static __inline__ unsigned long __DEFAULT_FN_ATTRS
59__riscv_cv_alu_exthz(uint16_t a) {
60 return __builtin_riscv_cv_alu_exthz(a);
61}
62
63static __inline__ long __DEFAULT_FN_ATTRS __riscv_cv_alu_extbs(int8_t a) {
64 return __builtin_riscv_cv_alu_extbs(a);
65}
66
67static __inline__ unsigned long __DEFAULT_FN_ATTRS
68__riscv_cv_alu_extbz(uint8_t a) {
69 return __builtin_riscv_cv_alu_extbz(a);
70}
71
72static __inline__ long __DEFAULT_FN_ATTRS __riscv_cv_alu_clip(long a,
73 unsigned long b) {
74 return __builtin_riscv_cv_alu_clip(a, b);
75}
76
77static __inline__ unsigned long __DEFAULT_FN_ATTRS
78__riscv_cv_alu_clipu(unsigned long a, unsigned long b) {
79 return __builtin_riscv_cv_alu_clipu(a, b);
80}
81
82static __inline__ long __DEFAULT_FN_ATTRS __riscv_cv_alu_addN(long a, long b,
83 uint8_t shft) {
84 return __builtin_riscv_cv_alu_addN(a, b, shft);
85}
86
87static __inline__ unsigned long __DEFAULT_FN_ATTRS
88__riscv_cv_alu_adduN(unsigned long a, unsigned long b, uint8_t shft) {
89 return __builtin_riscv_cv_alu_adduN(a, b, shft);
90}
91
92static __inline__ long __DEFAULT_FN_ATTRS __riscv_cv_alu_addRN(long a, long b,
93 uint8_t shft) {
94 return __builtin_riscv_cv_alu_addRN(a, b, shft);
95}
96
97static __inline__ unsigned long __DEFAULT_FN_ATTRS
98__riscv_cv_alu_adduRN(unsigned long a, unsigned long b, uint8_t shft) {
99 return __builtin_riscv_cv_alu_adduRN(a, b, shft);
100}
101
102static __inline__ long __DEFAULT_FN_ATTRS __riscv_cv_alu_subN(long a, long b,
103 uint8_t shft) {
104 return __builtin_riscv_cv_alu_subN(a, b, shft);
105}
106
107static __inline__ unsigned long __DEFAULT_FN_ATTRS
108__riscv_cv_alu_subuN(unsigned long a, unsigned long b, uint8_t shft) {
109 return __builtin_riscv_cv_alu_subuN(a, b, shft);
110}
111
112static __inline__ long __DEFAULT_FN_ATTRS __riscv_cv_alu_subRN(long a, long b,
113 uint8_t shft) {
114 return __builtin_riscv_cv_alu_subRN(a, b, shft);
115}
116
117static __inline__ unsigned long __DEFAULT_FN_ATTRS
118__riscv_cv_alu_subuRN(unsigned long a, unsigned long b, uint8_t shft) {
119 return __builtin_riscv_cv_alu_subuRN(a, b, shft);
120}
121
122#endif // defined(__riscv_xcvalu)
123
124#if defined(__cplusplus)
125}
126#endif
127
128#endif // define __RISCV_COREV_ALU_H
__device__ __2f16 b
#define __DEFAULT_FN_ATTRS