Hi Jakub and Matthias,

New overall patch attached. My commit access is pending so I'm relying on Martin
or someone else to get this committed for now.

Added replies inline:

On Thu, Jan 26, 2017 at 2:04 PM, Jakub Jelinek <ja...@redhat.com> wrote:
> Hi!
>
> On Thu, Jan 26, 2017 at 01:30:21PM +0200, Pekka Jääskeläinen wrote:
>> diff --git a/ChangeLog b/ChangeLog
>> index 9695f9d..6f4f256 100644
>> --- a/ChangeLog
>> +++ b/ChangeLog
>> @@ -1,3 +1,9 @@
>> +2017-01-26  Pekka J????skel??inen  <pekka.jaaskelai...@parmance.com>
>> +
>> +     * configure.ac: Added i[3456789]86-*-linux* as a supported env
>> +     for the BRIG FE.
>> +     * configure: Regenerated.
>> +
>>  2017-01-24  Pekka J????skel??inen <pe...@parmance.com>
>>           Martin Jambor  <mjam...@suse.cz>
>>
>
> It might be better if this isn't present directly in toplevel configure.
> Can you add libhsail-rt/configure.tgt and handle it in toplevel configure.ac
> similarly to libatomic, libcilkrts, liboffloadmic, libitm, libsanitizer,
> libvtv and libmpx, i.e. like:
> # Disable libhsail-rt on unsupported systems.
> if test -d ${srcdir}/libhsail-rt; then
>     if test x$enable_libhsail-rt = x; then
>         AC_MSG_CHECKING([for libhsail-rt support])
>         if (srcdir=${srcdir}/libhsail-rt; \
>                 . ${srcdir}/configure.tgt; \
>                 test -n "$UNSUPPORTED")
>         then
>             AC_MSG_RESULT([no])
>             unsupported_languages="$unsupported_languages brig"
>             # This implicitly disables also target-libhsail-rt as it won't
>             # get added to the build without BRIG FE.
>         else
>             AC_MSG_RESULT([yes])
>         fi
>     fi
> fi
> or so?

Done.

>> diff --git a/gcc/ChangeLog b/gcc/ChangeLog
>> index f485bb3..d481b25 100644
>> --- a/gcc/ChangeLog
>> +++ b/gcc/ChangeLog
>> @@ -1,3 +1,7 @@
>> +2017-01-26  Pekka J????skel??inen <pekka.jaaskelai...@parmance.com>
>
> 1) there should be 2 spaces rather than just one on each side of the name,
> so date two spaces name two spaces <mail@address>

Fixed.

> 2) when committing, please make sure the unicode characters in your
> name are actually valid UTF-8, not sure if it is my MUA or your or something
> in between, but I'm just seeing ???? and ??

I believe it's your MUA or something in between. The Scandinavian
letters in my patch look
correct in an editor with UTF-8 encoding on (my emacs seems to also
have utf-8 on by default).
However, I'm not obsessed with those obscure letters so I can write my
surname Jaaskelainen
if preferred (like it's written in the copyright lines).

>> --- a/gcc/brig/ChangeLog
>> +++ b/gcc/brig/ChangeLog
>> @@ -1,3 +1,7 @@
>> +2017-01-26  Pekka J????skel??inen <pekka.jaaskelai...@parmance.com>
>> +
>> +     Removed stale target-libbrig reference from config-lang.in
>> +
>>  2017-01-26  Jakub Jelinek  <ja...@redhat.com>
>>
>>       Update copyright years.
>> diff --git a/gcc/brig/config-lang.in b/gcc/brig/config-lang.in
>> index ab139b3..e390a16 100644
>> --- a/gcc/brig/config-lang.in
>> +++ b/gcc/brig/config-lang.in
>> @@ -28,7 +28,7 @@ language="brig"
>>
>>  compilers="brig1\$(exeext)"
>>
>> -target_libs="target-libbrig target-libhsail-rt"
>> +target_libs="target-libhsail-rt"
>
> If you are BRIG maintainer (but not listed yet in MAINTAINERS?), you can
> approve this yourself.

I added Martin and myself to MAINTAINERS for BRIG FE and libhsail-rt.

>> --- a/gcc/builtin-types.def
>> +++ b/gcc/builtin-types.def
>> @@ -70,7 +70,7 @@ DEF_PRIMITIVE_TYPE (BT_UINTMAX, uintmax_type_node)
>>  DEF_PRIMITIVE_TYPE (BT_INT8, signed_char_type_node)
>>  DEF_PRIMITIVE_TYPE (BT_INT16, short_integer_type_node)
>>  DEF_PRIMITIVE_TYPE (BT_UINT8, char_type_node)
>> -DEF_PRIMITIVE_TYPE (BT_UINT16, short_unsigned_type_node)
>> +DEF_PRIMITIVE_TYPE (BT_UINT16, uint16_type_node)
>>  DEF_PRIMITIVE_TYPE (BT_UINT32, uint32_type_node)
>>  DEF_PRIMITIVE_TYPE (BT_UINT64, uint64_type_node)
>>  DEF_PRIMITIVE_TYPE (BT_WORD, (*lang_hooks.types.type_for_mode) (word_mode, 
>> 1))
>
> This is ok for trunk.  Not sure about the INT8/INT16/UINT8 though,
> 1) char_type_node can be generally signed or unsigned, shouldn't that be
> unsigned_char_type_node instead?

True, fixed.

> 2) wonder what will happen on targets where char is 32-bit or similar.

I wondered it myself, and I'm pretty sure BRIG FE fails in that case.
I didn't want to add new fixed width type nodes for now as I thought
it's a bit too intrusive
at this point. If BRIG FE is ported to such a platform (BTW are there
such targets in gcc
now -- just curious?) this needs to be fixed and the target white
listed in the new configure.tgt.

>> --- a/libhsail-rt/ChangeLog
>> +++ b/libhsail-rt/ChangeLog
>> @@ -1,3 +1,7 @@
>> +2017-01-26  Pekka J????skel??inen <pekka.jaaskelai...@parmance.com>
>> +
>> +     * README: Added a proper description of what libhsail-rt is.
>> +
>>  2017-01-26  Jakub Jelinek  <ja...@redhat.com>
>>
>>       Update copyright years.
>> diff --git a/libhsail-rt/README b/libhsail-rt/README
>> index 2792253..64c2107 100644
>> --- a/libhsail-rt/README
>> +++ b/libhsail-rt/README
>> @@ -1,4 +1,10 @@
>> -Run autoconf2.64 && automake-1.11  to regenerate the buildfiles.
>> -You might need to manually tweak the minor automake version number
>> -in configure.ac and aclocal.m4 (search for 1.11.6) in case your
>> -local 1.11 minor version doesn't match.
>> \ No newline at end of file
>> +This library implements the agent-side runtime functionality required
>> +to run HSA finalized programs produced by the BRIG frontend.
>> +
>> +The library contains both the code required to run kernels on the agent
>> +and also functions implementing more complex HSAIL instructions.
>> +
>> +rt/workitems.c contains the runtime entry function that manages multiple
>> +work-item execution using fibers or simple for-loops (in case of work groups
>> +without barriers).  Otherwise, the rest of the source files mostly contain
>> +functions that typically map directly to HSAIL instructions.
>
> This looks good, but again, you should be able to commit without review if
> you are gcc/brig and libhsail-rt maintainer.

Thanks,
Pekka
diff --git a/ChangeLog b/ChangeLog
index 9695f9d..a52f925 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,15 @@
-2017-01-24  Pekka Jääskeläinen <pe...@parmance.com>
+2017-01-27  Pekka Jääskeläinen  <pekka.jaaskelai...@parmance.com>
+
+	* configure.ac: Moved the white list of enabling BRIG FE to
+	libhsail-rt/configure.tgt.
+
+2017-01-26  Pekka Jääskeläinen  <pekka.jaaskelai...@parmance.com>
+
+	* configure.ac: Added i[3456789]86-*-linux* as a supported env
+	for the BRIG FE.
+	* configure: Regenerated.
+
+2017-01-24  Pekka Jääskeläinen  <pe...@parmance.com>
 	    Martin Jambor  <mjam...@suse.cz>
 
 
diff --git a/MAINTAINERS b/MAINTAINERS
index 0a8f0cc..ca2b181 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -143,6 +143,8 @@ C front end/ISO C99	Joseph Myers		<jos...@codesourcery.com>
 C front end/ISO C99	Richard Henderson	<r...@redhat.com>
 Ada front end		Arnaud Charlet		<char...@adacore.com>
 Ada front end		Eric Botcazou		<ebotca...@libertysurf.fr>
+BRIG (HSAIL) front end	Pekka Jääskeläinen	<pekka.jaaskelai...@parmance.com>
+     	     	   	Martin Jambor		<mjam...@suse.cz>
 c++			Jason Merrill		<ja...@redhat.com>
 c++			Nathan Sidwell		<nat...@acm.org>
 go			Ian Lance Taylor	<i...@airs.com>
@@ -170,6 +172,8 @@ libobjc			Andrew Pinski		<pins...@gmail.com>
 libquadmath		Tobias Burnus		<bur...@net-b.de>
 libquadmath		Jakub Jelinek		<ja...@redhat.com>
 libvtv			Caroline Tice		<cmt...@google.com>
+libhsail-rt		Pekka Jääskeläinen	<pekka.jaaskelai...@parmance.com>
+			Martin Jambor		<mjam...@suse.cz>
 line map		Dodji Seketeli		<do...@redhat.com>
 soft-fp			Joseph Myers		<jos...@codesourcery.com>
 scheduler (+ haifa)	Jim Wilson		<wil...@tuliptree.org>
diff --git a/configure b/configure
index d757369..5a06f52 100755
--- a/configure
+++ b/configure
@@ -3304,6 +3304,26 @@ $as_echo "yes" >&6; }
     fi
 fi
 
+# Disable libhsail-rt on unsupported systems.
+if test -d ${srcdir}/libhsail-rt; then
+    if test x$enable_libhsail_rt = x; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libhsail-rt support" >&5
+$as_echo_n "checking for libhsail-rt support... " >&6; }
+        if (srcdir=${srcdir}/libhsail-rt; \
+                . ${srcdir}/configure.tgt; \
+                test -n "$UNSUPPORTED")
+        then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+            unsupported_languages="$unsupported_languages brig"
+            # This implicitly disables also target-libhsail-rt as it won't
+            # get added to the build without BRIG FE.
+        else
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+        fi
+    fi
+fi
 
 
 # Disable libquadmath for some systems.
@@ -3483,19 +3503,6 @@ if test x$enable_libgo = x; then
     esac
 fi
 
-# Disable the BRIG frontend and libhsail-rt on untested or known
-# broken systems. Currently it has been tested only on x86_64 Linux
-# of the upstream gcc targets. More targets shall be added after testing.
-case "${target}" in
-  x86_64-*-linux*)
-    ;;
-    *)
-    unsupported_languages="$unsupported_languages brig"
-    # This implicitly disables also target-libhsail-rt as it won't
-    # get added to the build without BRIG FE.
-    ;;
-esac
-
 # Default libgloss CPU subdirectory.
 libgloss_dir="$target_cpu"
 
diff --git a/configure.ac b/configure.ac
index 5818332..17a9f17 100644
--- a/configure.ac
+++ b/configure.ac
@@ -634,6 +634,23 @@ if test -d ${srcdir}/libmpx; then
     fi
 fi
 
+# Disable libhsail-rt on unsupported systems.
+if test -d ${srcdir}/libhsail-rt; then
+    if test x$enable_libhsail_rt = x; then
+        AC_MSG_CHECKING([for libhsail-rt support])
+        if (srcdir=${srcdir}/libhsail-rt; \
+                . ${srcdir}/configure.tgt; \
+                test -n "$UNSUPPORTED")
+        then
+            AC_MSG_RESULT([no])
+            unsupported_languages="$unsupported_languages brig"
+            # This implicitly disables also target-libhsail-rt as it won't
+            # get added to the build without BRIG FE.
+        else
+            AC_MSG_RESULT([yes])
+        fi
+    fi
+fi
 
 
 # Disable libquadmath for some systems.
@@ -813,19 +830,6 @@ if test x$enable_libgo = x; then
     esac
 fi
 
-# Disable the BRIG frontend and libhsail-rt on untested or known
-# broken systems. Currently it has been tested only on x86_64 Linux
-# of the upstream gcc targets. More targets shall be added after testing.
-case "${target}" in
-  x86_64-*-linux*)
-    ;;
-    *)
-    unsupported_languages="$unsupported_languages brig"
-    # This implicitly disables also target-libhsail-rt as it won't
-    # get added to the build without BRIG FE.
-    ;;
-esac
-
 # Default libgloss CPU subdirectory.
 libgloss_dir="$target_cpu"
 
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f485bb3..4a61361 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2017-01-27  Pekka Jääskeläinen  <pekka.jaaskelai...@parmance.com>
+
+	* builtin-types.def: Use unsigned_char_type_node for BT_UINT8.
+	* MAINTAINERS: Updated maintainers for BRIG FE and libhsail-rt.
+
+2017-01-26  Pekka Jääskeläinen  <pekka.jaaskelai...@parmance.com>
+
+	* builtin-types.def: Use uint16_type_node for BT_UINT16.
+
 2017-01-26  Jakub Jelinek  <ja...@redhat.com>
 
 	PR middle-end/79236
diff --git a/gcc/brig/ChangeLog b/gcc/brig/ChangeLog
index d947c5a..fe002fe 100644
--- a/gcc/brig/ChangeLog
+++ b/gcc/brig/ChangeLog
@@ -1,3 +1,7 @@
+2017-01-26  Pekka Jääskeläinen  <pekka.jaaskelai...@parmance.com>
+
+	Removed stale target-libbrig reference from config-lang.in
+
 2017-01-26  Jakub Jelinek  <ja...@redhat.com>
 
 	Update copyright years.
diff --git a/gcc/brig/config-lang.in b/gcc/brig/config-lang.in
index ab139b3..e390a16 100644
--- a/gcc/brig/config-lang.in
+++ b/gcc/brig/config-lang.in
@@ -28,7 +28,7 @@ language="brig"
 
 compilers="brig1\$(exeext)"
 
-target_libs="target-libbrig target-libhsail-rt"
+target_libs="target-libhsail-rt"
 
 # The BRIG frontend is written in C++, so we need to build the C++
 # compiler during stage 1.  Note: when cross-compiling / not bootstrapping,
diff --git a/gcc/builtin-types.def b/gcc/builtin-types.def
index ee6d052..ac98944 100644
--- a/gcc/builtin-types.def
+++ b/gcc/builtin-types.def
@@ -69,8 +69,8 @@ DEF_PRIMITIVE_TYPE (BT_INTMAX, intmax_type_node)
 DEF_PRIMITIVE_TYPE (BT_UINTMAX, uintmax_type_node)
 DEF_PRIMITIVE_TYPE (BT_INT8, signed_char_type_node)
 DEF_PRIMITIVE_TYPE (BT_INT16, short_integer_type_node)
-DEF_PRIMITIVE_TYPE (BT_UINT8, char_type_node)
-DEF_PRIMITIVE_TYPE (BT_UINT16, short_unsigned_type_node)
+DEF_PRIMITIVE_TYPE (BT_UINT8, unsigned_char_type_node)
+DEF_PRIMITIVE_TYPE (BT_UINT16, uint16_type_node)
 DEF_PRIMITIVE_TYPE (BT_UINT32, uint32_type_node)
 DEF_PRIMITIVE_TYPE (BT_UINT64, uint64_type_node)
 DEF_PRIMITIVE_TYPE (BT_WORD, (*lang_hooks.types.type_for_mode) (word_mode, 1))
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6a65a68..e4b79a9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -158,7 +158,7 @@
 	PR tree-optimization/79159
 	* g++.dg/tree-ssa/pr79159.C: New test.
 
-2017-01-24  Pekka Jääskeläinen <pe...@parmance.com>
+2017-01-24  Pekka Jääskeläinen  <pe...@parmance.com>
 	    Martin Jambor  <mjam...@suse.cz>
 
 	* lib/brig-dg.exp: New file.
diff --git a/include/ChangeLog b/include/ChangeLog
index 4c1879b..54cccc0 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,4 +1,4 @@
-2017-01-24  Pekka Jääskeläinen <pe...@parmance.com>
+2017-01-24  Pekka Jääskeläinen  <pe...@parmance.com>
 	    Martin Jambor  <mjam...@suse.cz>
 
 	* hsa.h: Moved here from libgomp/plugin/hsa.h.
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index be6a13a..f1cf7ed 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,4 +1,4 @@
-2017-01-24  Pekka Jääskeläinen <pe...@parmance.com>
+2017-01-24  Pekka Jääskeläinen  <pe...@parmance.com>
 	    Martin Jambor  <mjam...@suse.cz>
 
 	* plugin/hsa.h: Moved to top level include.
diff --git a/libhsail-rt/ChangeLog b/libhsail-rt/ChangeLog
index b986286..30bc404 100644
--- a/libhsail-rt/ChangeLog
+++ b/libhsail-rt/ChangeLog
@@ -1,3 +1,12 @@
+2017-01-26  Pekka Jääskeläinen  <pekka.jaaskelai...@parmance.com>
+
+	* configure.tgt: Moved the white list of supported targets here
+	from configure.ac.
+
+2017-01-26  Pekka Jääskeläinen  <pekka.jaaskelai...@parmance.com>
+
+	* README: Added a proper description of what libhsail-rt is.
+
 2017-01-26  Jakub Jelinek  <ja...@redhat.com>
 
 	Update copyright years.
diff --git a/libhsail-rt/README b/libhsail-rt/README
index 2792253..64c2107 100644
--- a/libhsail-rt/README
+++ b/libhsail-rt/README
@@ -1,4 +1,10 @@
-Run autoconf2.64 && automake-1.11  to regenerate the buildfiles.
-You might need to manually tweak the minor automake version number
-in configure.ac and aclocal.m4 (search for 1.11.6) in case your
-local 1.11 minor version doesn't match. 
\ No newline at end of file
+This library implements the agent-side runtime functionality required
+to run HSA finalized programs produced by the BRIG frontend.
+
+The library contains both the code required to run kernels on the agent
+and also functions implementing more complex HSAIL instructions.
+
+rt/workitems.c contains the runtime entry function that manages multiple
+work-item execution using fibers or simple for-loops (in case of work groups
+without barriers).  Otherwise, the rest of the source files mostly contain
+functions that typically map directly to HSAIL instructions.
diff --git a/libhsail-rt/configure.tgt b/libhsail-rt/configure.tgt
new file mode 100644
index 0000000..7c481ca
--- /dev/null
+++ b/libhsail-rt/configure.tgt
@@ -0,0 +1,38 @@
+# -*- shell-script -*-
+#  Copyright (C) 2012-2017 Free Software Foundation, Inc.
+#  Contributed by Pekka Jaaskelainen <pekka.jaaskelai...@parmance.com>
+#  for General Processor Tech.
+#
+#  This file is part of the libhsail-rt.
+#
+#  Permission is hereby granted, free of charge, to any person obtaining a
+#  copy of this software and associated documentation files
+#  (the "Software"), to deal in the Software without restriction, including
+#  without limitation the rights to use, copy, modify, merge, publish,
+#  distribute, sublicense, and/or sell copies of the Software, and to
+#  permit persons to whom the Software is furnished to do so, subject to
+#  the following conditions:
+#
+#  The above copyright notice and this permission notice shall be included
+#  in all copies or substantial portions of the Software.
+#
+#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+#  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+#  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+#  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+#  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+#  OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+#  USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+# Disable the BRIG frontend and libhsail-rt on untested or known
+# broken systems. Currently it has been tested only on x86_64 Linux
+# of the upstream gcc targets. More targets shall be added after testing.
+case "${target}" in
+  i[[3456789]]86-*linux*)
+    ;;
+  x86_64-*-linux*)
+    ;;
+    *)
+    UNSUPPORTED=1
+    ;;
+esac

Reply via email to