diff options
author | Juzhe-Zhong <juzhe.zhong@rivai.ai> | 2023-08-10 18:37:05 +0800 |
---|---|---|
committer | Pan Li <pan2.li@intel.com> | 2023-08-10 21:17:19 +0800 |
commit | da7b43fb0224cdce5157a747fdd6975b7c81c6cf (patch) | |
tree | d89298ec7913e4fd201bca4275b5305adf456b86 | |
parent | 6176527a7528ec626fa1e7afb381124867881388 (diff) | |
download | gcc-da7b43fb0224cdce5157a747fdd6975b7c81c6cf.zip gcc-da7b43fb0224cdce5157a747fdd6975b7c81c6cf.tar.gz gcc-da7b43fb0224cdce5157a747fdd6975b7c81c6cf.tar.bz2 |
RISC-V: Add MASK vec_duplicate pattern[PR110962]
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:
PR target/110962
* config/riscv/autovec.md (vec_duplicate<mode>): New pattern.
-rw-r--r-- | gcc/config/riscv/autovec.md | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/config/riscv/autovec.md b/gcc/config/riscv/autovec.md index 6cb5fa3..3b396a9 100644 --- a/gcc/config/riscv/autovec.md +++ b/gcc/config/riscv/autovec.md @@ -288,6 +288,27 @@ ;; ========================================================================= ;; ------------------------------------------------------------------------- +;; ---- [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 ;; ------------------------------------------------------------------------- ;; Includes: |