* [ptx] Fix sso tests
@ 2015-11-23 20:20 Nathan Sidwell
2015-11-23 20:45 ` Jeff Law
2015-11-24 8:20 ` Thomas Schwinge
0 siblings, 2 replies; 6+ messages in thread
From: Nathan Sidwell @ 2015-11-23 20:20 UTC (permalink / raw)
To: GCC Patches; +Cc: Bernd Schmidt
[-- Attachment #1: Type: text/plain, Size: 337 bytes --]
The gcc.dg/sso tests gratuitously fail on PTX because they use IO facilities
that don't exist there. This patch changes the dumping to use the putchar
function call (and not a macro), and not use fputs.
With this they all pass.
I'm not quite sure where the maintainer boundaries lie for this kind of fix.
Any objections?
nathan
[-- Attachment #2: trunk-sso.patch --]
[-- Type: text/x-patch, Size: 796 bytes --]
2015-11-23 Nathan Sidwell <nathan@acm.org>
* gcc.dg/sso/dump.h: Force IO to be putchar function call on nvptx.
Index: gcc/testsuite/gcc.dg/sso/dump.h
===================================================================
--- gcc/testsuite/gcc.dg/sso/dump.h (revision 230718)
+++ gcc/testsuite/gcc.dg/sso/dump.h (working copy)
@@ -1,3 +1,9 @@
+#ifdef __nvptx__
+/* Force function call. NVPTX's IO is extremely limited. */
+#undef putchar
+#define putchar (putchar)
+#endif
+
void dump (void *p, unsigned int len)
{
const char digits[17] = "0123456789abcdef";
@@ -14,7 +20,13 @@ void dump (void *p, unsigned int len)
void put (const char s[])
{
+#ifdef __nvptx__
+ int i;
+ for (i = 0; s[i]; i++)
+ putchar (s[i]);
+#else
fputs (s, stdout);
+#endif
}
void new_line (void)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ptx] Fix sso tests
2015-11-23 20:20 [ptx] Fix sso tests Nathan Sidwell
@ 2015-11-23 20:45 ` Jeff Law
2015-11-23 21:00 ` Nathan Sidwell
2015-11-24 8:20 ` Thomas Schwinge
1 sibling, 1 reply; 6+ messages in thread
From: Jeff Law @ 2015-11-23 20:45 UTC (permalink / raw)
To: Nathan Sidwell, GCC Patches; +Cc: Bernd Schmidt
On 11/23/2015 01:16 PM, Nathan Sidwell wrote:
> The gcc.dg/sso tests gratuitously fail on PTX because they use IO
> facilities that don't exist there. This patch changes the dumping to
> use the putchar function call (and not a macro), and not use fputs.
>
> With this they all pass.
>
> I'm not quite sure where the maintainer boundaries lie for this kind of
> fix. Any objections?
In the 'put' function, why not just make all targets go through putchar?
It's not like this is performance critical code and I don't think it
compromises any of the tests, does it?
jeff
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ptx] Fix sso tests
2015-11-23 20:45 ` Jeff Law
@ 2015-11-23 21:00 ` Nathan Sidwell
2015-11-24 5:38 ` Jeff Law
0 siblings, 1 reply; 6+ messages in thread
From: Nathan Sidwell @ 2015-11-23 21:00 UTC (permalink / raw)
To: Jeff Law, GCC Patches; +Cc: Bernd Schmidt
On 11/23/15 15:41, Jeff Law wrote:
> In the 'put' function, why not just make all targets go through putchar? It's
> not like this is performance critical code and I don't think it compromises any
> of the tests, does it?
I contemplated that, but wondered if someone would complain. I'm happy either way.
nathan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ptx] Fix sso tests
2015-11-23 21:00 ` Nathan Sidwell
@ 2015-11-24 5:38 ` Jeff Law
2015-11-24 14:03 ` Nathan Sidwell
0 siblings, 1 reply; 6+ messages in thread
From: Jeff Law @ 2015-11-24 5:38 UTC (permalink / raw)
To: Nathan Sidwell, GCC Patches; +Cc: Bernd Schmidt
On 11/23/2015 01:54 PM, Nathan Sidwell wrote:
> On 11/23/15 15:41, Jeff Law wrote:
>
>
>> In the 'put' function, why not just make all targets go through
>> putchar? It's not like this is performance critical code and I
>> don't think it compromises any of the tests, does it?
>
> I contemplated that, but wondered if someone would complain. I'm
> happy either way.
Let's go with a single codepath here. The one that ought to work for
all targets is putchar.
Thanks,
jeff
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ptx] Fix sso tests
2015-11-23 20:20 [ptx] Fix sso tests Nathan Sidwell
2015-11-23 20:45 ` Jeff Law
@ 2015-11-24 8:20 ` Thomas Schwinge
1 sibling, 0 replies; 6+ messages in thread
From: Thomas Schwinge @ 2015-11-24 8:20 UTC (permalink / raw)
To: Nathan Sidwell, Bernd Schmidt; +Cc: GCC Patches
[-- Attachment #1: Type: text/plain, Size: 935 bytes --]
Hi!
On Mon, 23 Nov 2015 15:16:12 -0500, Nathan Sidwell <nathan@acm.org> wrote:
> The gcc.dg/sso tests gratuitously fail on PTX because they use IO facilities
> that don't exist there. This patch changes the dumping to use the putchar
> function call (and not a macro), and not use fputs.
> void put (const char s[])
> {
> +#ifdef __nvptx__
> + int i;
> + for (i = 0; s[i]; i++)
> + putchar (s[i]);
> +#else
> fputs (s, stdout);
> +#endif
> }
Doesn't __builtin_printf work?
More generally, I've been wondering before, whether we should improve the
I/O support in nvptx' newlib. I suppose (but have not verified) that the
_stdout member of _REENT (struct _reent) will by default be initilized to
&__sf_fake_stdout (and similar for stderr), which we could detect in
nvptx I/O functions, and in such cases use the PTX printf function. Or
something along these lines.
Grüße
Thomas
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ptx] Fix sso tests
2015-11-24 5:38 ` Jeff Law
@ 2015-11-24 14:03 ` Nathan Sidwell
0 siblings, 0 replies; 6+ messages in thread
From: Nathan Sidwell @ 2015-11-24 14:03 UTC (permalink / raw)
To: Jeff Law, GCC Patches; +Cc: Bernd Schmidt
[-- Attachment #1: Type: text/plain, Size: 528 bytes --]
On 11/24/15 00:01, Jeff Law wrote:
> On 11/23/2015 01:54 PM, Nathan Sidwell wrote:
>> On 11/23/15 15:41, Jeff Law wrote:
>>
>>
>>> In the 'put' function, why not just make all targets go through
>>> putchar? It's not like this is performance critical code and I
>>> don't think it compromises any of the tests, does it?
>>
>> I contemplated that, but wondered if someone would complain. I'm
>> happy either way.
> Let's go with a single codepath here. The one that ought to work for all
> targets is putchar.
Done.
nathan
[-- Attachment #2: trunk-tests.patch --]
[-- Type: text/x-patch, Size: 734 bytes --]
2015-11-24 Nathan Sidwell <nathan@acm.org>
* gcc.dg/sso/dump.h: Force IO to be putchar function call on nvptx.
Index: gcc/testsuite/gcc.dg/sso/dump.h
===================================================================
--- gcc/testsuite/gcc.dg/sso/dump.h (revision 230809)
+++ gcc/testsuite/gcc.dg/sso/dump.h (working copy)
@@ -1,3 +1,8 @@
+#ifdef __nvptx__
+/* Force function call. NVPTX's IO is extremely limited. */
+#undef putchar
+#endif
+
void dump (void *p, unsigned int len)
{
const char digits[17] = "0123456789abcdef";
@@ -14,7 +19,9 @@ void dump (void *p, unsigned int len)
void put (const char s[])
{
- fputs (s, stdout);
+ int i;
+ for (i = 0; s[i]; i++)
+ putchar (s[i]);
}
void new_line (void)
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-11-24 13:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-23 20:20 [ptx] Fix sso tests Nathan Sidwell
2015-11-23 20:45 ` Jeff Law
2015-11-23 21:00 ` Nathan Sidwell
2015-11-24 5:38 ` Jeff Law
2015-11-24 14:03 ` Nathan Sidwell
2015-11-24 8:20 ` Thomas Schwinge
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).