]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
amdgcn: Add preprocessor builtins for every processor type
authorPaul-Antoine Arras <pa@codesourcery.com>
Thu, 1 Dec 2022 14:09:54 +0000 (15:09 +0100)
committerPaul-Antoine Arras <pa@codesourcery.com>
Thu, 1 Dec 2022 14:48:34 +0000 (15:48 +0100)
Provide a specific builtin for each possible value of '-march'.

gcc/ChangeLog:

* config/gcn/gcn-opts.h (TARGET_FIJI): -march=fiji.
(TARGET_VEGA10): -march=gfx900.
(TARGET_VEGA20): -march=gfx906.
(TARGET_GFX908): -march=gfx908.
(TARGET_GFX90a): -march=gfx90a.
* config/gcn/gcn.h (TARGET_CPU_CPP_BUILTINS): Define a builtin that
uniquely maps to '-march'.

gcc/config/gcn/gcn-opts.h
gcc/config/gcn/gcn.h

index b62dfb45f591e49b2d83212d794a3e52afeb51b3..b54eae79fafb198656e7a7b05776ca351dd22820 100644 (file)
@@ -27,6 +27,12 @@ enum processor_type
   PROCESSOR_GFX90a
 };
 
+#define TARGET_FIJI (gcn_arch == PROCESSOR_FIJI)
+#define TARGET_VEGA10 (gcn_arch == PROCESSOR_VEGA10)
+#define TARGET_VEGA20 (gcn_arch == PROCESSOR_VEGA20)
+#define TARGET_GFX908 (gcn_arch == PROCESSOR_GFX908)
+#define TARGET_GFX90a (gcn_arch == PROCESSOR_GFX90a)
+
 /* Set in gcn_option_override.  */
 extern enum gcn_isa {
   ISA_UNKNOWN,
index 38f7212db59a209ca0762f62e26b924562878261..1cc5981d904ef2c89a6dac228ab2afde5bf6cf92 100644 (file)
 
 #include "config/gcn/gcn-opts.h"
 
-#define TARGET_CPU_CPP_BUILTINS()      \
-  do                                   \
-    {                                  \
-      builtin_define ("__AMDGCN__");   \
-      if (TARGET_GCN3)                 \
-       builtin_define ("__GCN3__");    \
-      else if (TARGET_GCN5)            \
-       builtin_define ("__GCN5__");    \
-      else if (TARGET_CDNA1)           \
-       builtin_define ("__CDNA1__");   \
-      else if (TARGET_CDNA2)           \
-       builtin_define ("__CDNA2__");   \
-    }                                  \
-  while(0)
+#define TARGET_CPU_CPP_BUILTINS()                                              \
+  do                                                                           \
+    {                                                                          \
+      builtin_define ("__AMDGCN__");                                           \
+      if (TARGET_GCN3)                                                         \
+       builtin_define ("__GCN3__");                                           \
+      else if (TARGET_GCN5)                                                    \
+       builtin_define ("__GCN5__");                                           \
+      else if (TARGET_CDNA1)                                                   \
+       builtin_define ("__CDNA1__");                                          \
+      else if (TARGET_CDNA2)                                                   \
+       builtin_define ("__CDNA2__");                                          \
+      if (TARGET_FIJI)                                                         \
+       {                                                                      \
+         builtin_define ("__fiji__");                                         \
+         builtin_define ("__gfx803__");                                       \
+       }                                                                      \
+      else if (TARGET_VEGA10)                                                  \
+       builtin_define ("__gfx900__");                                         \
+      else if (TARGET_VEGA20)                                                  \
+       builtin_define ("__gfx906__");                                         \
+      else if (TARGET_GFX908)                                                  \
+       builtin_define ("__gfx908__");                                         \
+      else if (TARGET_GFX90a)                                                  \
+       builtin_define ("__gfx90a__");                                         \
+  } while (0)
 
 /* Support for a compile-time default architecture and tuning.
    The rules are: