Testsuite check for sqrt_insn. Move pow/sqrt synth test from gcc.target/aarch64/...
authorKyrylo Tkachov <kyrylo.tkachov@arm.com>
Thu, 21 May 2015 13:30:24 +0000 (13:30 +0000)
committerKyrylo Tkachov <ktkachov@gcc.gnu.org>
Thu, 21 May 2015 13:30:24 +0000 (13:30 +0000)
* lib/target-supports.exp (check_effective_target_sqrt_insn): New check.
* gcc.dg/pow-sqrt-synth-1.c: New test.
* gcc.target/aarch64/pow-sqrt-synth-1.c: Delete.

* doc/sourcebuild.texi (7.2.3.9 Other hardware attributes):
Document sqrt_insn.

From-SVN: r223485

gcc/ChangeLog
gcc/doc/sourcebuild.texi
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pow-sqrt-synth-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/pow-sqrt-synth-1.c [deleted file]
gcc/testsuite/lib/target-supports.exp

index af2225b159583bdac8241ba173d516b1fc5e026d..46784af723504805ea2615e4a5004d6fd41a4832 100644 (file)
@@ -1,3 +1,8 @@
+2015-05-21  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
+
+       * doc/sourcebuild.texi (7.2.3.9 Other hardware attributes):
+       Document sqrt_insn.
+
 2015-05-21  Richard Biener  <rguenther@suse.de>
 
        PR c++/66211
index c6ef40e5db78f57d5b91341b8d2e0af68cac3a28..abe07799f33fedcd83717f59230f346253e7829d 100644 (file)
@@ -1695,6 +1695,9 @@ Target supports FPU instructions.
 @item non_strict_align
 Target does not require strict alignment.
 
+@item sqrt_insn
+Target has a square root instruction that the compiler can generate.
+
 @item sse
 Target supports compiling @code{sse} instructions.
 
index e681453384859874066287d0e374e416a7d15e18..a5b78aa738e0cec3a8f3431ca7103ee21dbb1c4e 100644 (file)
@@ -1,3 +1,9 @@
+2015-05-21  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
+
+       * lib/target-supports.exp (check_effective_target_sqrt_insn): New check.
+       * gcc.dg/pow-sqrt-synth-1.c: New test.
+       * gcc.target/aarch64/pow-sqrt-synth-1.c: Delete.
+
 2015-05-21  Richard Biener  <rguenther@suse.de>
 
        PR c++/66211
diff --git a/gcc/testsuite/gcc.dg/pow-sqrt-synth-1.c b/gcc/testsuite/gcc.dg/pow-sqrt-synth-1.c
new file mode 100644 (file)
index 0000000..d55b626
--- /dev/null
@@ -0,0 +1,38 @@
+/* { dg-do compile { target sqrt_insn } } */
+/* { dg-options "-fdump-tree-sincos -Ofast --param max-pow-sqrt-depth=8" } */
+/* { dg-additional-options "-mfloat-abi=softfp -mfpu=neon-vfpv4" { target arm*-*-* } } */
+
+double
+foo (double a)
+{
+  return __builtin_pow (a, -5.875);
+}
+
+double
+foof (double a)
+{
+  return __builtin_pow (a, 0.75f);
+}
+
+double
+bar (double a)
+{
+  return __builtin_pow (a, 1.0 + 0.00390625);
+}
+
+double
+baz (double a)
+{
+  return __builtin_pow (a, -1.25) + __builtin_pow (a, 5.75) - __builtin_pow (a, 3.375);
+}
+
+#define N 256
+void
+vecfoo (double *a)
+{
+  for (int i = 0; i < N; i++)
+    a[i] = __builtin_pow (a[i], 1.25);
+}
+
+/* { dg-final { scan-tree-dump-times "synthesizing" 7 "sincos" } } */
+/* { dg-final { cleanup-tree-dump "sincos" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/pow-sqrt-synth-1.c b/gcc/testsuite/gcc.target/aarch64/pow-sqrt-synth-1.c
deleted file mode 100644 (file)
index 52514fb..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-fdump-tree-sincos -Ofast --param max-pow-sqrt-depth=8" } */
-
-
-double
-foo (double a)
-{
-  return __builtin_pow (a, -5.875);
-}
-
-double
-foof (double a)
-{
-  return __builtin_pow (a, 0.75f);
-}
-
-double
-bar (double a)
-{
-  return __builtin_pow (a, 1.0 + 0.00390625);
-}
-
-double
-baz (double a)
-{
-  return __builtin_pow (a, -1.25) + __builtin_pow (a, 5.75) - __builtin_pow (a, 3.375);
-}
-
-#define N 256
-void
-vecfoo (double *a)
-{
-  for (int i = 0; i < N; i++)
-    a[i] = __builtin_pow (a[i], 1.25);
-}
-
-/* { dg-final { scan-tree-dump-times "synthesizing" 7 "sincos" } } */
-/* { dg-final { cleanup-tree-dump "sincos" } } */
\ No newline at end of file
index 732f718829be5b244d1ff901da1ec68d6c097927..f0c209fc7022fda77ee2a04b496fca8a6b1dcce0 100644 (file)
@@ -4670,6 +4670,27 @@ proc check_effective_target_vect_call_copysignf { } {
     return $et_vect_call_copysignf_saved
 }
 
+# Return 1 if the target supports hardware square root instructions.
+
+proc check_effective_target_sqrt_insn { } {
+    global et_sqrt_insn_saved
+
+    if [info exists et_sqrt_insn_saved] {
+       verbose "check_effective_target_hw_sqrt: using cached result" 2
+    } else {
+       set et_sqrt_insn_saved 0
+       if { [istarget x86_64-*-*]
+            || [istarget powerpc*-*-*]
+            || [istarget aarch64*-*-*]
+            || ([istarget arm*-*-*] && [check_effective_target_arm_vfp_ok]) } {
+          set et_sqrt_insn_saved 1
+       }
+    }
+
+    verbose "check_effective_target_hw_sqrt: returning et_sqrt_insn_saved" 2
+    return $et_sqrt_insn_saved
+}
+
 # Return 1 if the target supports vector sqrtf calls.
 
 proc check_effective_target_vect_call_sqrtf { } {