public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/riscv/heads/gcc-13-with-riscv-opts)] RISC-V: Avoid repeated GET_MODE calls in `riscv_expand_conditional_move'
@ 2023-11-22 5:09 Jeff Law
0 siblings, 0 replies; only message in thread
From: Jeff Law @ 2023-11-22 5:09 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:e75ca7015faf348b25b180168617dd2bef78cfc9
commit e75ca7015faf348b25b180168617dd2bef78cfc9
Author: Maciej W. Rozycki <macro@embecosm.com>
Date: Wed Nov 22 01:18:24 2023 +0000
RISC-V: Avoid repeated GET_MODE calls in `riscv_expand_conditional_move'
Use `mode0' and `mode1' shorthands respectively for `GET_MODE (op0)' and
`GET_MODE (op1)' to improve code readability.
gcc/
* config/riscv/riscv.cc (riscv_expand_conditional_move): Use
`mode0' and `mode1' for `GET_MODE (op0)' and `GET_MODE (op1)'.
(cherry picked from commit 00a3bd4ccae4f7a7fd1d76db325808129208986b)
Diff:
---
gcc/config/riscv/riscv.cc | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index d37ffb307c7..c8d3904fe3b 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -4036,12 +4036,15 @@ riscv_expand_conditional_move (rtx dest, rtx op, rtx cons, rtx alt)
else if (TARGET_ZICOND_LIKE
&& GET_MODE_CLASS (mode) == MODE_INT)
{
+ machine_mode mode0 = GET_MODE (op0);
+ machine_mode mode1 = GET_MODE (op1);
+
/* The comparison must be comparing WORD_MODE objects. We must
enforce that so that we don't strip away a sign_extension
thinking it is unnecessary. We might consider using
riscv_extend_operands if they are not already properly extended. */
- if ((GET_MODE (op0) != word_mode && GET_MODE (op0) != VOIDmode)
- || (GET_MODE (op1) != word_mode && GET_MODE (op1) != VOIDmode))
+ if ((mode0 != word_mode && mode0 != VOIDmode)
+ || (mode1 != word_mode && mode1 != VOIDmode))
return false;
/* Canonicalize the comparison. It must be an equality comparison
@@ -4061,9 +4064,9 @@ riscv_expand_conditional_move (rtx dest, rtx op, rtx cons, rtx alt)
rtx tmp = gen_reg_rtx (word_mode);
/* We can support both FP and integer conditional moves. */
- if (INTEGRAL_MODE_P (GET_MODE (XEXP (op, 0))))
+ if (INTEGRAL_MODE_P (mode0))
riscv_expand_int_scc (tmp, code, op0, op1, invert_ptr);
- else if (FLOAT_MODE_P (GET_MODE (XEXP (op, 0)))
+ else if (FLOAT_MODE_P (mode0)
&& fp_scc_comparison (op, GET_MODE (op)))
riscv_expand_float_scc (tmp, code, op0, op1);
else
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-11-22 5:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-22 5:09 [gcc(refs/vendors/riscv/heads/gcc-13-with-riscv-opts)] RISC-V: Avoid repeated GET_MODE calls in `riscv_expand_conditional_move' Jeff Law
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).