]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
LoongArch: Add tests for ASX xvldrepl/xvstelm instruction generation.
authorXiaolong Chen <chenxiaolong@loongson.cn>
Tue, 12 Sep 2023 08:00:48 +0000 (16:00 +0800)
committerLulu Cheng <chenglulu@loongson.cn>
Thu, 14 Sep 2023 00:42:58 +0000 (08:42 +0800)
gcc/testsuite/ChangeLog:

* gcc.target/loongarch/vector/lasx/lasx-xvldrepl.c: New test.
* gcc.target/loongarch/vector/lasx/lasx-xvstelm.c: New test.

gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-xvldrepl.c [new file with mode: 0644]
gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-xvstelm.c [new file with mode: 0644]

diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-xvldrepl.c b/gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-xvldrepl.c
new file mode 100644 (file)
index 0000000..1055679
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mlasx" } */
+/* { dg-final { scan-assembler-times "xvldrepl.w" 2} } */
+
+#define N 258
+
+float a[N], b[N], c[N];
+
+void
+test ()
+{
+  for (int i = 0; i < 256; i++)
+    {
+      a[i] = c[0] * b[i] + c[1];
+    }
+}
diff --git a/gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-xvstelm.c b/gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-xvstelm.c
new file mode 100644 (file)
index 0000000..1a7b0e8
--- /dev/null
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mlasx" } */
+/* { dg-final { scan-assembler-times "xvstelm.w" 8} } */
+
+#define LEN 256
+
+float a[LEN], b[LEN], c[LEN];
+
+void
+test ()
+{
+  for (int i = 0; i < LEN; i += 2)
+    a[i] = b[i] + c[i];
+}