Skip to content

Commit

Permalink
AArch64 LSE support.
Browse files Browse the repository at this point in the history
Add a new configure option, --enable-lse, which is only effective for
the AArch64 architecture. When used, most ck_pr_* atomics will use Large
System Extensions instructions as per the ARMv8.1 specification, rather
then LL/SC instruction pairs.
  • Loading branch information
akopytov committed Dec 7, 2016
1 parent dae84ba commit 5f1be5d
Show file tree
Hide file tree
Showing 5 changed files with 711 additions and 317 deletions.
15 changes: 15 additions & 0 deletions configure
Expand Up @@ -120,6 +120,7 @@ generate()
-e "s#@POINTER_PACK_ENABLE@#$POINTER_PACK_ENABLE#g" \
-e "s#@DISABLE_DOUBLE@#$DISABLE_DOUBLE#g" \
-e "s#@RTM_ENABLE@#$RTM_ENABLE#g" \
-e "s#@LSE_ENABLE@#$LSE_ENABLE#g" \
-e "s#@VMA_BITS@#$VMA_BITS_R#g" \
-e "s#@VMA_BITS_VALUE@#$VMA_BITS_VALUE_R#g" \
-e "s#@MM@#$MM#g" \
Expand Down Expand Up @@ -158,6 +159,7 @@ generate_stdout()
echo " VMA_BITS = $VMA_BITS"
echo " MEMORY_MODEL = $MM"
echo " RTM = $RTM_ENABLE"
echo " LSE = $LSE_ENABLE"
echo
echo "Headers will be installed in $HEADERS"
echo "Libraries will be installed in $LIBRARY"
Expand Down Expand Up @@ -193,6 +195,7 @@ for option; do
echo "The following options will affect generated code."
echo " --enable-pointer-packing Assumes address encoding is subset of pointer range"
echo " --enable-rtm Enable restricted transactional memory (power, x86_64)"
echo " --enable-lse Enable large system extensions (arm64)"
echo " --memory-model=N Specify memory model (currently tso, pso or rmo)"
echo " --vma-bits=N Specify valid number of VMA bits"
echo " --platform=N Force the platform type, instead of relying on autodetection"
Expand Down Expand Up @@ -237,6 +240,9 @@ for option; do
--enable-rtm)
RTM_ENABLE_SET="CK_MD_RTM_ENABLE"
;;
--enable-lse)
LSE_ENABLE_SET="CK_MD_LSE_ENABLE"
;;
--cores=*)
CORES=$value
;;
Expand Down Expand Up @@ -307,6 +313,7 @@ GZIP=${GZIP:-"gzip -c"}
POINTER_PACK_ENABLE=${POINTER_PACK_ENABLE:-"CK_MD_POINTER_PACK_DISABLE"}
DISABLE_DOUBLE=${DISABLE_DOUBLE:-"CK_PR_ENABLE_DOUBLE"}
RTM_ENABLE=${RTM_ENABLE_SET:-"CK_MD_RTM_DISABLE"}
LSE_ENABLE=${LSE_ENABLE_SET:-"CK_MD_LSE_DISABLE"}
VMA_BITS=${VMA_BITS:-"unknown"}

DCORES=2
Expand Down Expand Up @@ -364,19 +371,22 @@ fi
case $PLATFORM in
"macppc"|"Power Macintosh"|"powerpc")
RTM_ENABLE="CK_MD_RTM_DISABLE"
LSE_ENABLE="CK_MD_LSE_DISABLE"
MM="${MM:-"CK_MD_RMO"}"
PLATFORM=ppc
ENVIRONMENT=32
LDFLAGS="-m32 $LDFLAGS"
;;
"sun4u"|"sun4v"|"sparc64")
RTM_ENABLE="CK_MD_RTM_DISABLE"
LSE_ENABLE="CK_MD_LSE_DISABLE"
MM="${MM:-"CK_MD_TSO"}"
PLATFORM=sparcv9
ENVIRONMENT=64
LDFLAGS="-m64 $LDFLAGS"
;;
i386|i486|i586|i686|i586_i686|pentium*|athlon*|k5|k6|k6_2|k6_3)
LSE_ENABLE="CK_MD_LSE_DISABLE"
MM="${MM:-"CK_MD_TSO"}"
case $SYSTEM in
darwin)
Expand Down Expand Up @@ -423,13 +433,15 @@ case $PLATFORM in
esac
;;
"amd64"|"x86_64")
LSE_ENABLE="CK_MD_LSE_DISABLE"
PLATFORM=x86_64
ENVIRONMENT=64
LDFLAGS="-m64 $LDFLAGS"
MM="${MM:-"CK_MD_TSO"}"
;;
"i86pc")
RTM_ENABLE="CK_MD_RTM_DISABLE"
LSE_ENABLE="CK_MD_LSE_DISABLE"
MM="${MM:-"CK_MD_TSO"}"
if test -z "$ISA"; then ISA=`isainfo -n 2> /dev/null || echo i386` ; fi
case "$ISA" in
Expand All @@ -447,6 +459,7 @@ case $PLATFORM in
;;
"ppc64"|"ppc64le")
RTM_ENABLE="CK_MD_RTM_DISABLE"
LSE_ENABLE="CK_MD_LSE_DISABLE"
MM="${MM:-"CK_MD_RMO"}"
PLATFORM=ppc64
ENVIRONMENT=64
Expand All @@ -458,6 +471,7 @@ case $PLATFORM in
CFLAGS="$CFLAGS -march=armv7-a";
fi
RTM_ENABLE="CK_MD_RTM_DISABLE"
LSE_ENABLE="CK_MD_LSE_DISABLE"
MM="${MM:-"CK_MD_RMO"}"
PLATFORM=arm
ENVIRONMENT=32
Expand All @@ -470,6 +484,7 @@ case $PLATFORM in
;;
*)
RTM_ENABLE="CK_MD_RTM_DISABLE"
LSE_ENABLE="CK_MD_LSE_DISABLE"
PLATFORM=
MM="${MM:-"CK_MD_RMO"}"
;;
Expand Down
4 changes: 4 additions & 0 deletions include/ck_md.h.in
Expand Up @@ -39,6 +39,10 @@
#define @RTM_ENABLE@
#endif /* @RTM_ENABLE@ */

#ifndef @LSE_ENABLE@
#define @LSE_ENABLE@
#endif /* @LSE_ENABLE@ */

#ifndef @POINTER_PACK_ENABLE@
#define @POINTER_PACK_ENABLE@
#endif /* @POINTER_PACK_ENABLE@ */
Expand Down

0 comments on commit 5f1be5d

Please sign in to comment.