From 18e2ca55d452f95bbd3739f86bad2490726ee378 Mon Sep 17 00:00:00 2001 From: Mihailo Stojanovic Date: Mon, 28 Oct 2019 19:03:38 +0000 Subject: [PATCH] mips-msa.md (msa_insert_): Add an alternative which covers the floating-point input value. * config/mips/mips-msa.md (msa_insert_): Add an alternative which covers the floating-point input value. Also forbid the split of insert.d pattern for floating-point values. * gcc.target/mips/msa-insert-split.c: New test. From-SVN: r277533 --- gcc/ChangeLog | 6 ++++++ gcc/config/mips/mips-msa.md | 11 ++++++++--- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.target/mips/msa-insert-split.c | 16 ++++++++++++++++ 4 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.target/mips/msa-insert-split.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b875cef2793..a3fbadfacbf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-10-28 Mihailo Stojanovic + + * config/mips/mips-msa.md (msa_insert_): Add an + alternative which covers the floating-point input value. Also + forbid the split of insert.d pattern for floating-point values. + 2019-10-28 Andrew Burgess * config.gcc: Add riscv-sr.o to extra_objs for riscv. diff --git a/gcc/config/mips/mips-msa.md b/gcc/config/mips/mips-msa.md index 929646d3b71..628423d71ae 100644 --- a/gcc/config/mips/mips-msa.md +++ b/gcc/config/mips/mips-msa.md @@ -436,14 +436,17 @@ }) (define_insn "msa_insert_" - [(set (match_operand:MSA 0 "register_operand" "=f") + [(set (match_operand:MSA 0 "register_operand" "=f,f") (vec_merge:MSA (vec_duplicate:MSA - (match_operand: 1 "reg_or_0_operand" "dJ")) - (match_operand:MSA 2 "register_operand" "0") + (match_operand: 1 "reg_or_0_operand" "dJ,f")) + (match_operand:MSA 2 "register_operand" "0,0") (match_operand 3 "const__operand" "")))] "ISA_HAS_MSA" { + if (which_alternative == 1) + return "insve.\t%w0[%y3],%w1[0]"; + if (!TARGET_64BIT && (mode == V2DImode || mode == V2DFmode)) return "#"; else @@ -462,6 +465,8 @@ "reload_completed && ISA_HAS_MSA && !TARGET_64BIT" [(const_int 0)] { + if (REG_P (operands[1]) && FP_REG_P (REGNO (operands[1]))) + FAIL; mips_split_msa_insert_d (operands[0], operands[2], operands[3], operands[1]); DONE; }) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 14b3147d847..e5cecf4a767 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-10-28 Mihailo Stojanovic + + * gcc.target/mips/msa-insert-split.c: New test. + 2019-10-28 Andrew Burgess * gcc.target/riscv/save-restore-2.c: New file. diff --git a/gcc/testsuite/gcc.target/mips/msa-insert-split.c b/gcc/testsuite/gcc.target/mips/msa-insert-split.c new file mode 100644 index 00000000000..50f3b8a61a1 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/msa-insert-split.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-mfp64 -mhard-float -mmsa" } */ +/* { dg-skip-if "code quality test" { *-*-* } { "-O0" } { "" } } */ + +typedef double v2f64 __attribute__ ((vector_size (16))); + +void foo (double* arr, v2f64* vec) +{ + v2f64 v; + v[0] = arr[0]; + v[1] = arr[1]; + *vec = v; +} + +/* { dg-final { scan-assembler-not "insert.w" } } */ +/* { dg-final { scan-assembler-times "insve.d" 2 } } */ -- 2.30.2