From 05dc406d7a02b1157dab9cf38dd70f643af3d978 Mon Sep 17 00:00:00 2001 From: Peter Bergner Date: Thu, 30 Mar 2017 14:57:20 -0500 Subject: [PATCH] re PR target/80246 (Builtin's for POWER's dxex[q] and diex[q] use the wrong types) gcc/ PR target/80246 * config/rs6000/dfp.md (dfp_dxex_): Update mode of operand 0. (dfp_diex_): 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: Remove unneeded dg-skip-if for Darwin and SPE. (dxex, dxexq): Update return type. (diex, diexq): Update argument type. * gcc.target/powerpc/pr80246.c: New test. From-SVN: r246594 --- gcc/ChangeLog | 8 ++++ gcc/config/rs6000/dfp.md | 8 ++-- gcc/doc/extend.texi | 8 ++-- gcc/testsuite/ChangeLog | 9 +++++ .../gcc.target/powerpc/dfp-builtin-1.c | 12 +++--- gcc/testsuite/gcc.target/powerpc/pr80246.c | 37 +++++++++++++++++++ 6 files changed, 68 insertions(+), 14 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr80246.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 44e48ec9df9..d7fbf028456 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2017-03-30 Peter Bergner + + PR target/80246 + * config/rs6000/dfp.md (dfp_dxex_): Update mode of operand 0. + (dfp_diex_): Update mode of operand 1. + * doc/extend.texi (dxex, dxexq): Document change to return type. + (diex, diexq): Document change to argument type. + 2017-03-30 Martin Jambor PR ipa/77333 diff --git a/gcc/config/rs6000/dfp.md b/gcc/config/rs6000/dfp.md index c1c4c99b528..790f2e43d49 100644 --- a/gcc/config/rs6000/dfp.md +++ b/gcc/config/rs6000/dfp.md @@ -348,16 +348,16 @@ [(set_attr "type" "dfp")]) (define_insn "dfp_dxex_" - [(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 %0,%1" [(set_attr "type" "dfp")]) (define_insn "dfp_diex_" [(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" diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index b4d647067ee..fadbc9673f0 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -15427,14 +15427,14 @@ The following built-in functions are available for the PowerPC family 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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 89ade94f213..fcf4013338a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2017-03-30 Peter Bergner + + PR target/80246 + * gcc.target/powerpc/dfp-builtin-1.c: Remove unneeded dg-skip-if for + Darwin and SPE. + (dxex, dxexq): Update return type. + (diex, diexq): Update argument type. + * gcc.target/powerpc/pr80246.c: New test. + 2017-03-30 Martin Jambor PR ipa/77333 diff --git a/gcc/testsuite/gcc.target/powerpc/dfp-builtin-1.c b/gcc/testsuite/gcc.target/powerpc/dfp-builtin-1.c index c776d139dc5..bb5ad886697 100644 --- a/gcc/testsuite/gcc.target/powerpc/dfp-builtin-1.c +++ b/gcc/testsuite/gcc.target/powerpc/dfp-builtin-1.c @@ -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,14 +52,14 @@ do_enbcd_1 (_Decimal64 a) return __builtin_denbcd (1, a); } -_Decimal64 +long long do_xex (_Decimal64 a) { return __builtin_dxex (a); } _Decimal64 -do_iex (_Decimal64 a, _Decimal64 b) +do_iex (long long a, _Decimal64 b) { return __builtin_diex (a, b); } diff --git a/gcc/testsuite/gcc.target/powerpc/pr80246.c b/gcc/testsuite/gcc.target/powerpc/pr80246.c new file mode 100644 index 00000000000..915e31f2023 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr80246.c @@ -0,0 +1,37 @@ +/* { 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" } } */ +/* Verify we don't generate any drintn., drintnq., dctfix, dctfixq, dcffix + or dcffixq instructions, as they imply we are getting unwanted casting. */ +/* { dg-final { scan-assembler-not "drintn\[q\]\." } } */ +/* { dg-final { scan-assembler-not "dctfix\[q\]" } } */ +/* { dg-final { scan-assembler-not "dcffix\[q\]" } } */ + +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); +} -- 2.30.2