From ce0273b1366a16165e2b91dc0e24bacc1c64da51 Mon Sep 17 00:00:00 2001 From: Lin Runze Date: Tue, 19 Nov 2024 13:15:09 +0800 Subject: [PATCH] loongarch: Add SLJIT_UPPER_BITS_SIGN_EXTENDED Notice that in LoongArch V1.1 (LA664 and later), the SLJIT_UPPER_BITS_IGNORED should also be true, however due to a micro-architecture bug, 3A5000 (LA464) will needs the upper 32 bits of source register is sign extended while doing 32 bits division (e.g. div.w), otherwise it will output garbage result. See: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html Chapter 1.5.1 Item 7 --- sljit_src/sljitConfigInternal.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sljit_src/sljitConfigInternal.h b/sljit_src/sljitConfigInternal.h index 701bd4fc..3ae944ef 100644 --- a/sljit_src/sljitConfigInternal.h +++ b/sljit_src/sljitConfigInternal.h @@ -781,6 +781,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_sw sljit_exec_offset(void *code); #define SLJIT_LOCALS_OFFSET_BASE 0 #define SLJIT_MASKED_SHIFT 1 #define SLJIT_MASKED_SHIFT32 1 +#define SLJIT_UPPER_BITS_SIGN_EXTENDED 1 #elif (defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)