Projects
openEuler:24.03:SP1:Everything
gcc
_service:tar_scm:0155-testsuite-Add-a-test-case...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:0155-testsuite-Add-a-test-case-for-negating-FP-vectors-co.patch of Package gcc
From e27123a020e7bf0845a9804a4b09fe4ce57992f0 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao <xry111@xry111.site> Date: Tue, 6 Feb 2024 17:49:50 +0800 Subject: [PATCH 155/188] testsuite: Add a test case for negating FP vectors containing zeros Recently I've fixed two wrong FP vector negate implementation which caused wrong sign bits in zeros in targets (r14-8786 and r14-8801). To prevent a similar issue from happening again, add a test case. Tested on x86_64 (with SSE2, AVX, AVX2, and AVX512F), AArch64, MIPS (with MSA), LoongArch (with LSX and LASX). gcc/testsuite: * gcc.dg/vect/vect-neg-zero.c: New test. --- gcc/testsuite/gcc.dg/vect/vect-neg-zero.c | 38 +++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/vect/vect-neg-zero.c diff --git a/gcc/testsuite/gcc.dg/vect/vect-neg-zero.c b/gcc/testsuite/gcc.dg/vect/vect-neg-zero.c new file mode 100644 index 000000000..21fa00cfa --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-neg-zero.c @@ -0,0 +1,38 @@ +/* { dg-add-options ieee } */ +/* { dg-additional-options "-fno-associative-math -fsigned-zeros" } */ + +double x[4] = {-0.0, 0.0, -0.0, 0.0}; +float y[8] = {-0.0, 0.0, -0.0, 0.0, -0.0, -0.0, 0.0, 0.0}; + +static __attribute__ ((always_inline)) inline void +test (int factor) +{ + double a[4]; + float b[8]; + + asm ("" ::: "memory"); + + for (int i = 0; i < 2 * factor; i++) + a[i] = -x[i]; + + for (int i = 0; i < 4 * factor; i++) + b[i] = -y[i]; + +#pragma GCC novector + for (int i = 0; i < 2 * factor; i++) + if (__builtin_signbit (a[i]) == __builtin_signbit (x[i])) + __builtin_abort (); + +#pragma GCC novector + for (int i = 0; i < 4 * factor; i++) + if (__builtin_signbit (b[i]) == __builtin_signbit (y[i])) + __builtin_abort (); +} + +int +main (void) +{ + test (1); + test (2); + return 0; +} -- 2.43.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2