[Ping] [PATCH, 8/10] aarch64: ccmp insn patterns

Richard Henderson rth@redhat.com
Sat Oct 11 20:45:00 GMT 2014


On 09/22/2014 11:45 PM, Zhenqiang Chen wrote:
> +(define_expand "cbranchcc4"
> +  [(set (pc) (if_then_else
> +	      (match_operator 0 "aarch64_comparison_operator"
> +	       [(match_operand 1 "cc_register" "")
> +	        (const_int 0)])
> +	      (label_ref (match_operand 3 "" ""))
> +	      (pc)))]
> +  ""
> +  " ")

Extra space.

> +(define_insn "*ccmp_and"
> +  [(set (match_operand 6 "ccmp_cc_register" "")
> +	(compare
> +	 (and:SI
> +	  (match_operator 4 "aarch64_comparison_operator"
> +	   [(match_operand 0 "ccmp_cc_register" "")
> +	    (match_operand 1 "aarch64_plus_operand" "")])
> +	  (match_operator 5 "aarch64_comparison_operator"
> +	   [(match_operand:GPI 2 "register_operand" "r,r,r")
> +	    (match_operand:GPI 3 "aarch64_ccmp_operand" "r,Uss,Usn")]))
> +	 (const_int 0)))]
> +  ""
> +  {
> +    return aarch64_output_ccmp (operands, true, which_alternative);
> +  }
> +  [(set_attr "type" "alus_sreg,alus_imm,alus_imm")]
> +)
> +
> +(define_insn "*ccmp_ior"
> +  [(set (match_operand 6 "ccmp_cc_register" "")
> +	(compare
> +	 (ior:SI
> +	  (match_operator 4 "aarch64_comparison_operator"
> +	   [(match_operand 0 "ccmp_cc_register" "")
> +	    (match_operand 1 "aarch64_plus_operand" "")])
> +	  (match_operator 5 "aarch64_comparison_operator"
> +	   [(match_operand:GPI 2 "register_operand" "r,r,r")
> +	    (match_operand:GPI 3 "aarch64_ccmp_operand" "r,Uss,Usn")]))
> +	 (const_int 0)))]
> +  ""
> +  {
> +    return aarch64_output_ccmp (operands, false, which_alternative);
> +  }
> +  [(set_attr "type" "alus_sreg,alus_imm,alus_imm")]

Surely not aarch64_plus_operand for operand 1.  That's a comparison with the
flags register.  Surely (const_int 0) is the only valid operand there.

These could be combined with a code iterator, and thus there would be exactly
one call to aarch64_output_ccmp, and thus inlined.  Although...

It seems to me that you don't need a function call at all.  How about

AND
  "@
   ccmp\\t%<w>2, %<w>3, %K5, %m4
   ccmp\\t%<w>2, %<w>3, %K5, %m4
   ccmn\\t%<w>2, #%n3, %K5, %m4"

IOR
  "@
   ccmp\\t%<w>2, %<w>3, %k5, %M4
   ccmp\\t%<w>2, %<w>3, %k5, %M4
   ccmn\\t%<w>2, #%n3, %k5, %M4"

where 'k' and 'K' are new print_operand codes that output the nzcv (or its
inverse) integer for the comparison, much like 'm' and 'M' print the name of
the comparison.


r~



More information about the Gcc-patches mailing list