* IN THE SOFTWARE.
*/
-#pragma once
+#ifndef GEN_MACROS_H
+#define GEN_MACROS_H
/* Macros for handling per-gen compilation.
*
* The prefixing macros GENX() and genX() automatically prefix whatever you
* give them by GENX_ or genX_ where X is the gen number.
*
- * You can declare a function to be used on some range of gens like this:
- *
- * GENX_FUNC(GEN7, GEN75) void
- * genX(my_function_name)(args...)
- * {
- * // Do stuff
- * }
- *
- * If the file is compiled for any set of gens containing gen7 and gen75,
- * the function will effectively only get compiled twice as
- * gen7_my_function_nmae and gen75_my_function_name. The function has to
- * be compilable on all gens, but it will become a static inline that gets
- * discarded by the compiler on all gens not in range.
- *
* You can do pseudo-runtime checks in your function such as
*
* if (GEN_GEN > 8 || GEN_IS_HASWELL) {
#define GEN_GEN ((GEN_VERSIONx10) / 10)
#define GEN_IS_HASWELL ((GEN_VERSIONx10) == 75)
+#define GEN_IS_G4X ((GEN_VERSIONx10) == 45)
/* Prefixing macros */
-#if (GEN_VERSIONx10 == 70)
+#if (GEN_VERSIONx10 == 40)
+# define GENX(X) GEN4_##X
+# define genX(x) gen4_##x
+#elif (GEN_VERSIONx10 == 45)
+# define GENX(X) GEN45_##X
+# define genX(x) gen45_##x
+#elif (GEN_VERSIONx10 == 50)
+# define GENX(X) GEN5_##X
+# define genX(x) gen5_##x
+#elif (GEN_VERSIONx10 == 60)
+# define GENX(X) GEN6_##X
+# define genX(x) gen6_##x
+#elif (GEN_VERSIONx10 == 70)
# define GENX(X) GEN7_##X
# define genX(x) gen7_##x
#elif (GEN_VERSIONx10 == 75)
#elif (GEN_VERSIONx10 == 90)
# define GENX(X) GEN9_##X
# define genX(x) gen9_##x
+#elif (GEN_VERSIONx10 == 100)
+# define GENX(X) GEN10_##X
+# define genX(x) gen10_##x
+#elif (GEN_VERSIONx10 == 110)
+# define GENX(X) GEN11_##X
+# define genX(x) gen11_##x
+#elif (GEN_VERSIONx10 == 120)
+# define GENX(X) GEN12_##X
+# define genX(x) gen12_##x
#else
# error "Need to add prefixing macros for this gen"
#endif
+
+#endif /* GEN_MACROS_H */