From a7e9e84716e2d39b1e7ea7f231334c88f2428260 Mon Sep 17 00:00:00 2001 From: "Ruixin(Peter) Bao" Date: Mon, 27 Apr 2020 09:51:01 -0400 Subject: [PATCH] math/big: simplify hasVX checking on s390x Originally, we use an assembly function that returns a boolean result to tell whether the machine has vector facility or not. It is now no longer needed when we can directly use cpu.S390X.HasVX variable. Change-Id: Ic1dae851982532bcfd9a9453416c112347f21d87 Reviewed-on: https://go-review.googlesource.com/c/go/+/230318 Reviewed-by: Michael Munday Run-TryBot: Michael Munday TryBot-Result: Gobot Gobot --- src/math/big/arith_decl_s390x.go | 5 +++-- src/math/big/arith_s390x.s | 22 ---------------------- 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/src/math/big/arith_decl_s390x.go b/src/math/big/arith_decl_s390x.go index 5973d3cfc1..f1a69e1df0 100644 --- a/src/math/big/arith_decl_s390x.go +++ b/src/math/big/arith_decl_s390x.go @@ -6,12 +6,13 @@ package big +import "internal/cpu" + func addVV_check(z, x, y []Word) (c Word) func addVV_vec(z, x, y []Word) (c Word) func addVV_novec(z, x, y []Word) (c Word) func subVV_check(z, x, y []Word) (c Word) func subVV_vec(z, x, y []Word) (c Word) func subVV_novec(z, x, y []Word) (c Word) -func hasVectorFacility() bool -var hasVX = hasVectorFacility() +var hasVX = cpu.S390X.HasVX diff --git a/src/math/big/arith_s390x.s b/src/math/big/arith_s390x.s index ef0192224f..4891768111 100644 --- a/src/math/big/arith_s390x.s +++ b/src/math/big/arith_s390x.s @@ -9,28 +9,6 @@ // This file provides fast assembly versions for the elementary // arithmetic operations on vectors implemented in arith.go. -TEXT ·hasVectorFacility(SB), NOSPLIT, $24-1 - MOVD $x-24(SP), R1 - XC $24, 0(R1), 0(R1) // clear the storage - MOVD $2, R0 // R0 is the number of double words stored -1 - WORD $0xB2B01000 // STFLE 0(R1) - XOR R0, R0 // reset the value of R0 - MOVBZ z-8(SP), R1 - AND $0x40, R1 - BEQ novector - -vectorinstalled: - // check if the vector instruction has been enabled - VLEIB $0, $0xF, V16 - VLGVB $0, V16, R1 - CMPBNE R1, $0xF, novector - MOVB $1, ret+0(FP) // have vx - RET - -novector: - MOVB $0, ret+0(FP) // no vx - RET - TEXT ·mulWW(SB), NOSPLIT, $0 MOVD x+0(FP), R3 MOVD y+8(FP), R4 -- 2.50.0