diff --git a/gcc/testsuite/gcc.target/bpf/bpf.exp b/gcc/testsuite/gcc.target/bpf/bpf.exp
new file mode 100644
index 00000000000..e5c8cfcf6b0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/bpf.exp
@@ -0,0 +1,41 @@
+# Copyright (C) 2019 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Exit immediately if this isn't an eBPF target.
+if ![istarget bpf-*-*] then {
+  return
+}
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+    set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
+	"" $DEFAULT_CFLAGS
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/gcc.target/bpf/builtin-load.c b/gcc/testsuite/gcc.target/bpf/builtin-load.c
new file mode 100644
index 00000000000..0f93d91fb6f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/builtin-load.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -std=gnu99" } */
+
+void foo ()
+{
+  long long ll, off;
+
+  /* Indirect.  */
+  ll = __builtin_bpf_load_byte (off);
+  ll = __builtin_bpf_load_half (off);
+  ll = __builtin_bpf_load_word (off);
+
+  /* Absolute.  */
+  ll = __builtin_bpf_load_byte (0);
+  ll = __builtin_bpf_load_half (4);
+  ll = __builtin_bpf_load_word (8);
+}
+
+/* { dg-final { scan-assembler "ldindb\t%r.,0.*ldindh\t%r.,0.*ldindw\t%r.,0" } } */
+/* { dg-final { scan-assembler "ldabsb\t0.*ldabsh\t4.*ldabsw\t8" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/constant-calls.c b/gcc/testsuite/gcc.target/bpf/constant-calls.c
new file mode 100644
index 00000000000..6effc7dfdd4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/constant-calls.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+
+typedef void  *(*T)(void);
+f1 ()
+{
+  ((T) 0)();
+}
+f2 ()
+{
+  ((T) 1000)();
+}
+f3 ()
+{
+  ((T) 1000000)();
+}
+
+/* { dg-final { scan-assembler "call\t0" } } */
+/* { dg-final { scan-assembler "call\t1000" } } */
+/* { dg-final { scan-assembler "call\t10000" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/diag-funargs.c b/gcc/testsuite/gcc.target/bpf/diag-funargs.c
new file mode 100644
index 00000000000..63b71f91b6d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/diag-funargs.c
@@ -0,0 +1,15 @@
+/* Verify proper errors are generated for functions taking too many
+   arguments.  */
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+
+int
+foo (int a1,  /* { dg-error "more than 5 arguments" } */
+     int a2,
+     int a3,
+     int a4,
+     int a5,
+     int a6)
+{
+  return a6;
+}
diff --git a/gcc/testsuite/gcc.target/bpf/diag-indcalls.c b/gcc/testsuite/gcc.target/bpf/diag-indcalls.c
new file mode 100644
index 00000000000..9263fcf7e1a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/diag-indcalls.c
@@ -0,0 +1,11 @@
+/* Verify proper errors are generated for indirect function calls.  */
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+
+void (*fnp) (void);
+
+void
+foo ()
+{
+  (*fnp) ();
+} /* { dg-error "indirect call in function" } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-bind.c b/gcc/testsuite/gcc.target/bpf/helper-bind.c
new file mode 100644
index 00000000000..2d1fedc4ce8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-bind.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *ctx, *addr;
+  int addr_len;
+
+  ret = __builtin_bpf_helper_bind (ctx, addr, addr_len);
+}
+
+/* { dg-final { scan-assembler "call\t64" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-bpf-redirect.c b/gcc/testsuite/gcc.target/bpf/helper-bpf-redirect.c
new file mode 100644
index 00000000000..844c88d3e34
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-bpf-redirect.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  uint32_t ifindex;
+  uint64_t flags;
+
+  ret = __builtin_bpf_helper_redirect (ifindex, flags);
+}
+
+/* { dg-final { scan-assembler "call\t23" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-clone-redirect.c b/gcc/testsuite/gcc.target/bpf/helper-clone-redirect.c
new file mode 100644
index 00000000000..a4fb8139234
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-clone-redirect.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skb;
+  uint32_t ifindex;
+  uint64_t flags;
+
+  ret = __builtin_bpf_helper_clone_redirect (skb, ifindex, flags);
+}
+
+/* { dg-final { scan-assembler "call\t13" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-csum-diff.c b/gcc/testsuite/gcc.target/bpf/helper-csum-diff.c
new file mode 100644
index 00000000000..ef38192efd3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-csum-diff.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int64_t ret;
+  int32_t *to, *from;
+  uint64_t to_size, from_size;
+  int seed;
+
+  ret = __builtin_bpf_helper_csum_diff (from, from_size, to, to_size, seed);
+}
+
+/* { dg-final { scan-assembler "call\t28" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-csum-update.c b/gcc/testsuite/gcc.target/bpf/helper-csum-update.c
new file mode 100644
index 00000000000..3cde8678cb5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-csum-update.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int64_t ret;
+  void *skb;
+  int csum;
+
+  ret = __builtin_bpf_helper_csum_update (skb, csum);
+}
+
+/* { dg-final { scan-assembler "call\t40" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-current-task-under-cgroup.c b/gcc/testsuite/gcc.target/bpf/helper-current-task-under-cgroup.c
new file mode 100644
index 00000000000..a7eb6e617e8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-current-task-under-cgroup.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *map;
+  uint32_t index;
+
+  ret = __builtin_bpf_helper_current_task_under_cgroup (map, index);
+}
+
+/* { dg-final { scan-assembler "call\t37" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-fib-lookup.c b/gcc/testsuite/gcc.target/bpf/helper-fib-lookup.c
new file mode 100644
index 00000000000..9a9f79d402c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-fib-lookup.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *ctx, *params;
+  int plen;
+  uint32_t flags;
+
+  ret = __builtin_bpf_helper_fib_lookup (ctx, params, plen, flags);
+}
+
+/* { dg-final { scan-assembler "call\t69" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-cgroup-classid.c b/gcc/testsuite/gcc.target/bpf/helper-get-cgroup-classid.c
new file mode 100644
index 00000000000..6cfd14d0ad1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-get-cgroup-classid.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  uint32_t ret;
+  void *skb;
+
+  ret = __builtin_bpf_helper_get_cgroup_classid (skb);
+}
+
+/* { dg-final { scan-assembler "call\t17" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-current-cgroup-id.c b/gcc/testsuite/gcc.target/bpf/helper-get-current-cgroup-id.c
new file mode 100644
index 00000000000..916dc4d3bb1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-get-current-cgroup-id.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  uint64_t ret;
+  
+  ret = __builtin_bpf_helper_get_current_cgroup_id ();
+}
+
+/* { dg-final { scan-assembler "call\t80" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-current-comm.c b/gcc/testsuite/gcc.target/bpf/helper-get-current-comm.c
new file mode 100644
index 00000000000..efc330c3c98
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-get-current-comm.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *buf;
+  uint32_t size_of_buf;
+
+  ret = __builtin_bpf_helper_get_current_comm (buf, size_of_buf);
+}
+
+/* { dg-final { scan-assembler "call\t16" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-current-pid-tgid.c b/gcc/testsuite/gcc.target/bpf/helper-get-current-pid-tgid.c
new file mode 100644
index 00000000000..32d3e9c91d1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-get-current-pid-tgid.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  uint64_t ret;
+
+  ret = __builtin_bpf_helper_get_current_pid_tgid ();
+}
+
+/* { dg-final { scan-assembler "call\t14" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-current-task.c b/gcc/testsuite/gcc.target/bpf/helper-get-current-task.c
new file mode 100644
index 00000000000..c1290f6516e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-get-current-task.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  uint64_t ret;
+  void *ctx;
+
+  ret = __builtin_bpf_helper_get_current_task (ctx);
+}
+
+/* { dg-final { scan-assembler "call\t35" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-current-uid-gid.c b/gcc/testsuite/gcc.target/bpf/helper-get-current-uid-gid.c
new file mode 100644
index 00000000000..1dc2f9f41e5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-get-current-uid-gid.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  uint64_t ret;
+
+  ret = __builtin_bpf_helper_get_current_uid_gid ();
+}
+
+/* { dg-final { scan-assembler "call\t15" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-hash-recalc.c b/gcc/testsuite/gcc.target/bpf/helper-get-hash-recalc.c
new file mode 100644
index 00000000000..1db5d871c26
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-get-hash-recalc.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  uint32_t ret;
+  void *skb;
+
+  ret = __builtin_bpf_helper_get_hash_recalc (skb);
+}
+
+/* { dg-final { scan-assembler "call\t34" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-listener-sock.c b/gcc/testsuite/gcc.target/bpf/helper-get-listener-sock.c
new file mode 100644
index 00000000000..298da1c949b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-get-listener-sock.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  void *ret, *sk;
+
+  ret = __builtin_bpf_helper_get_listener_sock (sk);
+}
+
+/* { dg-final { scan-assembler "call\t98" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-local-storage.c b/gcc/testsuite/gcc.target/bpf/helper-get-local-storage.c
new file mode 100644
index 00000000000..88da67e99ae
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-get-local-storage.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  void *ret, *map;
+  uint64_t flags;
+  
+  ret = __builtin_bpf_helper_get_local_storage (map, flags);
+}
+
+/* { dg-final { scan-assembler "call\t81" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-numa-node-id.c b/gcc/testsuite/gcc.target/bpf/helper-get-numa-node-id.c
new file mode 100644
index 00000000000..628e1012152
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-get-numa-node-id.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+
+  ret = __builtin_bpf_helper_get_numa_node_id ();
+}
+
+/* { dg-final { scan-assembler "call\t42" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-prandom-u32.c b/gcc/testsuite/gcc.target/bpf/helper-get-prandom-u32.c
new file mode 100644
index 00000000000..6d3e5bc7a22
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-get-prandom-u32.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  uint32_t ret;
+
+  ret = __builtin_bpf_helper_get_prandom_u32 ();
+}
+
+/* { dg-final { scan-assembler "call\t7" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-route-realm.c b/gcc/testsuite/gcc.target/bpf/helper-get-route-realm.c
new file mode 100644
index 00000000000..5056c4adb1f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-get-route-realm.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  uint32_t ret;
+  void *skb;
+
+  ret = __builtin_bpf_helper_get_route_realm (skb);
+}
+
+/* { dg-final { scan-assembler "call\t24" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-smp-processor-id.c b/gcc/testsuite/gcc.target/bpf/helper-get-smp-processor-id.c
new file mode 100644
index 00000000000..655b87341df
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-get-smp-processor-id.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  uint32_t ret;
+
+  ret = __builtin_bpf_helper_get_smp_processor_id ();
+}
+
+/* { dg-final { scan-assembler "call\t8" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-socket-cookie.c b/gcc/testsuite/gcc.target/bpf/helper-get-socket-cookie.c
new file mode 100644
index 00000000000..afd17ddcd50
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-get-socket-cookie.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  uint64_t ret;
+  void *skb;
+  
+  ret = __builtin_bpf_helper_get_socket_cookie (skb);
+}
+
+/* { dg-final { scan-assembler "call\t46" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-socket-uid.c b/gcc/testsuite/gcc.target/bpf/helper-get-socket-uid.c
new file mode 100644
index 00000000000..3a274c965f7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-get-socket-uid.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  uint32_t ret;
+  void *skb;
+  
+  ret = __builtin_bpf_helper_get_socket_uid (skb);
+}
+
+/* { dg-final { scan-assembler "call\t47" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-stack.c b/gcc/testsuite/gcc.target/bpf/helper-get-stack.c
new file mode 100644
index 00000000000..bbcdeb58775
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-get-stack.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *regs, *buf;
+  uint32_t size;
+  uint64_t flags;
+
+  ret = __builtin_bpf_helper_get_stack (regs, buf, size, flags);
+}
+
+/* { dg-final { scan-assembler "call\t67" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-get-stackid.c b/gcc/testsuite/gcc.target/bpf/helper-get-stackid.c
new file mode 100644
index 00000000000..319d15cd2fa
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-get-stackid.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *ctx, *map;
+  uint64_t flags;
+
+  ret = __builtin_bpf_helper_get_stackid (ctx, map, flags);
+}
+
+/* { dg-final { scan-assembler "call\t27" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-getsockopt.c b/gcc/testsuite/gcc.target/bpf/helper-getsockopt.c
new file mode 100644
index 00000000000..fb16f15e6ea
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-getsockopt.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *bpf_socket;
+  int level, optname, optlen;
+  char *optval;
+  
+  ret = __builtin_bpf_helper_getsockopt (bpf_socket, level,
+					 optname, optval, optlen);
+}
+
+/* { dg-final { scan-assembler "call\t57" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-ktime-get-ns.c b/gcc/testsuite/gcc.target/bpf/helper-ktime-get-ns.c
new file mode 100644
index 00000000000..405df057e30
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-ktime-get-ns.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  uint64_t ret;
+  ret = __builtin_bpf_helper_ktime_get_ns ();
+}
+
+/* { dg-final { scan-assembler "call\t5" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-l3-csum-replace.c b/gcc/testsuite/gcc.target/bpf/helper-l3-csum-replace.c
new file mode 100644
index 00000000000..ac17662c5d6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-l3-csum-replace.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skb;
+  uint32_t offset;
+  uint64_t from, to, size;
+
+  ret = __builtin_bpf_helper_l3_csum_replace (skb, offset, from, to, size);
+}
+
+/* { dg-final { scan-assembler "call\t10" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-l4-csum-replace.c b/gcc/testsuite/gcc.target/bpf/helper-l4-csum-replace.c
new file mode 100644
index 00000000000..52b5514b6cb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-l4-csum-replace.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skb;
+  uint32_t offset;
+  uint64_t from, to, size;
+
+  ret = __builtin_bpf_helper_l4_csum_replace (skb, offset, from, to, size);
+}
+
+/* { dg-final { scan-assembler "call\t11" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-lwt-push-encap.c b/gcc/testsuite/gcc.target/bpf/helper-lwt-push-encap.c
new file mode 100644
index 00000000000..1baed27fac7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-lwt-push-encap.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skb, *hdr;
+  uint32_t type, len;
+  
+  ret = __builtin_bpf_helper_lwt_push_encap (skb, type, hdr, len);
+}
+
+/* { dg-final { scan-assembler "call\t73" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-lwt-seg6-action.c b/gcc/testsuite/gcc.target/bpf/helper-lwt-seg6-action.c
new file mode 100644
index 00000000000..ccc94c1af9d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-lwt-seg6-action.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skb, *param;
+  uint32_t action, param_len;
+  
+  ret = __builtin_bpf_helper_lwt_seg6_action (skb, action,
+					      param, param_len);
+}
+
+/* { dg-final { scan-assembler "call\t76" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-lwt-seg6-adjust-srh.c b/gcc/testsuite/gcc.target/bpf/helper-lwt-seg6-adjust-srh.c
new file mode 100644
index 00000000000..5e95124ad0f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-lwt-seg6-adjust-srh.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skb;
+  uint32_t offset, delta;
+  
+  ret = __builtin_bpf_helper_lwt_seg6_adjust_srh (skb, offset,
+						  delta);
+}
+
+/* { dg-final { scan-assembler "call\t75" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-lwt-seg6-store-bytes.c b/gcc/testsuite/gcc.target/bpf/helper-lwt-seg6-store-bytes.c
new file mode 100644
index 00000000000..098f97680f2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-lwt-seg6-store-bytes.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skb, *from;
+  uint32_t offset, len;
+  
+  ret = __builtin_bpf_helper_lwt_seg6_store_bytes (skb, offset,
+						   from, len);
+}
+
+/* { dg-final { scan-assembler "call\t74" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-map-delete-elem.c b/gcc/testsuite/gcc.target/bpf/helper-map-delete-elem.c
new file mode 100644
index 00000000000..b8a6cdec4ee
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-map-delete-elem.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+char *map () { return 0; }
+
+void
+foo ()
+{
+  int ret;
+  char *key = 0;
+
+  ret = __builtin_bpf_helper_map_delete_elem (map (), key);
+}
+
+/* { dg-final { scan-assembler "call\t3" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-map-lookup-elem.c b/gcc/testsuite/gcc.target/bpf/helper-map-lookup-elem.c
new file mode 100644
index 00000000000..839cfc423a7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-map-lookup-elem.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+
+char *map () { return 0; }
+
+void
+foo ()
+{
+  char *key = 0, *value = 0;
+  value = __builtin_bpf_helper_map_lookup_elem (map (), key);
+}
+
+/* { dg-final { scan-assembler "call\t1" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-map-peek-elem.c b/gcc/testsuite/gcc.target/bpf/helper-map-peek-elem.c
new file mode 100644
index 00000000000..6d0acb1dcb7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-map-peek-elem.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+char *map () { return 0; }
+
+void
+foo ()
+{
+  int ret;
+  char *value = 0;
+
+  ret = __builtin_bpf_helper_map_peek_elem (map (), value);
+}
+
+/* { dg-final { scan-assembler "call\t89" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-map-pop-elem.c b/gcc/testsuite/gcc.target/bpf/helper-map-pop-elem.c
new file mode 100644
index 00000000000..71a7851ca9c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-map-pop-elem.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+char *map () { return 0; }
+
+void
+foo ()
+{
+  int ret;
+  char *value = 0;
+
+  ret = __builtin_bpf_helper_map_pop_elem (map (), value);
+}
+
+/* { dg-final { scan-assembler "call\t88" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-map-push-elem.c b/gcc/testsuite/gcc.target/bpf/helper-map-push-elem.c
new file mode 100644
index 00000000000..53bc0ac5dd7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-map-push-elem.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+
+char *map () { return 0; }
+
+void
+foo ()
+{
+  int ret;
+  char *value = 0;
+  long long flags = 0;
+
+  ret = __builtin_bpf_helper_map_push_elem (map (), value, flags);
+}
+
+/* { dg-final { scan-assembler "call\t87" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-map-update-elem.c b/gcc/testsuite/gcc.target/bpf/helper-map-update-elem.c
new file mode 100644
index 00000000000..6281442ba3d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-map-update-elem.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+
+char *map () { return 0; }
+
+void
+foo ()
+{
+  int ret;
+  long long flags = 0;
+  char *key = 0, *value = 0;
+
+  ret = __builtin_bpf_helper_map_update_elem (map (), key, value, flags);
+}
+
+/* { dg-final { scan-assembler "call\t2" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-msg-apply-bytes.c b/gcc/testsuite/gcc.target/bpf/helper-msg-apply-bytes.c
new file mode 100644
index 00000000000..3b831acad64
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-msg-apply-bytes.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *msg;
+  uint32_t bytes;
+  
+  ret = __builtin_bpf_helper_msg_apply_bytes (msg, bytes);
+}
+
+/* { dg-final { scan-assembler "call\t61" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-msg-cork-bytes.c b/gcc/testsuite/gcc.target/bpf/helper-msg-cork-bytes.c
new file mode 100644
index 00000000000..2c4ee218832
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-msg-cork-bytes.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *msg;
+  uint32_t bytes;
+  
+  ret = __builtin_bpf_helper_msg_cork_bytes (msg, bytes);
+}
+
+/* { dg-final { scan-assembler "call\t62" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-msg-pop-data.c b/gcc/testsuite/gcc.target/bpf/helper-msg-pop-data.c
new file mode 100644
index 00000000000..377c036603e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-msg-pop-data.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skb;
+  uint32_t start, pop;
+  uint64_t flags;
+
+  ret = __builtin_bpf_helper_msg_pop_data (skb, start, pop, flags);
+}
+
+/* { dg-final { scan-assembler "call\t91" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-msg-pull-data.c b/gcc/testsuite/gcc.target/bpf/helper-msg-pull-data.c
new file mode 100644
index 00000000000..ef27493122b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-msg-pull-data.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *msg;
+  uint32_t start, end;
+  uint64_t flags;
+  
+  ret = __builtin_bpf_helper_msg_pull_data (msg, start, end, flags);
+}
+
+/* { dg-final { scan-assembler "call\t63" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-msg-push-data.c b/gcc/testsuite/gcc.target/bpf/helper-msg-push-data.c
new file mode 100644
index 00000000000..9e256bc5ca7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-msg-push-data.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skb;
+  uint32_t start, len;
+  uint64_t flags;
+
+  ret = __builtin_bpf_helper_msg_push_data (skb, start, len, flags);
+}
+
+/* { dg-final { scan-assembler "call\t90" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-msg-redirect-hash.c b/gcc/testsuite/gcc.target/bpf/helper-msg-redirect-hash.c
new file mode 100644
index 00000000000..2e9d4137d66
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-msg-redirect-hash.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *msg, *map, *key;
+  uint64_t flags;
+
+  ret = __builtin_bpf_helper_msg_redirect_hash (msg, map, key,
+						flags);
+}
+
+/* { dg-final { scan-assembler "call\t71" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-msg-redirect-map.c b/gcc/testsuite/gcc.target/bpf/helper-msg-redirect-map.c
new file mode 100644
index 00000000000..f5f8405e324
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-msg-redirect-map.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *msg, *map;
+  uint64_t key;
+  uint64_t flags;
+  
+  ret = __builtin_bpf_helper_msg_redirect_map (msg, map, key,
+					       flags);
+}
+
+/* { dg-final { scan-assembler "call\t60" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-override-return.c b/gcc/testsuite/gcc.target/bpf/helper-override-return.c
new file mode 100644
index 00000000000..3bd5424353f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-override-return.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *regs;
+  uint64_t rc;
+  
+  ret = __builtin_bpf_helper_override_return (regs, rc);
+}
+
+/* { dg-final { scan-assembler "call\t58" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-perf-event-output.c b/gcc/testsuite/gcc.target/bpf/helper-perf-event-output.c
new file mode 100644
index 00000000000..afb32010bdd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-perf-event-output.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *ctx, *map;
+  uint64_t flags;
+  void *data;
+  uint64_t size;
+
+  ret = __builtin_bpf_helper_perf_event_output (ctx, map, flags, data, size);
+}
+
+/* { dg-final { scan-assembler "call\t25" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-perf-event-read-value.c b/gcc/testsuite/gcc.target/bpf/helper-perf-event-read-value.c
new file mode 100644
index 00000000000..1d512c9ec65
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-perf-event-read-value.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *map, *buf;
+  uint64_t flags;
+  uint64_t buf_size;
+  
+  ret = __builtin_bpf_helper_perf_event_read_value (map, flags, buf, buf_size);
+}
+
+/* { dg-final { scan-assembler "call\t55" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-perf-event-read.c b/gcc/testsuite/gcc.target/bpf/helper-perf-event-read.c
new file mode 100644
index 00000000000..f099a09d66f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-perf-event-read.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  uint64_t ret;
+  void *map;
+  uint64_t flags;
+
+  ret = __builtin_bpf_helper_perf_event_read (map, flags);
+}
+
+/* { dg-final { scan-assembler "call\t22" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-perf-prog-read-value.c b/gcc/testsuite/gcc.target/bpf/helper-perf-prog-read-value.c
new file mode 100644
index 00000000000..00c4a3a78b5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-perf-prog-read-value.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *ctx, *buf;
+  uint64_t buf_size;
+  
+  ret = __builtin_bpf_helper_perf_prog_read_value (ctx, buf, buf_size);
+}
+
+/* { dg-final { scan-assembler "call\t56" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-probe-read-str.c b/gcc/testsuite/gcc.target/bpf/helper-probe-read-str.c
new file mode 100644
index 00000000000..fd04760221d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-probe-read-str.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  int size;
+  void *dst;
+  const void *unsafe_ptr;
+  
+  ret = __builtin_bpf_helper_probe_read_str (dst, size, unsafe_ptr);
+}
+
+/* { dg-final { scan-assembler "call\t45" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-probe-read.c b/gcc/testsuite/gcc.target/bpf/helper-probe-read.c
new file mode 100644
index 00000000000..a77a907767b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-probe-read.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *src, *dst;
+  uint32_t size;
+
+  ret = __builtin_bpf_helper_probe_read (dst, size, src);
+}
+
+/* { dg-final { scan-assembler "call\t4" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-probe-write-user.c b/gcc/testsuite/gcc.target/bpf/helper-probe-write-user.c
new file mode 100644
index 00000000000..bf226206769
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-probe-write-user.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *dst, *src;
+  uint32_t len;
+
+  ret = __builtin_bpf_helper_probe_write_user (dst, src, len);
+}
+
+/* { dg-final { scan-assembler "call\t36" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-rc-keydown.c b/gcc/testsuite/gcc.target/bpf/helper-rc-keydown.c
new file mode 100644
index 00000000000..58e9395dbeb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-rc-keydown.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *ctx;
+  uint32_t protocol, toggle;
+  uint64_t scancode;
+  
+  ret = __builtin_bpf_helper_rc_keydown (ctx, protocol,
+					 scancode, toggle);
+}
+
+/* { dg-final { scan-assembler "call\t78" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-rc-pointer-rel.c b/gcc/testsuite/gcc.target/bpf/helper-rc-pointer-rel.c
new file mode 100644
index 00000000000..e776bc75963
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-rc-pointer-rel.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *ctx;
+  int32_t rel_x, rel_y;
+
+  ret = __builtin_bpf_helper_rc_pointer_rel (ctx, rel_x, rel_y);
+}
+
+/* { dg-final { scan-assembler "call\t92" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-rc-repeat.c b/gcc/testsuite/gcc.target/bpf/helper-rc-repeat.c
new file mode 100644
index 00000000000..0ebc7de5bdf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-rc-repeat.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *ctx;
+  
+  ret = __builtin_bpf_helper_rc_repeat (ctx);
+}
+
+/* { dg-final { scan-assembler "call\t77" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-redirect-map.c b/gcc/testsuite/gcc.target/bpf/helper-redirect-map.c
new file mode 100644
index 00000000000..daeecc2a01e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-redirect-map.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *map;
+  uint32_t key;
+  uint64_t flags;
+  
+  ret = __builtin_bpf_helper_redirect_map (map, key, flags);
+}
+
+/* { dg-final { scan-assembler "call\t51" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-set-hash-invalid.c b/gcc/testsuite/gcc.target/bpf/helper-set-hash-invalid.c
new file mode 100644
index 00000000000..4bc63ffa063
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-set-hash-invalid.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  void *skb;
+
+  __builtin_bpf_helper_set_hash_invalid (skb);
+}
+
+/* { dg-final { scan-assembler "call\t41" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-set-hash.c b/gcc/testsuite/gcc.target/bpf/helper-set-hash.c
new file mode 100644
index 00000000000..d01ae6eb268
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-set-hash.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  uint32_t ret;
+  void *skb;
+  uint32_t hash;
+  
+  ret = __builtin_bpf_helper_set_hash (skb, hash);
+}
+
+/* { dg-final { scan-assembler "call\t48" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-setsockopt.c b/gcc/testsuite/gcc.target/bpf/helper-setsockopt.c
new file mode 100644
index 00000000000..6f3b450639e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-setsockopt.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *bpf_socket;
+  int level;
+  int optname;
+  void *optval;
+  int optlen;
+  
+  ret = __builtin_bpf_helper_setsockopt (bpf_socket, level, optname,
+					 optval, optlen);
+}
+
+/* { dg-final { scan-assembler "call\t49" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-sk-fullsock.c b/gcc/testsuite/gcc.target/bpf/helper-sk-fullsock.c
new file mode 100644
index 00000000000..abe813d94f6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-sk-fullsock.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  void *ret, *sk;
+
+  ret = __builtin_bpf_helper_sk_fullsock (sk);
+}
+
+/* { dg-final { scan-assembler "call\t95" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-sk-lookup-tcp.c b/gcc/testsuite/gcc.target/bpf/helper-sk-lookup-tcp.c
new file mode 100644
index 00000000000..4408640a6b2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-sk-lookup-tcp.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  void *ret;
+  void *ctx, *tuple;
+  uint32_t tuple_size;
+  uint64_t netns, flags;
+  
+  ret = __builtin_bpf_helper_sk_lookup_tcp (ctx,
+					    tuple,
+					    tuple_size,
+					    netns, flags);
+}
+
+/* { dg-final { scan-assembler "call\t84" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-sk-lookup-upd.c b/gcc/testsuite/gcc.target/bpf/helper-sk-lookup-upd.c
new file mode 100644
index 00000000000..4c50f9c6327
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-sk-lookup-upd.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  void *ret;
+  void *ctx, *tuple;
+  uint32_t tuple_size;
+  uint64_t netns, flags;
+  
+  ret = __builtin_bpf_helper_sk_lookup_udp (ctx,
+					    tuple,
+					    tuple_size,
+					    netns, flags);
+}
+
+/* { dg-final { scan-assembler "call\t85" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-sk-redirect-hash.c b/gcc/testsuite/gcc.target/bpf/helper-sk-redirect-hash.c
new file mode 100644
index 00000000000..7047c9f1290
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-sk-redirect-hash.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skb, *map, *key;
+  uint64_t flags;
+
+  ret = __builtin_bpf_helper_sk_redirect_hash (skb, map, key,
+					       flags);
+}
+
+/* { dg-final { scan-assembler "call\t72" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-sk-redirect-map.c b/gcc/testsuite/gcc.target/bpf/helper-sk-redirect-map.c
new file mode 100644
index 00000000000..5afb0ac4100
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-sk-redirect-map.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *ctx, *map;
+  uint32_t key;
+  uint64_t flags;
+  
+  ret = __builtin_bpf_helper_sk_redirect_map (ctx, map, key, flags);
+}
+
+/* { dg-final { scan-assembler "call\t52" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-sk-release.c b/gcc/testsuite/gcc.target/bpf/helper-sk-release.c
new file mode 100644
index 00000000000..f054c90652c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-sk-release.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *sock;
+  
+  ret = __builtin_bpf_helper_sk_release (sock);
+}
+
+/* { dg-final { scan-assembler "call\t86" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-sk-select-reuseport.c b/gcc/testsuite/gcc.target/bpf/helper-sk-select-reuseport.c
new file mode 100644
index 00000000000..399ad2c0231
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-sk-select-reuseport.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *reuse, *map, *key;
+  uint64_t flags;
+  
+  ret = __builtin_bpf_helper_sk_select_reuseport (reuse, map,
+						  key, flags);
+}
+
+/* { dg-final { scan-assembler "call\t82" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-sk-storage-delete.c b/gcc/testsuite/gcc.target/bpf/helper-sk-storage-delete.c
new file mode 100644
index 00000000000..07c5875d930
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-sk-storage-delete.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *map, *sk;
+  
+  ret = __builtin_bpf_helper_sk_storage_delete (map, sk);
+}
+
+/* { dg-final { scan-assembler "call\t108" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-sk-storage-get.c b/gcc/testsuite/gcc.target/bpf/helper-sk-storage-get.c
new file mode 100644
index 00000000000..a199ef0ae64
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-sk-storage-get.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  void *ret;
+  void *map, *sk, *value;
+  uint64_t flags;
+  
+  ret = __builtin_bpf_helper_sk_storage_get (map, sk, value,
+					     flags);
+}
+
+/* { dg-final { scan-assembler "call\t107" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-adjust-room.c b/gcc/testsuite/gcc.target/bpf/helper-skb-adjust-room.c
new file mode 100644
index 00000000000..88196f5e070
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-skb-adjust-room.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skb;
+  int32_t len_diff;
+  uint32_t mode;
+  uint64_t flags;
+  
+  ret = __builtin_bpf_helper_skb_adjust_room (skb, len_diff, mode, flags);
+}
+
+/* { dg-final { scan-assembler "call\t50" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-cgroup-id.c b/gcc/testsuite/gcc.target/bpf/helper-skb-cgroup-id.c
new file mode 100644
index 00000000000..7c9021e1763
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-skb-cgroup-id.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  uint64_t ret;
+  void *skb;
+  
+  ret = __builtin_bpf_helper_skb_cgroup_id (skb);
+}
+
+/* { dg-final { scan-assembler "call\t79" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-change-head.c b/gcc/testsuite/gcc.target/bpf/helper-skb-change-head.c
new file mode 100644
index 00000000000..de6281539fd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-skb-change-head.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skb;
+  uint32_t len;
+  uint64_t flags;
+  
+  ret = __builtin_bpf_helper_skb_change_head (skb, len, flags);
+}
+
+/* { dg-final { scan-assembler "call\t43" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-change-proto.c b/gcc/testsuite/gcc.target/bpf/helper-skb-change-proto.c
new file mode 100644
index 00000000000..5738f3cc59b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-skb-change-proto.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skb;
+  int16_t proto;
+  uint64_t flags;
+
+  ret = __builtin_bpf_helper_skb_change_proto (skb, proto, flags);
+}
+
+/* { dg-final { scan-assembler "call\t31" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-change-tail.c b/gcc/testsuite/gcc.target/bpf/helper-skb-change-tail.c
new file mode 100644
index 00000000000..1fb6b45cd1b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-skb-change-tail.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skb;
+  uint32_t len;
+  uint64_t flags;
+
+  ret = __builtin_bpf_helper_skb_change_tail (skb, len, flags);
+}
+
+/* { dg-final { scan-assembler "call\t38" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-change-type.c b/gcc/testsuite/gcc.target/bpf/helper-skb-change-type.c
new file mode 100644
index 00000000000..bcf22cebc28
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-skb-change-type.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skb;
+  uint32_t type;
+
+  ret = __builtin_bpf_helper_skb_change_type (skb, type);
+}
+
+/* { dg-final { scan-assembler "call\t32" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-ecn-set-ce.c b/gcc/testsuite/gcc.target/bpf/helper-skb-ecn-set-ce.c
new file mode 100644
index 00000000000..f769993f120
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-skb-ecn-set-ce.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skb;
+
+  ret = __builtin_bpf_helper_skb_ecn_set_ce (skb);
+}
+
+/* { dg-final { scan-assembler "call\t97" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-get-tunnel-key.c b/gcc/testsuite/gcc.target/bpf/helper-skb-get-tunnel-key.c
new file mode 100644
index 00000000000..0d4db236865
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-skb-get-tunnel-key.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skb, *key;
+  uint32_t size;
+  uint64_t flags;
+
+  ret = __builtin_bpf_helper_skb_get_tunnel_key (skb, key, size, flags);
+}
+
+/* { dg-final { scan-assembler "call\t20" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-get-tunnel-opt.c b/gcc/testsuite/gcc.target/bpf/helper-skb-get-tunnel-opt.c
new file mode 100644
index 00000000000..9428657b932
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-skb-get-tunnel-opt.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skb;
+  uint8_t *opt;
+  uint32_t size;
+
+  ret = __builtin_bpf_helper_skb_get_tunnel_opt (skb, opt, size);
+}
+
+/* { dg-final { scan-assembler "call\t29" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-get-xfrm-state.c b/gcc/testsuite/gcc.target/bpf/helper-skb-get-xfrm-state.c
new file mode 100644
index 00000000000..8217b4a17df
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-skb-get-xfrm-state.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skb, *xfrm_state;
+  uint32_t index, size;
+  uint64_t flags;
+
+  ret = __builtin_bpf_helper_skb_get_xfrm_state (skb, index,
+						 xfrm_state, size, flags);
+}
+
+/* { dg-final { scan-assembler "call\t66" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-load-bytes-relative.c b/gcc/testsuite/gcc.target/bpf/helper-skb-load-bytes-relative.c
new file mode 100644
index 00000000000..bcaa43be9de
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-skb-load-bytes-relative.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skb, *to;
+  uint32_t offset, len, start_header;
+
+  ret = __builtin_bpf_helper_skb_load_bytes_relative (skb, offset,
+						      to, len,
+						      start_header);
+}
+
+/* { dg-final { scan-assembler "call\t68" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-load-bytes.c b/gcc/testsuite/gcc.target/bpf/helper-skb-load-bytes.c
new file mode 100644
index 00000000000..9da545400c7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-skb-load-bytes.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skb, *to;
+  uint32_t offset, len;
+
+  ret = __builtin_bpf_helper_skb_load_bytes (skb, offset, to, len);
+}
+
+/* { dg-final { scan-assembler "call\t26" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-pull-data.c b/gcc/testsuite/gcc.target/bpf/helper-skb-pull-data.c
new file mode 100644
index 00000000000..9bb8b8d6e78
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-skb-pull-data.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skb;
+  uint32_t len;
+
+  ret = __builtin_bpf_helper_skb_pull_data (skb, len);
+}
+
+/* { dg-final { scan-assembler "call\t39" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-set-tunnel-key.c b/gcc/testsuite/gcc.target/bpf/helper-skb-set-tunnel-key.c
new file mode 100644
index 00000000000..21b835f5cef
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-skb-set-tunnel-key.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skb, *key;
+  uint32_t size;
+  uint64_t flags;
+
+  ret = __builtin_bpf_helper_skb_set_tunnel_key (skb, key, size, flags);
+}
+
+/* { dg-final { scan-assembler "call\t21" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-set-tunnel-opt.c b/gcc/testsuite/gcc.target/bpf/helper-skb-set-tunnel-opt.c
new file mode 100644
index 00000000000..5a0528ec0a3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-skb-set-tunnel-opt.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skb;
+  uint8_t *opt;
+  uint32_t size;
+
+  ret = __builtin_bpf_helper_skb_set_tunnel_opt (skb, opt, size);
+}
+
+/* { dg-final { scan-assembler "call\t30" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-store-bytes.c b/gcc/testsuite/gcc.target/bpf/helper-skb-store-bytes.c
new file mode 100644
index 00000000000..a41967cb904
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-skb-store-bytes.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skb;
+  uint32_t offset;
+  void *from;
+  uint32_t len;
+  uint64_t flags;
+
+  ret = __builtin_bpf_helper_skb_store_bytes (skb, offset, from, len, flags);
+}
+
+/* { dg-final { scan-assembler "call\t9" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-under-cgroup.c b/gcc/testsuite/gcc.target/bpf/helper-skb-under-cgroup.c
new file mode 100644
index 00000000000..0ccee8bed5c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-skb-under-cgroup.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skb, *map;
+  uint32_t index;
+
+  ret = __builtin_bpf_helper_skb_under_cgroup (skb, map, index);
+}
+
+/* { dg-final { scan-assembler "call\t33" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-vlan-pop.c b/gcc/testsuite/gcc.target/bpf/helper-skb-vlan-pop.c
new file mode 100644
index 00000000000..e99a0ac7802
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-skb-vlan-pop.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skb;
+
+  ret = __builtin_bpf_helper_skb_vlan_pop (skb);
+}
+
+/* { dg-final { scan-assembler "call\t19" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-vlan-push.c b/gcc/testsuite/gcc.target/bpf/helper-skb-vlan-push.c
new file mode 100644
index 00000000000..dbe52aee1b8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-skb-vlan-push.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skb;
+  int16_t vlan_proto;
+  uint16_t vlan_tci;
+
+  ret = __builtin_bpf_helper_skb_vlan_push (skb, vlan_proto, vlan_tci);
+}
+
+/* { dg-final { scan-assembler "call\t18" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-skc-lookup-tcp.c b/gcc/testsuite/gcc.target/bpf/helper-skc-lookup-tcp.c
new file mode 100644
index 00000000000..bbc4b99a808
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-skc-lookup-tcp.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  void *ret;
+  void *ctx, *tuple;
+  uint32_t tuple_size;
+  uint64_t netns, flags;
+
+  ret = __builtin_bpf_helper_skc_lookup_tcp (ctx, tuple,
+					     tuple_size, netns, flags);
+}
+
+/* { dg-final { scan-assembler "call\t99" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-sock-hash-update.c b/gcc/testsuite/gcc.target/bpf/helper-sock-hash-update.c
new file mode 100644
index 00000000000..bbb77ef9ad5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-sock-hash-update.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skops, *map, *key;
+  uint64_t flags;
+
+  ret = __builtin_bpf_helper_sock_hash_update (skops, map, key,
+					       flags);
+}
+
+/* { dg-final { scan-assembler "call\t70" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-sock-map-update.c b/gcc/testsuite/gcc.target/bpf/helper-sock-map-update.c
new file mode 100644
index 00000000000..301e59e975b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-sock-map-update.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skops, *map, *key;
+  uint64_t flags;
+  
+  ret = __builtin_bpf_helper_sock_map_update (skops, map, key,
+					      flags);
+}
+
+/* { dg-final { scan-assembler "call\t53" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-sock-ops-cb-flags-set.c b/gcc/testsuite/gcc.target/bpf/helper-sock-ops-cb-flags-set.c
new file mode 100644
index 00000000000..2056312bcf3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-sock-ops-cb-flags-set.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *bpf_sock;
+  int argval;
+  
+  ret = __builtin_bpf_helper_sock_ops_cb_flags_set (bpf_sock,
+						    argval);
+}
+
+/* { dg-final { scan-assembler "call\t59" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-spin-lock.c b/gcc/testsuite/gcc.target/bpf/helper-spin-lock.c
new file mode 100644
index 00000000000..4178914ae13
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-spin-lock.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  void *lock;
+
+  __builtin_bpf_helper_spin_lock (lock);
+}
+
+/* { dg-final { scan-assembler "call\t93" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-spin-unlock.c b/gcc/testsuite/gcc.target/bpf/helper-spin-unlock.c
new file mode 100644
index 00000000000..c2416b66994
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-spin-unlock.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  void *lock;
+
+  __builtin_bpf_helper_spin_unlock (lock);
+}
+
+/* { dg-final { scan-assembler "call\t94" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-strtol.c b/gcc/testsuite/gcc.target/bpf/helper-strtol.c
new file mode 100644
index 00000000000..e15b6d6b968
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-strtol.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+#include <stddef.h>
+
+void
+foo ()
+{
+  int ret;
+  void *buf;
+  long res;
+  uint64_t flags;
+  size_t buf_len;
+  
+  ret = __builtin_bpf_helper_strtol (buf, buf_len, flags, &res);
+}
+
+/* { dg-final { scan-assembler "call\t105" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-strtoul.c b/gcc/testsuite/gcc.target/bpf/helper-strtoul.c
new file mode 100644
index 00000000000..bc0d77656d2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-strtoul.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+#include <stddef.h>
+
+void
+foo ()
+{
+  int ret;
+  void *buf;
+  unsigned long res;
+  uint64_t flags;
+  size_t buf_len;
+  
+  ret = __builtin_bpf_helper_strtoul (buf, buf_len, flags, &res);
+}
+
+/* { dg-final { scan-assembler "call\t106" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-sysctl-get-current-value.c b/gcc/testsuite/gcc.target/bpf/helper-sysctl-get-current-value.c
new file mode 100644
index 00000000000..803584171dd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-sysctl-get-current-value.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+#include <stddef.h>
+
+void
+foo ()
+{
+  int ret;
+  void *ctx, *buf;
+  size_t buf_len;
+  
+  ret = __builtin_bpf_helper_sysctl_get_current_value (ctx, buf,
+						       buf_len);
+}
+
+/* { dg-final { scan-assembler "call\t102" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-sysctl-get-name.c b/gcc/testsuite/gcc.target/bpf/helper-sysctl-get-name.c
new file mode 100644
index 00000000000..a748b4bf911
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-sysctl-get-name.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+#include <stddef.h>
+
+void
+foo ()
+{
+  int ret;
+  void *ctx, *buf;
+  size_t buf_len;
+  uint64_t flags;
+  
+  ret = __builtin_bpf_helper_sysctl_get_name (ctx, buf,
+					      buf_len, flags);
+}
+
+/* { dg-final { scan-assembler "call\t101" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-sysctl-get-new-value.c b/gcc/testsuite/gcc.target/bpf/helper-sysctl-get-new-value.c
new file mode 100644
index 00000000000..2c4835100c9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-sysctl-get-new-value.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+#include <stddef.h>
+
+void
+foo ()
+{
+  int ret;
+  void *ctx, *buf;
+  size_t buf_len;
+  
+  ret = __builtin_bpf_helper_sysctl_get_new_value (ctx, buf,
+						   buf_len);
+}
+
+/* { dg-final { scan-assembler "call\t103" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-sysctl-set-new-value.c b/gcc/testsuite/gcc.target/bpf/helper-sysctl-set-new-value.c
new file mode 100644
index 00000000000..fc3780da7e2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-sysctl-set-new-value.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+#include <stddef.h>
+
+void
+foo ()
+{
+  int ret;
+  void *ctx, *buf;
+  size_t buf_len;
+  
+  ret = __builtin_bpf_helper_sysctl_set_new_value (ctx, buf,
+						   buf_len);
+}
+
+/* { dg-final { scan-assembler "call\t104" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-tail-call.c b/gcc/testsuite/gcc.target/bpf/helper-tail-call.c
new file mode 100644
index 00000000000..618064f4aea
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-tail-call.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  void *ctx, *prog_array_map;
+  uint32_t index;
+
+  __builtin_bpf_helper_tail_call (ctx, prog_array_map, index);
+}
+
+/* { dg-final { scan-assembler "call\t12" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-tcp-check-syncookie.c b/gcc/testsuite/gcc.target/bpf/helper-tcp-check-syncookie.c
new file mode 100644
index 00000000000..95846c6f2d7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-tcp-check-syncookie.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *sk, *iph, *th;
+  uint32_t iph_len, th_len;
+  
+  ret = __builtin_bpf_helper_tcp_check_syncookie (sk, iph,
+						  iph_len,
+						  th, th_len);
+}
+
+/* { dg-final { scan-assembler "call\t100" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-tcp-sock.c b/gcc/testsuite/gcc.target/bpf/helper-tcp-sock.c
new file mode 100644
index 00000000000..ab8f2de05d8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-tcp-sock.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  void *ret, *sk;
+
+  ret = __builtin_bpf_helper_tcp_sock (sk);
+}
+
+/* { dg-final { scan-assembler "call\t96" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-trace-printk.c b/gcc/testsuite/gcc.target/bpf/helper-trace-printk.c
new file mode 100644
index 00000000000..fcf9d5c9e50
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-trace-printk.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+char *map () { return 0; }
+
+void
+foo ()
+{
+  int ret;
+
+  ret = __builtin_bpf_helper_trace_printk ("foo %d %d", sizeof ("foo %d %d"), 10, 20);
+}
+
+/* { dg-final { scan-assembler "call\t6" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-xdp-adjust-head.c b/gcc/testsuite/gcc.target/bpf/helper-xdp-adjust-head.c
new file mode 100644
index 00000000000..3dce5434535
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-xdp-adjust-head.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *xdp_md;
+  int delta;
+  
+  ret = __builtin_bpf_helper_xdp_adjust_head (xdp_md, delta);
+}
+
+/* { dg-final { scan-assembler "call\t44" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-xdp-adjust-meta.c b/gcc/testsuite/gcc.target/bpf/helper-xdp-adjust-meta.c
new file mode 100644
index 00000000000..38a13748737
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-xdp-adjust-meta.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *xdp_md;
+  int delta;
+  
+  ret = __builtin_bpf_helper_xdp_adjust_meta (xdp_md, delta);
+}
+
+/* { dg-final { scan-assembler "call\t54" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/helper-xdp-adjust-tail.c b/gcc/testsuite/gcc.target/bpf/helper-xdp-adjust-tail.c
new file mode 100644
index 00000000000..319b65a233d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/helper-xdp-adjust-tail.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *xdp_md;
+  int delta;
+
+  ret = __builtin_bpf_helper_xdp_adjust_tail (xdp_md, delta);
+}
+
+/* { dg-final { scan-assembler "call\t65" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/skb-ancestor-cgroup-id.c b/gcc/testsuite/gcc.target/bpf/skb-ancestor-cgroup-id.c
new file mode 100644
index 00000000000..ce193ec14bf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/skb-ancestor-cgroup-id.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+void
+foo ()
+{
+  int ret;
+  void *skb;
+  int ancestor_level;
+  
+  ret = __builtin_bpf_helper_skb_ancestor_cgroup_id (skb,
+						     ancestor_level);
+}
+
+/* { dg-final { scan-assembler "call\t83" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/sync-fetch-and-add.c b/gcc/testsuite/gcc.target/bpf/sync-fetch-and-add.c
new file mode 100644
index 00000000000..69949f14d0c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/sync-fetch-and-add.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+long delta;
+long *val;
+
+void
+foo ()
+{
+  __sync_fetch_and_add(val, delta);
+  __sync_fetch_and_add((int *)val, (int)delta);
+}
+
+/* { dg-final { scan-assembler "xadddw\t.*" } } */
+/* { dg-final { scan-assembler "xaddw\t.*" } } */
