On 09/26/2013 05:48 PM, Alexander Graf wrote:
> +uint64_t HELPER(cinc)(uint32_t pstate, uint32_t insn, uint64_t n, uint64_t m)
> +{
> +    bool else_inc = get_bits(insn, 10, 1);
> +    int cond = get_bits(insn, 12, 4);
> +    bool else_inv = get_bits(insn, 30, 1);
> +    bool is_32bit = !get_bits(insn, 31, 1);
> +    uint64_t r;
> +
> +    if (helper_cond(pstate, cond)) {
> +        r = n;
> +        goto out;
> +    }
> +
> +    r = m;
> +    if (else_inv) {
> +        r = ~r;
> +    }
> +    if (else_inc) {
> +        r++;
> +    }
> +
> +out:
> +    if (is_32bit) {
> +        r = (uint32_t)r;
> +    }
> +
> +    return r;
> +}

Better to properly decode this during translate.  And it's easy to do
everything you need via setcond and movcond.


r~

Reply via email to