* [PATCH][committed] aarch64: Annotate fcvtn pattern for vec_concat with zeroes
@ 2023-04-23 13:44 Kyrylo Tkachov
0 siblings, 0 replies; only message in thread
From: Kyrylo Tkachov @ 2023-04-23 13:44 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 637 bytes --]
Hi all,
Using the define_substs in aarch64-simd.md this is a straightforward annotation to remove
a redundant fmov insn.
So the codegen goes from:
foo_d:
fcvtn v0.2s, v0.2d
fmov d0, d0
ret
to the simple:
foo_d:
fcvtn v0.2s, v0.2d
ret
Bootstrapped and tested on aarch64-none-linux-gnu.
Pushing to trunk.
Thanks,
Kyrill
gcc/ChangeLog:
* config/aarch64/aarch64-simd.md (aarch64_float_truncate_lo_): Rename to...
(aarch64_float_truncate_lo_<mode><vczle><vczbe>): ... This.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/float_truncate_zero.c: New test.
[-- Attachment #2: fcvtn.patch --]
[-- Type: application/octet-stream, Size: 1453 bytes --]
diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md
index c145c7d2097e88cd4090d07916145a18355f3da8..dafc0134d2fc8e2700306f76d081ef8a1e4d54e3 100644
--- a/gcc/config/aarch64/aarch64-simd.md
+++ b/gcc/config/aarch64/aarch64-simd.md
@@ -3384,7 +3384,7 @@ (define_expand "aarch64_float_trunc_rodd_hi_v4sf"
}
)
-(define_insn "aarch64_float_truncate_lo_<mode>"
+(define_insn "aarch64_float_truncate_lo_<mode><vczle><vczbe>"
[(set (match_operand:VDF 0 "register_operand" "=w")
(float_truncate:VDF
(match_operand:<VWIDE> 1 "register_operand" "w")))]
diff --git a/gcc/testsuite/gcc.target/aarch64/float_truncate_zero.c b/gcc/testsuite/gcc.target/aarch64/float_truncate_zero.c
new file mode 100644
index 0000000000000000000000000000000000000000..41775d164a501944a860d0777d6e73780a730f3b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/float_truncate_zero.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-additional-options "--save-temps -O1" } */
+/* { dg-final { check-function-bodies "**" "" "" } } */
+
+#include <arm_neon.h>
+
+/*
+** foo:
+** fcvtn v0.4h, v0.4s
+** ret
+*/
+
+float16x8_t
+foo (float32x4_t a)
+{
+ float16x4_t b = vcvt_f16_f32 (a);
+ return vcombine_f16 (b, vdup_n_f16 (0.0));
+}
+
+/*
+** foo_d:
+** fcvtn v0.2s, v0.2d
+** ret
+*/
+
+float32x4_t
+foo_d (float64x2_t a)
+{
+ float32x2_t b = vcvt_f32_f64 (a);
+ return vcombine_f32 (b, vdup_n_f32 (0.0));
+}
+
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-04-23 13:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-23 13:44 [PATCH][committed] aarch64: Annotate fcvtn pattern for vec_concat with zeroes Kyrylo Tkachov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).