* [PATCH] RISC-V: Add MASK vec_duplicate pattern[PR110962]
@ 2023-08-10 10:37 Juzhe-Zhong
2023-08-10 11:55 ` Robin Dapp
0 siblings, 1 reply; 6+ messages in thread
From: Juzhe-Zhong @ 2023-08-10 10:37 UTC (permalink / raw)
To: gcc-patches; +Cc: kito.cheng, kito.cheng, jeffreyalaw, rdapp.gcc, Juzhe-Zhong
This patch fix bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110962
SUBROUTINE a(b,c,d)
LOGICAL,DIMENSION(INOUT) :: b
LOGICAL e
REAL, DIMENSION(IN) :: c
REAL, DIMENSION(INOUT) :: d
REAL, DIMENSION(SIZE(c)) :: f
WHERE (b.AND.e)
WHERE (f>=0.)
d = g
ENDWHERE
ENDWHERE
END SUBROUTINE a
PR target/110962
gcc/ChangeLog:
* config/riscv/autovec.md (vec_duplicate<mode>): New pattern.
---
gcc/config/riscv/autovec.md | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/gcc/config/riscv/autovec.md b/gcc/config/riscv/autovec.md
index 6cb5fa3ed27..3b396a9a990 100644
--- a/gcc/config/riscv/autovec.md
+++ b/gcc/config/riscv/autovec.md
@@ -287,6 +287,27 @@
;; == Vector creation
;; =========================================================================
+;; -------------------------------------------------------------------------
+;; ---- [BOOL] Duplicate element
+;; -------------------------------------------------------------------------
+;; The patterns in this section are synthetic.
+;; -------------------------------------------------------------------------
+
+;; Implement a predicate broadcast by shifting the low bit of the scalar
+;; input into the top bit by duplicate the input and do a compare with zero.
+(define_expand "vec_duplicate<mode>"
+ [(set (match_operand:VB 0 "register_operand")
+ (vec_duplicate:VB (match_operand:QI 1 "register_operand")))]
+ "TARGET_VECTOR"
+ {
+ poly_int64 nunits = GET_MODE_NUNITS (<MODE>mode);
+ machine_mode mode = riscv_vector::get_vector_mode (QImode, nunits).require ();
+ rtx dup = expand_vector_broadcast (mode, operands[1]);
+ riscv_vector::expand_vec_cmp (operands[0], NE, dup, CONST0_RTX (mode));
+ DONE;
+ }
+)
+
;; -------------------------------------------------------------------------
;; ---- [INT] Linear series
;; -------------------------------------------------------------------------
--
2.36.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] RISC-V: Add MASK vec_duplicate pattern[PR110962]
2023-08-10 10:37 [PATCH] RISC-V: Add MASK vec_duplicate pattern[PR110962] Juzhe-Zhong
@ 2023-08-10 11:55 ` Robin Dapp
2023-08-10 11:57 ` juzhe.zhong
2023-08-10 12:38 ` juzhe.zhong
0 siblings, 2 replies; 6+ messages in thread
From: Robin Dapp @ 2023-08-10 11:55 UTC (permalink / raw)
To: Juzhe-Zhong, gcc-patches; +Cc: rdapp.gcc, kito.cheng, kito.cheng, jeffreyalaw
Is the testcase already in the test suite? If not we should add it.
Apart from that LGTM.
Regards
Robin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Re: [PATCH] RISC-V: Add MASK vec_duplicate pattern[PR110962]
2023-08-10 11:55 ` Robin Dapp
@ 2023-08-10 11:57 ` juzhe.zhong
2023-08-10 12:38 ` juzhe.zhong
1 sibling, 0 replies; 6+ messages in thread
From: juzhe.zhong @ 2023-08-10 11:57 UTC (permalink / raw)
To: Robin Dapp, gcc-patches; +Cc: Robin Dapp, kito.cheng, Kito.cheng, jeffreyalaw
[-- Attachment #1: Type: text/plain, Size: 429 bytes --]
I didn't add it.... since I don't know how to add a target specific fortran testcase.
juzhe.zhong@rivai.ai
From: Robin Dapp
Date: 2023-08-10 19:55
To: Juzhe-Zhong; gcc-patches
CC: rdapp.gcc; kito.cheng; kito.cheng; jeffreyalaw
Subject: Re: [PATCH] RISC-V: Add MASK vec_duplicate pattern[PR110962]
Is the testcase already in the test suite? If not we should add it.
Apart from that LGTM.
Regards
Robin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Re: [PATCH] RISC-V: Add MASK vec_duplicate pattern[PR110962]
2023-08-10 11:55 ` Robin Dapp
2023-08-10 11:57 ` juzhe.zhong
@ 2023-08-10 12:38 ` juzhe.zhong
2023-08-10 12:45 ` Robin Dapp
1 sibling, 1 reply; 6+ messages in thread
From: juzhe.zhong @ 2023-08-10 12:38 UTC (permalink / raw)
To: Robin Dapp, gcc-patches; +Cc: Robin Dapp, kito.cheng, Kito.cheng, jeffreyalaw
[-- Attachment #1: Type: text/plain, Size: 459 bytes --]
Is this patch ok ? Maybe we can find a way to add a target specific fortran test but should not block this bug fix.
juzhe.zhong@rivai.ai
From: Robin Dapp
Date: 2023-08-10 19:55
To: Juzhe-Zhong; gcc-patches
CC: rdapp.gcc; kito.cheng; kito.cheng; jeffreyalaw
Subject: Re: [PATCH] RISC-V: Add MASK vec_duplicate pattern[PR110962]
Is the testcase already in the test suite? If not we should add it.
Apart from that LGTM.
Regards
Robin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] RISC-V: Add MASK vec_duplicate pattern[PR110962]
2023-08-10 12:38 ` juzhe.zhong
@ 2023-08-10 12:45 ` Robin Dapp
2023-08-10 13:19 ` Li, Pan2
0 siblings, 1 reply; 6+ messages in thread
From: Robin Dapp @ 2023-08-10 12:45 UTC (permalink / raw)
To: juzhe.zhong, gcc-patches; +Cc: rdapp.gcc, kito.cheng, Kito.cheng, jeffreyalaw
> Is this patch ok ? Maybe we can find a way to add a target specific
> fortran test but should not block this bug fix.
It's not much different than adding a C testcase actually, apart from
starting comments with a !
But well, LGTM. The test doesn't look that complicated and quite likely
is covered by the Fortran testsuite already.
Regards
Robin
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] RISC-V: Add MASK vec_duplicate pattern[PR110962]
2023-08-10 12:45 ` Robin Dapp
@ 2023-08-10 13:19 ` Li, Pan2
0 siblings, 0 replies; 6+ messages in thread
From: Li, Pan2 @ 2023-08-10 13:19 UTC (permalink / raw)
To: Robin Dapp, juzhe.zhong, gcc-patches; +Cc: kito.cheng, Kito.cheng, jeffreyalaw
Committed, thanks Robin.
Pan
-----Original Message-----
From: Gcc-patches <gcc-patches-bounces+pan2.li=intel.com@gcc.gnu.org> On Behalf Of Robin Dapp via Gcc-patches
Sent: Thursday, August 10, 2023 8:45 PM
To: juzhe.zhong@rivai.ai; gcc-patches <gcc-patches@gcc.gnu.org>
Cc: rdapp.gcc@gmail.com; kito.cheng <kito.cheng@gmail.com>; Kito.cheng <kito.cheng@sifive.com>; jeffreyalaw <jeffreyalaw@gmail.com>
Subject: Re: [PATCH] RISC-V: Add MASK vec_duplicate pattern[PR110962]
> Is this patch ok ? Maybe we can find a way to add a target specific
> fortran test but should not block this bug fix.
It's not much different than adding a C testcase actually, apart from
starting comments with a !
But well, LGTM. The test doesn't look that complicated and quite likely
is covered by the Fortran testsuite already.
Regards
Robin
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-08-10 13:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-10 10:37 [PATCH] RISC-V: Add MASK vec_duplicate pattern[PR110962] Juzhe-Zhong
2023-08-10 11:55 ` Robin Dapp
2023-08-10 11:57 ` juzhe.zhong
2023-08-10 12:38 ` juzhe.zhong
2023-08-10 12:45 ` Robin Dapp
2023-08-10 13:19 ` Li, Pan2
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).