PATCH, RFC: Convert x86 SSE ops to TCG
These patches converts x86 SSE ops to TCG, which could possibly help compiling Qemu using some GCC versions on i386 host. The resulting version does not crash immediately. Please test.
tcg/tcg-op.h +12 -0
@@ -192,6 +192,18 @@ 0, NULL, 2, args); } +static inline void tcg_gen_helper_0_3 (void *func,TCGv arg1,TCGv arg2, +TCGv arg3) +{ +TCGv args[3 ]; + args[0 ] = arg1; + args[1 ] = arg2; + args[2 ] = arg3; +tcg_gen_call (&tcg_ctx, +tcg_const_ptr ((tcg_target_long )func),TCG_HELPER_CALL_FLAGS , +0 ,NULL ,3 , args); +} +static inline void tcg_gen_helper_0_4 (void *func,TCGv arg1,TCGv arg2,TCGv arg3,TCGv arg4) {
target-i386/op.c +0 -6
@@ -2222,12 +2222,6 @@ *(uint32_t *)(env->fptags +4 ) =0x01010101 ; } -#define SHIFT 0 -#include "ops_sse.h" - -#define SHIFT 1 -#include "ops_sse.h" -/* Secure Virtual Machine ops */ void OPPROTO op_vmrun(void)
target-i386/translate.c +101 -75
379 lines not on this page · raw message
target-i386/helper.c +6 -0
@@ -4446,3 +4446,9 @@ }#endif + +#define SHIFT 0 +#include "ops_sse.h" + +#define SHIFT 1 +#include "ops_sse.h"
target-i386/ops_sse.h +345 -358
1,378 lines not on this page · raw message
target-i386/helper.h +290 -0
293 lines not on this page · raw message
Quoted 3 lines · Blue Swirl
These patches converts x86 SSE ops to TCG, which could possibly help compiling Qemu using some GCC versions on i386 host. The resulting version does not crash immediately. Please test.
I get the following errors when I compile the helper.c file using gcc 3.4.6:
gcc-3.4 -fomit-frame-pointer -I. -I.. -I/home/test/makestuff/qemu-sse/target-i386 -I/home/test/makestuff/qemu-sse -MMD -MP -DNEED_CPU_H -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I/home/test/makestuff/qemu-sse/tcg -I/home/test/makestuff/qemu-sse/tcg/i386 -I/home/test/makestuff/qemu-sse/fpu -DHAS_AUDIO -DHAS_AUDIO_CHOICE -I/home/test/makestuff/qemu-sse/slirp -mfpmath=sse -march=pentium3 -msse -Wall -O2 -g -fno-strict-aliasing -mfpmath=sse -march=pentium3 -msse -m32 -c -o helper.o /home/test/makestuff/qemu-sse/target-i386/helper.c /home/test/makestuff/qemu-sse/target-i386/helper.c: In function `svm_check_intercept_param':/home/test/makestuff/qemu-sse/target-i386/helper.c:4315: error: unable to find a register to spill in class `GENERAL_REGS'/home/test/makestuff/qemu-sse/target-i386/helper.c:4315: error: this is the insn:
(insn:HI 353 352 354 39 /home/test/makestuff/qemu-sse/target-i386/helper.c:4308 (parallel [
(set (reg:DI 167 [ <variable>.intercept ])
(lshiftrt:DI (reg:DI 167 [ <variable>.intercept ])
(subreg:QI (reg:SI 166) 0)))
(clobber (scratch:SI))
(clobber (reg:CC 17 flags))
]) 309 {lshrdi3_1} (insn_list 351 (insn_list 352 (nil)))
(expr_list:REG_DEAD (reg:SI 166)
(expr_list:REG_UNUSED (reg:CC 17 flags)
(expr_list:REG_UNUSED (scratch:SI)
(nil)))))/home/test/makestuff/qemu-sse/target-i386/helper.c:4315: confused by earlier errors, bailing out
make: *** [helper.o] Error 1
and the following when using gcc 4.2:
gcc -fomit-frame-pointer -I. -I.. -I/home/test/makestuff/qemu-sse/target-i386 -I/home/test/makestuff/qemu-sse -MMD -MP -DNEED_CPU_H -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I/home/test/makestuff/qemu-sse/tcg -I/home/test/makestuff/qemu-sse/tcg/i386 -I/home/test/makestuff/qemu-sse/fpu -DHAS_AUDIO -DHAS_AUDIO_CHOICE -I/home/test/makestuff/qemu-sse/slirp -mfpmath=sse -march=pentium3 -msse -Wall -O2 -g -fno-strict-aliasing -mfpmath=sse -march=pentium3 -msse -m32 -c -o helper.o /home/test/makestuff/qemu-sse/target-i386/helper.c /home/test/makestuff/qemu-sse/target-i386/ops_sse.h: In function ‘helper_pshufw_mmx’:/home/test/makestuff/qemu-sse/target-i386/ops_sse.h:583: error: unable to find a register to spill in class ‘GENERAL_REGS’/home/test/makestuff/qemu-sse/target-i386/ops_sse.h:583: error: this is the insn:
(insn:HI 48 60 49 2 /home/test/makestuff/qemu-sse/target-i386/ops_sse.h:582 (set (mem/s:DI (plus:SI (reg:SI 60 [ env.850 ])
(reg/v:SI 62 [ dst_offset ])) [0 S8 A32])
(reg/v:DI 61 [ r ])) 56 {*movdi_2} (insn_list:REG_DEP_TRUE 3 (insn_list:REG_DEP_TRUE 46 (nil)))
(expr_list:REG_DEAD (reg/v:DI 61 [ r ])
(expr_list:REG_DEAD (reg:SI 60 [ env.850 ])
(expr_list:REG_DEAD (reg/v:SI 62 [ dst_offset ])
(nil)))))/home/test/makestuff/qemu-sse/target-i386/ops_sse.h:583: confused by earlier errors, bailing out
make: *** [helper.o] Error 1
Also, the x86_64 target compiled, but didn't link, saying that funtions 'gen_op_movq_T0_mm_mmx' and 'gen_op_movq_mm_T0_mmx' had undefined references.