Re: DMD 2.090.1: SIGILL, Illegal instruction on (ahem) intel Pentium III

2020-03-11 Thread Johan via Digitalmars-d-learn

On Wednesday, 11 March 2020 at 22:18:04 UTC, kdevel wrote:

On Thursday, 27 February 2020 at 19:24:39 UTC, Johan wrote:
LDC will work fine if told what processor you have: 
https://d.godbolt.org/z/5hrzgm

-m32 -mcpu=pentium3   (-mcpu=native should also work).


When I "cross compile" on an AMD 64 Bit machine for pentium3

   [AMD 64 bit] $ ldc2 -m32 -mcpu=pentium3 --linker=bfd vec.d


If you run
`ldc2 -m32 -mcpu=pentium3 --linker=bfd vec.d --output-s`
you should get file `vec.s` with the assembly that LDC generated. 
I'd be _very_ surprised if it contained SSE2 instructions (i.e. 
the "movsd xmm0" instruction).
Are you sure that the druntime you are linking with was also 
built with -m32 -mcpu=pentium3?


Thanks,
  Johan




Re: DMD 2.090.1: SIGILL, Illegal instruction on (ahem) intel Pentium III

2020-03-11 Thread kinke via Digitalmars-d-learn

On Wednesday, 11 March 2020 at 22:18:04 UTC, kdevel wrote:
Disassembly on the AMD 64 it reveals that ldc also emits the 
movds instructions:


   0x08051ba2 <+434>:	call   0x804f680 
<_D2rt5minfo11ModuleGroup6__ctorMFNbNcNiAyPS6object10ModuleInfoZSQCkQCkQCh>

   0x08051ba7 <+439>: sub$0x8,%esp
   0x08051baa <+442>: movsd  0x30(%esp),%xmm0
   0x08051bb0 <+448>: movsd  0x38(%esp),%xmm1


That's in druntime, not your cross-compiled code; you'll need to 
cross-compile druntime and Phobos first, see 
https://wiki.dlang.org/Building_LDC_runtime_libraries.


Re: DMD 2.090.1: SIGILL, Illegal instruction on (ahem) intel Pentium III

2020-03-11 Thread kdevel via Digitalmars-d-learn

On Thursday, 27 February 2020 at 19:24:39 UTC, Johan wrote:
LDC will work fine if told what processor you have: 
https://d.godbolt.org/z/5hrzgm

-m32 -mcpu=pentium3   (-mcpu=native should also work).


When I "cross compile" on an AMD 64 Bit machine for pentium3

   [AMD 64 bit] $ ldc2 -m32 -mcpu=pentium3 --linker=bfd vec.d

and execute the binary on the Pentium-III I get

   [PIII] $ gdb ./vec
   [...]
   This GDB was configured as "i586-suse-linux".
   For bug reporting instructions, please see:
   ...
   Dwarf Error: wrong version in compilation unit header (is 4, 
should be 2) [in module /[...]/tmp/vec]

   (gdb) r
   Starting program: /[...]/tmp/vec
   (no debugging symbols found)
   (no debugging symbols found)
   [Thread debugging using libthread_db enabled]

   Program received signal SIGILL, Illegal instruction.
   0x08051baa in ?? ()

Disassembly on the AMD 64 it reveals that ldc also emits the 
movds instructions:


   0x08051ba2 <+434>:	call   0x804f680 
<_D2rt5minfo11ModuleGroup6__ctorMFNbNcNiAyPS6object10ModuleInfoZSQCkQCkQCh>

   0x08051ba7 <+439>: sub$0x8,%esp
   0x08051baa <+442>: movsd  0x30(%esp),%xmm0
   0x08051bb0 <+448>: movsd  0x38(%esp),%xmm1


Re: DMD 2.090.1: SIGILL, Illegal instruction on (ahem) intel Pentium III

2020-02-27 Thread kdevel via Digitalmars-d-learn
On Thursday, 27 February 2020 at 18:07:40 UTC, Rainer Schuetze 
wrote:

"If this is an issue, please file a bug report."


Issue 20621 - Since DMD 2.087.0: 32 Bit Linux now uses XMM 
registers: SIGILL, Illegal instruction on intel Pentium III





Re: DMD 2.090.1: SIGILL, Illegal instruction on (ahem) intel Pentium III

2020-02-27 Thread Johan via Digitalmars-d-learn
On Thursday, 27 February 2020 at 18:07:40 UTC, Rainer Schuetze 
wrote:



On 27/02/2020 11:30, kdevel wrote:

On Thursday, 27 February 2020 at 07:44:57 UTC, Seb wrote:

On Thursday, 27 February 2020 at 00:36:49 UTC, kdevel wrote:


[...]


Program received signal SIGILL, Illegal instruction.


[...]

Does this exception relate to [1] and shall I file a bug or 
do I have to decommission my PIII?


[...]


I think so.


File a bug report?


Have you tried:
1) LDC on your machine?


Not yet.


2) the DMD version before this change?


2.086.1 good
2.087.0 bad



From the 2.087 changelog:

"32 Bit Linux now uses XMM registers for float and double 
rather than

the x87.
This should substantially speed up routine float and double 
processing.
SIMD vector operations, however, are still not support on 32 
bit Linux

code because of issues with 16 byte stack alignment.

This means that generated code will no longer work on older x86 
processors that do not have XMM registers. If this is an issue, 
please file a bug report."


Detail: the problem is not the absence of XMM (Pentium3 has SSE, 
hence has XMM registers), but that DMD is emitting an SSE2 
instruction (movsd).


LDC will work fine if told what processor you have: 
https://d.godbolt.org/z/5hrzgm

-m32 -mcpu=pentium3   (-mcpu=native should also work).

cheers,
  Johan





Re: DMD 2.090.1: SIGILL, Illegal instruction on (ahem) intel Pentium III

2020-02-27 Thread Rainer Schuetze via Digitalmars-d-learn



On 27/02/2020 11:30, kdevel wrote:
> On Thursday, 27 February 2020 at 07:44:57 UTC, Seb wrote:
>> On Thursday, 27 February 2020 at 00:36:49 UTC, kdevel wrote:
> 
> [...]
> 
>>> Program received signal SIGILL, Illegal instruction.
> 
> [...]
> 
>>> Does this exception relate to [1] and shall I file a bug or do I have
>>> to decommission my PIII?
> 
> [...]
> 
>> I think so.
> 
> File a bug report?
> 
>> Have you tried:
>> 1) LDC on your machine?
> 
> Not yet.
> 
>> 2) the DMD version before this change?
> 
> 2.086.1 good
> 2.087.0 bad
> 

>From the 2.087 changelog:

"32 Bit Linux now uses XMM registers for float and double rather than
the x87.
This should substantially speed up routine float and double processing.
SIMD vector operations, however, are still not support on 32 bit Linux
code because of issues with 16 byte stack alignment.

This means that generated code will no longer work on older x86
processors that do not have XMM registers. If this is an issue, please
file a bug report."


Re: DMD 2.090.1: SIGILL, Illegal instruction on (ahem) intel Pentium III

2020-02-27 Thread kdevel via Digitalmars-d-learn

On Thursday, 27 February 2020 at 07:44:57 UTC, Seb wrote:

On Thursday, 27 February 2020 at 00:36:49 UTC, kdevel wrote:


[...]


Program received signal SIGILL, Illegal instruction.


[...]

Does this exception relate to [1] and shall I file a bug or do 
I have to decommission my PIII?


[...]


I think so.


File a bug report?


Have you tried:
1) LDC on your machine?


Not yet.


2) the DMD version before this change?


2.086.1 good
2.087.0 bad



Re: DMD 2.090.1: SIGILL, Illegal instruction on (ahem) intel Pentium III

2020-02-26 Thread Seb via Digitalmars-d-learn

On Thursday, 27 February 2020 at 00:36:49 UTC, kdevel wrote:

```test.d
void main ()
{
   int [] v = new int [10];
}
```

$ [...]linux/bin32/dmd test
$ gdb test
[...]
(gdb) r
[...]
Program received signal SIGILL, Illegal instruction.
0x0809ad14 in 
_D2gc4impl12conservativeQw3Gcx10smallAllocMFNbkKkkxC8TypeInfoZPv ()

[...]
(gdb) disass
[...]
0x0809ad14 
<_D2gc4impl12conservativeQw3Gcx10smallAllocMFNbkKkkxC8TypeInfoZPv+172>:	movsd  -0x58(%ebp),%xmm0


Does this exception relate to [1] and shall I file a bug or do 
I have to decommission my PIII?


I think so.

Have you tried:
1) LDC on your machine?
2) the DMD version before this change?




DMD 2.090.1: SIGILL, Illegal instruction on (ahem) intel Pentium III

2020-02-26 Thread kdevel via Digitalmars-d-learn

```test.d
void main ()
{
   int [] v = new int [10];
}
```

$ [...]linux/bin32/dmd test
$ gdb test
[...]
(gdb) r
[...]
Program received signal SIGILL, Illegal instruction.
0x0809ad14 in 
_D2gc4impl12conservativeQw3Gcx10smallAllocMFNbkKkkxC8TypeInfoZPv 
()

[...]
(gdb) disass
[...]
0x0809ad14 
<_D2gc4impl12conservativeQw3Gcx10smallAllocMFNbkKkkxC8TypeInfoZPv+172>:	movsd  -0x58(%ebp),%xmm0


Does this exception relate to [1] and shall I file a bug or do I 
have to decommission my PIII?


Stefan

[1] https://dlang.org/changelog/2.087.0.html#xmm-linux-changelog