[Bug target/63260] [SH] fabs, fneg do not need fp-mode setting and do not use fpscr

2014-10-16 Thread olegendo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63260

--- Comment #9 from Oleg Endo  ---
Author: olegendo
Date: Thu Oct 16 12:32:24 2014
New Revision: 216317

URL: https://gcc.gnu.org/viewcvs?rev=216317&root=gcc&view=rev
Log:
gcc/testsuite/
PR target/63260
* gcc.target/sh/pr63260.c: Fix typo __builtin_fabs vs. __builtin_abs.

Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.target/sh/pr63260.c


[Bug target/63260] [SH] fabs, fneg do not need fp-mode setting and do not use fpscr

2014-10-13 Thread olegendo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63260

Oleg Endo  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED

--- Comment #8 from Oleg Endo  ---
Fixed for 5.0.


[Bug target/63260] [SH] fabs, fneg do not need fp-mode setting and do not use fpscr

2014-10-13 Thread olegendo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63260

--- Comment #7 from Oleg Endo  ---
Author: olegendo
Date: Tue Oct 14 00:50:18 2014
New Revision: 216173

URL: https://gcc.gnu.org/viewcvs?rev=216173&root=gcc&view=rev
Log:
gcc/
PR target/63260
* config/sh/sh.md (negsf2, negsf2_i, negdf2, negdf2_i, abssf2,
abssf2_i, absdf2, absdf2_i): Remove fp_mode attribute.  Remove use
of FPSCR.
(negsf2_i): Rename to *negsf2_i.
(abssf2_i): Rename to *abssf2_i.
(negdf2_i): Rename to *negdf2_i.
(absdf2_i): Rename to *absdf2_i.

gcc/testsuite/
PR target/63260
* gcc.target/sh/pr63260.c: New.

Added:
trunk/gcc/testsuite/gcc.target/sh/pr63260.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/sh/sh.md
trunk/gcc/testsuite/ChangeLog


[Bug target/63260] [SH] fabs, fneg do not need fp-mode setting and do not use fpscr

2014-10-13 Thread olegendo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63260

--- Comment #6 from Oleg Endo  ---
GDB patch submitted:
https://sourceware.org/ml/gdb-patches/2014-10/msg00334.html


[Bug target/63260] [SH] fabs, fneg do not need fp-mode setting and do not use fpscr

2014-10-13 Thread kkojima at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63260

--- Comment #5 from Kazumoto Kojima  ---
(In reply to Oleg Endo from comment #4)
> If the failures on my side go away after that, I'll commit
> the patch from comment #2, OK?

Please go ahead.


[Bug target/63260] [SH] fabs, fneg do not need fp-mode setting and do not use fpscr

2014-10-13 Thread olegendo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63260

--- Comment #4 from Oleg Endo  ---
(In reply to Kazumoto Kojima from comment #3)
> 
> I've just run "make -k check-gcc" with the patch on my environment and got
> no new failures.

Great.  Thanks!  I'll try patching GDB sh-sim and check again.  If the failures
on my side go away after that, I'll commit the patch from comment #2, OK?


[Bug target/63260] [SH] fabs, fneg do not need fp-mode setting and do not use fpscr

2014-10-13 Thread kkojima at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63260

--- Comment #3 from Kazumoto Kojima  ---
(In reply to Oleg Endo from comment #2)
> Kaz, could you please add the proposed patch to your test run and let me
> know of the result?  I'd like to sort this out before proceeding with PR
> 53513.

I've just run "make -k check-gcc" with the patch on my environment and got
no new failures.


[Bug target/63260] [SH] fabs, fneg do not need fp-mode setting and do not use fpscr

2014-10-13 Thread olegendo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63260

Oleg Endo  changed:

   What|Removed |Added

 CC||kkojima at gcc dot gnu.org

--- Comment #2 from Oleg Endo  ---
(In reply to Oleg Endo from comment #0)
> Created attachment 33490 [details]
> Proposed patch
> 
> The fabs and fneg insns do not require an FPSCR.PR or FPSCR.SZ mode setting
> as they operate on the high part of a double register pair.  Thus they are
> the same for single and double precision

I've tested the proposed patch on sh-sim, there are some new failures:

-m4 -mb:
FAIL: g++.dg/torture/type-generic-1.C   -O0  execution test
FAIL: gcc.c-torture/execute/builtins/complex-1.c execution,  -O0 
FAIL: gcc.c-torture/execute/builtins/complex-1.c execution,  -Og -g 
FAIL: gcc.c-torture/execute/complex-6.c   -O0  execution test
FAIL: gcc.c-torture/execute/gofast.c   -O0  execution test
FAIL: gcc.c-torture/execute/ieee/20010114-2.c execution,  -O0 
FAIL: gcc.c-torture/execute/ieee/20010114-2.c execution,  -O1 
FAIL: gcc.c-torture/execute/ieee/20010114-2.c execution,  -Og -g 
FAIL: gcc.c-torture/execute/ieee/20030331-1.c execution,  -O0 
FAIL: gcc.c-torture/execute/ieee/copysign1.c execution,  -O0 
FAIL: gcc.c-torture/execute/ieee/mzero3.c execution,  -O0 
FAIL: gcc.dg/torture/type-generic-1.c   -O0  execution test

-m4 -ml:
FAIL: g++.dg/torture/type-generic-1.C   -O0  execution test
FAIL: g++.dg/torture/type-generic-1.C   -O1  execution test
FAIL: g++.dg/torture/type-generic-1.C   -O2  execution test
FAIL: g++.dg/torture/type-generic-1.C   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  execution test
FAIL: g++.dg/torture/type-generic-1.C   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  execution test
FAIL: g++.dg/torture/type-generic-1.C   -O3 -fomit-frame-pointer  execution
test
FAIL: g++.dg/torture/type-generic-1.C   -O3 -g  execution test
FAIL: g++.dg/torture/type-generic-1.C   -Os  execution test
FAIL: gcc.c-torture/execute/builtins/complex-1.c execution,  -O0 
FAIL: gcc.c-torture/execute/builtins/complex-1.c execution,  -Og -g 
FAIL: gcc.c-torture/execute/complex-6.c   -O0  execution test
FAIL: gcc.c-torture/execute/conversion.c   -O0  execution test
FAIL: gcc.c-torture/execute/gofast.c   -O0  execution test
FAIL: gcc.c-torture/execute/ieee/20010114-2.c execution,  -O0 
FAIL: gcc.c-torture/execute/ieee/20010114-2.c execution,  -O1 
FAIL: gcc.c-torture/execute/ieee/20010114-2.c execution,  -Og -g 
FAIL: gcc.c-torture/execute/ieee/20030331-1.c execution,  -O0 
FAIL: gcc.c-torture/execute/ieee/copysign1.c execution,  -O0 
FAIL: gcc.c-torture/execute/ieee/mzero3.c execution,  -O0 
FAIL: gcc.dg/pr28796-2.c execution test
FAIL: gcc.dg/torture/fp-int-convert-float.c   -O0  execution test
FAIL: gcc.dg/torture/fp-int-convert-float.c   -O1  execution test
FAIL: gcc.dg/torture/fp-int-convert-float.c   -O2  execution test
FAIL: gcc.dg/torture/fp-int-convert-float.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  execution test
FAIL: gcc.dg/torture/fp-int-convert-float.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  execution test
FAIL: gcc.dg/torture/fp-int-convert-float.c   -O3 -fomit-frame-pointer 
execution test
FAIL: gcc.dg/torture/fp-int-convert-float.c   -O3 -g  execution test
FAIL: gcc.dg/torture/fp-int-convert-float.c   -Os  execution test
FAIL: gcc.dg/torture/type-generic-1.c   -O0  execution test
FAIL: gcc.dg/torture/type-generic-1.c   -O1  execution test
FAIL: gcc.dg/torture/type-generic-1.c   -O2  execution test
FAIL: gcc.dg/torture/type-generic-1.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  execution test
FAIL: gcc.dg/torture/type-generic-1.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  execution test
FAIL: gcc.dg/torture/type-generic-1.c   -O3 -fomit-frame-pointer  execution
test
FAIL: gcc.dg/torture/type-generic-1.c   -O3 -g  execution test
FAIL: gcc.dg/torture/type-generic-1.c   -Os  execution test
FAIL: gcc.dg/torture/vec-cvt-1.c   -O0  execution test
FAIL: gcc.dg/torture/vec-cvt-1.c   -O1  execution test
FAIL: gcc.dg/torture/vec-cvt-1.c   -O2  execution test
FAIL: gcc.dg/torture/vec-cvt-1.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  execution test
FAIL: gcc.dg/torture/vec-cvt-1.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  execution test
FAIL: gcc.dg/torture/vec-cvt-1.c   -O3 -fomit-frame-pointer  execution test
FAIL: gcc.dg/torture/vec-cvt-1.c   -O3 -fomit-frame-pointer -funroll-all-loops
-finline-functions  execution test
FAIL: gcc.dg/torture/vec-cvt-1.c   -O3 -fomit-frame-pointer -funroll-loops 
execution test
FAIL: gcc.dg/torture/vec-cvt-1.c   -O3 -g  execution test
FAIL: gcc.dg/torture/vec-cvt-1.c   -Os  execution test


This seems to be due to the implementation in GDB.

sim/sh/interp.c:

#define FP_UNARY(n, OP) \
{ \
  if (FPSCR_PR) \
{ \
  if ((n) & 1) \
RAISE_EXCEPTION (SIGILL); \
  else

[Bug target/63260] [SH] fabs, fneg do not need fp-mode setting and do not use fpscr

2014-10-12 Thread olegendo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63260

--- Comment #1 from Oleg Endo  ---
The following functions should not show any mode changes:

float test_0 (float x)
{
  return -x;
}

double test_1 (double x)
{
  return -x;
}

float test_2 (float x)
{
  return __builtin_fabs (x);
}

double test_3 (double x)
{
  return __builtin_abs (x);
}