Hi!

On 2022-03-01T09:00:45+0100, Tom de Vries via Gcc-patches 
<gcc-patches@gcc.gnu.org> wrote:
> Add a few test-cases that test passing each -misa=sm_xx version and verify 
> that
> the proper __PTX_SM__ is defined.

Pushed to trunk branch commit ed96ce81b19b76ba6a5edfe68dd86d8ea319c6d9
"nvptx: Enhance '-march=[...]' test cases", see attached.


Grüße
 Thomas


>From ed96ce81b19b76ba6a5edfe68dd86d8ea319c6d9 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <tschwi...@baylibre.com>
Date: Sun, 10 Nov 2024 20:09:42 +0100
Subject: [PATCH] nvptx: Enhance '-march=[...]' test cases

This expands upon the test cases added in
commit 4706670cd3b06bb024da0683776bf86c79d55940
"[nvptx, testsuite] Add gcc.target/nvptx/sm*.c".

	gcc/testsuite/
	* gcc.target/nvptx/sm30.c: Remove; expanded into...
	* gcc.target/nvptx/march=sm_30.c: ... this.
	* gcc.target/nvptx/sm35.c: Remove; expanded into...
	* gcc.target/nvptx/march=sm_35.c: ... this.
	* gcc.target/nvptx/sm53.c: Remove; expanded into...
	* gcc.target/nvptx/march=sm_53.c: ... this.
	* gcc.target/nvptx/sm70.c: Remove; expanded into...
	* gcc.target/nvptx/march=sm_70.c: ... this.
	* gcc.target/nvptx/sm75.c: Remove; expanded into...
	* gcc.target/nvptx/march=sm_75.c: ... this.
	* gcc.target/nvptx/sm80.c: Remove; expanded into...
	* gcc.target/nvptx/march=sm_80.c: ... this.
	* gcc.target/nvptx/march.c: Remove.
---
 gcc/testsuite/gcc.target/nvptx/march.c       |  5 -----
 gcc/testsuite/gcc.target/nvptx/march=sm_30.c | 19 +++++++++++++++++++
 gcc/testsuite/gcc.target/nvptx/march=sm_35.c | 19 +++++++++++++++++++
 gcc/testsuite/gcc.target/nvptx/march=sm_53.c | 19 +++++++++++++++++++
 gcc/testsuite/gcc.target/nvptx/march=sm_70.c | 19 +++++++++++++++++++
 gcc/testsuite/gcc.target/nvptx/march=sm_75.c | 19 +++++++++++++++++++
 gcc/testsuite/gcc.target/nvptx/march=sm_80.c | 19 +++++++++++++++++++
 gcc/testsuite/gcc.target/nvptx/sm30.c        |  6 ------
 gcc/testsuite/gcc.target/nvptx/sm35.c        |  6 ------
 gcc/testsuite/gcc.target/nvptx/sm53.c        |  6 ------
 gcc/testsuite/gcc.target/nvptx/sm70.c        |  6 ------
 gcc/testsuite/gcc.target/nvptx/sm75.c        |  6 ------
 gcc/testsuite/gcc.target/nvptx/sm80.c        |  6 ------
 13 files changed, 114 insertions(+), 41 deletions(-)
 delete mode 100644 gcc/testsuite/gcc.target/nvptx/march.c
 create mode 100644 gcc/testsuite/gcc.target/nvptx/march=sm_30.c
 create mode 100644 gcc/testsuite/gcc.target/nvptx/march=sm_35.c
 create mode 100644 gcc/testsuite/gcc.target/nvptx/march=sm_53.c
 create mode 100644 gcc/testsuite/gcc.target/nvptx/march=sm_70.c
 create mode 100644 gcc/testsuite/gcc.target/nvptx/march=sm_75.c
 create mode 100644 gcc/testsuite/gcc.target/nvptx/march=sm_80.c
 delete mode 100644 gcc/testsuite/gcc.target/nvptx/sm30.c
 delete mode 100644 gcc/testsuite/gcc.target/nvptx/sm35.c
 delete mode 100644 gcc/testsuite/gcc.target/nvptx/sm53.c
 delete mode 100644 gcc/testsuite/gcc.target/nvptx/sm70.c
 delete mode 100644 gcc/testsuite/gcc.target/nvptx/sm75.c
 delete mode 100644 gcc/testsuite/gcc.target/nvptx/sm80.c

diff --git a/gcc/testsuite/gcc.target/nvptx/march.c b/gcc/testsuite/gcc.target/nvptx/march.c
deleted file mode 100644
index d1dd715798c4..000000000000
--- a/gcc/testsuite/gcc.target/nvptx/march.c
+++ /dev/null
@@ -1,5 +0,0 @@
-/* { dg-options "-march=sm_30" } */
-
-#include "main.c"
-
-/* { dg-final { scan-assembler-times "\\.target\tsm_30" 1 } } */
diff --git a/gcc/testsuite/gcc.target/nvptx/march=sm_30.c b/gcc/testsuite/gcc.target/nvptx/march=sm_30.c
new file mode 100644
index 000000000000..a362935f3827
--- /dev/null
+++ b/gcc/testsuite/gcc.target/nvptx/march=sm_30.c
@@ -0,0 +1,19 @@
+/* { dg-do assemble } */
+/* { dg-options {-march=sm_30 -mptx=_} } */
+/* { dg-additional-options -save-temps } */
+/* { dg-final { scan-assembler-times {(?n)^	\.version	6\.0$} 1 } } */
+/* { dg-final { scan-assembler-times {(?n)^	\.target	sm_30$} 1 } } */
+
+#if __PTX_ISA_VERSION_MAJOR__ != 6
+#error wrong value for __PTX_ISA_VERSION_MAJOR__
+#endif
+
+#if __PTX_ISA_VERSION_MINOR__ != 0
+#error wrong value for __PTX_ISA_VERSION_MINOR__
+#endif
+
+#if __PTX_SM__ != 300
+#error wrong value for __PTX_SM__
+#endif
+
+int dummy;
diff --git a/gcc/testsuite/gcc.target/nvptx/march=sm_35.c b/gcc/testsuite/gcc.target/nvptx/march=sm_35.c
new file mode 100644
index 000000000000..c9e92261b0e9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/nvptx/march=sm_35.c
@@ -0,0 +1,19 @@
+/* { dg-do assemble } */
+/* { dg-options {-march=sm_35 -mptx=_} } */
+/* { dg-additional-options -save-temps } */
+/* { dg-final { scan-assembler-times {(?n)^	\.version	6\.0$} 1 } } */
+/* { dg-final { scan-assembler-times {(?n)^	\.target	sm_35$} 1 } } */
+
+#if __PTX_ISA_VERSION_MAJOR__ != 6
+#error wrong value for __PTX_ISA_VERSION_MAJOR__
+#endif
+
+#if __PTX_ISA_VERSION_MINOR__ != 0
+#error wrong value for __PTX_ISA_VERSION_MINOR__
+#endif
+
+#if __PTX_SM__ != 350
+#error wrong value for __PTX_SM__
+#endif
+
+int dummy;
diff --git a/gcc/testsuite/gcc.target/nvptx/march=sm_53.c b/gcc/testsuite/gcc.target/nvptx/march=sm_53.c
new file mode 100644
index 000000000000..3155c714bc5b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/nvptx/march=sm_53.c
@@ -0,0 +1,19 @@
+/* { dg-do assemble } */
+/* { dg-options {-march=sm_53 -mptx=_} } */
+/* { dg-additional-options -save-temps } */
+/* { dg-final { scan-assembler-times {(?n)^	\.version	6\.0$} 1 } } */
+/* { dg-final { scan-assembler-times {(?n)^	\.target	sm_53$} 1 } } */
+
+#if __PTX_ISA_VERSION_MAJOR__ != 6
+#error wrong value for __PTX_ISA_VERSION_MAJOR__
+#endif
+
+#if __PTX_ISA_VERSION_MINOR__ != 0
+#error wrong value for __PTX_ISA_VERSION_MINOR__
+#endif
+
+#if __PTX_SM__ != 530
+#error wrong value for __PTX_SM__
+#endif
+
+int dummy;
diff --git a/gcc/testsuite/gcc.target/nvptx/march=sm_70.c b/gcc/testsuite/gcc.target/nvptx/march=sm_70.c
new file mode 100644
index 000000000000..6bde63938056
--- /dev/null
+++ b/gcc/testsuite/gcc.target/nvptx/march=sm_70.c
@@ -0,0 +1,19 @@
+/* { dg-do assemble } */
+/* { dg-options {-march=sm_70 -mptx=_} } */
+/* { dg-additional-options -save-temps } */
+/* { dg-final { scan-assembler-times {(?n)^	\.version	6\.0$} 1 } } */
+/* { dg-final { scan-assembler-times {(?n)^	\.target	sm_70$} 1 } } */
+
+#if __PTX_ISA_VERSION_MAJOR__ != 6
+#error wrong value for __PTX_ISA_VERSION_MAJOR__
+#endif
+
+#if __PTX_ISA_VERSION_MINOR__ != 0
+#error wrong value for __PTX_ISA_VERSION_MINOR__
+#endif
+
+#if __PTX_SM__ != 700
+#error wrong value for __PTX_SM__
+#endif
+
+int dummy;
diff --git a/gcc/testsuite/gcc.target/nvptx/march=sm_75.c b/gcc/testsuite/gcc.target/nvptx/march=sm_75.c
new file mode 100644
index 000000000000..2ec77ac70d3e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/nvptx/march=sm_75.c
@@ -0,0 +1,19 @@
+/* { dg-do assemble } */
+/* { dg-options {-march=sm_75 -mptx=_} } */
+/* { dg-additional-options -save-temps } */
+/* { dg-final { scan-assembler-times {(?n)^	\.version	6\.3$} 1 } } */
+/* { dg-final { scan-assembler-times {(?n)^	\.target	sm_75$} 1 } } */
+
+#if __PTX_ISA_VERSION_MAJOR__ != 6
+#error wrong value for __PTX_ISA_VERSION_MAJOR__
+#endif
+
+#if __PTX_ISA_VERSION_MINOR__ != 3
+#error wrong value for __PTX_ISA_VERSION_MINOR__
+#endif
+
+#if __PTX_SM__ != 750
+#error wrong value for __PTX_SM__
+#endif
+
+int dummy;
diff --git a/gcc/testsuite/gcc.target/nvptx/march=sm_80.c b/gcc/testsuite/gcc.target/nvptx/march=sm_80.c
new file mode 100644
index 000000000000..024d75ece4c9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/nvptx/march=sm_80.c
@@ -0,0 +1,19 @@
+/* { dg-do assemble } */
+/* { dg-options {-march=sm_80 -mptx=_} } */
+/* { dg-additional-options -save-temps } */
+/* { dg-final { scan-assembler-times {(?n)^	\.version	7\.0$} 1 } } */
+/* { dg-final { scan-assembler-times {(?n)^	\.target	sm_80$} 1 } } */
+
+#if __PTX_ISA_VERSION_MAJOR__ != 7
+#error wrong value for __PTX_ISA_VERSION_MAJOR__
+#endif
+
+#if __PTX_ISA_VERSION_MINOR__ != 0
+#error wrong value for __PTX_ISA_VERSION_MINOR__
+#endif
+
+#if __PTX_SM__ != 800
+#error wrong value for __PTX_SM__
+#endif
+
+int dummy;
diff --git a/gcc/testsuite/gcc.target/nvptx/sm30.c b/gcc/testsuite/gcc.target/nvptx/sm30.c
deleted file mode 100644
index 4b3531788d44..000000000000
--- a/gcc/testsuite/gcc.target/nvptx/sm30.c
+++ /dev/null
@@ -1,6 +0,0 @@
-/* { 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
deleted file mode 100644
index ff3d17938460..000000000000
--- a/gcc/testsuite/gcc.target/nvptx/sm35.c
+++ /dev/null
@@ -1,6 +0,0 @@
-/* { 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
deleted file mode 100644
index b4d819c6a799..000000000000
--- a/gcc/testsuite/gcc.target/nvptx/sm53.c
+++ /dev/null
@@ -1,6 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-misa=sm_53 -mptx=_" } */
-
-#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
deleted file mode 100644
index 4bd012b5680a..000000000000
--- a/gcc/testsuite/gcc.target/nvptx/sm70.c
+++ /dev/null
@@ -1,6 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-misa=sm_70 -mptx=_" } */
-
-#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
deleted file mode 100644
index d159d3f5fb31..000000000000
--- a/gcc/testsuite/gcc.target/nvptx/sm75.c
+++ /dev/null
@@ -1,6 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-misa=sm_75 -mptx=_" } */
-
-#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
deleted file mode 100644
index ef6d8b7fa23d..000000000000
--- a/gcc/testsuite/gcc.target/nvptx/sm80.c
+++ /dev/null
@@ -1,6 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-misa=sm_80 -mptx=_" } */
-
-#if __PTX_SM__ != 800
-#error wrong value for __PTX_SM__
-#endif
-- 
2.34.1

Reply via email to