]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
RISC-V: Remove tail && mask policy operand for vmclr, vmset, vmld, vmst
authorJu-Zhe Zhong <juzhe.zhong@rivai.ai>
Tue, 29 Nov 2022 01:22:01 +0000 (09:22 +0800)
committerKito Cheng <kito.cheng@sifive.com>
Thu, 1 Dec 2022 16:14:22 +0000 (00:14 +0800)
1. vector.md: remove tail && mask policy operand for mask mode operations since
   we don't need them according to RVV ISA.
2. riscv-v.cc: adapt emit_pred_op for mask mode predicated mov since all RVV modes
   including vector integer mode && vector float mode  && vector bool mode are
   all use emit_pred_op function. For vector integer mode && vector float mode,
   we have instruction like vle.v/vse.v that we need tail && mask policy.
   However, for vector bool mode, the instruction is vlm/vsm that we don't need
   tail && mask policy. So we add a condition here to add tail && mask policy operand
   during expand if it is not a vector bool modes.

This patch is to cleanup the code and make it be consistent with RVV ISA.

gcc/ChangeLog:

* config/riscv/riscv-v.cc (emit_pred_op): Adapt for mask mode.
* config/riscv/vector.md: Remove Tail && make policy operand for mask mode mov.

gcc/config/riscv/riscv-v.cc
gcc/config/riscv/vector.md

index d54795694f1a03d4ff1e61a2b190b3671e121e7e..4992ff2470cd10c621488113c80544d01a9f3cba 100644 (file)
@@ -136,7 +136,8 @@ emit_pred_op (unsigned icode, rtx dest, rtx src, machine_mode mask_mode)
   rtx vlmax = emit_vlmax_vsetvl (mode);
   e.add_input_operand (vlmax, Pmode);
 
-  e.add_policy_operand (TAIL_AGNOSTIC, MASK_AGNOSTIC);
+  if (GET_MODE_CLASS (mode) != MODE_VECTOR_BOOL)
+    e.add_policy_operand (TAIL_AGNOSTIC, MASK_AGNOSTIC);
 
   e.expand ((enum insn_code) icode, MEM_P (dest) || MEM_P (src));
 }
index a2f5a3eb69c6fc59b65bf7f41a4117d6d98092cd..1b822184d27ed9f149f0bdc1ee56a81a6f0ad194 100644 (file)
          (unspec:VB
            [(match_operand:VB 1 "vector_mask_operand"   "Wc1, Wc1, Wc1, Wc1, Wc1")
             (match_operand 4 "vector_length_operand"    " rK,  rK,  rK,  rK,  rK")
-            (match_operand 5 "const_int_operand"        "  i,   i,   i,   i,   i")
-            (match_operand 6 "const_int_operand"        "  i,   i,   i,   i,   i")
             (reg:SI VL_REGNUM)
             (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
          (match_operand:VB 3 "vector_move_operand"      "  m,  vr,  vr, Wc0, Wc1")