summaryrefslogtreecommitdiffstats
path: root/tcg
Commit message (Collapse)AuthorAgeFilesLines
* tcg/x86_64: Avoid unnecessary REX.B prefixes.Richard Henderson2010-01-151-16/+30
| | | | | | | | | | | | | | The existing P_REXB internal opcode flag unconditionally emits the REX prefix. Technically it's not needed if the register in question is %al, %bl, %cl, %dl. Eliding the prefix requires splitting the P_REXB flag into two, in order to indicate whether the byte register in question is in the REG or the R/M field. Within TCG, the byte register is in the REG field only for stores. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg/x86_64: Special-case all 32-bit AND operands.Richard Henderson2010-01-141-18/+8
| | | | | | | | | | | This avoids an unnecessary REX.W prefix when dealing with AND operands that fit into a 32-bit quantity. The most common change actually seen is movz[wb]q -> movz[wb]l. Similarly, avoid REXW in ext{8,16}u_i64 tcg opcodes. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg-sparc: Implement ext32[su]_i64Richard Henderson2010-01-122-0/+21
| | | | | | | | | The 32-bit right-shift instructions is defined to extend the shifted output to 64-bits. A shift count of zero therefore is a simple extension without actually shifting. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* tcg-sparc: Implement division properly.Richard Henderson2010-01-122-30/+55
| | | | | | | | | | | | | | | | | | | The {div,divu}2 opcodes are intended for systems for which the division instruction produces both quotient and remainder. Sparc is not such a system. Indeed, the remainder must be computed as quot = a / b rem = a - (quot * b) Split out a tcg_out_div32 function that properly initializes Y with the extension of the input to 64-bits. Discard the code that used the 64-bit DIVX on sparc9/sparcv8plus without extending the inputs to 64-bits. Implement remainders in terms of division followed by multiplication. Signed-off-by: Richard Henderson <rth@twiddle.net> [blauwirbel@gmail.com: applied rth's typo fix in tcg_out_div32] Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* tcg-sparc: Do not remove %o[012] from 'r' constraint.Richard Henderson2010-01-121-0/+3
| | | | | | | Only 'L' constraint needs that. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* tcg-sparc: Implement add2, sub2, mulu2.Richard Henderson2010-01-121-0/+27
| | | | | | | Add missing 32-bit double-word support opcodes. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* tcg-sparc: Add tcg_out_arithc.Richard Henderson2010-01-121-43/+43
| | | | | | | | | | | Add a function to handle the register-vs-immediate test for arithmetic. Also, adjust the OP_32_64 macro so that it auto-indents properly. Rename the gen_arith32 label to gen_arith, since it handles 64-bit arithmetic as well. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* tcg: Add tcg_unsigned_cond.Richard Henderson2009-12-271-0/+5
| | | | | | | | Returns an unsigned version of a signed condition; returns the original condition otherwise. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* tcg-sparc: Implement brcond2.Richard Henderson2009-12-211-14/+69
| | | | | | | | | Split out tcg_out_cmp and properly handle immediate arguments. Fix constraints on brcond to match what SUBCC accepts. Add tcg_out_brcond2_i32 for 32-bit host. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* tcg-sparc: Use TCG_TARGET_REG_BITS in conditional compilation.Richard Henderson2009-12-211-16/+16
| | | | | | | | | | The test TCG_TARGET_REG_BITS==64 is exactly the feature that we are checking for, whereas something involving __sparc_v9__ or __sparc_v8plus__ should be reserved for something ISA related, as with SMULX. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* tcg-sparc: Improve tcg_out_movi for sparc64.Richard Henderson2009-12-211-12/+15
| | | | | | | | | Generate sign-extended 32-bit constants with SETHI+XOR. Otherwise tidy the routine to avoid the need for conditional compilation and code duplication with movi_imm32. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* tcg-sparc: Fix imm13 check in movi.Richard Henderson2009-12-211-1/+1
| | | | | | | We were unnecessarily restricting imm13 constants to 12 bits. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* tcg/ppc64: Fix loading of 32bit constantsmalc2009-12-151-1/+2
| | | | Signed-off-by: malc <av1474@comtv.ru>
* TCG: Mac OS X support for ppc64 targetAndreas Faerber2009-12-061-14/+41
| | | | | | | | | | | | | | | | | Darwin/ppc64 does not use function descriptors, adapt prologue and tcg_out_call accordingly. GPR2 is available for general use, so let's use it. http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/LowLevelABI/110-64-bit_PowerPC_Function_Calling_Conventions/64bitPowerPC.html v2: - Don't mark reserved GPR13 as callee-save. - Move tcg_out_b up. - Fix unused variable warning in prologue. Signed-off-by: Andreas Faerber <andreas.faerber@web.de> Cc: malc <av1474@comtv.ru> Signed-off-by: malc <av1474@comtv.ru>
* S/390 fake TCG implementationAlexander Graf2009-12-052-0/+174
| | | | | | | | | | | | Qemu won't let us run a KVM target without having host TCG support. Well, for now we don't have any so let's implement a fake target that only stubs out everything. I tried to keep the patch as close to Uli's source as possible, so whenever he feels like it he can easily diff his version against this one. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg: initial mips supportAurelien Jarno2009-12-012-0/+1446
| | | | | | | | | | | | | | | | Based on a patch from Arnaud Patard (Rtp) <arnaud.patard@rtp-net.org> A few words about design choices: * Two registers, at and t0, are reserved for TCG internal use. They are useful for bswap and 64-bit ops. * Most ops supports a constant argument with value 0, which is actually mapped to the zero register. * While the at register is available for constant loading, ops only support a limited range of constants. TCG does a better job doing the register allocation and constant loading by itself. There are plenty of registers available anyway. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg: fix tcg_regset_{set,reset}_reg with more than 32 registersAurelien Jarno2009-11-241-2/+2
| | | | Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg/ppc64,x86_64: fix constraints of op_qemu_st64Aurelien Jarno2009-11-242-2/+2
| | | | | | This op only takes two arguments, not two. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg/i386: remove duplicate sar opcodeMagnus Damm2009-11-141-1/+0
| | | | | Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg: improve output logAurelien Jarno2009-10-071-1/+1
| | | | Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg: allocate s->op_dead_iargs dynamicallyAurelien Jarno2009-10-041-2/+1
| | | | | | | Similarly to what is already done in tcg_liveness_analysis() when USE_LIVENESS_ANALYSIS is not set. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg: remove dead codeAurelien Jarno2009-10-041-2/+0
| | | | Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg/i386: add support for ext{8,16}u_i32 TCG opsAurelien Jarno2009-10-042-0/+10
| | | | Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg/x86_64: add support for ext{8,16,32}u_i{32,64} TCG opsAurelien Jarno2009-10-042-0/+26
| | | | Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg: add ext{8,16,32}u_i{32,64} TCG opsAurelien Jarno2009-10-042-3/+36
| | | | | | | | | | | | | | | | | | | | | Currently zero extensions ops are implemented by a and op with a constant. This is then catched in some backend, and replaced by a zero extension instruction. While this works well on RISC machines, this adds a useless register move on non-RISC machines. Example on x86: ext16u_i32 r1, r2 is translated into mov %eax,%ebx movzwl %bx, %ebx while the optimized version should be: movzwl %ax, %ebx This patch adds ext{8,16,32}u_i{32,64} TCG ops that can be implemented in the backends to avoid emitting useless register moves. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* Revert part of 6692b043198d58a12317009edb98654c6839f043Aurelien Jarno2009-09-301-8/+4
| | | | | | Committed by accident. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* TCG: fix DEF2 macroAurelien Jarno2009-09-301-5/+9
| | | | Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg/i386: generates dec/inc instead of sub/add when possibleAurelien Jarno2009-09-271-9/+15
| | | | | | | We must take care that dec/inc do not compute CF, which is needed by add2/sub2. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg/i386: optimize and $0xff(ff), regAurelien Jarno2009-09-271-0/+6
| | | | Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg/x86_64: generated dec/inc instead of sub/add when possibleAurelien Jarno2009-09-271-2/+14
| | | | Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg/ppc: always use tcg_out_callmalc2009-09-271-20/+10
| | | | Signed-off-by: malc <av1474@comtv.ru>
* ARM back-end: Use sxt[bh] instructions for ext{8, 6}sLaurent Desnogues2009-09-261-0/+10
| | | | | | | This patch uses sxtb for ext8s_i32 and sxth for ext16s_i32 in ARM back-end. Signed-off-by: Laurent Desnogues <laurent.desnogues@gmail.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* Suppress some variants of English in commentsStefan Weil2009-09-252-4/+4
| | | | | | | Replace surpress, supress by suppress. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* Compile TCG runtime library only onceBlue Swirl2009-09-203-77/+14
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* tcg: fix size of local variables in tcg_gen_bswap64_i64Stefan Weil2009-09-161-5/+4
| | | | | | | t0, t1 must be 64 bit values, not 32 bit. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* X86_64: Use proper jumps/calls when displacement exceeds +-2Gmalc2009-09-111-12/+19
| | | | Signed-off-by: malc <av1474@comtv.ru>
* When targeting PPU use rlwinm instead of andi. if possiblemalc2009-09-061-8/+54
| | | | | | andi. is microcoded and slow there. Signed-off-by: malc <av1474@comtv.ru>
* ARM back-end: Fix encode_immLaurent Desnogues2009-08-251-0/+2
| | | | | | | | | the encode_imm function in tcg/arm/tcg-target.c lacks shift declaration. Laurent Signed-off-by: Laurent Desnogues <laurent.desnogues@gmail.com> Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
* ARM back-end: Handle all possible immediates for ALU opsLaurent Desnogues2009-08-221-5/+32
| | | | | | | | | | this patch handles all possible constants for immediate operand of ALU ops. I'm not very satisfied by the implementation. Laurent Signed-off-by: Laurent Desnogues <laurent.desnogues@gmail.com> Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
* ARM back-end: Add TCG notLaurent Desnogues2009-08-222-0/+6
| | | | | | | | | | | this patch: - implements TCG not. Laurent Signed-off-by: Laurent Desnogues <laurent.desnogues@gmail.com> Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
* rename WORDS_BIGENDIAN to HOST_WORDS_BIGENDIANJuan Quintela2009-07-271-1/+1
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* rename DEBUG_TCG to CONFIG_DEBUG_TCGJuan Quintela2009-07-272-2/+2
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* change HOST_SOLARIS to CONFIG_SOLARIS{_VERSION}Juan Quintela2009-07-271-1/+1
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Fix CONFIG_PROFILERBlue Swirl2009-07-211-5/+3
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Fix rbase initializationmalc2009-07-201-1/+1
| | | | Signed-off-by: malc <av1474@comtv.ru>
* this patch improves the ARM back-end in the following way:Laurent Desnogues2009-07-182-7/+37
| | | | | | | | | | - use movw/movt to load immediate values for ARMv7-A - implement add/sub/and/or/xor with immediate (only 8-bit) Laurent Signed-off-by: Laurent Desnogues <laurent.desnogues@gmail.com> Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
* tcg: Fix tcg_gen_rotr_i64Aurelien Jarno2009-07-181-1/+1
| | | | | Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* PPC 32/64 GUEST_BASE supportmalc2009-07-184-41/+127
| | | | Signed-off-by: malc <av1474@comtv.ru>
* Fix LHZX opcode valuemalc2009-07-182-2/+2
| | | | Signed-off-by: malc <av1474@comtv.ru>
* Userspace guest address offsettingJuan Quintela2009-07-171-1/+1
| | | | | | Fix type in i386 tcg. Signed-off-by: Juan Quintela <quintela@redhat.com>
OpenPOWER on IntegriCloud