]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: Tests the pattern folding x/sqrt(x) to sqrt(x) for Float16
authorJennifer Schmitz <jschmitz@nvidia.com>
Wed, 10 Jul 2024 07:24:01 +0000 (12:54 +0530)
committerKyrylo Tkachov <ktkachov@nvidia.com>
Wed, 10 Jul 2024 07:24:01 +0000 (12:54 +0530)
As a follow-up to adding a pattern that folds x/sqrt(x) to sqrt(x) in match.pd, this patch adds a test case for type Float16 for armv8.2-a+fp16.

The patch was bootstrapped and regtested on aarch64-linux-gnu, no regression.

Signed-off-by: Jennifer Schmitz <jschmitz@nvidia.com>
gcc/testsuite/

* gcc.target/aarch64/sqrt_div_float16.c: New test.

gcc/testsuite/gcc.target/aarch64/sqrt_div_float16.c [new file with mode: 0644]

diff --git a/gcc/testsuite/gcc.target/aarch64/sqrt_div_float16.c b/gcc/testsuite/gcc.target/aarch64/sqrt_div_float16.c
new file mode 100644 (file)
index 0000000..c4f297e
--- /dev/null
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ffast-math -fdump-tree-forwprop-details" } */
+/* { dg-require-effective-target c99_runtime } */
+
+#pragma GCC target ("arch=armv8.2-a+fp16")
+
+_Float16 f (_Float16 x) 
+{
+  _Float16 t1 = __builtin_sqrt (x);
+  _Float16 t2 = x / t1;
+  return t2;
+}
+
+/* { dg-final { scan-tree-dump "gimple_simplified to t2_\[0-9\]+ = .SQRT .x_\[0-9\]*.D.." "forwprop1" } } */