[1/3] sparc: build with -mvis on sparc32/sparcv9 and sparc64

Message ID 1470272940-22128-1-git-send-email-aurelien@aurel32.net
State New, archived
Headers

Commit Message

Aurelien Jarno Aug. 4, 2016, 1:08 a.m. UTC
  When building for sparc32/sparcv9 or sparc64, we assume that VIS
instructions are available and use them in the sparc specific assembly
code. However we do not tell GCC to use such instructions, resulting in
slightly suboptimal code.

Fix that by passing -Wa,-Av9a -mvis to GCC.

Changelog:
	* sysdeps/sparc/sparc32/sparcv9/Makefile (sysdep-CFLAGS): Add -mvis.
	* sysdeps/sparc/sparc64/Makefile (sysdep-CFLAGS): New. Define to
	-Wa,-Av9a -mvis.
---
 ChangeLog                              | 6 ++++++
 sysdeps/sparc/sparc32/sparcv9/Makefile | 2 +-
 sysdeps/sparc/sparc64/Makefile         | 2 ++
 3 files changed, 9 insertions(+), 1 deletion(-)
  

Comments

David Miller Aug. 4, 2016, 5:19 a.m. UTC | #1
From: Aurelien Jarno <aurelien@aurel32.net>
Date: Thu,  4 Aug 2016 03:08:58 +0200

> When building for sparc32/sparcv9 or sparc64, we assume that VIS
> instructions are available and use them in the sparc specific assembly
> code. However we do not tell GCC to use such instructions, resulting in
> slightly suboptimal code.
> 
> Fix that by passing -Wa,-Av9a -mvis to GCC.
> 
> Changelog:
> 	* sysdeps/sparc/sparc32/sparcv9/Makefile (sysdep-CFLAGS): Add -mvis.
> 	* sysdeps/sparc/sparc64/Makefile (sysdep-CFLAGS): New. Define to
> 	-Wa,-Av9a -mvis.

All three patches look great, please commit them and thanks for doing
this work.
  
Mike Frysinger Aug. 4, 2016, 11:29 a.m. UTC | #2
On 04 Aug 2016 03:08, Aurelien Jarno wrote:
> When building for sparc32/sparcv9 or sparc64, we assume that VIS
> instructions are available and use them in the sparc specific assembly
> code. However we do not tell GCC to use such instructions, resulting in
> slightly suboptimal code.
> 
> Fix that by passing -Wa,-Av9a -mvis to GCC.

does this address:
	https://sourceware.org/bugzilla/show_bug.cgi?id=19477

it also seems to imply that v9 is *not* supported, and if you want to
build for sparc64, you must have at least v9a ?  and that VIS is always
supported ?  glancing at some wiki history, it doesn't seem like a big
problem, but it is different from before.
-mike
  
Aurelien Jarno Aug. 4, 2016, 12:58 p.m. UTC | #3
On 2016-08-04 07:29, Mike Frysinger wrote:
> On 04 Aug 2016 03:08, Aurelien Jarno wrote:
> > When building for sparc32/sparcv9 or sparc64, we assume that VIS
> > instructions are available and use them in the sparc specific assembly
> > code. However we do not tell GCC to use such instructions, resulting in
> > slightly suboptimal code.
> > 
> > Fix that by passing -Wa,-Av9a -mvis to GCC.
> 
> does this address:
> 	https://sourceware.org/bugzilla/show_bug.cgi?id=19477

Depends what you mean by address. The issue will disappear for sure.
However the real issue seems to be a misconfiguration between binutils
and GCC. The GCC call doesn't force any specific architecture, so it
means GCC is configure to default to v9a, while binutils is configured
for v9.

> it also seems to imply that v9 is *not* supported, and if you want to
> build for sparc64, you must have at least v9a ?  and that VIS is always
> supported ?  glancing at some wiki history, it doesn't seem like a big
> problem, but it is different from before.

Yes we have v9a code for example in sparc/sparc64/memset.S for more than
17 years, so it means v9 is not support since at least that time. Now I
do wonder if pure v9 CPUs (ie v9 without VIS) have ever existed.

Aurelien
  
Aurelien Jarno Aug. 5, 2016, 8:36 p.m. UTC | #4
On 2016-08-03 22:19, David Miller wrote:
> From: Aurelien Jarno <aurelien@aurel32.net>
> Date: Thu,  4 Aug 2016 03:08:58 +0200
> 
> > When building for sparc32/sparcv9 or sparc64, we assume that VIS
> > instructions are available and use them in the sparc specific assembly
> > code. However we do not tell GCC to use such instructions, resulting in
> > slightly suboptimal code.
> > 
> > Fix that by passing -Wa,-Av9a -mvis to GCC.
> > 
> > Changelog:
> > 	* sysdeps/sparc/sparc32/sparcv9/Makefile (sysdep-CFLAGS): Add -mvis.
> > 	* sysdeps/sparc/sparc64/Makefile (sysdep-CFLAGS): New. Define to
> > 	-Wa,-Av9a -mvis.
> 
> All three patches look great, please commit them and thanks for doing
> this work.

Thanks for the review, I have just pushed the patches.
  

Patch

diff --git a/ChangeLog b/ChangeLog
index ac692dc..c3fe9fa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@ 
+2016-08-04  Aurelien Jarno  <aurelien@aurel32.net>
+
+	* sysdeps/sparc/sparc32/sparcv9/Makefile (sysdep-CFLAGS): Add -mvis.
+	* sysdeps/sparc/sparc64/Makefile (sysdep-CFLAGS): New. Define to
+	-Wa,-Av9a -mvis.
+
 2016-08-03  Joseph Myers  <joseph@codesourcery.com>
 
 	* bits/libc-header-start.h (__GLIBC_USE_IEC_60559_FUNCS_EXT): New
diff --git a/sysdeps/sparc/sparc32/sparcv9/Makefile b/sysdeps/sparc/sparc32/sparcv9/Makefile
index fefc742..08c5a96 100644
--- a/sysdeps/sparc/sparc32/sparcv9/Makefile
+++ b/sysdeps/sparc/sparc32/sparcv9/Makefile
@@ -1,4 +1,4 @@ 
-sysdep-CFLAGS += -mcpu=ultrasparc -Wa,-Av9a
+sysdep-CFLAGS += -mcpu=ultrasparc -Wa,-Av9a -mvis
 
 ifeq ($(have-as-vis3),yes)
 ASFLAGS-.o += -Wa,-Av9d
diff --git a/sysdeps/sparc/sparc64/Makefile b/sysdeps/sparc/sparc64/Makefile
index 3a12510..fbabf69 100644
--- a/sysdeps/sparc/sparc64/Makefile
+++ b/sysdeps/sparc/sparc64/Makefile
@@ -1,3 +1,5 @@ 
+sysdep-CFLAGS += -Wa,-Av9a -mvis
+
 ifeq ($(subdir),string)
 sysdep_routines += align-cpy
 endif