diff mbox

[testsuite] Fix gcc.target/i386/avx512f-vrndscaless-2.c on Solaris 9/x86

Message ID ydda9e5sgn2.fsf@lokon.CeBiTec.Uni-Bielefeld.DE
State New
Headers show

Commit Message

Rainer Orth Feb. 5, 2014, 3:50 p.m. UTC
gcc.target/i386/avx512f-vrndscaless-2.c currently FAILs on Solaris 9/x86
with gas:

FAIL: gcc.target/i386/avx512f-vrndscaless-2.c (test for excess errors)
Excess errors:
/vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.target/i386/avx512f-vrndscaless-2.
c:21:14: warning: incompatible implicit declaration of built-in function 'floorf
' [enabled by default]
/vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.target/i386/avx512f-vrndscaless-2.
c:24:14: warning: incompatible implicit declaration of built-in function 'ceilf'
 [enabled by default]

The platform lacks C99 support, but this can easily be avoided by using
the builtins instead.  The following patch does just that; tested
with the appropriate runtest invocation on i386-pc-solaris2.9 and
x86_64-unknown-linux-gnu.

Ok for mainline?

	Rainer


2014-02-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* gcc.target/i386/avx512f-vrndscaless-2.c (compute_rndscaless):
	Use __builtin_floorf, __builtin_ceilf.

Comments

Uros Bizjak Feb. 5, 2014, 4:09 p.m. UTC | #1
On Wed, Feb 5, 2014 at 4:50 PM, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
> gcc.target/i386/avx512f-vrndscaless-2.c currently FAILs on Solaris 9/x86
> with gas:
>
> FAIL: gcc.target/i386/avx512f-vrndscaless-2.c (test for excess errors)
> Excess errors:
> /vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.target/i386/avx512f-vrndscaless-2.
> c:21:14: warning: incompatible implicit declaration of built-in function 'floorf
> ' [enabled by default]
> /vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.target/i386/avx512f-vrndscaless-2.
> c:24:14: warning: incompatible implicit declaration of built-in function 'ceilf'
>  [enabled by default]
>
> The platform lacks C99 support, but this can easily be avoided by using
> the builtins instead.  The following patch does just that; tested
> with the appropriate runtest invocation on i386-pc-solaris2.9 and
> x86_64-unknown-linux-gnu.

Let's solve this in the way sse4_1-floorf-vec.c solves it and simply add

extern float floorf (float);

after math.h include.

Does this work for you?

Uros.
Jakub Jelinek Feb. 5, 2014, 4:11 p.m. UTC | #2
On Wed, Feb 05, 2014 at 05:09:31PM +0100, Uros Bizjak wrote:
> On Wed, Feb 5, 2014 at 4:50 PM, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
> > gcc.target/i386/avx512f-vrndscaless-2.c currently FAILs on Solaris 9/x86
> > with gas:
> >
> > FAIL: gcc.target/i386/avx512f-vrndscaless-2.c (test for excess errors)
> > Excess errors:
> > /vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.target/i386/avx512f-vrndscaless-2.
> > c:21:14: warning: incompatible implicit declaration of built-in function 'floorf
> > ' [enabled by default]
> > /vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.target/i386/avx512f-vrndscaless-2.
> > c:24:14: warning: incompatible implicit declaration of built-in function 'ceilf'
> >  [enabled by default]
> >
> > The platform lacks C99 support, but this can easily be avoided by using
> > the builtins instead.  The following patch does just that; tested
> > with the appropriate runtest invocation on i386-pc-solaris2.9 and
> > x86_64-unknown-linux-gnu.
> 
> Let's solve this in the way sse4_1-floorf-vec.c solves it and simply add
> 
> extern float floorf (float);

Won't that break if math.h defines floorf as a macro?
You'd at least need then
extern float (floorf) (float);

	Jakub
Uros Bizjak Feb. 5, 2014, 4:19 p.m. UTC | #3
On Wed, Feb 5, 2014 at 5:11 PM, Jakub Jelinek <jakub@redhat.com> wrote:

>> > gcc.target/i386/avx512f-vrndscaless-2.c currently FAILs on Solaris 9/x86
>> > with gas:
>> >
>> > FAIL: gcc.target/i386/avx512f-vrndscaless-2.c (test for excess errors)
>> > Excess errors:
>> > /vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.target/i386/avx512f-vrndscaless-2.
>> > c:21:14: warning: incompatible implicit declaration of built-in function 'floorf
>> > ' [enabled by default]
>> > /vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.target/i386/avx512f-vrndscaless-2.
>> > c:24:14: warning: incompatible implicit declaration of built-in function 'ceilf'
>> >  [enabled by default]
>> >
>> > The platform lacks C99 support, but this can easily be avoided by using
>> > the builtins instead.  The following patch does just that; tested
>> > with the appropriate runtest invocation on i386-pc-solaris2.9 and
>> > x86_64-unknown-linux-gnu.
>>
>> Let's solve this in the way sse4_1-floorf-vec.c solves it and simply add
>>
>> extern float floorf (float);
>
> Won't that break if math.h defines floorf as a macro?
> You'd at least need then
> extern float (floorf) (float);

Looks like using builtins should be the correct way, so the original
patch is OK.

Rainer, can you please add the same cure to sse4_1-floor*.vec tests?

Thanks,
Uros.
Rainer Orth Feb. 5, 2014, 4:21 p.m. UTC | #4
Hi Uros,

> Let's solve this in the way sse4_1-floorf-vec.c solves it and simply add
>
> extern float floorf (float);
>
> after math.h include.
>
> Does this work for you?

it does, but only because the floorf call is optimized away at -O2.
While the Solaris 9 libm contains __floorf, there's no floorf, neither
in libm nor in headers.  The builtin route avoids those problems.

	Rainer
Rainer Orth Feb. 5, 2014, 4:22 p.m. UTC | #5
Uros Bizjak <ubizjak@gmail.com> writes:

> Looks like using builtins should be the correct way, so the original
> patch is OK.
>
> Rainer, can you please add the same cure to sse4_1-floor*.vec tests?

Sure, will do.

Thanks.
	Rainer
diff mbox

Patch

# HG changeset patch
# Parent c8a18ca98263f4a2ca4e3e723f9d2b4596b67207
Fix gcc.target/i386/avx512f-vrndscaless-2.c on Solaris 9/x86

diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vrndscaless-2.c b/gcc/testsuite/gcc.target/i386/avx512f-vrndscaless-2.c
--- a/gcc/testsuite/gcc.target/i386/avx512f-vrndscaless-2.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vrndscaless-2.c
@@ -18,10 +18,10 @@  compute_rndscaless (float *s1, float *s2
   switch (rc)
     {
     case _MM_FROUND_FLOOR:
-      r[0] = floorf (s2[0] * pow (2, m)) / pow (2, m);
+      r[0] = __builtin_floorf (s2[0] * pow (2, m)) / pow (2, m);
       break;
     case _MM_FROUND_CEIL:
-      r[0] = ceilf (s2[0] * pow (2, m)) / pow (2, m);
+      r[0] = __builtin_ceilf (s2[0] * pow (2, m)) / pow (2, m);
       break;
     default:
       abort ();