Re: [Tinycc-devel] arm-asm: Test script

2021-01-05 Thread Michael Matz

Hello,

On Wed, 6 Jan 2021, Danny Milosavljevic wrote:


Hello,

On Wed, 6 Jan 2021 00:07:07 +0100 (CET)
Michael Matz  wrote:


Hmm, how can I get the name of the tcc executable to use for tests from
inside the shell script?  Do I just use ./tcc ?


Probably easiest to pass $(TCC) to the shell script as an argument I
guess.  It needs -B and -I flags to work correctly from uninstalled paths
and the Makefile sets that up correctly.


Does that mean I should use ${TCC} without quotes in the shell script?


No, it's currently not exported from make, so not available in the 
environment.  What I meant is something like this: extend the script to 
take an optional compiler-with-arguments argument, so that it can be 
called like:


% ./the-test-script.sh -c "../tcc -B.. -I.. -whatever-else"

and then use it with that argument in the makefile like so:

 snip 
mytarget: the-test-script.sh
./the-test-script.sh -c "$(TCC)"
 snap 


Do I need $(TCCFLAGS), too?


The Makevariable $(TCC) should contain everything that's needed.
Still, even the above might be overdesigning it a bit :)
(I see you also access the tcc-tok file directly, so that might further 
complicate things from the tests/ Makefile, so don't bother if that gets 
you into the rabbit hole too far)



Ciao,
Michael.

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] x86_64 tcc doesn't set sign bit on NaNs

2021-01-05 Thread Michael Matz

Hello,

On Wed, 6 Jan 2021, ian wrote:


Hi to all, and happy new year.

AFAIK neither -NaN nor +NaN have sense (how to put a sign at a 'not a
number' ).


To be precise, the sense isn't specified.  Like for the payload of IEEE 
NaNs you can give it any meaning you like, including none.  But if you 
regard unary minus as a non-arithmetic but algebraic operation (like 
recommended by IEEE) on an extension of the float numbers, it should do 
something to the (algebraic) sign.



For instance, in my own language NaN have no sign, but on the other hand I
use -Inf and +Inf :


That's completely fine.


It seems to me that using a sign bit on NaN is a design error.


Possibly.  But it's the more orthogonal choice with IEEE float (where 
simply all specified values have a sign).



Ciao,
Michael.



Regards to all, and best wishes.

ian

Le 05/01/2021 à 10:27, Vincent Lefevre a écrit :

On 2021-01-04 04:59:28 +0100, Michael Matz wrote:

Hello,

On Mon, 4 Jan 2021, Vincent Lefevre wrote:

-
#include 
#include 
#include 

int main(int argc, char **argv)
{
double d = strtod("-nan", NULL);
d = -d;
printf("%g, signbit(d) = %d\n", d, signbit(d));
return 0;
}
-

Results:

$ gcc foo.c -o foo && ./foo
-nan, signbit(d) = 1

$ tcc foo.c -o foo2 && ./foo2
nan, signbit(d) = 0

I get the same results as gcc with clang and pcc. tcc is the outlier.

AFAIK, the status of the sign bit of a NaN is unspecified, except
for some particular functions, but not strtod. So I don't see a
bug in tcc.

Note: for GCC, there's an inconsistency between your testcase
and the result.

Yeah, I think that's merely a typo in Arnolds email.  The inconsistency is
there, applying unary '-' to a NaN doesn't change the sign of it in TCC.

But my point is that with the above testcase, you cannot know whether
the difference between gcc and tcc comes from strtod (which would be
valid, as strtod doesn't specify the sign or NaN) or the "d = -d;"
(which would be invalid). A printf should have been added between
the strtod and the "d = -d;" to be sure.

--
-- sibian0...@gmail.com
-- Développeur compulsif

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] x86_64 tcc doesn't set sign bit on NaNs

2021-01-05 Thread ian
Hi to all, and *happy new year*.

AFAIK neither -NaN nor +NaN have sense (how to put a sign at a 'not a
number' ).

So, d=-d is a non-sense too.

For instance, in my own language NaN have no sign, but on the other hand
I use -Inf and +Inf :

? (/ -1 0)
-Inf.
? (/ 1 0)
+Inf.
? (* 0 (/ -1 0))
NaN


It seems to me that using a sign bit on NaN is a design error.

Regards to all, and best wishes.

*ian*

Le 05/01/2021 à 10:27, Vincent Lefevre a écrit :
> On 2021-01-04 04:59:28 +0100, Michael Matz wrote:
>> Hello,
>>
>> On Mon, 4 Jan 2021, Vincent Lefevre wrote:
>>
 -
 #include 
 #include 
 #include 

 int main(int argc, char **argv)
 {
double d = strtod("-nan", NULL);
d = -d;
printf("%g, signbit(d) = %d\n", d, signbit(d));
return 0;
 }
 -

 Results:

$ gcc foo.c -o foo && ./foo
-nan, signbit(d) = 1

$ tcc foo.c -o foo2 && ./foo2
nan, signbit(d) = 0

 I get the same results as gcc with clang and pcc. tcc is the outlier.
>>> AFAIK, the status of the sign bit of a NaN is unspecified, except
>>> for some particular functions, but not strtod. So I don't see a
>>> bug in tcc.
>>>
>>> Note: for GCC, there's an inconsistency between your testcase
>>> and the result.
>> Yeah, I think that's merely a typo in Arnolds email.  The inconsistency is
>> there, applying unary '-' to a NaN doesn't change the sign of it in TCC.
> But my point is that with the above testcase, you cannot know whether
> the difference between gcc and tcc comes from strtod (which would be
> valid, as strtod doesn't specify the sign or NaN) or the "d = -d;"
> (which would be invalid). A printf should have been added between
> the strtod and the "d = -d;" to be sure.
>
-- 
-- sibian0...@gmail.com
-- Développeur compulsif
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] arm-asm: Test script

2021-01-05 Thread Danny Milosavljevic
Hello,

On Wed, 6 Jan 2021 00:07:07 +0100 (CET)
Michael Matz  wrote:

> > Hmm, how can I get the name of the tcc executable to use for tests from 
> > inside the shell script?  Do I just use ./tcc ?  
> 
> Probably easiest to pass $(TCC) to the shell script as an argument I 
> guess.  It needs -B and -I flags to work correctly from uninstalled paths 
> and the Makefile sets that up correctly.

Does that mean I should use ${TCC} without quotes in the shell script?

Do I need $(TCCFLAGS), too?


pgpUdFPgXx6XE.pgp
Description: OpenPGP digital signature
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] NetBSD/aarch64 Unknown relocation type for got: 299

2021-01-05 Thread grischka

Herman ten Brugge via Tinycc-devel wrote:

I fixed this one also. But the problem is that below commits are gone.
This happended after te commit 'arm-asm: Implement branch to label


Hi Herman,

Would you consider to review the "text relocation for arm" commit,
eventually?

Such copy & paste portions not only look ugly but also make it more
difficult for other people to understand the structure and to make
changes if they want to.

Also a bit more explanation would be nice.  Does it introduce text
relocations or does it try to avoid them?  What is the benefit, under
what scenario, and is it desirable always or should it maybe depend
on a -fPIE switch or like that?

Thanks,

--- grischka


___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] x86_64 tcc doesn't set sign bit on NaNs

2021-01-05 Thread grischka

Michael Matz wrote:


So the current "-0.0-x" expansion of unary '-' needs a change.  It
turned out to be a bit uglier than I wished for, ...


Hm, yes, the more as on x87 using just 'fchs' could be so easy.
Anyway, I tried to make it look a bit less ugly:

https://repo.or.cz/tinycc.git/commitdiff/aeb8f427e2be133d6a0a67b695eb9579f5fa4232

-- grischka


... but alas, fixed in mob.

Thanks for the report, Arnold.



___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] arm-asm: Test script

2021-01-05 Thread Michael Matz

Hello,

On Tue, 5 Jan 2021, Danny Milosavljevic wrote:


Hi,

On Mon, 4 Jan 2021 05:05:40 +0100 (CET)
Michael Matz  wrote:


Yeah, put it into tests/ I'd say.


Ok, I've added it as tests/arm-asm-testsuite.sh .


 The x86 assembler also has a little
testfile in there that isn't used by default (as it shows a few
differences between GNU as and tcc; and needs updates from time to time
to cater to stricter versions of GNU as).



Maybe you can wire it into the
existing asmtest target when $(ARCH) is arm.


Hmm, how can I get the name of the tcc executable to use for tests from 
inside the shell script?  Do I just use ./tcc ?


Probably easiest to pass $(TCC) to the shell script as an argument I 
guess.  It needs -B and -I flags to work correctly from uninstalled paths 
and the Makefile sets that up correctly.



Ciao,
Michael.

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] recover commits on mob

2021-01-05 Thread Michael Matz

Hello,

On Tue, 5 Jan 2021, Danny Milosavljevic wrote:


On Tue, 5 Jan 2021 18:12:35 +
Ramsay Jones  wrote:


I just pushed a fix-up to the 'mob' branch to recover three
commits which had been 'overwritten' somehow. (Danny, did
you not see an error message when you tried to push?).


Thank you!

I've reconstructed what could have happened.

In the current tinycc-suggested workflow

 git push ssh://m...@repo.or.cz/srv/git/tinycc.git arm-asm:mob


Yeah, but you must have used -f somewhere.  Almost never a good idea when 
pushing to some remote :-)



Ciao,
Michael.

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] [PATCH 1/3] arm-asm: Implement branch to label

2021-01-05 Thread Michael Matz

Hello,

On Tue, 5 Jan 2021, Danny Milosavljevic wrote:


Some tests which cannot be automatically generated:

1.

__asm__(".a:\n\t"
   "mov r0, #1\n\t"
   "bne .a");

2.

__asm__("mov r0, #1\n\t"
   "bne L0\n\t"
   "L0:\n\t");

3.

__asm__("mov r1, #2\n\t"
   ".L0:\n\t"
   "mov r0, #1\n\t"
   "bne .L0");

So maybe we should have a directory with manual assembly tests, probably 
at least one for arm and one for x86.


What do you think?


Don't overcomplicate :)  Make it one file and add it as tests/asm-arm.c 
(or .s or .S).



Ciao,
Michael.

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] recover commits on mob

2021-01-05 Thread grischka

Danny Milosavljevic wrote:

So I think what happened is that one time I force-pushed and overwrote the mob
branch with a command like the one above (sorry).  It should have only affected
a tiny bit though since I rebase arm-asm on top of mob.


Do not use the -f option with push,  please.


In the future, I'll switch over to using this instead (while working
in the local "arm-asm" branch):
...
git merge arm-asm


No, do not push merge commits please.  If you look at it there are
(almost) no merge commits in the tinycc git history, and that is
intentional.

Just push your commits on top of the public mob branch.  You can
use any notation or procedure you prefer, as long as the result
is fast-forward of the remote branch and no merge commits.

Thanks,

-- gr


git push -u origin mob # the first time; later times just "git push".

That would make merges explicit and would thus be much safer.  Also, it's
how I use git elsewhere.

(I had never seen the foo:bar with URL push syntax before)


___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] [PATCH 1/3] arm-asm: Implement branch to label

2021-01-05 Thread Danny Milosavljevic
Some tests which cannot be automatically generated:

1.

__asm__(".a:\n\t"
"mov r0, #1\n\t"
"bne .a");

2.

__asm__("mov r0, #1\n\t"
"bne L0\n\t"
"L0:\n\t");

3.

__asm__("mov r1, #2\n\t"
".L0:\n\t"
"mov r0, #1\n\t"
"bne .L0");

So maybe we should have a directory with manual assembly tests, probably at
least one for arm and one for x86.

What do you think?


pgpMs1EjbttxD.pgp
Description: OpenPGP digital signature
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] recover commits on mob

2021-01-05 Thread Herman ten Brugge via Tinycc-devel

Oops. I should have said:

I reapplied the last 2 *missing* patches again.

Everything is fine now.

Thanks for the help.

    Herman

On 1/5/21 8:00 PM, Ramsay Jones wrote:


On 05/01/2021 18:48, Herman ten Brugge wrote:

I reapplied the last 2 patches again.

Oops, sorry did I mess-up? (I had the repo.or.cz website open
and, just before pushing, checked that no new commits had come
in - I also git a 'git fetch origin' just seconds before the
push!).

Sorry for the inconvenience!

ATB,
Ramsay Jones



___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] recover commits on mob

2021-01-05 Thread Ramsay Jones


On 05/01/2021 18:48, Herman ten Brugge wrote:
> I reapplied the last 2 patches again.

Oops, sorry did I mess-up? (I had the repo.or.cz website open
and, just before pushing, checked that no new commits had come
in - I also git a 'git fetch origin' just seconds before the
push!).

Sorry for the inconvenience!

ATB,
Ramsay Jones


___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] recover commits on mob

2021-01-05 Thread Herman ten Brugge via Tinycc-devel

I reapplied the last 2 patches again.

    Herman

On 1/5/21 7:35 PM, Danny Milosavljevic wrote:

Hi,

On Tue, 5 Jan 2021 18:12:35 +
Ramsay Jones  wrote:


I just pushed a fix-up to the 'mob' branch to recover three
commits which had been 'overwritten' somehow. (Danny, did
you not see an error message when you tried to push?).

Thank you!

I've reconstructed what could have happened.

In the current tinycc-suggested workflow

   git push ssh://m...@repo.or.cz/srv/git/tinycc.git arm-asm:mob

it turns out that the colon separates the local branch from the upstream branch,
so, here, it pushes my branch "arm-asm" as the upstream branch "mob" (WTF!).
That sounds dangerous.  Also, it is not what I thought that does.

So I think what happened is that one time I force-pushed and overwrote the mob
branch with a command like the one above (sorry).  It should have only affected
a tiny bit though since I rebase arm-asm on top of mob.

In the future, I'll switch over to using this instead (while working
in the local "arm-asm" branch):

git checkout mob
git pull --rebase

git checkout arm-asm
git rebase mob

git checkout mob
git merge arm-asm
git push -u origin mob # the first time; later times just "git push".

That would make merges explicit and would thus be much safer.  Also, it's
how I use git elsewhere.

(I had never seen the foo:bar with URL push syntax before)



___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] recover commits on mob

2021-01-05 Thread Danny Milosavljevic
Hi,

On Tue, 5 Jan 2021 18:12:35 +
Ramsay Jones  wrote:

> I just pushed a fix-up to the 'mob' branch to recover three
> commits which had been 'overwritten' somehow. (Danny, did
> you not see an error message when you tried to push?).

Thank you!

I've reconstructed what could have happened.

In the current tinycc-suggested workflow

  git push ssh://m...@repo.or.cz/srv/git/tinycc.git arm-asm:mob

it turns out that the colon separates the local branch from the upstream branch,
so, here, it pushes my branch "arm-asm" as the upstream branch "mob" (WTF!).
That sounds dangerous.  Also, it is not what I thought that does.

So I think what happened is that one time I force-pushed and overwrote the mob
branch with a command like the one above (sorry).  It should have only affected
a tiny bit though since I rebase arm-asm on top of mob.

In the future, I'll switch over to using this instead (while working
in the local "arm-asm" branch):

git checkout mob
git pull --rebase

git checkout arm-asm
git rebase mob

git checkout mob
git merge arm-asm
git push -u origin mob # the first time; later times just "git push".

That would make merges explicit and would thus be much safer.  Also, it's
how I use git elsewhere.

(I had never seen the foo:bar with URL push syntax before)


pgpMMIs1PiNuy.pgp
Description: OpenPGP digital signature
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


[Tinycc-devel] recover commits on mob

2021-01-05 Thread Ramsay Jones
Hi Herman, Danny,

I just pushed a fix-up to the 'mob' branch to recover three
commits which had been 'overwritten' somehow. (Danny, did
you not see an error message when you tried to push?).

ATB,
Ramsay Jones

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] NetBSD/aarch64 Unknown relocation type for got: 299

2021-01-05 Thread Herman ten Brugge via Tinycc-devel

Help,

Can you help me to recover the commits and give advice to Danny 
Milosavljevic

to use git correctly.

Thanks,

    Herman

On 1/5/21 2:40 PM, Danny Milosavljevic wrote:

Hi,

On Tue, 5 Jan 2021 07:25:33 +0100
Herman ten Brugge  wrote:


I fixed this one also. But the problem is that below commits are gone.
This happended after te commit 'arm-asm: Implement branch to label
'

The git workflow I'm using for this project is unusual for me--I'm not sure
I do the steps the right way.

I always work on the same local branch, "arm-asm".

To push changes, I do:

git checkout mob
git pull --rebase
git checkout arm-asm
git rebase mob
git push -f ssh://m...@repo.or.cz/srv/git/tinycc.git arm-asm:mob

The last form I've never used ever before anywhere else--and I use git every 
day.
But that's what the description in tinycc said.

Anyway, could be that the stuff above broke something, or not.  Just wanted to
make sure we can figure out what happened.

Should I instead create a new branch every time?

(Can I set the upstream link ("-u") so I don't have to do the last line with 
URL?
How would that look?)



___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] x86_64 tcc doesn't set sign bit on NaNs

2021-01-05 Thread arnold
Vincent Lefevre  wrote:

>
> But my point is that with the above testcase, you cannot know whether
> the difference between gcc and tcc comes from strtod (which would be
> valid, as strtod doesn't specify the sign or NaN) or the "d = -d;"
> (which would be invalid). A printf should have been added between
> the strtod and the "d = -d;" to be sure.

It was definitely the "d = -d".  Sorry I wasn't more clear.

Arnold

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] x86_64 tcc doesn't set sign bit on NaNs

2021-01-05 Thread Vincent Lefevre
On 2021-01-04 04:59:28 +0100, Michael Matz wrote:
> Hello,
> 
> On Mon, 4 Jan 2021, Vincent Lefevre wrote:
> 
> > > -
> > > #include 
> > > #include 
> > > #include 
> > > 
> > > int main(int argc, char **argv)
> > > {
> > >   double d = strtod("-nan", NULL);
> > >   d = -d;
> > >   printf("%g, signbit(d) = %d\n", d, signbit(d));
> > >   return 0;
> > > }
> > > -
> > > 
> > > Results:
> > > 
> > >   $ gcc foo.c -o foo && ./foo
> > >   -nan, signbit(d) = 1
> > > 
> > >   $ tcc foo.c -o foo2 && ./foo2
> > >   nan, signbit(d) = 0
> > > 
> > > I get the same results as gcc with clang and pcc. tcc is the outlier.
> > 
> > AFAIK, the status of the sign bit of a NaN is unspecified, except
> > for some particular functions, but not strtod. So I don't see a
> > bug in tcc.
> > 
> > Note: for GCC, there's an inconsistency between your testcase
> > and the result.
> 
> Yeah, I think that's merely a typo in Arnolds email.  The inconsistency is
> there, applying unary '-' to a NaN doesn't change the sign of it in TCC.

But my point is that with the above testcase, you cannot know whether
the difference between gcc and tcc comes from strtod (which would be
valid, as strtod doesn't specify the sign or NaN) or the "d = -d;"
(which would be invalid). A printf should have been added between
the strtod and the "d = -d;" to be sure.

-- 
Vincent Lefèvre  - Web: 
100% accessible validated (X)HTML - Blog: 
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel