Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions include/fast_io_hosted/platforms/linux/aarch64.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ namespace fast_io

template <::std::size_t syscall_number, ::std::signed_integral return_value_type>
requires(1 < sizeof(return_value_type))
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#else
#error "system_call must be inlined"
#endif
inline return_value_type system_call() noexcept
{
register ::std::uint_least64_t x8 __asm__("x8") = syscall_number;
Expand All @@ -15,6 +20,11 @@ inline return_value_type system_call() noexcept

template <::std::size_t syscall_number, ::std::signed_integral return_value_type>
requires(1 < sizeof(return_value_type))
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#else
#error "system_call must be inlined"
#endif
inline return_value_type system_call(auto p1) noexcept
{
register ::std::uint_least64_t x8 __asm__("x8") = syscall_number;
Expand All @@ -24,6 +34,11 @@ inline return_value_type system_call(auto p1) noexcept
}

template <::std::size_t syscall_number>
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#else
#error "system_call must be inlined"
#endif
inline void system_call_no_return(auto p1) noexcept
{
register ::std::uint_least64_t x8 __asm__("x8") = syscall_number;
Expand All @@ -34,6 +49,11 @@ inline void system_call_no_return(auto p1) noexcept

template <::std::size_t syscall_number, ::std::signed_integral return_value_type>
requires(1 < sizeof(return_value_type))
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#else
#error "system_call must be inlined"
#endif
inline return_value_type system_call(auto p1, auto p2) noexcept
{
register ::std::uint_least64_t x8 __asm__("x8") = syscall_number;
Expand All @@ -45,6 +65,11 @@ inline return_value_type system_call(auto p1, auto p2) noexcept

template <::std::size_t syscall_number, ::std::signed_integral return_value_type>
requires(1 < sizeof(return_value_type))
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#else
#error "system_call must be inlined"
#endif
inline return_value_type system_call(auto p1, auto p2, auto p3) noexcept
{
register ::std::uint_least64_t x8 __asm__("x8") = syscall_number;
Expand All @@ -57,6 +82,11 @@ inline return_value_type system_call(auto p1, auto p2, auto p3) noexcept

template <::std::size_t syscall_number, ::std::signed_integral return_value_type>
requires(1 < sizeof(return_value_type))
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#else
#error "system_call must be inlined"
#endif
inline return_value_type system_call(auto p1, auto p2, auto p3, auto p4) noexcept
{
register ::std::uint_least64_t x8 __asm__("x8") = syscall_number;
Expand All @@ -70,6 +100,11 @@ inline return_value_type system_call(auto p1, auto p2, auto p3, auto p4) noexcep

template <::std::size_t syscall_number, ::std::signed_integral return_value_type>
requires(1 < sizeof(return_value_type))
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#else
#error "system_call must be inlined"
#endif
inline return_value_type system_call(auto p1, auto p2, auto p3, auto p4, auto p5) noexcept
{
register ::std::uint_least64_t x8 __asm__("x8") = syscall_number;
Expand All @@ -84,6 +119,11 @@ inline return_value_type system_call(auto p1, auto p2, auto p3, auto p4, auto p5

template <::std::size_t syscall_number, ::std::signed_integral return_value_type>
requires(1 < sizeof(return_value_type))
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#else
#error "system_call must be inlined"
#endif
inline return_value_type system_call(auto p1, auto p2, auto p3, auto p4, auto p5, auto p6) noexcept
{
register ::std::uint_least64_t x8 __asm__("x8") = syscall_number;
Expand Down
41 changes: 40 additions & 1 deletion include/fast_io_hosted/platforms/linux/amd64.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@

namespace fast_io
{

template <::std::size_t syscall_number, ::std::signed_integral return_value_type>
requires(1 < sizeof(return_value_type))
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#else
#error "system_call must be inlined"
#endif
inline return_value_type system_call() noexcept
{
return_value_type ret;
Expand All @@ -19,6 +23,11 @@ inline return_value_type system_call() noexcept

template <::std::size_t syscall_number, ::std::signed_integral return_value_type>
requires(1 < sizeof(return_value_type))
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#else
#error "system_call must be inlined"
#endif
inline return_value_type system_call(auto p1) noexcept
{
return_value_type ret;
Expand All @@ -31,6 +40,11 @@ inline return_value_type system_call(auto p1) noexcept
}

template <::std::size_t syscall_number>
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#else
#error "system_call must be inlined"
#endif
inline void system_call_no_return(auto p1) noexcept
{
::std::size_t ret;
Expand All @@ -44,6 +58,11 @@ inline void system_call_no_return(auto p1) noexcept

template <::std::size_t syscall_number, ::std::signed_integral return_value_type>
requires(1 < sizeof(return_value_type))
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#else
#error "system_call must be inlined"
#endif
inline return_value_type system_call(auto p1, auto p2) noexcept
{
return_value_type ret;
Expand All @@ -57,6 +76,11 @@ inline return_value_type system_call(auto p1, auto p2) noexcept

template <::std::size_t syscall_number, ::std::signed_integral return_value_type>
requires(1 < sizeof(return_value_type))
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#else
#error "system_call must be inlined"
#endif
inline return_value_type system_call(auto p1, auto p2, auto p3) noexcept
{
return_value_type ret;
Expand All @@ -70,6 +94,11 @@ inline return_value_type system_call(auto p1, auto p2, auto p3) noexcept

template <::std::size_t syscall_number, ::std::signed_integral return_value_type>
requires(1 < sizeof(return_value_type))
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#else
#error "system_call must be inlined"
#endif
inline return_value_type system_call(auto p1, auto p2, auto p3, auto p4) noexcept
{
return_value_type ret;
Expand All @@ -84,6 +113,11 @@ inline return_value_type system_call(auto p1, auto p2, auto p3, auto p4) noexcep

template <::std::size_t syscall_number, ::std::signed_integral return_value_type>
requires(1 < sizeof(return_value_type))
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#else
#error "system_call must be inlined"
#endif
inline return_value_type system_call(auto p1, auto p2, auto p3, auto p4, auto p5) noexcept
{
return_value_type ret;
Expand All @@ -99,6 +133,11 @@ inline return_value_type system_call(auto p1, auto p2, auto p3, auto p4, auto p5

template <::std::size_t syscall_number, ::std::signed_integral return_value_type>
requires(1 < sizeof(return_value_type))
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#else
#error "system_call must be inlined"
#endif
inline return_value_type system_call(auto p1, auto p2, auto p3, auto p4, auto p5, auto p6) noexcept
{
return_value_type ret;
Expand Down
10 changes: 10 additions & 0 deletions include/fast_io_hosted/platforms/linux/generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ namespace fast_io

template <::std::size_t syscall_number, ::std::signed_integral return_value_type, typename... Args>
requires(::std::is_trivially_copyable_v<Args> && ...)
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#else
#error "system_call must be inlined"
#endif
inline return_value_type system_call(Args... args) noexcept
{
long ret{::syscall(syscall_number, args...)};
Expand All @@ -18,6 +23,11 @@ inline return_value_type system_call(Args... args) noexcept
}

template <::std::size_t syscall_number>
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#else
#error "system_call must be inlined"
#endif
inline void system_call_no_return(auto p1) noexcept
{
::syscall(syscall_number, p1);
Expand Down
40 changes: 40 additions & 0 deletions include/fast_io_hosted/platforms/linux/loongarch64.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ namespace fast_io

template <::std::uint_least64_t syscall_number, ::std::signed_integral return_value_type>
requires(1 < sizeof(return_value_type))
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#else
#error "system_call must be inlined"
#endif
inline return_value_type system_call() noexcept
{
register ::std::uint_least64_t a7 __asm__("$a7") = syscall_number;
Expand All @@ -21,6 +26,11 @@ inline return_value_type system_call() noexcept

template <::std::uint_least64_t syscall_number, ::std::signed_integral return_value_type>
requires(1 < sizeof(return_value_type))
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#else
#error "system_call must be inlined"
#endif
inline return_value_type system_call(auto p1) noexcept
{
register ::std::uint_least64_t a7 __asm__("$a7") = syscall_number;
Expand All @@ -31,6 +41,11 @@ inline return_value_type system_call(auto p1) noexcept
}

template <::std::uint_least64_t syscall_number>
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#else
#error "system_call must be inlined"
#endif
inline void system_call_no_return(auto p1) noexcept
{
register ::std::uint_least64_t a7 __asm__("$a7") = syscall_number;
Expand All @@ -42,6 +57,11 @@ inline void system_call_no_return(auto p1) noexcept

template <::std::uint_least64_t syscall_number, ::std::signed_integral return_value_type>
requires(1 < sizeof(return_value_type))
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#else
#error "system_call must be inlined"
#endif
inline return_value_type system_call(auto p1, auto p2) noexcept
{
register ::std::uint_least64_t a7 __asm__("$a7") = syscall_number;
Expand All @@ -54,6 +74,11 @@ inline return_value_type system_call(auto p1, auto p2) noexcept

template <::std::uint_least64_t syscall_number, ::std::signed_integral return_value_type>
requires(1 < sizeof(return_value_type))
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#else
#error "system_call must be inlined"
#endif
inline return_value_type system_call(auto p1, auto p2, auto p3) noexcept
{
register ::std::uint_least64_t a7 __asm__("$a7") = syscall_number;
Expand All @@ -67,6 +92,11 @@ inline return_value_type system_call(auto p1, auto p2, auto p3) noexcept

template <::std::uint_least64_t syscall_number, ::std::signed_integral return_value_type>
requires(1 < sizeof(return_value_type))
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#else
#error "system_call must be inlined"
#endif
inline return_value_type system_call(auto p1, auto p2, auto p3, auto p4) noexcept
{
register ::std::uint_least64_t a7 __asm__("$a7") = syscall_number;
Expand All @@ -81,6 +111,11 @@ inline return_value_type system_call(auto p1, auto p2, auto p3, auto p4) noexcep

template <::std::uint_least64_t syscall_number, ::std::signed_integral return_value_type>
requires(1 < sizeof(return_value_type))
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#else
#error "system_call must be inlined"
#endif
inline return_value_type system_call(auto p1, auto p2, auto p3, auto p4, auto p5) noexcept
{
register ::std::uint_least64_t a7 __asm__("$a7") = syscall_number;
Expand All @@ -96,6 +131,11 @@ inline return_value_type system_call(auto p1, auto p2, auto p3, auto p4, auto p5

template <::std::uint_least64_t syscall_number, ::std::signed_integral return_value_type>
requires(1 < sizeof(return_value_type))
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#else
#error "system_call must be inlined"
#endif
inline return_value_type system_call(auto p1, auto p2, auto p3, auto p4, auto p5, auto p6) noexcept
{
register ::std::uint_least64_t a7 __asm__("$a7") = syscall_number;
Expand Down
Loading