From: Sylvain Noiry <snoiry@kalrayinc.com>
To: gcc-patches@gcc.gnu.org
Cc: Sylvain Noiry <snoiry@kalrayinc.com>
Subject: [PATCH v2 05/11] Native complex ops: Add the conjugate op in optabs
Date: Tue, 12 Sep 2023 12:07:07 +0200 [thread overview]
Message-ID: <20230912100713.1074-6-snoiry@kalrayinc.com> (raw)
In-Reply-To: <20230912100713.1074-1-snoiry@kalrayinc.com>
Summary:
Add an optab and rtl operation for the conjugate, called conj,
to expand CONJ_EXPR.
gcc/ChangeLog:
* rtl.def: Add a conj operation in rtl
* optabs.def: Add a conj optab
* optabs-tree.cc (optab_for_tree_code): use the
conj_optab to convert a CONJ_EXPR
* expr.cc (expand_expr_real_2): Add a case to expand
native CONJ_EXPR
(expand_expr_real_1): Likewise
---
gcc/expr.cc | 17 ++++++++++++++++-
gcc/optabs-tree.cc | 3 +++
gcc/optabs.def | 3 +++
gcc/rtl.def | 3 +++
4 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/gcc/expr.cc b/gcc/expr.cc
index 01462486631..937c2375133 100644
--- a/gcc/expr.cc
+++ b/gcc/expr.cc
@@ -10487,6 +10487,18 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode,
return dst;
}
+ case CONJ_EXPR:
+ op0 = expand_expr (treeop0, subtarget, VOIDmode, EXPAND_NORMAL);
+ if (modifier == EXPAND_STACK_PARM)
+ target = 0;
+ temp = expand_unop (mode,
+ optab_for_tree_code (CONJ_EXPR, type,
+ optab_default),
+ op0, target, 0);
+ gcc_assert (temp);
+ return REDUCE_BIT_FIELD (temp);
+
+
default:
gcc_unreachable ();
}
@@ -12099,6 +12111,10 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode,
op0 = expand_normal (treeop0);
return read_complex_part (op0, IMAG_P);
+ case CONJ_EXPR:
+ op0 = expand_normal (treeop0);
+ return op0;
+
case RETURN_EXPR:
case LABEL_EXPR:
case GOTO_EXPR:
@@ -12122,7 +12138,6 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode,
case VA_ARG_EXPR:
case BIND_EXPR:
case INIT_EXPR:
- case CONJ_EXPR:
case COMPOUND_EXPR:
case PREINCREMENT_EXPR:
case PREDECREMENT_EXPR:
diff --git a/gcc/optabs-tree.cc b/gcc/optabs-tree.cc
index 40bfbb1a5ad..ee5d52a7d50 100644
--- a/gcc/optabs-tree.cc
+++ b/gcc/optabs-tree.cc
@@ -271,6 +271,9 @@ optab_for_tree_code (enum tree_code code, const_tree type,
return TYPE_UNSIGNED (type) ? usneg_optab : ssneg_optab;
return trapv ? negv_optab : neg_optab;
+ case CONJ_EXPR:
+ return conj_optab;
+
case ABS_EXPR:
return trapv ? absv_optab : abs_optab;
diff --git a/gcc/optabs.def b/gcc/optabs.def
index 2ccbe4197b7..8405d365c97 100644
--- a/gcc/optabs.def
+++ b/gcc/optabs.def
@@ -162,6 +162,9 @@ OPTAB_NL(umax_optab, "umax$I$a3", UMAX, "umax", '3', gen_int_libfunc)
OPTAB_NL(neg_optab, "neg$P$a2", NEG, "neg", '2', gen_int_fp_fixed_libfunc)
OPTAB_NX(neg_optab, "neg$F$a2")
OPTAB_NX(neg_optab, "neg$Q$a2")
+OPTAB_NL(conj_optab, "conj$P$a2", CONJ, "conj", '2', gen_int_fp_fixed_libfunc)
+OPTAB_NX(conj_optab, "conj$F$a2")
+OPTAB_NX(conj_optab, "conj$Q$a2")
OPTAB_VL(negv_optab, "negv$I$a2", NEG, "neg", '2', gen_intv_fp_libfunc)
OPTAB_VX(negv_optab, "neg$F$a2")
OPTAB_NL(ssneg_optab, "ssneg$Q$a2", SS_NEG, "ssneg", '2', gen_signed_fixed_libfunc)
diff --git a/gcc/rtl.def b/gcc/rtl.def
index 88e2b198503..0312b3ea262 100644
--- a/gcc/rtl.def
+++ b/gcc/rtl.def
@@ -460,6 +460,9 @@ DEF_RTL_EXPR(MINUS, "minus", "ee", RTX_BIN_ARITH)
/* Minus operand 0. */
DEF_RTL_EXPR(NEG, "neg", "e", RTX_UNARY)
+/* Conj operand 0. */
+DEF_RTL_EXPR(CONJ, "conj", "e", RTX_UNARY)
+
DEF_RTL_EXPR(MULT, "mult", "ee", RTX_COMM_ARITH)
/* Multiplication with signed saturation */
--
2.17.1
next prev parent reply other threads:[~2023-09-12 10:07 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-17 9:02 [PATCH 0/9] Native complex operations Sylvain Noiry
2023-07-17 9:02 ` [PATCH 1/9] Native complex operations: Conditional lowering Sylvain Noiry
2023-07-17 9:02 ` [PATCH 2/9] Native complex operations: Move functions to hooks Sylvain Noiry
2023-07-17 9:02 ` [PATCH 3/9] Native complex operations: Add gen_rtx_complex hook Sylvain Noiry
2023-07-17 9:02 ` [PATCH 4/9] Native complex operations: Allow native complex regs and ops in rtl Sylvain Noiry
2023-07-17 9:02 ` [PATCH 5/9] Native complex operations: Add the conjugate op in optabs Sylvain Noiry
2023-07-17 9:02 ` [PATCH 6/9] Native complex operations: Update how complex rotations are handled Sylvain Noiry
2023-07-17 9:02 ` [PATCH 7/9] Native complex operations: Vectorization of native complex operations Sylvain Noiry
2023-07-17 9:02 ` [PATCH 8/9] Native complex operations: Add explicit vector of complex Sylvain Noiry
2023-07-17 9:02 ` [PATCH 9/9] Native complex operation: Experimental support in x86 backend Sylvain Noiry
2023-09-12 10:07 ` [PATCH v2 0/11] Native complex operations Sylvain Noiry
2023-09-12 10:07 ` [PATCH v2 01/11] Native complex ops : Conditional lowering Sylvain Noiry
2023-09-12 10:07 ` [PATCH v2 02/11] Native complex ops: Move functions to hooks Sylvain Noiry
2023-09-12 10:07 ` [PATCH v2 03/11] Native complex ops: Add gen_rtx_complex hook Sylvain Noiry
2023-09-12 10:07 ` [PATCH v2 04/11] Native complex ops: Allow native complex regs and ops in rtl Sylvain Noiry
2023-09-12 10:07 ` Sylvain Noiry [this message]
2023-09-12 10:07 ` [PATCH v2 06/11] Native complex ops: Update how complex rotations are handled Sylvain Noiry
2023-09-12 10:07 ` [PATCH v2 07/11] Native complex ops: Vectorization of native complex operations Sylvain Noiry
2023-09-12 10:07 ` [PATCH v2 08/11] Native complex ops: Add explicit vector of complex Sylvain Noiry
2023-09-12 17:25 ` Joseph Myers
2023-09-13 6:48 ` Richard Biener
2023-09-12 10:07 ` [PATCH v2 09/11] Native complex ops: remove useless special cases Sylvain Noiry
2023-09-12 10:07 ` [PATCH v2 10/11] Native complex ops: Add a fast complex multiplication pattern Sylvain Noiry
2023-09-12 10:07 ` [PATCH v2 11/11] Native complex ops: Experimental support in x86 backend Sylvain Noiry
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=20230912100713.1074-6-snoiry@kalrayinc.com \
--to=snoiry@kalrayinc.com \
--cc=gcc-patches@gcc.gnu.org \
/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).