]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/dist: add -check-armv6k command to check for ARMv6K
authorShenghou Ma <minux@golang.org>
Wed, 30 Nov 2016 04:29:49 +0000 (23:29 -0500)
committerMinux Ma <minux@golang.org>
Thu, 1 Dec 2016 07:17:38 +0000 (07:17 +0000)
so that our release note can reference a simple command to check if
the processor implements ARMv6K or not.

Updates #17082.

Change-Id: I9ca52051e5517394a7cd6b778fb822c3ee435f84
Reviewed-on: https://go-review.googlesource.com/33686
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/dist/util.go
src/cmd/dist/util_gc.go
src/cmd/dist/util_gccgo.go
src/cmd/dist/vfp_arm.s
src/cmd/dist/vfp_default.s

index e2f22dfe44000de9f2a632850cf6cfa3615876de..511978f2f572ec383465578796cd32b5db057fcd 100644 (file)
@@ -393,6 +393,14 @@ func errprintf(format string, args ...interface{}) {
 func main() {
        os.Setenv("TERM", "dumb") // disable escape codes in clang errors
 
+       // provide -check-armv6k first, before checking for $GOROOT so that
+       // it is possible to run this check without having $GOROOT available.
+       if len(os.Args) > 1 && os.Args[1] == "-check-armv6k" {
+               useARMv6K() // might fail with SIGILL
+               println("ARMv6K supported.")
+               os.Exit(0)
+       }
+
        slash = string(filepath.Separator)
 
        gohostos = runtime.GOOS
index 6e099e5f9c70c2124ff265c22d3213aaf2283336..698beef704729180958e2032960d6681b43efa5f 100644 (file)
@@ -25,3 +25,8 @@ func useVFPv1()
 // useVFPv3 tries to execute one VFPv3 instruction on ARM.
 // It will crash the current process if VFPv3 is missing.
 func useVFPv3()
+
+// useARMv6K tries to run ARMv6K instructions on ARM.
+// It will crash the current process if it doesn't implement
+// ARMv6K or above.
+func useARMv6K()
index 5edb4734f9bb89afe8847d8dd8e1598fed84bec0..f9f01dc04874e0f0e294c800c9f060ac9cbcbd89 100644 (file)
@@ -22,3 +22,5 @@ func cansse2() bool { return C.supports_sse2() != 0 }
 func useVFPv1() {}
 
 func useVFPv3() {}
+
+func useARMv6K() {}
index c42b593aec4d3d534312ca0b78be1b47c98b5a4d..d571f8b82a2d39e6e9d1495bfb03af3c0aaa072f 100644 (file)
@@ -15,3 +15,12 @@ TEXT ·useVFPv1(SB),NOSPLIT,$0
 TEXT ·useVFPv3(SB),NOSPLIT,$0
        WORD $0xeeb70b00        // vmov.f64 d0, #112
        RET
+
+// try to run ARMv6K (or above) "ldrexd" instruction
+TEXT ·useARMv6K(SB),NOSPLIT,$32
+       MOVW R13, R2
+       BIC  $15, R13
+       WORD $0xe1bd0f9f        // ldrexd r0, r1, [sp]
+       WORD $0xf57ff01f        // clrex
+       MOVW R2, R13
+       RET
index 95ccbe3e44f2c2d2eb433c43ff645d00a1adaf05..84829beeff35742ab79ff67ed8714d9b37b830e5 100644 (file)
@@ -11,3 +11,6 @@ TEXT ·useVFPv1(SB),NOSPLIT,$0
 
 TEXT ·useVFPv3(SB),NOSPLIT,$0
        RET
+
+TEXT ·useARMv6K(SB),NOSPLIT,$0
+       RET