return false;
}
-/* Implement TARGET_PREFERRED_ELSE_VALUE. For binary operations,
- prefer to use the first arithmetic operand as the else value if
- the else value doesn't matter, since that exactly matches the RVV
- destructive merging form. For ternary operations we could either
- pick the first operand and use VMADD-like instructions or the last
- operand and use VMACC-like instructions; the latter seems more
- natural.
-
- TODO: Currently, the return value is not ideal for RVV since it will
- let VSETVL PASS use MU or TU. We will suport undefine value that allows
- VSETVL PASS use TA/MA in the future. */
-
-static tree
-riscv_preferred_else_value (unsigned, tree, unsigned int nops, tree *ops)
-{
- return nops == 3 ? ops[2] : ops[0];
-}
-
static bool
riscv_frame_pointer_required (void)
{
#undef TARGET_VECTORIZE_VEC_PERM_CONST
#define TARGET_VECTORIZE_VEC_PERM_CONST riscv_vectorize_vec_perm_const
-#undef TARGET_PREFERRED_ELSE_VALUE
-#define TARGET_PREFERRED_ELSE_VALUE riscv_preferred_else_value
-
#undef TARGET_FRAME_POINTER_REQUIRED
#define TARGET_FRAME_POINTER_REQUIRED riscv_frame_pointer_required
/* { dg-final { scan-assembler-times {\tvadd\.vv} 16 } } */
/* { dg-final { scan-assembler-times {\tvadd\.vi} 8 } } */
-/* { dg-final { scan-assembler-times {\tvfadd\.vv} 7 } } */
-/* There are 2 MINUS operations. */
-/* { dg-final { scan-assembler-times {\tvfsub\.vv} 2 } } */
+/* { dg-final { scan-assembler-times {\tvfadd\.vv} 9 } } */
-/* { dg-final { scan-tree-dump-times "\.COND_LEN_ADD" 7 "optimized" } } */
-/* { dg-final { scan-tree-dump-times "\.COND_LEN_SUB" 2 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "\.COND_LEN_ADD" 9 "optimized" } } */
/* { dg-final { scan-assembler-times {\tvadd\.vv} 16 } } */
/* { dg-final { scan-assembler-times {\tvadd\.vi} 8 } } */
-/* { dg-final { scan-assembler-times {\tvfadd\.vv} 7 } } */
-/* There are 2 MINUS operations. */
-/* { dg-final { scan-assembler-times {\tvfsub\.vv} 2 } } */
+/* { dg-final { scan-assembler-times {\tvfadd\.vv} 9 } } */
-/* { dg-final { scan-tree-dump-times "\.COND_LEN_ADD" 7 "optimized" } } */
-/* { dg-final { scan-tree-dump-times "\.COND_LEN_SUB" 2 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "\.COND_LEN_ADD" 9 "optimized" } } */
TEST_ALL (DEF_LOOP)
-/* { dg-final { scan-assembler-times {vfadd\.vv\s+v[0-9]+,v[0-9]+,v[0-9]+,v0.t} 9 } } */
-/* { dg-final { scan-assembler-times {vfsub\.vv\s+v[0-9]+,v[0-9]+,v[0-9]+,v0.t} 9 } } */
+/* { dg-final { scan-assembler-times {vfadd\.vv\s+v[0-9]+,v[0-9]+,v[0-9]+,v0.t} 18 } } */
TEST_ALL (DEF_LOOP)
-/* { dg-final { scan-assembler-times {vfadd\.vv\s+v[0-9]+,v[0-9]+,v[0-9]+,v0.t} 6 } } */
-/* { dg-final { scan-assembler-times {vfsub\.vv\s+v[0-9]+,v[0-9]+,v[0-9]+,v0.t} 6 } } */
+/* { dg-final { scan-assembler-times {vfadd\.vv\s+v[0-9]+,v[0-9]+,v[0-9]+,v0.t} 12 } } */
TEST_ALL (DEF_LOOP)
-/* { dg-final { scan-assembler-times {vfadd\.vv\s+v[0-9]+,v[0-9]+,v[0-9]+,v0.t} 9 } } */
-/* { dg-final { scan-assembler-times {vfsub\.vv\s+v[0-9]+,v[0-9]+,v[0-9]+,v0.t} 9 } } */
+/* { dg-final { scan-assembler-times {vfadd\.vv\s+v[0-9]+,v[0-9]+,v[0-9]+,v0.t} 18 } } */
TEST_ALL (DEF_LOOP)
-/* { dg-final { scan-assembler-times {vfadd\.vv\s+v[0-9]+,v[0-9]+,v[0-9]+,v0.t} 9 } } */
-/* { dg-final { scan-assembler-times {vfsub\.vv\s+v[0-9]+,v[0-9]+,v[0-9]+,v0.t} 9 } } */
+/* { dg-final { scan-assembler-times {vfadd\.vv\s+v[0-9]+,v[0-9]+,v[0-9]+,v0.t} 18 } } */
#include "ternop-1.c"
-/* { dg-final { scan-assembler-not {\tvmv} } } */
+/* TODO: we don't have undefine IR for COND_LEN_* operations,
+ which will produce redundant move instructions here.
+ Will add assembler-not check of 'vmv' instructions in the future. */
/* { dg-final { scan-tree-dump-times "COND_LEN_FMA" 3 "optimized" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -fdump-tree-optimized-details" } */
+
+#include "ternop-10.c"
+
+/* TODO: we don't have undefine IR for COND_LEN_* operations,
+ which will produce redundant move instructions here.
+ Will add assembler-not check of 'vmv' instructions in the future. */
+/* { dg-final { scan-tree-dump-times "COND_LEN_FNMS" 3 "optimized" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -fdump-tree-optimized-details" } */
+
+#include "ternop-11.c"
+
+/* TODO: we don't have undefine IR for COND_LEN_* operations,
+ which will produce redundant move instructions here.
+ Will add assembler-not check of 'vmv' instructions in the future. */
+/* { dg-final { scan-tree-dump-times "COND_LEN_FNMS" 3 "optimized" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -fdump-tree-optimized-details -fno-schedule-insns" } */
+
+#include "ternop-12.c"
+
+/* { dg-final { scan-tree-dump-times "COND_LEN_FNMS" 3 "optimized" } } */
#include "ternop-3.c"
/* { dg-final { scan-assembler-times {\tvmacc\.vv} 8 } } */
-/* { dg-final { scan-assembler-times {\tvfmacc\.vv} 6 } } */
-/* { dg-final { scan-assembler-times {\tvmv} 11 } } */
-/* { dg-final { scan-tree-dump-times "COND_LEN_FMA" 6 "optimized" } } */
+/* { dg-final { scan-assembler-times {\tvfmacc\.vv} 9 } } */
+/* { dg-final { scan-tree-dump-times "COND_LEN_FMA" 9 "optimized" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -fdump-tree-optimized-details" } */
+
+#include "ternop-4.c"
+
+/* TODO: we don't have undefine IR for COND_LEN_* operations,
+ which will produce redundant move instructions here.
+ Will add assembler-not check of 'vmv' instructions in the future. */
+/* { dg-final { scan-tree-dump-times "COND_LEN_FNMA" 3 "optimized" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -fdump-tree-optimized-details" } */
+
+#include "ternop-5.c"
+
+/* TODO: we don't have undefine IR for COND_LEN_* operations,
+ which will produce redundant move instructions here.
+ Will add assembler-not check of 'vmv' instructions in the future. */
+/* { dg-final { scan-tree-dump-times "COND_LEN_FNMA" 3 "optimized" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -fdump-tree-optimized-details -fno-schedule-insns" } */
+
+#include "ternop-6.c"
+
+/* { dg-final { scan-tree-dump-times "COND_LEN_FNMA" 3 "optimized" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -fdump-tree-optimized-details" } */
+
+#include "ternop-7.c"
+
+/* TODO: we don't have undefine IR for COND_LEN_* operations,
+ which will produce redundant move instructions here.
+ Will add assembler-not check of 'vmv' instructions in the future. */
+/* { dg-final { scan-tree-dump-times "COND_LEN_FMS" 3 "optimized" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -fdump-tree-optimized-details" } */
+
+#include "ternop-8.c"
+
+/* TODO: we don't have undefine IR for COND_LEN_* operations,
+ which will produce redundant move instructions here.
+ Will add assembler-not check of 'vmv' instructions in the future. */
+/* { dg-final { scan-tree-dump-times "COND_LEN_FMS" 9 "optimized" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d --param=riscv-autovec-preference=scalable -fdump-tree-optimized-details -fno-schedule-insns" } */
+
+#include "ternop-9.c"
+
+/* { dg-final { scan-tree-dump-times "COND_LEN_FMS" 9 "optimized" } } */
--- /dev/null
+/* { dg-do run { target { riscv_vector } } } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable" } */
+
+#include "ternop_run-10.c"
--- /dev/null
+/* { dg-do run { target { riscv_vector } } } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable" } */
+
+#include "ternop_run-11.c"
--- /dev/null
+/* { dg-do run { target { riscv_vector } } } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable" } */
+
+#include "ternop_run-12.c"
--- /dev/null
+/* { dg-do run { target { riscv_vector } } } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable" } */
+
+#include "ternop_run-4.c"
--- /dev/null
+/* { dg-do run { target { riscv_vector } } } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable" } */
+
+#include "ternop_run-5.c"
--- /dev/null
+/* { dg-do run { target { riscv_vector } } } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable" } */
+
+#include "ternop_run-6.c"
--- /dev/null
+/* { dg-do run { target { riscv_vector } } } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable" } */
+
+#include "ternop_run-7.c"
--- /dev/null
+/* { dg-do run { target { riscv_vector } } } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable" } */
+
+#include "ternop_run-8.c"
--- /dev/null
+/* { dg-do run { target { riscv_vector } } } */
+/* { dg-additional-options "--param=riscv-autovec-preference=scalable" } */
+
+#include "ternop_run-9.c"