Patchwork [AArch64] Support scalar form of FABD

login
register
mail settings
Submitter Vidya Praveen
Date May 2, 2013, 6:04 p.m.
Message ID <5182AAB1.8030300@arm.com>
Download mbox | patch
Permalink /patch/241047/
State New
Headers show

Comments

Vidya Praveen - May 2, 2013, 6:04 p.m.
Hello,

This attached patch adds support to the scalar form of FABD
instruction along with the compile & execute tests for the same.

Regression tested on aarch64-none-elf with no issues.

OK?

Regards
VP

---

gcc/ChangeLog

2013-05-02  Vidya Praveen  <vidyapraveen@arm.com>

         * config/aarch64/aarch64-simd.md (*fabd_scalar<mode>3): Support
           scalar form of FABD instruction.

gcc/testsuite/ChangeLog

2013-05-02  Vidya Praveen <vidyapraveen@arm.com>

         * gcc.target/aarch64/fabd.c: New file.
Marcus Shawcroft - May 3, 2013, 10:18 a.m.
OK and committed.  Thankyou.

/Marcus

On 2 May 2013 19:04, Vidya Praveen <vidyapraveen@arm.com> wrote:
> Hello,
>
> This attached patch adds support to the scalar form of FABD
> instruction along with the compile & execute tests for the same.
>
> Regression tested on aarch64-none-elf with no issues.
>
> OK?
>
> Regards
> VP
>
> ---
>
> gcc/ChangeLog
>
> 2013-05-02  Vidya Praveen  <vidyapraveen@arm.com>
>
>         * config/aarch64/aarch64-simd.md (*fabd_scalar<mode>3): Support
>           scalar form of FABD instruction.
>
> gcc/testsuite/ChangeLog
>
> 2013-05-02  Vidya Praveen <vidyapraveen@arm.com>
>
>         * gcc.target/aarch64/fabd.c: New file.

Patch

diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md
index 5862d26..e5fc032 100644
--- a/gcc/config/aarch64/aarch64-simd.md
+++ b/gcc/config/aarch64/aarch64-simd.md
@@ -556,6 +556,17 @@ 
    (set_attr "simd_mode" "<MODE>")]
 )
 
+(define_insn "*fabd_scalar<mode>3"
+  [(set (match_operand:GPF 0 "register_operand" "=w")
+        (abs:GPF (minus:GPF
+                 (match_operand:GPF 1 "register_operand" "w")
+                 (match_operand:GPF 2 "register_operand" "w"))))]
+  "TARGET_SIMD"
+  "fabd\t%<s>0, %<s>1, %<s>2"
+  [(set_attr "simd_type" "simd_fabd")
+   (set_attr "mode" "<MODE>")]
+)
+
 (define_insn "and<mode>3"
   [(set (match_operand:VDQ 0 "register_operand" "=w")
         (and:VDQ (match_operand:VDQ 1 "register_operand" "w")
diff --git a/gcc/testsuite/gcc.target/aarch64/fabd.c b/gcc/testsuite/gcc.target/aarch64/fabd.c
new file mode 100644
index 0000000..7206d5e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/fabd.c
@@ -0,0 +1,38 @@ 
+/* { dg-do run } */
+/* { dg-options "-O1 -fno-inline --save-temps" } */
+
+extern double fabs (double);
+extern float fabsf (float);
+extern void abort ();
+extern void exit (int);
+
+void
+fabd_d (double x, double y, double d)
+{
+  if ((fabs (x - y) - d) > 0.00001)
+    abort ();
+}
+
+/* { dg-final { scan-assembler "fabd\td\[0-9\]+" } } */
+
+void
+fabd_f (float x, float y, float d)
+{
+  if ((fabsf (x - y) - d) > 0.00001)
+    abort ();
+}
+
+/* { dg-final { scan-assembler "fabd\ts\[0-9\]+" } } */
+
+int
+main ()
+{
+  fabd_d (10.0, 5.0, 5.0);
+  fabd_d (5.0, 10.0, 5.0);
+  fabd_f (10.0, 5.0, 5.0);
+  fabd_f (5.0, 10.0, 5.0);
+
+  return 0;
+}
+
+/* { dg-final { cleanup-saved-temps } } */