From 10c609191c4462133d6a4ea10a739167204f2cd3 Mon Sep 17 00:00:00 2001 From: David Faust Date: Thu, 7 Mar 2024 09:23:38 -0800 Subject: bpf: testsuite: fix unresolved test in memset-1.c 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 | 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 (limited to 'gcc') diff --git a/gcc/testsuite/gcc.target/bpf/memset-1.c b/gcc/testsuite/gcc.target/bpf/memset-1.c index 9e9f8ef..7c4768c 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 0000000..0602a1a --- /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" } */ +} -- cgit v1.1