public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libgo: fix support for ia64
@ 2017-06-06 13:11 Andreas Schwab
  2017-06-07 18:13 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Schwab @ 2017-06-06 13:11 UTC (permalink / raw)
  To: gcc-patches

This adds support for ia64 in lfstack.

Andreas.

diff --git a/libgo/go/runtime/lfstack_64bit.go b/libgo/go/runtime/lfstack_64bit.go
index b314a3ba21..99dcec02de 100644
--- a/libgo/go/runtime/lfstack_64bit.go
+++ b/libgo/go/runtime/lfstack_64bit.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build amd64 arm64 mips64 mips64le ppc64 ppc64le s390x arm64be alpha mipsn64 sparc64
+// +build amd64 arm64 mips64 mips64le ppc64 ppc64le s390x arm64be alpha mipsn64 sparc64 ia64
 
 package runtime
 
@@ -38,12 +38,22 @@ const (
 	// room in the bottom for the count.
 	sparcLinuxAddrBits = 52
 	sparcLinuxCntBits  = 64 - sparcLinuxAddrBits + 3
+
+	// On IA64, the virtual address space is devided into 8 regions, with
+	// 52 address bits each (with 64k page size).
+	ia64AddrBits = 55
+	ia64CntBits = 64 - ia64AddrBits + 3
 )
 
 func lfstackPack(node *lfnode, cnt uintptr) uint64 {
 	if GOARCH == "sparc64" && GOOS == "linux" {
 		return uint64(uintptr(unsafe.Pointer(node)))<<(64-sparcLinuxAddrBits) | uint64(cnt&(1<<sparcLinuxCntBits-1))
 	}
+	if GOARCH == "ia64" {
+		// Top three bits are the region number
+		val := uint64(uintptr(unsafe.Pointer(node)))
+		return (val<<(64-ia64AddrBits))&(1<<(64-3)-1) | val&^(1<<(64-3)-1) | uint64(cnt&(1<<ia64CntBits-1))
+	}
 	return uint64(uintptr(unsafe.Pointer(node)))<<(64-addrBits) | uint64(cnt&(1<<cntBits-1))
 }
 
@@ -56,5 +66,8 @@ func lfstackUnpack(val uint64) *lfnode {
 	if GOARCH == "sparc64" && GOOS == "linux" {
 		return (*lfnode)(unsafe.Pointer(uintptr(int64(val) >> sparcLinuxCntBits << 3)))
 	}
+	if GOARCH == "ia64" {
+		return (*lfnode)(unsafe.Pointer(uintptr((val >> ia64CntBits << 3)&(1<<(64-3)-1) | val&^(1<<(64-3)-1))))
+	}
 	return (*lfnode)(unsafe.Pointer(uintptr(val >> cntBits << 3)))
 }
-- 
2.13.1


-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] libgo: fix support for ia64
  2017-06-06 13:11 [PATCH] libgo: fix support for ia64 Andreas Schwab
@ 2017-06-07 18:13 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2017-06-07 18:13 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: gcc-patches, gofrontend-dev

On Tue, Jun 6, 2017 at 6:11 AM, Andreas Schwab <schwab@suse.de> wrote:
> This adds support for ia64 in lfstack.

Thanks.

Committed to mainline.

Ian


> diff --git a/libgo/go/runtime/lfstack_64bit.go b/libgo/go/runtime/lfstack_64bit.go
> index b314a3ba21..99dcec02de 100644
> --- a/libgo/go/runtime/lfstack_64bit.go
> +++ b/libgo/go/runtime/lfstack_64bit.go
> @@ -2,7 +2,7 @@
>  // Use of this source code is governed by a BSD-style
>  // license that can be found in the LICENSE file.
>
> -// +build amd64 arm64 mips64 mips64le ppc64 ppc64le s390x arm64be alpha mipsn64 sparc64
> +// +build amd64 arm64 mips64 mips64le ppc64 ppc64le s390x arm64be alpha mipsn64 sparc64 ia64
>
>  package runtime
>
> @@ -38,12 +38,22 @@ const (
>         // room in the bottom for the count.
>         sparcLinuxAddrBits = 52
>         sparcLinuxCntBits  = 64 - sparcLinuxAddrBits + 3
> +
> +       // On IA64, the virtual address space is devided into 8 regions, with
> +       // 52 address bits each (with 64k page size).
> +       ia64AddrBits = 55
> +       ia64CntBits = 64 - ia64AddrBits + 3
>  )
>
>  func lfstackPack(node *lfnode, cnt uintptr) uint64 {
>         if GOARCH == "sparc64" && GOOS == "linux" {
>                 return uint64(uintptr(unsafe.Pointer(node)))<<(64-sparcLinuxAddrBits) | uint64(cnt&(1<<sparcLinuxCntBits-1))
>         }
> +       if GOARCH == "ia64" {
> +               // Top three bits are the region number
> +               val := uint64(uintptr(unsafe.Pointer(node)))
> +               return (val<<(64-ia64AddrBits))&(1<<(64-3)-1) | val&^(1<<(64-3)-1) | uint64(cnt&(1<<ia64CntBits-1))
> +       }
>         return uint64(uintptr(unsafe.Pointer(node)))<<(64-addrBits) | uint64(cnt&(1<<cntBits-1))
>  }
>
> @@ -56,5 +66,8 @@ func lfstackUnpack(val uint64) *lfnode {
>         if GOARCH == "sparc64" && GOOS == "linux" {
>                 return (*lfnode)(unsafe.Pointer(uintptr(int64(val) >> sparcLinuxCntBits << 3)))
>         }
> +       if GOARCH == "ia64" {
> +               return (*lfnode)(unsafe.Pointer(uintptr((val >> ia64CntBits << 3)&(1<<(64-3)-1) | val&^(1<<(64-3)-1))))
> +       }
>         return (*lfnode)(unsafe.Pointer(uintptr(val >> cntBits << 3)))
>  }
> --

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-07 18:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-06 13:11 [PATCH] libgo: fix support for ia64 Andreas Schwab
2017-06-07 18:13 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).