[Libre-soc-org] [Bug 1005] write and submit grant request to nlnet for beginning adding compiler support for libre-soc

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Wed Feb 22 22:43:59 GMT 2023


https://bugs.libre-soc.org/show_bug.cgi?id=1005

--- Comment #4 from Jacob Lifshay <programmerjake at gmail.com> ---
(In reply to Jacob Lifshay from comment #3)
> i'm planning on this grant request including designing C/C++/Rust intrinsics
> (C++/Rust can use generics/templates on types and intrinsic functions, C we
> probably want something like the _Alignas keyword for types where it's a
> modifier on an existing type that also has const-expr arguments, intrinsic
> functions can be generic like tgmath.h)

for C types we discussed on irc (around linked location):
https://libre-soc.org/irclog/%23libre-soc.2023-02-21.log.html#t2023-02-21T10:32:16
that it would be good to have a header that defines ease-of-use macros:
// _SVP64_vec(MAXVL, [SUBVL]) changes a int, float, or pointer type into
// a vector with that type as the element type, and with the provided MAXVL
// and SUBVL (SUBVL defaults to 1) -- MAXVL and SUBVL are const expressions.
#ifndef NOSHORTMACROS // user can define if short macros conflict with their
code
// naming scheme follows rust types plus -x since they're short and
to-the-point
#define u64x(MAXVL, ...) uint64_t _SVP64_vec(MAXVL __VA_OPT__(,) __VA_ARGS__)
#define i64x(MAXVL, ...) int64_t _SVP64_vec(MAXVL __VA_OPT__(,) __VA_ARGS__)
#define f64x(MAXVL, ...) double _SVP64_vec(MAXVL __VA_OPT__(,) __VA_ARGS__)
#define u32x(MAXVL, ...) uint32_t _SVP64_vec(MAXVL __VA_OPT__(,) __VA_ARGS__)
#define i32x(MAXVL, ...) int32_t _SVP64_vec(MAXVL __VA_OPT__(,) __VA_ARGS__)
#define f32x(MAXVL, ...) float _SVP64_vec(MAXVL __VA_OPT__(,) __VA_ARGS__)
// ...
#define u8x(MAXVL, ...) uint8_t _SVP64_vec(MAXVL __VA_OPT__(,) __VA_ARGS__)
#define i8x(MAXVL, ...) int8_t _SVP64_vec(MAXVL __VA_OPT__(,) __VA_ARGS__)
#define usizex(MAXVL, ...) size_t _SVP64_vec(MAXVL __VA_OPT__(,) __VA_ARGS__)
#define isizex(MAXVL, ...) ptrdiff_t _SVP64_vec(MAXVL __VA_OPT__(,)
__VA_ARGS__)

// no macros for pointer element types, just use the _SVP64_vec keyword, e.g.:
// const struct node *_SVP64_vec(16, 2) my_node_ptr_vec;

// predicate mask vector type, compiles to integer bitmask and/or cr vectors
// masks don't have SUBVL
#define maskx(MAXVL) bool _SVP64_vec(MAXVL)
#endif
// long macros that won't conflict
#define _SVP64_u64x(MAXVL, ...) uint64_t _SVP64_vec(MAXVL __VA_OPT__(,)
__VA_ARGS__)
#define _SVP64_i64x(MAXVL, ...) int64_t _SVP64_vec(MAXVL __VA_OPT__(,)
__VA_ARGS__)
#define _SVP64_f64x(MAXVL, ...) double _SVP64_vec(MAXVL __VA_OPT__(,)
__VA_ARGS__)
#define _SVP64_u32x(MAXVL, ...) uint32_t _SVP64_vec(MAXVL __VA_OPT__(,)
__VA_ARGS__)
#define _SVP64_i32x(MAXVL, ...) int32_t _SVP64_vec(MAXVL __VA_OPT__(,)
__VA_ARGS__)
#define _SVP64_f32x(MAXVL, ...) float _SVP64_vec(MAXVL __VA_OPT__(,)
__VA_ARGS__)
// ...
#define _SVP64_u8x(MAXVL, ...) uint8_t _SVP64_vec(MAXVL __VA_OPT__(,)
__VA_ARGS__)
#define _SVP64_i8x(MAXVL, ...) int8_t _SVP64_vec(MAXVL __VA_OPT__(,)
__VA_ARGS__)
#define _SVP64_usizex(MAXVL, ...) size_t _SVP64_vec(MAXVL __VA_OPT__(,)
__VA_ARGS__)
#define _SVP64_isizex(MAXVL, ...) ptrdiff_t _SVP64_vec(MAXVL __VA_OPT__(,)
__VA_ARGS__)
#define _SVP64_maskx(MAXVL) bool _SVP64_vec(MAXVL)

there may also be additional types for a RVV/SVE-style vector compatibility
layer, where the compiler determines MAXVL -- imho this should be left for
later as it will be much more complex to implement due to needing to guess
register usage

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Libre-soc-org mailing list