diff -Naur redis-4.0.14.org/deps/jemalloc/config.guess redis-4.0.14.sw/deps/jemalloc/config.guess
--- redis-4.0.14.org/deps/jemalloc/config.guess	2022-09-29 13:42:55.740000000 +0800
+++ redis-4.0.14.sw/deps/jemalloc/config.guess	2022-09-29 13:48:05.190000000 +0800
@@ -890,6 +890,14 @@
 	UNAME_MACHINE=aarch64_be
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
+    sw_64:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  sw)   UNAME_MACHINE=sw_64 ;;
+	esac
+	objdump --private-headers /bin/sh | grep -q ld.so.1
+	if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
+	echo ${UNAME_MACHINE}-sunway-linux-${LIBC}
+	exit ;;
     alpha:Linux:*:*)
 	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
 	  EV5)   UNAME_MACHINE=alphaev5 ;;
diff -Naur redis-4.0.14.org/deps/jemalloc/config.sub redis-4.0.14.sw/deps/jemalloc/config.sub
--- redis-4.0.14.org/deps/jemalloc/config.sub	2022-09-29 13:42:55.740000000 +0800
+++ redis-4.0.14.sw/deps/jemalloc/config.sub	2022-09-29 13:47:42.200000000 +0800
@@ -248,6 +248,7 @@
 	# Some are omitted here because they have special meanings below.
 	1750a | 580 \
 	| a29k \
+	| sw_64 \
 	| aarch64 | aarch64_be \
 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
@@ -366,6 +367,7 @@
 	# Recognize the basic CPU types with company name.
 	580-* \
 	| a29k-* \
+	| sw_64-* \
 	| aarch64-* | aarch64_be-* \
 	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
 	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
diff -Naur redis-4.0.14.org/deps/jemalloc/include/jemalloc/internal/jemalloc_internal.h.in redis-4.0.14.sw/deps/jemalloc/include/jemalloc/internal/jemalloc_internal.h.in
--- redis-4.0.14.org/deps/jemalloc/include/jemalloc/internal/jemalloc_internal.h.in	2022-09-29 13:42:55.720000000 +0800
+++ redis-4.0.14.sw/deps/jemalloc/include/jemalloc/internal/jemalloc_internal.h.in	2022-09-29 13:44:13.410000000 +0800
@@ -232,6 +232,9 @@
 #  ifdef __alpha__
 #    define LG_QUANTUM		4
 #  endif
+#  ifdef __sw_64__
+#    define LG_QUANTUM		4
+#  endif
 #  if (defined(__sparc64__) || defined(__sparcv9))
 #    define LG_QUANTUM		4
 #  endif
diff -Naur redis-4.0.14.org/src/config.h redis-4.0.14.sw/src/config.h
--- redis-4.0.14.org/src/config.h	2022-09-29 13:42:55.760000000 +0800
+++ redis-4.0.14.sw/src/config.h	2022-09-29 13:53:27.710000000 +0800
@@ -145,7 +145,8 @@
 #if defined(__i386__) || defined(__x86_64__) || defined(__amd64__) || \
    defined(vax) || defined(ns32000) || defined(sun386) || \
    defined(MIPSEL) || defined(_MIPSEL) || defined(BIT_ZERO_ON_RIGHT) || \
-   defined(__alpha__) || defined(__alpha)
+   defined(__alpha__) || defined(__alpha) || \
+   defined(__sw_64__) || defined(__sw_64) 
 #define BYTE_ORDER    LITTLE_ENDIAN
 #endif
 
@@ -215,6 +216,10 @@
 #define __arm64__
 #endif
 
+#if defined (__sw_64__)
+#define __sw_64__
+#endif
+
 /* Make sure we can test for SPARC just checking for __sparc__. */
 #if defined(__sparc) && !defined(__sparc__)
 #define __sparc__
