From 40f4f8fac315658ff7f7221d577caa6e54065366 Mon Sep 17 00:00:00 2001 From: Kito Cheng Date: Wed, 9 Dec 2020 16:43:48 +0800 Subject: [PATCH 1/4] Add riscv_intrinsic.h to define int_xlen_t and uint_xlen_t --- riscv-c-api.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/riscv-c-api.md b/riscv-c-api.md index 3478494..560da46 100644 --- a/riscv-c-api.md +++ b/riscv-c-api.md @@ -235,6 +235,27 @@ long __riscv_clmul (long a, long b); // clmul rd, rs1, rs2 vint8m1_t __riscv_vadd_vv_i8m1(vint8m1_t vs2, vint8m1_t vs1, size_t vl); // vadd.vv vd, vs2, vs1 ``` +### riscv_intrinsic.h + +This file is universal intrinsic header file for all extensions, each extension +could have their own header files, but should included in this file if +corresponding extension is enabled. + +This header file also defined several common RISC-V specific type and related +marco could be used in intrinsic interface or user program directly. + +| Type Name | Meaning | +| --------------------- | ------------------------------------ | +| int_xlen_t | Signed integer type with XLEN bits | +| uint_xlen_t | Unsigned integer type with XLEN bits | + +| Macro Name | Value | +| --------------------- | ------------------------------------ | +| INT_XLEN_MAX | Minimum value of int_xlen_t | +| INT_XLEN_MIN | Minimum value of int_xlen_t | +| UINT_XLEN_MAX | Maximum value of uint_xlen_t | +| UINT_XLEN_MIN | Minimum value of uint_xlen_t | + ## Constraints on Operands of Inline Assembly Statements This section lists operand constraints that can be used with inline assembly From 39cad30e3da735bac612d93bfae3576e3640a1cc Mon Sep 17 00:00:00 2001 From: Kito Cheng Date: Fri, 11 Dec 2020 13:59:02 +0800 Subject: [PATCH 2/4] Apply suggestions from Nick Knight Co-authored-by: Nick Knight --- riscv-c-api.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/riscv-c-api.md b/riscv-c-api.md index 560da46..188afeb 100644 --- a/riscv-c-api.md +++ b/riscv-c-api.md @@ -246,12 +246,12 @@ marco could be used in intrinsic interface or user program directly. | Type Name | Meaning | | --------------------- | ------------------------------------ | -| int_xlen_t | Signed integer type with XLEN bits | -| uint_xlen_t | Unsigned integer type with XLEN bits | +| int_xlen_t | Two's-complement signed integer type with exactly XLEN bits (no padding bits) | +| uint_xlen_t | Unsigned integer type with exactly XLEN bits (no padding bits) | | Macro Name | Value | | --------------------- | ------------------------------------ | -| INT_XLEN_MAX | Minimum value of int_xlen_t | +| INT_XLEN_MAX | Maximum value of int_xlen_t | | INT_XLEN_MIN | Minimum value of int_xlen_t | | UINT_XLEN_MAX | Maximum value of uint_xlen_t | | UINT_XLEN_MIN | Minimum value of uint_xlen_t | From a55483630aff9086ebd7f8badf24b78832a289ab Mon Sep 17 00:00:00 2001 From: Kito Cheng Date: Fri, 7 Jul 2023 19:47:03 +0800 Subject: [PATCH 3/4] Rename to riscv_int.h, add riscv prefix and full marco for fixed width integer --- riscv-c-api.md | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/riscv-c-api.md b/riscv-c-api.md index 188afeb..a4b7835 100644 --- a/riscv-c-api.md +++ b/riscv-c-api.md @@ -235,26 +235,33 @@ long __riscv_clmul (long a, long b); // clmul rd, rs1, rs2 vint8m1_t __riscv_vadd_vv_i8m1(vint8m1_t vs2, vint8m1_t vs1, size_t vl); // vadd.vv vd, vs2, vs1 ``` -### riscv_intrinsic.h +### riscv_int.h -This file is universal intrinsic header file for all extensions, each extension -could have their own header files, but should included in this file if -corresponding extension is enabled. - -This header file also defined several common RISC-V specific type and related +This header file defined several common RISC-V specific integer type and related marco could be used in intrinsic interface or user program directly. | Type Name | Meaning | | --------------------- | ------------------------------------ | -| int_xlen_t | Two's-complement signed integer type with exactly XLEN bits (no padding bits) | -| uint_xlen_t | Unsigned integer type with exactly XLEN bits (no padding bits) | +| __riscv_int_xlen_t | Two's-complement signed integer type with exactly XLEN bits (no padding bits) | +| __riscv_uint_xlen_t | Unsigned integer type with exactly XLEN bits (no padding bits) | | Macro Name | Value | | --------------------- | ------------------------------------ | -| INT_XLEN_MAX | Maximum value of int_xlen_t | -| INT_XLEN_MIN | Minimum value of int_xlen_t | -| UINT_XLEN_MAX | Maximum value of uint_xlen_t | -| UINT_XLEN_MIN | Minimum value of uint_xlen_t | +| __RISCV_INT_XLEN_MAX | Maximum value of int_xlen_t | +| __RISCV_INT_XLEN_MIN | Minimum value of int_xlen_t | +| __RISCV_UINT_XLEN_MAX | Maximum value of uint_xlen_t | +| __RISCV_PRIdXLEN | Expand to a string literal for use as a `d` print specificier for int_xlen_t/uint_xlen_t. | +| __RISCV_PRIiXLEN | Expand to a string literal for use as a `i` print specificier for int_xlen_t/uint_xlen_t. | +| __RISCV_PRIoXLEN | Expand to a string literal for use as a `o` print specificier for int_xlen_t/uint_xlen_t. | +| __RISCV_PRIuXLEN | Expand to a string literal for use as a `u` print specificier for int_xlen_t/uint_xlen_t. | +| __RISCV_PRIxXLEN | Expand to a string literal for use as a `x` print specificier for int_xlen_t/uint_xlen_t. | +| __RISCV_PRIXXLEN | Expand to a string literal for use as a `X` print specificier for int_xlen_t/uint_xlen_t. | +| __RISCV_SCNdXLEN | Expand to a string literal for use as a `d` scan specificier for int_xlen_t/uint_xlen_t. | +| __RISCV_SCNiXLEN | Expand to a string literal for use as a `i` scan specificier for int_xlen_t/uint_xlen_t. | +| __RISCV_SCNoXLEN | Expand to a string literal for use as a `o` scan specificier for int_xlen_t/uint_xlen_t. | +| __RISCV_SCNuXLEN | Expand to a string literal for use as a `u` scan specificier for int_xlen_t/uint_xlen_t. | +| __RISCV_SCNxXLEN | Expand to a string literal for use as a `x` scan specificier for int_xlen_t/uint_xlen_t. | + ## Constraints on Operands of Inline Assembly Statements From 30af6b9e854c5980cc7cce0f3c477599a38c7d0b Mon Sep 17 00:00:00 2001 From: Kito Cheng Date: Mon, 10 Jul 2023 11:03:30 +0800 Subject: [PATCH 4/4] Fix typo --- riscv-c-api.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/riscv-c-api.md b/riscv-c-api.md index a4b7835..8e5fb3d 100644 --- a/riscv-c-api.md +++ b/riscv-c-api.md @@ -238,7 +238,7 @@ vint8m1_t __riscv_vadd_vv_i8m1(vint8m1_t vs2, vint8m1_t vs1, size_t vl); // vadd ### riscv_int.h This header file defined several common RISC-V specific integer type and related -marco could be used in intrinsic interface or user program directly. +macro could be used in intrinsic interface or user program directly. | Type Name | Meaning | | --------------------- | ------------------------------------ | @@ -250,17 +250,17 @@ marco could be used in intrinsic interface or user program directly. | __RISCV_INT_XLEN_MAX | Maximum value of int_xlen_t | | __RISCV_INT_XLEN_MIN | Minimum value of int_xlen_t | | __RISCV_UINT_XLEN_MAX | Maximum value of uint_xlen_t | -| __RISCV_PRIdXLEN | Expand to a string literal for use as a `d` print specificier for int_xlen_t/uint_xlen_t. | -| __RISCV_PRIiXLEN | Expand to a string literal for use as a `i` print specificier for int_xlen_t/uint_xlen_t. | -| __RISCV_PRIoXLEN | Expand to a string literal for use as a `o` print specificier for int_xlen_t/uint_xlen_t. | -| __RISCV_PRIuXLEN | Expand to a string literal for use as a `u` print specificier for int_xlen_t/uint_xlen_t. | -| __RISCV_PRIxXLEN | Expand to a string literal for use as a `x` print specificier for int_xlen_t/uint_xlen_t. | -| __RISCV_PRIXXLEN | Expand to a string literal for use as a `X` print specificier for int_xlen_t/uint_xlen_t. | -| __RISCV_SCNdXLEN | Expand to a string literal for use as a `d` scan specificier for int_xlen_t/uint_xlen_t. | -| __RISCV_SCNiXLEN | Expand to a string literal for use as a `i` scan specificier for int_xlen_t/uint_xlen_t. | -| __RISCV_SCNoXLEN | Expand to a string literal for use as a `o` scan specificier for int_xlen_t/uint_xlen_t. | -| __RISCV_SCNuXLEN | Expand to a string literal for use as a `u` scan specificier for int_xlen_t/uint_xlen_t. | -| __RISCV_SCNxXLEN | Expand to a string literal for use as a `x` scan specificier for int_xlen_t/uint_xlen_t. | +| __RISCV_PRIdXLEN | Expand to a string literal for use as a `d` print specifier for int_xlen_t/uint_xlen_t. | +| __RISCV_PRIiXLEN | Expand to a string literal for use as a `i` print specifier for int_xlen_t/uint_xlen_t. | +| __RISCV_PRIoXLEN | Expand to a string literal for use as a `o` print specifier for int_xlen_t/uint_xlen_t. | +| __RISCV_PRIuXLEN | Expand to a string literal for use as a `u` print specifier for int_xlen_t/uint_xlen_t. | +| __RISCV_PRIxXLEN | Expand to a string literal for use as a `x` print specifier for int_xlen_t/uint_xlen_t. | +| __RISCV_PRIXXLEN | Expand to a string literal for use as a `X` print specifier for int_xlen_t/uint_xlen_t. | +| __RISCV_SCNdXLEN | Expand to a string literal for use as a `d` scan specifier for int_xlen_t/uint_xlen_t. | +| __RISCV_SCNiXLEN | Expand to a string literal for use as a `i` scan specifier for int_xlen_t/uint_xlen_t. | +| __RISCV_SCNoXLEN | Expand to a string literal for use as a `o` scan specifier for int_xlen_t/uint_xlen_t. | +| __RISCV_SCNuXLEN | Expand to a string literal for use as a `u` scan specifier for int_xlen_t/uint_xlen_t. | +| __RISCV_SCNxXLEN | Expand to a string literal for use as a `x` scan specifier for int_xlen_t/uint_xlen_t. | ## Constraints on Operands of Inline Assembly Statements