[Top][All Lists]

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

MIPS MSA instructions result in SIGILL

From: Evan Nemerson
Subject: MIPS MSA instructions result in SIGILL
Date: Fri, 11 Jun 2021 11:48:07 -0400
User-agent: Evolution 3.40.1 (3.40.1-1.fc34)

I'm trying to find a way to run MSA code using QEMU.  I've been able to
get *some* MSA instructions to execute on Loongson-3A4000, but
eventually I get a SIGILL.

I have access to the source code, and I don't really care what CPU I'm
targeting as long as it supports MSA, but I've had the most luck with
GCC targeting mips64el.  The goal is actually to add an implementation
of MSA to SIMDe (<https://github.com/simd-everywhere/simde>), but I
need to be able to verify that I'm getting the same results as a
different implementation, and since I don't have any MIPS hardware that
means QEMU :)

As an example of some failing code, I've compiled one of our tests
) and uploaded an executable to

It's compiled with:

mips64el-linux-gnuabi64-gcc-10 -DSIMDE_TEST_BARE -g -mmsa -static \
  -o add-native-c path/to/add.c -lm

If you want to try changing compilation options, here is the
amalgamated (not preprocessed, so it should work with clang too) source
code: https://www.dropbox.com/s/0jf8cs6cmzhjn13/add.c?dl=0

Attempting to run it with qemu (5.2.0, from Debian):

   qemu-mips64el-static -cpu Loongson-3A4000 ./add-native-c1..22
   ok 1 add/vaddd_s64
   ok 2 add/vaddd_u64
   ok 3 add/vadd_f32
   ok 4 add/vadd_f64
   ok 5 add/vadd_s8
   ok 6 add/vadd_s16
   ok 7 add/vadd_s32
   ok 8 add/vadd_s64
   ok 9 add/vadd_u8
   ok 10 add/vadd_u16
   ok 11 add/vadd_u32
   ok 12 add/vadd_u64
   qemu: uncaught target signal 4 (Illegal instruction) - core dumped
   Illegal instruction (core dumped)

If I add -d in_asm, I see it crashes on ld.b, which is indeed an MSA

I've tried with every -cpu supported by qemu, and nothing has worked. 
Any help would be greatly appreciated; FWIW, I'm definitely open to
compiling a patched QEMU if it would help.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]