Commit a3f6d680 by Michael Meissner Committed by Michael Meissner

re PR target/70131 (PowerPC ISA 2.07 is inefficient at doint (float)(int)x.)

[gcc]
2016-03-11  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/70131
	* config/rs6000/rs6000.md (round32<mode>2_fprs): Do not do the
	optimization if we have direct move.
	(roundu32<mode>2_fprs): Likewise.

[gcc/testsuite]
2016-03-11  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/70131
	* gcc.target/powerpc/ppc-round2.c: New test.

From-SVN: r234155
parent 089d955f
2016-03-11 Michael Meissner <meissner@linux.vnet.ibm.com>
PR target/70131
* config/rs6000/rs6000.md (round32<mode>2_fprs): Do not do the
optimization if we have direct move.
(roundu32<mode>2_fprs): Likewise.
2016-03-11 Bernd Schmidt <bschmidt@redhat.com> 2016-03-11 Bernd Schmidt <bschmidt@redhat.com>
PR target/70123 PR target/70123
......
...@@ -5387,10 +5387,12 @@ ...@@ -5387,10 +5387,12 @@
xsrdpiz %x0,%x1" xsrdpiz %x0,%x1"
[(set_attr "type" "fp")]) [(set_attr "type" "fp")])
;; Since FCTIWZ doesn't sign extend the upper bits, we have to do a store and a ;; Opitmize converting SF/DFmode to signed SImode and back to SF/DFmode. This
;; load to properly sign extend the value, but at least doing a store, load ;; optimization prevents on ISA 2.06 systems and earlier having to store the
;; into a GPR to sign extend, a store from the GPR and a load back into the FPR ;; value from the FPR/vector unit to the stack, load the value into a GPR, sign
;; if we have 32-bit memory ops ;; extend it, store it back on the stack from the GPR, load it back into the
;; FP/vector unit to do the rounding. If we have direct move (ISA 2.07),
;; disable using store and load to sign/zero extend the value.
(define_insn_and_split "*round32<mode>2_fprs" (define_insn_and_split "*round32<mode>2_fprs"
[(set (match_operand:SFDF 0 "gpc_reg_operand" "=d") [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
(float:SFDF (float:SFDF
...@@ -5399,7 +5401,7 @@ ...@@ -5399,7 +5401,7 @@
(clobber (match_scratch:DI 3 "=d"))] (clobber (match_scratch:DI 3 "=d"))]
"TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
&& <SI_CONVERT_FP> && TARGET_LFIWAX && TARGET_STFIWX && TARGET_FCFID && <SI_CONVERT_FP> && TARGET_LFIWAX && TARGET_STFIWX && TARGET_FCFID
&& can_create_pseudo_p ()" && !TARGET_DIRECT_MOVE && can_create_pseudo_p ()"
"#" "#"
"" ""
[(pc)] [(pc)]
...@@ -5431,7 +5433,7 @@ ...@@ -5431,7 +5433,7 @@
(clobber (match_scratch:DI 2 "=d")) (clobber (match_scratch:DI 2 "=d"))
(clobber (match_scratch:DI 3 "=d"))] (clobber (match_scratch:DI 3 "=d"))]
"TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
&& TARGET_LFIWZX && TARGET_STFIWX && TARGET_FCFIDU && TARGET_LFIWZX && TARGET_STFIWX && TARGET_FCFIDU && !TARGET_DIRECT_MOVE
&& can_create_pseudo_p ()" && can_create_pseudo_p ()"
"#" "#"
"" ""
......
2016-03-11 Michael Meissner <meissner@linux.vnet.ibm.com>
PR target/70131
* gcc.target/powerpc/ppc-round2.c: New test.
2016-03-11 Bernd Schmidt <bschmidt@redhat.com> 2016-03-11 Bernd Schmidt <bschmidt@redhat.com>
PR target/70123 PR target/70123
......
/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
/* { dg-options "-O2 -mcpu=power8" } */
/* { dg-final { scan-assembler-times "fcfid " 2 } } */
/* { dg-final { scan-assembler-times "fcfids " 2 } } */
/* { dg-final { scan-assembler-times "fctiwuz " 2 } } */
/* { dg-final { scan-assembler-times "fctiwz " 2 } } */
/* { dg-final { scan-assembler-times "mfvsrd " 4 } } */
/* { dg-final { scan-assembler-times "mtvsrwa " 2 } } */
/* { dg-final { scan-assembler-times "mtvsrwz " 2 } } */
/* { dg-final { scan-assembler-not "lwz" } } */
/* { dg-final { scan-assembler-not "lfiwax " } } */
/* { dg-final { scan-assembler-not "lfiwzx " } } */
/* { dg-final { scan-assembler-not "stw" } } */
/* { dg-final { scan-assembler-not "stfiwx " } } */
/* Make sure we don't have loads/stores to the GPR unit. */
double
round_double_int (double a)
{
return (double)(int)a;
}
float
round_float_int (float a)
{
return (float)(int)a;
}
double
round_double_uint (double a)
{
return (double)(unsigned int)a;
}
float
round_float_uint (float a)
{
return (float)(unsigned int)a;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment