Skip to content

Add loongarch64 support #160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions src/libblastrampoline.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ __attribute__((always_inline)) inline uintptr_t get_forward_name_idx() {
asm("\t mv %0,t4" : "=r"(idx));
#elif defined(ARCH_x86_64)
asm("\t movq %%r10,%0" : "=r"(idx));
#elif defined(ARCH_loongarch64)
asm("\t move %0, $t8" : "=r"(idx));
#else
#error "Unrecognized ARCH for `get_forward_name_idx()`"
#endif
Expand Down
20 changes: 20 additions & 0 deletions src/trampolines/trampolines_loongarch64.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "common.h"
#include "../exported_funcs.inc"

#define SEP ;

#define XX(name, idx) \
.global MANGLE(UNDERSCORE(name)) SEP \
.cfi_startproc SEP \
.p2align 2 SEP \
MANGLE(UNDERSCORE(name))##: SEP \
li.d $t8, SYMBOL_IDX(idx) SEP \
la.pcrel $t3, NAMEADDR(name) SEP \
ld.d $t3, $t3, 0 SEP \
jr $t3 SEP \
amswap.w $zero, $zero, $zero SEP \
.cfi_endproc SEP \

// Generate both `dgemm_` and `dgemm_64_`
#include "ilp64_doubling.h"
#undef XX