From 1ea9fe562c2e9c3a7772304e588aba86d8e58152 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Thu, 21 May 2009 16:53:48 +0000 Subject: [PATCH] neon.md (*mul3add_neon): New pattern. * config/arm/neon.md (*mul3add_neon): New pattern. (*mul3negadd_neon): Likewise. * gcc.dg/target/arm/neon-vmla-1.c: New. * gcc.dg/target/arm/neon-vmls-1.c: Likewise. From-SVN: r147771 --- gcc/ChangeLog | 5 ++++ gcc/config/arm/neon.md | 44 ++++++++++++++++++++++++++++++ gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/gcc.target/arm/neon-vmla-1.c | 10 +++++++ gcc/testsuite/gcc.target/arm/neon-vmls-1.c | 10 +++++++ 5 files changed, 74 insertions(+) create mode 100644 gcc/testsuite/gcc.target/arm/neon-vmla-1.c create mode 100644 gcc/testsuite/gcc.target/arm/neon-vmls-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6b0f89a..8b7c623 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2009-05-21 Mark Mitchell + + * config/arm/neon.md (*mul3add_neon): New pattern. + (*mul3negadd_neon): Likewise. + 2009-05-21 Shujing Zhao * config/i386/i386.c: Use REG_P, MEM_P, CONST_INT_P, LABEL_P and diff --git a/gcc/config/arm/neon.md b/gcc/config/arm/neon.md index f4ba7e7..ebd2a45 100644 --- a/gcc/config/arm/neon.md +++ b/gcc/config/arm/neon.md @@ -862,6 +862,50 @@ (const_string "neon_mul_qqq_8_16_32_ddd_32")))))] ) +(define_insn "*mul3add_neon" + [(set (match_operand:VDQ 0 "s_register_operand" "=w") + (plus:VDQ (mult:VDQ (match_operand:VDQ 2 "s_register_operand" "w") + (match_operand:VDQ 3 "s_register_operand" "w")) + (match_operand:VDQ 1 "s_register_operand" "0")))] + "TARGET_NEON" + "vmla.\t%0, %2, %3" + [(set (attr "neon_type") + (if_then_else (ne (symbol_ref "") (const_int 0)) + (if_then_else (ne (symbol_ref "") (const_int 0)) + (const_string "neon_fp_vmla_ddd") + (const_string "neon_fp_vmla_qqq")) + (if_then_else (ne (symbol_ref "") (const_int 0)) + (if_then_else + (ne (symbol_ref "") (const_int 0)) + (const_string "neon_mla_ddd_8_16_qdd_16_8_long_32_16_long") + (const_string "neon_mla_ddd_32_qqd_16_ddd_32_scalar_qdd_64_32_long_scalar_qdd_64_32_long")) + (if_then_else (ne (symbol_ref "") (const_int 0)) + (const_string "neon_mla_qqq_8_16") + (const_string "neon_mla_qqq_32_qqd_32_scalar")))))] +) + +(define_insn "*mul3negadd_neon" + [(set (match_operand:VDQ 0 "s_register_operand" "=w") + (minus:VDQ (match_operand:VDQ 1 "s_register_operand" "0") + (mult:VDQ (match_operand:VDQ 2 "s_register_operand" "w") + (match_operand:VDQ 3 "s_register_operand" "w"))))] + "TARGET_NEON" + "vmls.\t%0, %2, %3" + [(set (attr "neon_type") + (if_then_else (ne (symbol_ref "") (const_int 0)) + (if_then_else (ne (symbol_ref "") (const_int 0)) + (const_string "neon_fp_vmla_ddd") + (const_string "neon_fp_vmla_qqq")) + (if_then_else (ne (symbol_ref "") (const_int 0)) + (if_then_else + (ne (symbol_ref "") (const_int 0)) + (const_string "neon_mla_ddd_8_16_qdd_16_8_long_32_16_long") + (const_string "neon_mla_ddd_32_qqd_16_ddd_32_scalar_qdd_64_32_long_scalar_qdd_64_32_long")) + (if_then_else (ne (symbol_ref "") (const_int 0)) + (const_string "neon_mla_qqq_8_16") + (const_string "neon_mla_qqq_32_qqd_32_scalar")))))] +) + (define_insn "ior3" [(set (match_operand:VDQ 0 "s_register_operand" "=w,w") (ior:VDQ (match_operand:VDQ 1 "s_register_operand" "w,0") diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6c693b8..e1db42b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-05-21 Mark Mitchell + + * gcc.dg/target/arm/neon-vmla-1.c: New. + * gcc.dg/target/arm/neon-vmls-1.c: Likewise. + 2009-05-20 Adam Nemet * gcc.target/mips/octeon-exts-6.c: New test. diff --git a/gcc/testsuite/gcc.target/arm/neon-vmla-1.c b/gcc/testsuite/gcc.target/arm/neon-vmla-1.c new file mode 100644 index 0000000..3592ab9 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/neon-vmla-1.c @@ -0,0 +1,10 @@ +/* { dg-require-effective-target arm_neon_hw } */ +/* { dg-options "-O2 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize" } */ +/* { dg-final { scan-assembler "vmla\\.f32" } } */ + +/* Verify that VMLA is used. */ +void f1(int n, float a, float x[], float y[]) { + int i; + for (i = 0; i < n; ++i) + y[i] = a * x[i] + y[i]; +} diff --git a/gcc/testsuite/gcc.target/arm/neon-vmls-1.c b/gcc/testsuite/gcc.target/arm/neon-vmls-1.c new file mode 100644 index 0000000..1b3fcbb --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/neon-vmls-1.c @@ -0,0 +1,10 @@ +/* { dg-require-effective-target arm_neon_hw } */ +/* { dg-options "-O2 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize" } */ +/* { dg-final { scan-assembler "vmls\\.f32" } } */ + +/* Verify that VMLS is used. */ +void f1(int n, float a, float x[], float y[]) { + int i; + for (i = 0; i < n; ++i) + y[i] = y[i] - a * x[i]; +} -- 2.7.4