public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Peter Bergner <bergner@vnet.ibm.com>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	David Edelsohn <dje.gcc@gmail.com>,
	       Bill Schmidt <wschmidt@linux.vnet.ibm.com>
Subject: Re: [PATCH, rs6000] Fix PR target/80246, DFP builtins using the wrong types
Date: Thu, 30 Mar 2017 16:21:00 -0000	[thread overview]
Message-ID: <cb494b8c-cfbc-c481-72c2-a71570b5f2c6@vnet.ibm.com> (raw)
In-Reply-To: <530c97bd-1669-dd67-528e-3f879efa8bac@vnet.ibm.com>

On 3/29/17 6:29 PM, Peter Bergner wrote:
> On 3/29/17 5:28 PM, Segher Boessenkool wrote:

>>> +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
>>> +/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */
>>> +/* { dg-require-effective-target dfp } */
>>
>> You can leave off the default arguments "*" "".  Do we really need to
>> explicitly skip on Darwin and SPE if there is a test for DFP anyway?

Ok, I removed the darwin and spe tests, since the dfp requirement will
disallow those.  I made the same change to teh dfp-builtin-1.c test case
as well.  I also failed to realize that dfp-builtin-1.c was failing due
to the check for no "stfd" and "lfd", which we will now expect to see,
since we're compiling the test case with -mcpu=power7, therefore I
updated the test case to expect them.


>>> +/* { dg-final { scan-assembler-not "drintn\\." } } */
>>> +/* { dg-final { scan-assembler-not "drintnq\\." } } */
>>> +/* { dg-final { scan-assembler-not "dctfix" } } */
>>> +/* { dg-final { scan-assembler-not "dctfixq" } } */
>>
>> If there is no "dctfix" there surely is no "dctfixq" either (i.e., your
>> regexen aren't very tight).
> 
> Ahh, true.  I suppose I could also just look for "drintn" too,
> since that would catch both drintn. and drintnq., ok with that
> change?

Fixed.  Here is an updated patch.  Is this better?

Peter


gcc/
	PR target/80246
	* config/rs6000/dfp.md (dfp_dxex_<mode>): Update mode of operand 0.
	(dfp_diex_<mode>): Update mode of operand 1.
	* doc/extend.texi (dxex, dxexq): Document change to return type.
	(diex, diexq): Document change to argument type.

gcc/testsuite/
	PR target/80246
	* gcc.target/powerpc/dfp-builtin-1.c (dxex, dxexq): Update return types.
	(diex, diexq): Update argument type.
	* gcc.target/powerpc/pr80246.c: New test.


Index: gcc/config/rs6000/dfp.md
===================================================================
--- gcc/config/rs6000/dfp.md	(revision 246539)
+++ gcc/config/rs6000/dfp.md	(working copy)
@@ -348,9 +348,9 @@
   [(set_attr "type" "dfp")])
 
 (define_insn "dfp_dxex_<mode>"
-  [(set (match_operand:D64_D128 0 "gpc_reg_operand" "=d")
-	(unspec:D64_D128 [(match_operand:D64_D128 1 "gpc_reg_operand" "d")]
-			 UNSPEC_DXEX))]
+  [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
+	(unspec:DI [(match_operand:D64_D128 1 "gpc_reg_operand" "d")]
+		   UNSPEC_DXEX))]
   "TARGET_DFP"
   "dxex<dfp_suffix> %0,%1"
   [(set_attr "type" "dfp")])
@@ -357,7 +357,7 @@
 
 (define_insn "dfp_diex_<mode>"
   [(set (match_operand:D64_D128 0 "gpc_reg_operand" "=d")
-	(unspec:D64_D128 [(match_operand:D64_D128 1 "gpc_reg_operand" "d")
+	(unspec:D64_D128 [(match_operand:DI 1 "gpc_reg_operand" "d")
 			  (match_operand:D64_D128 2 "gpc_reg_operand" "d")]
 			 UNSPEC_DXEX))]
   "TARGET_DFP"
Index: gcc/doc/extend.texi
===================================================================
--- gcc/doc/extend.texi	(revision 246539)
+++ gcc/doc/extend.texi	(working copy)
@@ -15427,14 +15427,14 @@
 of processors when hardware decimal floating point
 (@option{-mhard-dfp}) is available:
 @smallexample
-_Decimal64 __builtin_dxex (_Decimal64);
-_Decimal128 __builtin_dxexq (_Decimal128);
+long long __builtin_dxex (_Decimal64);
+long long __builtin_dxexq (_Decimal128);
 _Decimal64 __builtin_ddedpd (int, _Decimal64);
 _Decimal128 __builtin_ddedpdq (int, _Decimal128);
 _Decimal64 __builtin_denbcd (int, _Decimal64);
 _Decimal128 __builtin_denbcdq (int, _Decimal128);
-_Decimal64 __builtin_diex (_Decimal64, _Decimal64);
-_Decimal128 _builtin_diexq (_Decimal128, _Decimal128);
+_Decimal64 __builtin_diex (long long, _Decimal64);
+_Decimal128 _builtin_diexq (long long, _Decimal128);
 _Decimal64 __builtin_dscli (_Decimal64, int);
 _Decimal128 __builtin_dscliq (_Decimal128, int);
 _Decimal64 __builtin_dscri (_Decimal64, int);
Index: gcc/testsuite/gcc.target/powerpc/dfp-builtin-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/dfp-builtin-1.c	(revision 246539)
+++ gcc/testsuite/gcc.target/powerpc/dfp-builtin-1.c	(working copy)
@@ -1,6 +1,4 @@
 /* { dg-do compile { target { powerpc*-*-linux* } } } */
-/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
-/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */
 /* { dg-require-effective-target powerpc_vsx_ok } */
 /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */
 /* { dg-options "-mcpu=power7 -O2" } */
@@ -10,11 +8,13 @@
 /* { dg-final { scan-assembler-times "diex "   1    } } */
 /* { dg-final { scan-assembler-times "dscli "  2    } } */
 /* { dg-final { scan-assembler-times "dscri "  2    } } */
+/* { dg-final { scan-assembler-times "std "    1    } } */
+/* { dg-final { scan-assembler-times "ld "     1    } } */
+/* { dg-final { scan-assembler-times "stfd "   1    } } */
+/* { dg-final { scan-assembler-times "lfd "    1    } } */
 /* { dg-final { scan-assembler-not   "bl __builtin" } } */
 /* { dg-final { scan-assembler-not   "dctqpq"       } } */
 /* { dg-final { scan-assembler-not   "drdpq"        } } */
-/* { dg-final { scan-assembler-not   "stfd"         } } */
-/* { dg-final { scan-assembler-not   "lfd"          } } */
 
 _Decimal64
 do_dedpd_0 (_Decimal64 a)
@@ -52,7 +52,7 @@
   return __builtin_denbcd (1, a);
 }
 
-_Decimal64
+long long
 do_xex (_Decimal64 a)
 {
   return __builtin_dxex (a);
@@ -59,7 +59,7 @@
 }
 
 _Decimal64
-do_iex (_Decimal64 a, _Decimal64 b)
+do_iex (long long a, _Decimal64 b)
 {
   return __builtin_diex (a, b);
 }
Index: gcc/testsuite/gcc.target/powerpc/pr80246.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/pr80246.c	(nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/pr80246.c	(working copy)
@@ -0,0 +1,35 @@
+/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-require-effective-target dfp } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "dxex "  1 } } */
+/* { dg-final { scan-assembler-times "dxexq " 1 } } */
+/* { dg-final { scan-assembler-times "diex "  1 } } */
+/* { dg-final { scan-assembler-times "diexq " 1 } } */
+/* { dg-final { scan-assembler-not "bl __builtin" } } */
+/* { dg-final { scan-assembler-not "drintn" } } */
+/* { dg-final { scan-assembler-not "dctfix" } } */
+/* { dg-final { scan-assembler-not "dcffix" } } */
+
+long long
+do_xex (_Decimal64 arg)
+{
+  return __builtin_dxex (arg);
+}
+
+long long
+do_xexq (_Decimal128 arg)
+{
+  return __builtin_dxexq (arg);
+}
+
+_Decimal64
+do_iex (long long exp, _Decimal64 arg)
+{
+  return __builtin_diex (exp, arg);
+}
+
+_Decimal128
+do_iexq (long long exp, _Decimal128 arg)
+{
+  return __builtin_diexq (exp, arg);
+}


  reply	other threads:[~2017-03-30 14:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-29 21:20 Peter Bergner
2017-03-29 22:36 ` Segher Boessenkool
2017-03-30  7:33   ` Peter Bergner
2017-03-30 16:21     ` Peter Bergner [this message]
2017-04-02  7:21       ` Andreas Schwab
2017-04-02  7:29       ` Andreas Schwab
2017-04-02 14:48         ` Peter Bergner
2017-04-02 15:07           ` Andreas Schwab
2017-04-02 18:54           ` Segher Boessenkool
2017-04-03 14:41             ` Peter Bergner
2017-04-03 14:55               ` Peter Bergner
2017-04-03 16:04             ` Peter Bergner
2017-04-03 17:01               ` Peter Bergner
2017-04-03 18:08                 ` Peter Bergner
2017-03-30 17:45     ` Segher Boessenkool
2017-03-30 18:27       ` Peter Bergner
2017-03-30 20:24         ` Peter Bergner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cb494b8c-cfbc-c481-72c2-a71570b5f2c6@vnet.ibm.com \
    --to=bergner@vnet.ibm.com \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=segher@kernel.crashing.org \
    --cc=wschmidt@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).