[nvptx, testsuite] Add gcc.target/nvptx/sm*.c
authorTom de Vries <tdevries@suse.de>
Fri, 25 Feb 2022 10:43:55 +0000 (11:43 +0100)
committerTom de Vries <tdevries@suse.de>
Tue, 1 Mar 2022 07:58:35 +0000 (08:58 +0100)
Add a few test-cases that test passing each -misa=sm_xx version and verify that
the proper __PTX_SM__ is defined.

Tested on nvptx.

gcc/testsuite/ChangeLog:

2022-02-25  Tom de Vries  <tdevries@suse.de>

* gcc.target/nvptx/sm30.c: New test.
* gcc.target/nvptx/sm35.c: New test.
* gcc.target/nvptx/sm53.c: New test.
* gcc.target/nvptx/sm70.c: New test.
* gcc.target/nvptx/sm75.c: New test.
* gcc.target/nvptx/sm80.c: New test.

gcc/testsuite/gcc.target/nvptx/sm30.c [new file with mode: 0644]
gcc/testsuite/gcc.target/nvptx/sm35.c [new file with mode: 0644]
gcc/testsuite/gcc.target/nvptx/sm53.c [new file with mode: 0644]
gcc/testsuite/gcc.target/nvptx/sm70.c [new file with mode: 0644]
gcc/testsuite/gcc.target/nvptx/sm75.c [new file with mode: 0644]
gcc/testsuite/gcc.target/nvptx/sm80.c [new file with mode: 0644]

diff --git a/gcc/testsuite/gcc.target/nvptx/sm30.c b/gcc/testsuite/gcc.target/nvptx/sm30.c
new file mode 100644 (file)
index 0000000..4b35317
--- /dev/null
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-misa=sm_30" } */
+
+#if __PTX_SM__ != 300
+#error wrong value for __PTX_SM__
+#endif
diff --git a/gcc/testsuite/gcc.target/nvptx/sm35.c b/gcc/testsuite/gcc.target/nvptx/sm35.c
new file mode 100644 (file)
index 0000000..ff3d179
--- /dev/null
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-misa=sm_35" } */
+
+#if __PTX_SM__ != 350
+#error wrong value for __PTX_SM__
+#endif
diff --git a/gcc/testsuite/gcc.target/nvptx/sm53.c b/gcc/testsuite/gcc.target/nvptx/sm53.c
new file mode 100644 (file)
index 0000000..c47790b
--- /dev/null
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-misa=sm_53" } */
+
+#if __PTX_SM__ != 530
+#error wrong value for __PTX_SM__
+#endif
diff --git a/gcc/testsuite/gcc.target/nvptx/sm70.c b/gcc/testsuite/gcc.target/nvptx/sm70.c
new file mode 100644 (file)
index 0000000..dc5a5fd
--- /dev/null
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-misa=sm_70" } */
+
+#if __PTX_SM__ != 700
+#error wrong value for __PTX_SM__
+#endif
diff --git a/gcc/testsuite/gcc.target/nvptx/sm75.c b/gcc/testsuite/gcc.target/nvptx/sm75.c
new file mode 100644 (file)
index 0000000..c098bf7
--- /dev/null
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-misa=sm_75" } */
+
+#if __PTX_SM__ != 750
+#error wrong value for __PTX_SM__
+#endif
diff --git a/gcc/testsuite/gcc.target/nvptx/sm80.c b/gcc/testsuite/gcc.target/nvptx/sm80.c
new file mode 100644 (file)
index 0000000..3770563
--- /dev/null
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-misa=sm_80" } */
+
+#if __PTX_SM__ != 800
+#error wrong value for __PTX_SM__
+#endif