Skip to content

Commit

Permalink
Import gcc-ve-7.1.0-6
Browse files Browse the repository at this point in the history
  • Loading branch information
veos-sxarr committed Feb 19, 2021
1 parent f9105a3 commit 5d6038e
Show file tree
Hide file tree
Showing 32 changed files with 10,377 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
*.{c,C,cc,h} whitespace=indent-with-non-tab,space-before-tab,trailing-space
.gitignore export-ignore
.gitattributes export-ignore
66 changes: 66 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@

# gcc for VE

gcc for VE is developed based on gcc (the GNU Compiler Collection) version 7.1.0.
User can compile a program for Vector Engine by using this software.
Please read this document carefully before use.

##### What is VE

VE stands for Vector Engine which is vector processors of [SX-Aurora TSUBASA](https://www.nec.com/en/global/solutions/hpc/sx/index.html).


## Notice

1. This software needs binutils for VE. It is available on the [SX-Aurora
TSUBASA yum repository including SDK runtime](https://www.hpc.nec/repos/runtime/sdk/) for free.
2. This software can compile only C language.
- Only C compiler is available.
3. This software can't generate vector instructions.
4. It is required to use ncc, nc++, or nfort which are compilers for SX-Aurora
TSUBASA to link objects compiled by ncc, nc++ or nfort.
5. This software is developed only for the purpose to build glibc for VE.
Please note that NEC verified only the functionality required for it.
6. NEC doesn't support this software as the SX-Aurora TSUBASA product software.
Please note that NEC is not obligated to respond if user sends a bug report.

## Known Issues

1. A binary may malfunction when optimize options are enabled. In such case,
use '-O0' option.
2. Gcc for VE is installed to /opt/nec/ve/bin/gcc.
When user set /opt/nec/ve/bin in $PATH before /usr/bin, /opt/nec/ve/bin/gcc
is invoked instead of /usr/bin/gcc.
- NEC MPI setup script adds /opt/nec/ve/bin into the head of $PATH. Therefore,
a build of VH side MPI program fails.
- A command expecting /usr/bin/gcc may invoke /opt/nec/ve/bin/gcc.

## Disclaimer

1. The contents of this document may change without prior notice.
2. NEC assumes no liability for any loss, including loss of earnings,
arising from the use of this software.
3. This software is not intended for use in medical, nuclear, aerospace, mass
transit or other applications where human life may be at stake or high
reliability is required, nor is it intended for use in controlling such
applications. We disclaim liability for any personal injury and property
damages caused by such use of this software.

## Installation

Please refer to [releases](https://github.com/veos-sxarr-NEC/gcc-ve/releases).

## License

Gcc for VE is distributed under the GNU General Public License, version 3.

## Bug Report and Sharing of Information

* [Issues](https://github.com/veos-sxarr-NEC/gcc-ve/issues) of this project
* [Aurora Web Forum](https://www.hpc.nec/forums/)






8 changes: 8 additions & 0 deletions config.sub
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ timestamp='2016-12-24'
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").

# Changes by NEC Corporation for the VE port, 2017-2021

# Please send patches to <[email protected]>.
#
Expand Down Expand Up @@ -1332,6 +1333,9 @@ case $basic_machine in
pmac | pmac-mpw)
basic_machine=powerpc-apple
;;
ve | ve-nec)
basic_machine=ve-nec
;;
*-unknown)
# Make sure to match an already-canonicalized machine name.
;;
Expand Down Expand Up @@ -1737,6 +1741,10 @@ case $basic_machine in
*-atari*)
os=-mint
;;
ve-nec)
os=-linux
vendor=nec
;;
*)
os=-none
;;
Expand Down
41 changes: 41 additions & 0 deletions gcc/common/config/ve/ve-common.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/* Common hooks for NEC VE.
Copyright (C) 1998-2017 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
/* Changes by NEC Corporation for the VE port, 2017-2021 */

#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "common/common-target.h"
#include "common/common-target-def.h"

/* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */
static const struct default_options ve_option_optimization_table[] =
{
{ OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 },
{ OPT_LEVELS_NONE, 0, NULL, 0 }
};

#undef TARGET_OPTION_OPTIMIZATION_TABLE
#define TARGET_OPTION_OPTIMIZATION_TABLE ve_option_optimization_table

#undef TARGET_EXCEPT_UNWIND_INFO
#define TARGET_EXCEPT_UNWIND_INFO sjlj_except_unwind_info

struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER;
8 changes: 8 additions & 0 deletions gcc/config.gcc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#along with GCC; see the file COPYING3. If not see
#<http://www.gnu.org/licenses/>.

# Changes by NEC Corporation for the VE port, 2017-2021

# This is the GCC target-specific configuration file
# where a configuration type is mapped to different system-specific
# definitions and files. This is invoked by the autoconf-generated
Expand Down Expand Up @@ -496,6 +498,9 @@ tilegx*-*-*)
tilepro*-*-*)
cpu_type=tilepro
;;
ve-*-*)
cpu_type=ve
;;
esac

tm_file=${cpu_type}/${cpu_type}.h
Expand Down Expand Up @@ -3043,6 +3048,9 @@ m32c-*-elf*)
c_target_objs="m32c-pragma.o"
cxx_target_objs="m32c-pragma.o"
;;
ve-*-*)
tm_file="${tm_file} ve/linux.h ve/ve-stdint.h"
;;
*)
echo "*** Configuration ${target} not supported" 1>&2
exit 1
Expand Down
94 changes: 94 additions & 0 deletions gcc/config/ve/constraints.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
;; Machine description for VE architecture.
;; Copyright (C) 2009-2016 Free Software Foundation, Inc.
;;
;; This file is part of GCC.
;;
;; GCC is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;;
;; GCC is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GCC; see the file COPYING3. If not see
;; <http://www.gnu.org/licenses/>.

;; Changes by NEC Corporation for the VE port, 2017-2021

;; Register constraints.
;(define_register_constraint "f" "S_REGS"
; "Single precision floating point registers. Same as r.")

(define_register_constraint "U" "QS_REGS"
"Upper quadruple floating point registers, that is, even number registers.")

;;;; Memory constraints
(define_memory_constraint "a"
"Memory address. Replaces 'm'"
(match_code "mem"))

;; Integer constant constraints.
(define_constraint "I"
"Integer constant in the range -64 @dots{} 63"
(and (match_code "const_int")
(match_test "IN_RANGE (ival, -64, 63)")))

(define_constraint "J"
"Integer constant in the range 0 @dots{} 31"
(and (match_code "const_int")
(match_test "IN_RANGE (ival, 0, 31)")))

(define_constraint "K"
"Integer constant in the range 0 @dots{} 63"
(and (match_code "const_int")
(match_test "IN_RANGE (ival, 0, 63)")))

(define_constraint "L"
"Integer constant in the range 0 @dots{} 127"
(and (match_code "const_int")
(match_test "IN_RANGE (ival, 0, 127)")))

(define_constraint "M"
"Integer constant of 64 bit M format"
(and (match_code "const_int")
(match_test "(ival & (ival+1)) == 0 ||
(~ival & (~ival +1)) ==0")))

(define_constraint "N"
"Integer constant of 32 bit"
(and (match_code "const_int")
(match_test "ival >= -2147483647LL-1
&& ival <= 2147483647LL")))

(define_constraint "O"
"Integer constant of signed 32 bit M format"
(and (match_code "const_int")
(match_test "(ival >= -2147483647LL-1 && ival <= 2147483647LL)
&& (( (ival & (ival + 1)) == 0)
|| (( ( 0xffffffffLL^(0xffffffffLL&ival))
& ((0xffffffffLL^(0xffffffffLL&ival)) +1) ) == 0))")))

(define_constraint "P"
"Integer constant of unsigned 32 bit M format"
(and (match_code "const_int")
(match_test "ival == 0 || ival == -1 || ival == 0xffffffff ||
((ival >= 0 && ival <= 2147483647LL)
&& ( (ival & (ival + 1)) == 0)) ")))


;; Floating-point constant constraints.
(define_constraint "G"
"The floating point zero constant"
(and (match_code "const_double")
(match_test "GET_MODE_CLASS (mode) == MODE_FLOAT
&& op == CONST0_RTX (mode)")))

(define_constraint "H"
"Any floating point constant"
(and (match_code "const_double")
(match_test "1")))

79 changes: 79 additions & 0 deletions gcc/config/ve/linux.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/* This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */

/* Definitions for NEC VE running Linux-based GNU systems with ELF format.
Changes by NEC Corporation for the VE port, 2018-2021 */

#undef LIB_SPEC
#define LIB_SPEC \
"%{pthread:-lpthread} \
%{shared:-lc} \
%{!shared:%{profile:-lc_p}%{!profile:-lc}}"

#ifdef ENABLE_SHARED_LIBGCC
#define SHARED_LIBGCC_SPEC " \
%{static|static-libgcc:-lgcc -lgcc_eh} \
%{!static: \
%{!static-libgcc: \
%{!shared: \
%{!shared-libgcc:-lgcc -lgcc_eh} \
%{shared-libgcc:-lgcc_s -lgcc} \
} \
%{shared:-lgcc_s -lgcc} \
} \
} "
#else
#define SHARED_LIBGCC_SPEC " -lgcc "
#endif

#undef REAL_LIBGCC_SPEC
#define REAL_LIBGCC_SPEC SHARED_LIBGCC_SPEC

#undef STARTFILE_SPEC
#if defined HAVE_LD_PIE
#define STARTFILE_SPEC \
"%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
#else
#define STARTFILE_SPEC \
"%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
#endif

#undef ENDFILE_SPEC
#define ENDFILE_SPEC \
"%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"

/* At the officeal release, the install path is changed to '/opt/nec/ve'. */
#define GLIBC_DYNAMIC_LINKER "/opt/nec/ve/lib/ld-linux-ve.so.1"

#undef MUSL_DYNAMIC_LINKER
#define MUSL_DYNAMIC_LINKER "/opt/nec/ve/musl/lib/ld-musl-ve.so.1"

#if DEFAULT_LIBC == LIBC_MUSL
#define GNU_USER_DYNAMIC_LINKER MUSL_DYNAMIC_LINKER
#else
#define GNU_USER_DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER
#endif

#undef LINK_SPEC
#define LINK_SPEC "\
%{shared:-shared} \
%{!shared: \
%{!static: \
%{rdynamic:-export-dynamic} \
-dynamic-linker " GNU_USER_DYNAMIC_LINKER "} \
%{static:-static}}"
Loading

0 comments on commit 5d6038e

Please sign in to comment.