]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
s390: arch15: Prepare for future builtins
authorStefan Schulze Frielinghaus <stefansf@linux.ibm.com>
Mon, 20 Jan 2025 09:01:08 +0000 (10:01 +0100)
committerStefan Schulze Frielinghaus <stefansf@gcc.gnu.org>
Mon, 20 Jan 2025 09:01:08 +0000 (10:01 +0100)
gcc/ChangeLog:

* config/s390/s390-builtins.def (B_VXE3): Define.
(B_ARCH15): Define.
* config/s390/s390-c.cc (s390_resolve_overloaded_builtin):
Consistency checks for VXE3.
* config/s390/s390.cc (s390_expand_builtin): Consistency checks
for VXE3.

gcc/testsuite/ChangeLog:

* lib/target-supports.exp: VXE3 effective target check.

gcc/config/s390/s390-builtins.def
gcc/config/s390/s390-c.cc
gcc/config/s390/s390.cc
gcc/testsuite/lib/target-supports.exp

index 8186fad19f78009a88d4424bcf7cd88ed9f50c07..1700016fe4cede83958401c353cbccee901a712f 100644 (file)
 #define B_VXE2  (1 << 4)  /* Builtins requiring the z15 vector extensions.  */
 #define B_DEP   (1 << 5)  /* Builtin has been deprecated and a warning should be issued.  */
 #define B_NNPA  (1 << 6)  /* Builtins requiring the NNPA Facility.  */
+#define B_VXE3  (1 << 7)  /* Builtins requiring the arch15 vector extensions.  */
+#define B_ARCH15 (1 << 8) /* Builtins requiring arch15.  */
 
 /* B_DEF defines a standard (not overloaded) builtin
    B_DEF (<builtin name>, <RTL expander name>, <function attributes>, <builtin flags>, <operand flags, see above>, <fntype>)
index 27e18f0b4754cf847bdc57e804f7175d97dc781b..bda60ef8670e96eb28a86bcbe6b749b3047d6cca 100644 (file)
@@ -958,6 +958,12 @@ s390_resolve_overloaded_builtin (location_t loc, tree ob_fndecl,
       return error_mark_node;
     }
 
+  if (!TARGET_VXE3 && (ob_flags & B_VXE3))
+    {
+      error_at (loc, "%qF requires arch15 or higher", ob_fndecl);
+      return error_mark_node;
+    }
+
   ob_fcode -= S390_BUILTIN_MAX;
 
   for (b_arg_chain = TYPE_ARG_TYPES (TREE_TYPE (ob_fndecl));
@@ -1045,6 +1051,14 @@ s390_resolve_overloaded_builtin (location_t loc, tree ob_fndecl,
       return error_mark_node;
     }
 
+  if (!TARGET_VXE3
+      && bflags_overloaded_builtin_var[last_match_index] & B_VXE3)
+    {
+      error_at (loc, "%qs matching variant requires arch15 or higher",
+               IDENTIFIER_POINTER (DECL_NAME (ob_fndecl)));
+      return error_mark_node;
+    }
+
   if (bflags_overloaded_builtin_var[last_match_index] & B_DEP)
     warning_at (loc, 0, "%qs matching variant is deprecated",
                IDENTIFIER_POINTER (DECL_NAME (ob_fndecl)));
index f5053781ffde220032b573da811b0fea48cecb86..f3b0061ac38dd70d52b9dc7bacd2b3041806eb07 100644 (file)
@@ -913,6 +913,12 @@ s390_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
          error ("Builtin %qF requires z15 or higher", fndecl);
          return const0_rtx;
        }
+
+      if ((bflags & B_VXE3) && !TARGET_VXE3)
+       {
+         error ("Builtin %qF requires arch15 or higher", fndecl);
+         return const0_rtx;
+       }
     }
   if (fcode >= S390_OVERLOADED_BUILTIN_VAR_OFFSET
       && fcode < S390_ALL_BUILTIN_MAX)
index 939ef3a41196c0d6ae9248687aec4c7ad1d9c83a..ca85a47c9ed61828f7d7f06dd93aad7307100d2f 100644 (file)
@@ -12959,6 +12959,22 @@ proc check_effective_target_s390_vxe2 { } {
     } "-march=arch13 -mzarch" ]
 }
 
+# Same as above but for the arch15 vector enhancement facility. Test
+# is performed with the vector divide instruction.
+proc check_effective_target_s390_vxe3 { } {
+    if ![istarget s390*-*-*] then {
+       return 0;
+    }
+
+    return [check_runtime s390_check_vxe3 {
+       int main (void)
+       {
+           asm ("vd %%v24, %%v26, %%v28, 2, 0" : : : "v24", "v26", "v28");
+           return 0;
+       }
+    } "-march=arch15 -mzarch" ]
+}
+
 # Same as above but for the arch14 NNPA facility.
 proc check_effective_target_s390_nnpa { } {
     if ![istarget s390*-*-*] then {