Re: [committed] libphobos: Add power*-*-linux* as a supported target

2020-04-29 Thread Iain Buclaw via Gcc-patches
On 28/04/2020 19:12, Segher Boessenkool wrote:
> Hi!
> 
> On Sun, Apr 26, 2020 at 11:35:21AM +0200, Iain Buclaw wrote:
>> This patch adds power*-*-linux* as a supported target for libphobos.
> 
> Many thanks for doing this!
> 
> A problem though: libphobos/libdruntime is built for -m32 as well, but
> that builds libphobos/libdruntime/config/powerpc64/callwithstack.S,
> which cannot work (that file has all kinds of 64-bit only constructs and
> instructions in it).
> 

Yes, sadly I could not get --enable-multilib/multiarch to work properly
locally, so this one unfornately slipped though.

>> diff --git a/libphobos/configure b/libphobos/configure
>> index c2b49132fda..c923417532f 100755
>> --- a/libphobos/configure
>> +++ b/libphobos/configure
>> @@ -13991,9 +13991,10 @@ fi
>> ;;
>>mips*)   druntime_target_cpu_parsed="mips"
>> ;;
>> -  powerpc) druntime_target_cpu_parsed="powerpc"
>> +  powerpc|powerpcle)
>> +   druntime_target_cpu_parsed="powerpc"
>> ;;
>> -  powerpc64)
>> +  powerpc64|powerpc64le)
>> druntime_target_cpu_parsed="powerpc64"
>> ;;
>>i[34567]86|x86_64)
> 
> We are a biarch target, so both powerpc-* and powerpc64-* configurations
> can do both those configs (potentially, and the default for many configs).
> 

Fixed on master 2110-g8b53086ab6a

Iain.


Re: [committed] libphobos: Add power*-*-linux* as a supported target

2020-04-28 Thread Segher Boessenkool
Hi!

On Sun, Apr 26, 2020 at 11:35:21AM +0200, Iain Buclaw wrote:
> This patch adds power*-*-linux* as a supported target for libphobos.

Many thanks for doing this!

A problem though: libphobos/libdruntime is built for -m32 as well, but
that builds libphobos/libdruntime/config/powerpc64/callwithstack.S,
which cannot work (that file has all kinds of 64-bit only constructs and
instructions in it).

> diff --git a/libphobos/configure b/libphobos/configure
> index c2b49132fda..c923417532f 100755
> --- a/libphobos/configure
> +++ b/libphobos/configure
> @@ -13991,9 +13991,10 @@ fi
> ;;
>mips*)   druntime_target_cpu_parsed="mips"
> ;;
> -  powerpc) druntime_target_cpu_parsed="powerpc"
> +  powerpc|powerpcle)
> +   druntime_target_cpu_parsed="powerpc"
> ;;
> -  powerpc64)
> +  powerpc64|powerpc64le)
> druntime_target_cpu_parsed="powerpc64"
> ;;
>i[34567]86|x86_64)

We are a biarch target, so both powerpc-* and powerpc64-* configurations
can do both those configs (potentially, and the default for many configs).


Segher


[committed] libphobos: Add power*-*-linux* as a supported target

2020-04-26 Thread Iain Buclaw via Gcc-patches
Hi,

This patch adds power*-*-linux* as a supported target for libphobos.

As there is no support for IBM real (long double) types in the std.math
module, full phobos support has been switched off.  This is not needed
currently anyway in order to be able to bootstrap a self-hosted
front-end written in D.

Testsuite summaries from a native powerpc64le D compiler running inside
a QEMU/Docker container:

---
=== libphobos tests ===
WARNING: libphobos.allocations/tls_gc_integration.d execution test program 
timed out.
FAIL: libphobos.allocations/tls_gc_integration.d execution test
FAIL: libphobos.hash/test_hash.d execution test
FAIL: libphobos.thread/tlsgc_sections.d execution test
=== libphobos Summary ===
# of expected passes62
# of unexpected failures3
# of unsupported tests  1
 
=== gdc tests ===
FAIL: compilable/ctfe_math.d   output-exists ctfe_math.o
FAIL: compilable/ctfe_math.d -O2output-exists ctfe_math.o
FAIL: compilable/ctfe_math.d -freleaseoutput-exists ctfe_math.o
FAIL: compilable/ctfe_math.d -O2 -freleaseoutput-exists ctfe_math.o
FAIL: compilable/ctfe_math.d -goutput-exists ctfe_math.o
FAIL: compilable/ctfe_math.d -O2 -goutput-exists ctfe_math.o
FAIL: compilable/ctfe_math.d -frelease -goutput-exists ctfe_math.o
FAIL: compilable/ctfe_math.d -O2 -frelease -goutput-exists ctfe_math.o
WARNING: compilable/test15019.d -O2 -frelease   (test for excess errors) 
program timed out.
FAIL: compilable/test15019.d -O2 -freleaseoutput-exists test15019.o
WARNING: compilable/test15019.d -O2 -g   (test for excess errors) program timed 
out.
FAIL: compilable/test15019.d -O2 -goutput-exists test15019.o
WARNING: compilable/test15019.d -O2 -frelease -g   (test for excess errors) 
program timed out.
FAIL: compilable/test15019.d -O2 -frelease -goutput-exists test15019.o
WARNING: compilable/test15019.d -O2   (test for excess errors) program timed 
out.
FAIL: compilable/test15019.d -O2output-exists test15019.o
FAIL: compilable/test5227.d   output-exists test5227.o
=== gdc Summary ===
# of expected passes21181
# of unexpected failures13
# of unsupported tests  100
/build/gcc/gdc  version 10.0.1 20200425 (experimental) (GCC)
---

Of those that flagged up:

 * I have no immediate cause for concern on the timed out tests, as the
   QEMU interpreter can take a long time to run expensive tests.

 * I can only attribute the test_hash.d failure to QEMU, as it doesn't
   strike me as being anything else.

float f = 2.71;
ubyte* p = cast(ubyte*)
// 2.71 = 0
printf("%f = %d\n", *cast(float*)p, *cast(uint*)p);
uint p0 = cast(uint)p[0];
uint p1 = cast(uint)p[1] << 8;
uint p2 = cast(uint)p[2] << 16;
uint p3 = cast(uint)p[3] << 24;
// 1076719780
printf("%d\n", (p0|p1|p2|p3));
uint i = (p0|p1|p2|p3);
// 0
printf("%d\n", i);

* ctfe_math.d and test5227.d are already reported in PR d/89418.


Tested non-bootstrapped targets powerpc-linux-gnu, powerpc64-linux-gnu,
and powerpc64le-linux-gnu.  Committed to mainline.

Regards
Iain.

---
libphobos/ChangeLog:

* configure: Regenerate.
* configure.tgt: Add power*-*-linux* as a supported target, only
building libdruntime.
* m4/druntime/cpu.m4 (DRUNTIME_CPU_SOURCES): Add cases for powerpcle
and powerpc64le target cpus.
---
 libphobos/configure  | 5 +++--
 libphobos/configure.tgt  | 4 
 libphobos/m4/druntime/cpu.m4 | 5 +++--
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/libphobos/configure b/libphobos/configure
index c2b49132fda..c923417532f 100755
--- a/libphobos/configure
+++ b/libphobos/configure
@@ -13991,9 +13991,10 @@ fi
;;
   mips*)   druntime_target_cpu_parsed="mips"
;;
-  powerpc) druntime_target_cpu_parsed="powerpc"
+  powerpc|powerpcle)
+   druntime_target_cpu_parsed="powerpc"
;;
-  powerpc64)
+  powerpc64|powerpc64le)
druntime_target_cpu_parsed="powerpc64"
;;
   i[34567]86|x86_64)
diff --git a/libphobos/configure.tgt b/libphobos/configure.tgt
index 66082e36fad..ce4cc1f7527 100644
--- a/libphobos/configure.tgt
+++ b/libphobos/configure.tgt
@@ -33,6 +33,10 @@ case "${target}" in
   mips*-*-linux*)
LIBPHOBOS_SUPPORTED=yes
;;
+  power*-*-linux*)
+   LIBPHOBOS_SUPPORTED=yes
+   LIBDRUNTIME_ONLY=yes
+   ;;
   riscv*-*-linux*)
LIBPHOBOS_SUPPORTED=yes
;;
diff --git a/libphobos/m4/druntime/cpu.m4 b/libphobos/m4/druntime/cpu.m4
index 4887248fd09..6e88896ca66 100644
--- a/libphobos/m4/druntime/cpu.m4
+++ b/libphobos/m4/druntime/cpu.m4
@@ -17,9 +17,10 @@ AC_DEFUN([DRUNTIME_CPU_SOURCES],
;;
   mips*)   druntime_target_cpu_parsed="mips"
;;
-  powerpc) druntime_target_cpu_parsed="powerpc"
+  powerpc|powerpcle)
+