]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
bpf: testsuite: fix unresolved test in memset-1.c
authorDavid Faust <david.faust@oracle.com>
Thu, 7 Mar 2024 17:23:38 +0000 (09:23 -0800)
committerDavid Faust <david.faust@oracle.com>
Fri, 8 Mar 2024 16:50:01 +0000 (08:50 -0800)
The test was trying to do too much by both checking for an error, and
checking the resulting assembly. Of course, due to the error no asm was
produced, so the scan-asm went unresolved. Split it into two separate
tests to fix the issue.

gcc/testsuite/

* gcc.target/bpf/memset-1.c: Move error test case to...
* gcc.target/bpf/memset-2.c: ... here. New test.

gcc/testsuite/gcc.target/bpf/memset-1.c
gcc/testsuite/gcc.target/bpf/memset-2.c [new file with mode: 0644]

index 9e9f8eff0282b74ccd80b0a2ef50a1484a469655..7c4768c6e737b469a6cb9db8c7cade405f7ff77d 100644 (file)
@@ -28,12 +28,4 @@ set_large (struct context *ctx)
   __builtin_memset (dest, 0xfe, 130);
 }
 
-void
-set_variable (struct context *ctx)
-{
-  void *data = (void *)(long)ctx->data;
-  char *dest = data;
-  __builtin_memset (dest, 0xbc, ctx->data_meta); /* { dg-error "could not inline call" } */
-}
-
 /* { dg-final { scan-assembler-times "call" 0 } } */
diff --git a/gcc/testsuite/gcc.target/bpf/memset-2.c b/gcc/testsuite/gcc.target/bpf/memset-2.c
new file mode 100644 (file)
index 0000000..0602a1a
--- /dev/null
@@ -0,0 +1,22 @@
+/* Test that we error if memset cannot be expanded inline.  */
+
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+struct context {
+ unsigned int data;
+ unsigned int data_end;
+ unsigned int data_meta;
+ unsigned int ingress;
+ unsigned int queue_index;
+ unsigned int egress;
+};
+
+
+void
+set_variable (struct context *ctx)
+{
+  void *data = (void *)(long)ctx->data;
+  char *dest = data;
+  __builtin_memset (dest, 0xbc, ctx->data_meta); /* { dg-error "could not inline call" } */
+}