diff --git a/gcc/config/s390/s390-builtins.def b/gcc/config/s390/s390-builtins.def
index 8186fad19f78009a88d4424bcf7cd88ed9f50c07..1700016fe4cede83958401c353cbccee901a712f 100644
--- a/gcc/config/s390/s390-builtins.def
+++ b/gcc/config/s390/s390-builtins.def
@@ -300,6 +300,8 @@
 #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>)
diff --git a/gcc/config/s390/s390-c.cc b/gcc/config/s390/s390-c.cc
index 27e18f0b4754cf847bdc57e804f7175d97dc781b..bda60ef8670e96eb28a86bcbe6b749b3047d6cca 100644
--- a/gcc/config/s390/s390-c.cc
+++ b/gcc/config/s390/s390-c.cc
@@ -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)));
diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc
index f5053781ffde220032b573da811b0fea48cecb86..f3b0061ac38dd70d52b9dc7bacd2b3041806eb07 100644
--- a/gcc/config/s390/s390.cc
+++ b/gcc/config/s390/s390.cc
@@ -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)
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 939ef3a41196c0d6ae9248687aec4c7ad1d9c83a..ca85a47c9ed61828f7d7f06dd93aad7307100d2f 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -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 {