diff mbox series

bpf: testsuite: fix unresolved test in memset-1.c

Message ID 20240307175324.25257-1-david.faust@oracle.com
State New
Headers show
Series bpf: testsuite: fix unresolved test in memset-1.c | expand

Commit Message

David Faust March 7, 2024, 5:53 p.m. UTC
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.

Tested on x86_64-linux-gnu host for bpf-unknown-none target.

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 |  8 --------
 gcc/testsuite/gcc.target/bpf/memset-2.c | 22 ++++++++++++++++++++++
 2 files changed, 22 insertions(+), 8 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/bpf/memset-2.c

Comments

Jose E. Marchesi March 8, 2024, 8:11 a.m. UTC | #1
Hi David.
OK.  Thanks.

> 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.
>
> Tested on x86_64-linux-gnu host for bpf-unknown-none target.
>
> 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 |  8 --------
>  gcc/testsuite/gcc.target/bpf/memset-2.c | 22 ++++++++++++++++++++++
>  2 files changed, 22 insertions(+), 8 deletions(-)
>  create mode 100644 gcc/testsuite/gcc.target/bpf/memset-2.c
>
> diff --git a/gcc/testsuite/gcc.target/bpf/memset-1.c b/gcc/testsuite/gcc.target/bpf/memset-1.c
> index 9e9f8eff028..7c4768c6e73 100644
> --- a/gcc/testsuite/gcc.target/bpf/memset-1.c
> +++ b/gcc/testsuite/gcc.target/bpf/memset-1.c
> @@ -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
> index 00000000000..0602a1a277c
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/bpf/memset-2.c
> @@ -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" } */
> +}
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.target/bpf/memset-1.c b/gcc/testsuite/gcc.target/bpf/memset-1.c
index 9e9f8eff028..7c4768c6e73 100644
--- a/gcc/testsuite/gcc.target/bpf/memset-1.c
+++ b/gcc/testsuite/gcc.target/bpf/memset-1.c
@@ -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
index 00000000000..0602a1a277c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/memset-2.c
@@ -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" } */
+}