cpu_type=nvptx
c_target_objs="nvptx-c.o"
cxx_target_objs="nvptx-c.o"
+ extra_options="${extra_options} nvptx/nvptx-gen.opt"
;;
or1k*-*-*)
cpu_type=or1k
--- /dev/null
+#!/bin/sh
+
+# Copyright (C) 2022 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/>.
+
+style="$1"
+case $style in
+ opt)
+ ;;
+ c)
+ first=true
+ ;;
+ *)
+ echo "Unknown style: \"$style\""
+ exit 1
+ ;;
+esac
+
+( cat <<EOF
+Copyright (C) 2022 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/>.
+EOF
+) | while read line; do
+ case $style in
+ opt)
+ if [ "$line" = "" ]; then
+ echo ";"
+ else
+ echo "; $line"
+ fi
+ ;;
+ c)
+ if $first; then
+ echo "/* $line"
+ first=false
+ else
+ if [ "$line" = "" ]; then
+ echo
+ else
+ echo " $line"
+ fi
+ fi
+ ;;
+ esac
+done
+
+
+case $style in
+ c)
+ echo "*/"
+ ;;
+esac
--- /dev/null
+#!/bin/sh
+
+# Copyright (C) 2022 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/>.
+
+nvptx_sm_def="$1/nvptx-sm.def"
+gen_copyright_sh="$1/gen-copyright.sh"
+
+sms=$(grep ^NVPTX_SM $nvptx_sm_def | sed 's/.*(//;s/,.*//')
+
+cat <<EOF
+/* -*- buffer-read-only: t -*-
+ Generated automatically by gen-h.sh from nvptx-sm.def.
+*/
+EOF
+
+# Separator.
+echo
+
+. $gen_copyright_sh c
+
+# Separator.
+echo
+
+for sm in $sms; do
+ cat <<EOF
+#define TARGET_SM$sm (ptx_isa_option >= PTX_ISA_SM$sm)
+EOF
+done
--- /dev/null
+#!/bin/sh
+
+# Copyright (C) 2022 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/>.
+
+nvptx_sm_def="$1/nvptx-sm.def"
+gen_copyright_sh="$1/gen-copyright.sh"
+
+sms=$(grep ^NVPTX_SM $nvptx_sm_def | sed 's/.*(//;s/,.*//')
+
+last=
+for sm in $sms; do
+ last="$sm"
+done
+
+cat <<EOF
+; -*- buffer-read-only: t -*-
+; Generated automatically by gen-opt.sh from nvptx-sm.def.
+EOF
+
+# Separator.
+echo
+
+. $gen_copyright_sh opt
+
+# Separator.
+echo
+
+cat <<EOF
+Enum
+Name(ptx_isa) Type(int)
+Known PTX ISA versions (for use with the -misa= option):
+EOF
+
+# Separator.
+echo
+
+for sm in $sms; do
+ cat <<EOF
+EnumValue
+Enum(ptx_isa) String(sm_$sm) Value(PTX_ISA_SM$sm)
+EOF
+
+ if [ "$sm" == "$last" ]; then
+ # Don't end with trailing empty line.
+ continue
+ fi
+
+ # Separator.
+ echo
+done
--- /dev/null
+/* -*- buffer-read-only: t -*-
+ Generated automatically by gen-h.sh from nvptx-sm.def.
+*/
+
+/* Copyright (C) 2022 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/>.
+*/
+
+#define TARGET_SM30 (ptx_isa_option >= PTX_ISA_SM30)
+#define TARGET_SM35 (ptx_isa_option >= PTX_ISA_SM35)
+#define TARGET_SM53 (ptx_isa_option >= PTX_ISA_SM53)
+#define TARGET_SM70 (ptx_isa_option >= PTX_ISA_SM70)
+#define TARGET_SM75 (ptx_isa_option >= PTX_ISA_SM75)
+#define TARGET_SM80 (ptx_isa_option >= PTX_ISA_SM80)
--- /dev/null
+; -*- buffer-read-only: t -*-
+; Generated automatically by gen-opt.sh from nvptx-sm.def.
+
+; Copyright (C) 2022 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/>.
+
+Enum
+Name(ptx_isa) Type(int)
+Known PTX ISA versions (for use with the -misa= option):
+
+EnumValue
+Enum(ptx_isa) String(sm_30) Value(PTX_ISA_SM30)
+
+EnumValue
+Enum(ptx_isa) String(sm_35) Value(PTX_ISA_SM35)
+
+EnumValue
+Enum(ptx_isa) String(sm_53) Value(PTX_ISA_SM53)
+
+EnumValue
+Enum(ptx_isa) String(sm_70) Value(PTX_ISA_SM70)
+
+EnumValue
+Enum(ptx_isa) String(sm_75) Value(PTX_ISA_SM75)
+
+EnumValue
+Enum(ptx_isa) String(sm_80) Value(PTX_ISA_SM80)
#define Pmode (TARGET_ABI64 ? DImode : SImode)
#define STACK_SIZE_MODE Pmode
-#define TARGET_SM35 (ptx_isa_option >= PTX_ISA_SM35)
-#define TARGET_SM53 (ptx_isa_option >= PTX_ISA_SM53)
-#define TARGET_SM70 (ptx_isa_option >= PTX_ISA_SM70)
-#define TARGET_SM75 (ptx_isa_option >= PTX_ISA_SM75)
-#define TARGET_SM80 (ptx_isa_option >= PTX_ISA_SM80)
+#include "nvptx-gen.h"
#define TARGET_PTX_6_0 (ptx_version_option >= PTX_VERSION_6_0)
#define TARGET_PTX_6_3 (ptx_version_option >= PTX_VERSION_6_3)
Target Mask(GOMP)
Generate code for OpenMP offloading: enables -msoft-stack and -muniform-simt.
-Enum
-Name(ptx_isa) Type(int)
-Known PTX ISA versions (for use with the -misa= option):
-
-EnumValue
-Enum(ptx_isa) String(sm_30) Value(PTX_ISA_SM30)
-
-EnumValue
-Enum(ptx_isa) String(sm_35) Value(PTX_ISA_SM35)
-
-EnumValue
-Enum(ptx_isa) String(sm_53) Value(PTX_ISA_SM53)
-
-EnumValue
-Enum(ptx_isa) String(sm_70) Value(PTX_ISA_SM70)
-
-EnumValue
-Enum(ptx_isa) String(sm_75) Value(PTX_ISA_SM75)
-
-EnumValue
-Enum(ptx_isa) String(sm_80) Value(PTX_ISA_SM80)
-
; Default needs to be in sync with default in ASM_SPEC in nvptx.h.
misa=
Target RejectNegative ToLower Joined Enum(ptx_isa) Var(ptx_isa_option) Init(PTX_ISA_SM35)
+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
mkoffload.o collect-utils.o libcommon-target.a $(LIBIBERTY) $(LIBS)
+$(srcdir)/config/nvptx/nvptx.h: $(srcdir)/config/nvptx/nvptx-gen.h
+$(srcdir)/config/nvptx/nvptx-gen.h: s-nvptx-gen-h; @true
+s-nvptx-gen-h: $(srcdir)/config/nvptx/nvptx-sm.def
+ $(SHELL) $(srcdir)/config/nvptx/gen-h.sh "$(srcdir)/config/nvptx" \
+ > tmp-nvptx-gen.h
+ $(SHELL) $(srcdir)/../move-if-change \
+ tmp-nvptx-gen.h $(srcdir)/config/nvptx/nvptx-gen.h
+ $(STAMP) s-nvptx-gen-h
+
+$(srcdir)/config/nvptx/nvptx-gen.opt: s-nvptx-gen-opt; @true
+s-nvptx-gen-opt: $(srcdir)/config/nvptx/nvptx-sm.def
+ $(SHELL) $(srcdir)/config/nvptx/gen-opt.sh "$(srcdir)/config/nvptx" \
+ > tmp-nvptx-gen.opt
+ $(SHELL) $(srcdir)/../move-if-change \
+ tmp-nvptx-gen.opt $(srcdir)/config/nvptx/nvptx-gen.opt
+ $(STAMP) s-nvptx-gen-opt
+
MULTILIB_OPTIONS = mgomp