[gcc(refs/users/meissner/heads/work010)] PowerPC: Rename power9 min, max, cmove support functions.
Michael Meissner
meissner@gcc.gnu.org
Sat Aug 15 01:17:24 GMT 2020
https://gcc.gnu.org/g:c53a5c0f1eb587350a8a5da1b9d581716a0701c5
commit c53a5c0f1eb587350a8a5da1b9d581716a0701c5
Author: Michael Meissner <meissner@gcc.gnu.org>
Date: Fri Aug 14 20:42:42 2020 -0400
PowerPC: Rename power9 min, max, cmove support functions.
gcc/
2020-08-14 Michael Meissner <meissner@linux.ibm.com>
* config/rs6000/rs6000.c (rs6000_emit_p9_fp_minmax): Rename to
maybe_emit_fp_c_minmax.
(maybe_emit_fp_c_minmax): Rename rs6000_emit_p9_fp_minmax. Return
bool instead of int.
(rs6000_emit_p9_fp_cmove): Rename to maybe_emit_fp_cmove.
(maybe_emit_fp_cmove): Rename rs6000_emit_p9_fp_cmove. Return
bool instead of int.
(rs6000_emit_cmove): Call maybe_emit_fp_c_minmax and
maybe_emit_fp_cmove.
Diff:
---
gcc/config/rs6000/rs6000.c | 48 +++++++++++++++++++++++++++-------------------
1 file changed, 28 insertions(+), 20 deletions(-)
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 40ee0a695f1..ad871b3850f 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -15032,13 +15032,17 @@ rs6000_emit_vector_cond_expr (rtx dest, rtx op_true, rtx op_false,
return 1;
}
-/* ISA 3.0 (power9) minmax subcase to emit a XSMAXCDP or XSMINCDP instruction
- for SF/DF scalars. Move TRUE_COND to DEST if OP of the operands of the last
- comparison is nonzero/true, FALSE_COND if it is zero/false. Return 0 if the
- hardware has no such operation. */
+/* Possibly emit the C variant of the minimum or maximum instruction for
+ floating point scalars (xsmincdp, xsmaxcdp, etc.).
-static int
-rs6000_emit_p9_fp_minmax (rtx dest, rtx op, rtx true_cond, rtx false_cond)
+ Move TRUE_COND to DEST if OP of the operands of the last comparison is
+ nonzero/true, FALSE_COND if it is zero/false.
+
+ Return false if we can't generate the appropriate minimum or maximum, and
+ true if we can did the minimum or maximum. */
+
+static bool
+maybe_emit_fp_c_minmax (rtx dest, rtx op, rtx true_cond, rtx false_cond)
{
enum rtx_code code = GET_CODE (op);
rtx op0 = XEXP (op, 0);
@@ -15048,14 +15052,14 @@ rs6000_emit_p9_fp_minmax (rtx dest, rtx op, rtx true_cond, rtx false_cond)
bool max_p = false;
if (result_mode != compare_mode)
- return 0;
+ return false;
if (code == GE || code == GT)
max_p = true;
else if (code == LE || code == LT)
max_p = false;
else
- return 0;
+ return false;
if (rtx_equal_p (op0, true_cond) && rtx_equal_p (op1, false_cond))
;
@@ -15068,19 +15072,23 @@ rs6000_emit_p9_fp_minmax (rtx dest, rtx op, rtx true_cond, rtx false_cond)
max_p = !max_p;
else
- return 0;
+ return false;
rs6000_emit_minmax (dest, max_p ? SMAX : SMIN, op0, op1);
- return 1;
+ return true;
}
-/* ISA 3.0 (power9) conditional move subcase to emit XSCMP{EQ,GE,GT,NE}DP and
- XXSEL instructions for SF/DF scalars. Move TRUE_COND to DEST if OP of the
- operands of the last comparison is nonzero/true, FALSE_COND if it is
- zero/false. Return 0 if the hardware has no such operation. */
+/* Possibly emit a floating point conditional move by generating a compare that
+ sets a mask instruction and a XXSEL select instruction.
-static int
-rs6000_emit_p9_fp_cmove (rtx dest, rtx op, rtx true_cond, rtx false_cond)
+ Move TRUE_COND to DEST if OP of the operands of the last comparison is
+ nonzero/true, FALSE_COND if it is zero/false.
+
+ Return false if the operation cannot be generated, and true if we could
+ generate the instruction. */
+
+static bool
+maybe_emit_fp_cmove (rtx dest, rtx op, rtx true_cond, rtx false_cond)
{
enum rtx_code code = GET_CODE (op);
rtx op0 = XEXP (op, 0);
@@ -15108,7 +15116,7 @@ rs6000_emit_p9_fp_cmove (rtx dest, rtx op, rtx true_cond, rtx false_cond)
break;
default:
- return 0;
+ return false;
}
/* Generate: [(parallel [(set (dest)
@@ -15128,7 +15136,7 @@ rs6000_emit_p9_fp_cmove (rtx dest, rtx op, rtx true_cond, rtx false_cond)
emit_insn (gen_rtx_PARALLEL (VOIDmode,
gen_rtvec (2, cmove_rtx, clobber_rtx)));
- return 1;
+ return true;
}
/* Emit a conditional move: move TRUE_COND to DEST if OP of the
@@ -15162,10 +15170,10 @@ rs6000_emit_cmove (rtx dest, rtx op, rtx true_cond, rtx false_cond)
&& (compare_mode == SFmode || compare_mode == DFmode)
&& (result_mode == SFmode || result_mode == DFmode))
{
- if (rs6000_emit_p9_fp_minmax (dest, op, true_cond, false_cond))
+ if (maybe_emit_fp_c_minmax (dest, op, true_cond, false_cond))
return 1;
- if (rs6000_emit_p9_fp_cmove (dest, op, true_cond, false_cond))
+ if (maybe_emit_fp_cmove (dest, op, true_cond, false_cond))
return 1;
}
More information about the Gcc-cvs
mailing list