]> git.proxmox.com Git - mirror_qemu.git/commit - tcg/mips/tcg-target.c.inc
tcg/mips: Support r6 SEL{NE, EQ}Z instead of MOVN/MOVZ
authorJames Hogan <james.hogan@imgtec.com>
Fri, 2 Oct 2015 12:24:17 +0000 (13:24 +0100)
committerRichard Henderson <rth@twiddle.net>
Mon, 19 Oct 2015 21:04:39 +0000 (11:04 -1000)
commit137d63902faf4960081856db9242cbaf234a23af
treecc7ddee084123779691a6722a20e440b54f8ff1a
parentbc6d0c22b09a72897d9db4482076f89e7de97400
tcg/mips: Support r6 SEL{NE, EQ}Z instead of MOVN/MOVZ

Extend MIPS movcond implementation to support the SELNEZ/SELEQZ
instructions introduced in MIPS r6 (where MOVN/MOVZ have been removed).

Whereas the "MOVN/MOVZ rd, rs, rt" instructions have the following
semantics:
 rd = [!]rt ? rs : rd

The "SELNEZ/SELEQZ rd, rs, rt" instructions are slightly different:
 rd = [!]rt ? rs : 0

First we ensure that if one of the movcond input values is zero that it
comes last (we can swap the input arguments if we invert the condition).
This is so that it can exactly match one of the SELNEZ/SELEQZ
instructions and avoid the need to emit the other one.

Otherwise we emit the opposite instruction first into a temporary
register, and OR that into the result:
 SELNEZ/SELEQZ  TMP1, v2, c1
 SELEQZ/SELNEZ  ret, v1, c1
 OR             ret, ret, TMP1

Which does the following:
 ret = cond ? v1 : v2

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Message-Id: <1443788657-14537-7-git-send-email-james.hogan@imgtec.com>
tcg/mips/tcg-target.c