MASK_ANY = 2,
};
+/* Return true if VALUE is agnostic or any policy. */
+#define IS_AGNOSTIC(VALUE) (bool) (VALUE & 0x1 || (VALUE >> 1 & 0x1))
+
enum class reduction_type
{
UNORDERED,
gen_no_side_effects_vsetvl_rtx (machine_mode vmode, rtx vl, rtx avl)
{
unsigned int sew = get_sew (vmode);
+ rtx tail_policy = gen_int_mode (get_prefer_tail_policy (), Pmode);
+ rtx mask_policy = gen_int_mode (get_prefer_mask_policy (), Pmode);
return gen_vsetvl_no_side_effects (Pmode, vl, avl, gen_int_mode (sew, Pmode),
gen_int_mode (get_vlmul (vmode), Pmode),
- const0_rtx, const0_rtx);
+ tail_policy, mask_policy);
}
/* GET VL * 2 rtx. */
/* LMUL. */
e.add_input_operand (Pmode, gen_int_mode (get_vlmul (mode), Pmode));
- /* TA. */
- e.add_input_operand (Pmode, gen_int_mode (1, Pmode));
+ /* TAIL_ANY. */
+ e.add_input_operand (Pmode, gen_int_mode (get_prefer_tail_policy (), Pmode));
- /* MU. */
- e.add_input_operand (Pmode, gen_int_mode (0, Pmode));
+ /* MASK_ANY. */
+ e.add_input_operand (Pmode, gen_int_mode (get_prefer_mask_policy (), Pmode));
return e.generate_insn (code_for_vsetvl_no_side_effects (Pmode));
}
};
#ifndef GCC_RISCV_VSETVL_H
#define GCC_RISCV_VSETVL_H
-#define IS_AGNOSTIC(VALUE) (bool) (VALUE & 0x1 || (VALUE >> 1 & 0x1))
-
namespace riscv_vector {
/* Classification of vsetvl instruction. */
else if (code == CONST_INT)
{
/* Tail && Mask policy. */
- bool agnostic_p = UINTVAL (op) & 0x1;
- asm_fprintf (file, "%s", agnostic_p ? "a" : "u");
+ asm_fprintf (file, "%s", IS_AGNOSTIC (UINTVAL (op)) ? "a" : "u");
}
else
output_operand_lossage ("invalid vector constant");
/*
** f1:
** ...
-** vsetivli\t[a-x0-9]+,\s*4,e64,m1,tu,m[au]
+** vsetivli\t[a-x0-9]+,\s*4,e64,m1,t[au],m[au]
** ...
** vsetvli\tzero,\s*[a-x0-9]+,e32,m1,tu,m[au]
** ...
/*
** f2:
** ...
-** vsetivli\t[a-x0-9]+,\s*4,e64,m1,tu,m[au]
+** vsetivli\t[a-x0-9]+,\s*4,e64,m1,t[au],m[au]
** ...
** vsetvli\tzero,\s*[a-x0-9]+,e32,m1,tu,m[au]
** ...
/*
** f1:
** ...
-** vsetvli\t[a-x0-9]+,\s*[a-x0-9]+,e64,m1,tu,m[au]
+** vsetvli\t[a-x0-9]+,\s*[a-x0-9]+,e64,m1,t[au],m[au]
** ...
** vsetvli\tzero,\s*[a-x0-9]+,e32,m1,tu,m[au]
** ...
/*
** f2:
** ...
-** vsetvli\t[a-x0-9]+,\s*[a-x0-9]+,e64,m1,tu,m[au]
+** vsetvli\t[a-x0-9]+,\s*[a-x0-9]+,e64,m1,t[au],m[au]
** ...
** vsetvli\tzero,\s*[a-x0-9]+,e32,m1,tu,m[au]
** ...
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv -mabi=lp64d" } */
+
+#include <riscv_vector.h>
+
+size_t foo ()
+{
+ return __riscv_vsetvlmax_e8m1 ();
+}
+
+/* { dg-final { scan-assembler-times {\tvsetvli\t[a-x0-9]+,zero,e8,m1,ta,ma} 1 } } */