[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] x86emul: work around gcc11 bug in SIMD tests



commit 71760cf0fe477adeaa5d41fa63ca7db8ea51f756
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Mon Feb 14 10:08:17 2022 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Feb 14 10:08:17 2022 +0100

    x86emul: work around gcc11 bug in SIMD tests
    
    Gcc11 looks to have trouble with conditional expressions used with
    vector operands: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104497.
    Replace two instances causing SEGV there in certain cases.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 tools/tests/x86_emulator/simd-sg.c | 2 +-
 tools/tests/x86_emulator/simd.c    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/tests/x86_emulator/simd-sg.c 
b/tools/tests/x86_emulator/simd-sg.c
index 09228a4639..36f2d63d49 100644
--- a/tools/tests/x86_emulator/simd-sg.c
+++ b/tools/tests/x86_emulator/simd-sg.c
@@ -282,7 +282,7 @@ int sg_test(void)
 # if ELEM_SIZE == IDX_SIZE
     y = gather(x, array, idx, (idx & inv) != 0, ELEM_SIZE);
     for ( i = 0; i < ITEM_COUNT; ++i )
-        if ( y[i] != ((i + 1) & (ITEM_COUNT - i) ? idx : inv)[i] + 1 )
+        if ( y[i] != ((i + 1) & (ITEM_COUNT - i) ? idx[i] : inv[i]) + 1 )
             return __LINE__;
     for ( ; i < ELEM_COUNT; ++i )
         if ( y[i] )
diff --git a/tools/tests/x86_emulator/simd.c b/tools/tests/x86_emulator/simd.c
index 995f4e3683..198f7b933e 100644
--- a/tools/tests/x86_emulator/simd.c
+++ b/tools/tests/x86_emulator/simd.c
@@ -1727,8 +1727,8 @@ int simd_test(void)
     if ( !eq(x - src, (alt + 1) / 2) ) return __LINE__;
 #endif
 
-    for ( i = 0; i < ELEM_COUNT; ++i )
-        y[i] = (i & 1 ? inv : src)[i];
+    for ( y = src, i = 1; i < ELEM_COUNT; i += 2 )
+        y[i] = inv[i];
 
 #ifdef select
 # ifdef UINT_SIZE
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.