mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-12 06:11:37 +00:00
Force "hardfloat" mode for inline assembly that uses FPU instructions, but pop original mode at the end of the assembly. Unhandled FPU instructions will be handled by the signal handler (env_unsup_insn). Skip MIPS specific tests for FPU if the code gets compiled for soft- float. This should allow Valgrind to be compiled as a soft-float binary, but that executable should be used for soft-float systems only. Related VEX change - r3261. Related issue - BZ#351282. Patch by Aleksandar Rikalo. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16039
33 lines
1.1 KiB
C
33 lines
1.1 KiB
C
#if defined(__mips_hard_float)
|
|
|
|
#include <stdio.h>
|
|
|
|
int main ()
|
|
{
|
|
int out [] = {0, 0};
|
|
unsigned long long in [] = {0x405EE0A3D70A3D71ULL, 0x3FF0000000000000ULL};
|
|
__asm__ volatile("cfc1 $a1, $31" "\n\t"
|
|
"ldc1 $f0, 0(%0)" "\n\t"
|
|
"ctc1 $zero, $31" "\n\t"
|
|
"round.w.d $f0, $f0" "\n\t"
|
|
"cfc1 $a2, $31" "\n\t"
|
|
"sw $a2, 0(%1)" "\n\t"
|
|
"ldc1 $f0, 8(%0)" "\n\t"
|
|
"ctc1 $zero, $31" "\n\t"
|
|
"round.w.d $f0, $f0" "\n\t"
|
|
"cfc1 $a2, $31" "\n\t"
|
|
"sw $a2, 4(%1)" "\n\t"
|
|
"ctc1 $a1, $31" "\n\t"
|
|
:
|
|
: "r" (in), "r" (out)
|
|
: "a1", "a2", "t0", "$f0", "$f1"
|
|
);
|
|
printf("FCSR::1: 0x%x, 2: 0x%x\n", out[0], out[1]);
|
|
return 0;
|
|
}
|
|
#else
|
|
int main() {
|
|
return 0;
|
|
}
|
|
#endif
|