On 09/22/2014 11:45 PM, Zhenqiang Chen wrote:
> +static unsigned int
> +aarch64_code_to_nzcv (enum rtx_code code, bool inverse) {
> + switch (code)
> + {
> + case NE: /* NE, Z == 0. */
> + return inverse ? AARCH64_CC_Z : 0;
> + case EQ: /* EQ, Z == 1. */
> + return inverse ? 0 : AARCH64_CC_Z;
> + case LE: /* LE, !(Z == 0 && N == V). */
> + return inverse ? AARCH64_CC_N | AARCH64_CC_V : AARCH64_CC_Z;
> + case GT: /* GT, Z == 0 && N == V. */
> + return inverse ? AARCH64_CC_Z : AARCH64_CC_N | AARCH64_CC_V;
> + case LT: /* LT, N != V. */
> + return inverse ? AARCH64_CC_N | AARCH64_CC_V : AARCH64_CC_N;
> + case GE: /* GE, N == V. */
> + return inverse ? AARCH64_CC_N : AARCH64_CC_N | AARCH64_CC_V;
> + case LEU: /* LS, !(C == 1 && Z == 0). */
> + return inverse ? AARCH64_CC_C: AARCH64_CC_Z;
> + case GTU: /* HI, C ==1 && Z == 0. */
> + return inverse ? AARCH64_CC_Z : AARCH64_CC_C;
> + case LTU: /* CC, C == 0. */
> + return inverse ? AARCH64_CC_C : 0;
> + case GEU: /* CS, C == 1. */
> + return inverse ? 0 : AARCH64_CC_C;
> + default:
> + gcc_unreachable ();
> + return 0;
> + }
> +}
> +
I'm not overly fond of this, since "code" doesn't map 1-1. It needs the
context of a mode to provide a unique mapping.
I think it would be better to rearrange the existing aarch64_cond_code enum
such that AARCH64_NE et al are meaningful wrt NZCV. Then you can use
aarch64_get_condition_code_1 to get this mapping.
> +static unsigned
> +aarch64_mode_to_condition_code (enum machine_mode mode, bool
> inverse) {
> + switch (mode)
> + {
> + case CC_DNEmode:
> + return inverse ? aarch64_get_condition_code_1 (CCmode, EQ)
> + : aarch64_get_condition_code_1 (CCmode, NE);
This function is just silly. Modulo the unsigned result, which is wrong after
the rebase, the whole thing reduces to
return aarch64_get_condition_code_1 (mode, inverse ? EQ : NE);
I'm really not sure what you're after here.
> +const char *
> +aarch64_output_ccmp (rtx *operands, bool is_and, int which_alternative)
Is this really used more than once? I'm not fond of the use of
which_alternative without the context of a pattern. I think this could simply
be inlined.
r~