+2013-04-10 David S. Miller <davem@davemloft.net>
+
+ * target.def (cstore_mode): New hook.
+ * target.h: Include insn-codes.h
+ * targhooks.c: Likewise.
+ (default_cstore_mode): New function.
+ * targhooks.h: Declare it.
+ * doc/tm.texi.in: New hook slot for TARGET_CSTORE_MODE.
+ * doc/tm.texi: Rebuild.
+ * expmed.c (emit_cstore): Obtain cstore boolean result mode using
+ target hook, rather than inspecting the insn_data.
+ * config/sparc/sparc.c (sparc_cstore_mode): New function.
+ (TARGET_CSTORE_MODE): Redefine.
+ (emit_scc_insn): When TARGET_ARCH64, emit new 64-bit boolean
+ result patterns.
+ * config/sparc/predicates.md (cstore_result_operand): New special
+ predicate.
+ * config/sparc/sparc.md (cstoresi4, cstoredi4, cstore<F:mode>4):
+ Use it for operand 0.
+ (*seqsi_special): Rewrite using 'P' mode iterator on operand 0.
+ (*snesi_special): Likewise.
+ (*snesi_zero): Likewise.
+ (*seqsi_zero): Likewise.
+ (*sltu_insn): Likewise.
+ (*sgeu_insn): Likewise.
+ (*seqdi_special): Make operand 0 and comparison operation be of
+ DImode.
+ (*snedi_special): Likewise.
+ (*snedi_special_vis3): Likewise.
+ (*neg_snesi_zero): Rename to *neg_snesisi_zero.
+ (*neg_snesi_sign_extend): Rename to *neg_snesidi_zero.
+ (*snesi_zero_extend): Delete, covered by 'P' mode iterator.
+ (*neg_seqsi_zero): Rename to *neg_seqsisi_zero.
+ (*neg_seqsi_sign_extend): Rename to *neg_seqsidi_zero.
+ (*seqsi_zero_extend): Delete, covered by 'P' mode iterator.
+ (*sltu_extend_sp64): Likewise.
+ (*neg_sltu_insn): Rename to *neg_sltusi_insn.
+ (*neg_sltu_extend_sp64): Rename to *neg_sltudi_insn.
+ (*sgeu_extend_sp64): Delete, covered by 'P' mode iterator.
+ (*neg_sgeu_insn): Rename to *neg_sgeusi_insn.
+ (*neg_sgeu_extend_sp64): Rename to *neg_sgeudi_insn.
+
2013-04-10 Yufeng Zhang <yufeng.zhang@arm.com>
* config/aarch64/aarch64.c (aarch64_print_extension): New function.
\f
;; Next come the scc insns.
+;; Note that the boolean result (operand 0) takes on DImode
+;; (not SImode) when TARGET_ARCH64.
+
(define_expand "cstoresi4"
[(use (match_operator 1 "comparison_operator"
[(match_operand:SI 2 "compare_operand" "")
(match_operand:SI 3 "arith_operand" "")]))
- (clobber (match_operand:SI 0 "register_operand"))]
+ (clobber (match_operand:SI 0 "cstore_result_operand"))]
""
{
if (GET_CODE (operands[2]) == ZERO_EXTRACT && operands[3] != const0_rtx)
[(use (match_operator 1 "comparison_operator"
[(match_operand:DI 2 "compare_operand" "")
(match_operand:DI 3 "arith_operand" "")]))
- (clobber (match_operand:SI 0 "register_operand"))]
+ (clobber (match_operand:SI 0 "cstore_result_operand"))]
"TARGET_ARCH64"
{
if (GET_CODE (operands[2]) == ZERO_EXTRACT && operands[3] != const0_rtx)
[(use (match_operator 1 "comparison_operator"
[(match_operand:F 2 "register_operand" "")
(match_operand:F 3 "register_operand" "")]))
- (clobber (match_operand:SI 0 "register_operand"))]
+ (clobber (match_operand:SI 0 "cstore_result_operand"))]
"TARGET_FPU"
{ if (emit_scc_insn (operands)) DONE; else FAIL; })
;; Seq_special[_xxx] and sne_special[_xxx] clobber the CC reg, because they
;; generate addcc/subcc instructions.
-(define_expand "seqsi_special"
+(define_expand "seqsi<P:mode>_special"
[(set (match_dup 3)
(xor:SI (match_operand:SI 1 "register_operand" "")
(match_operand:SI 2 "register_operand" "")))
- (parallel [(set (match_operand:SI 0 "register_operand" "")
- (eq:SI (match_dup 3) (const_int 0)))
+ (parallel [(set (match_operand:P 0 "register_operand" "")
+ (eq:P (match_dup 3) (const_int 0)))
(clobber (reg:CC CC_REG))])]
""
{ operands[3] = gen_reg_rtx (SImode); })
[(set (match_dup 3)
(xor:DI (match_operand:DI 1 "register_operand" "")
(match_operand:DI 2 "register_operand" "")))
- (set (match_operand:SI 0 "register_operand" "")
- (eq:SI (match_dup 3) (const_int 0)))]
+ (set (match_operand:DI 0 "register_operand" "")
+ (eq:DI (match_dup 3) (const_int 0)))]
"TARGET_ARCH64"
{ operands[3] = gen_reg_rtx (DImode); })
-(define_expand "snesi_special"
+(define_expand "snesi<P:mode>_special"
[(set (match_dup 3)
(xor:SI (match_operand:SI 1 "register_operand" "")
(match_operand:SI 2 "register_operand" "")))
- (parallel [(set (match_operand:SI 0 "register_operand" "")
- (ne:SI (match_dup 3) (const_int 0)))
+ (parallel [(set (match_operand:P 0 "register_operand" "")
+ (ne:P (match_dup 3) (const_int 0)))
(clobber (reg:CC CC_REG))])]
""
{ operands[3] = gen_reg_rtx (SImode); })
[(set (match_dup 3)
(xor:DI (match_operand:DI 1 "register_operand" "")
(match_operand:DI 2 "register_operand" "")))
- (set (match_operand:SI 0 "register_operand" "")
- (ne:SI (match_dup 3) (const_int 0)))]
+ (set (match_operand:DI 0 "register_operand" "")
+ (ne:DI (match_dup 3) (const_int 0)))]
"TARGET_ARCH64 && ! TARGET_VIS3"
{ operands[3] = gen_reg_rtx (DImode); })
[(set (match_dup 3)
(xor:DI (match_operand:DI 1 "register_operand" "")
(match_operand:DI 2 "register_operand" "")))
- (parallel [(set (match_operand:SI 0 "register_operand" "")
- (ne:SI (match_dup 3) (const_int 0)))
+ (parallel [(set (match_operand:DI 0 "register_operand" "")
+ (ne:DI (match_dup 3) (const_int 0)))
(clobber (reg:CCX CC_REG))])]
"TARGET_ARCH64 && TARGET_VIS3"
{ operands[3] = gen_reg_rtx (DImode); })
;; them to always use the splits below so the results can be
;; scheduled.
-(define_insn_and_split "*snesi_zero"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ne:SI (match_operand:SI 1 "register_operand" "r")
+(define_insn_and_split "*snesi<P:mode>_zero"
+ [(set (match_operand:P 0 "register_operand" "=r")
+ (ne:P (match_operand:SI 1 "register_operand" "r")
(const_int 0)))
(clobber (reg:CC CC_REG))]
""
""
[(set (reg:CC_NOOV CC_REG) (compare:CC_NOOV (neg:SI (match_dup 1))
(const_int 0)))
- (set (match_dup 0) (ltu:SI (reg:CC CC_REG) (const_int 0)))]
+ (set (match_dup 0) (ltu:P (reg:CC CC_REG) (const_int 0)))]
""
[(set_attr "length" "2")])
-(define_insn_and_split "*neg_snesi_zero"
+(define_insn_and_split "*neg_snesisi_zero"
[(set (match_operand:SI 0 "register_operand" "=r")
(neg:SI (ne:SI (match_operand:SI 1 "register_operand" "r")
(const_int 0))))
""
[(set_attr "length" "2")])
-(define_insn_and_split "*snesi_zero_extend"
+(define_insn_and_split "*neg_snesidi_zero"
[(set (match_operand:DI 0 "register_operand" "=r")
- (ne:DI (match_operand:SI 1 "register_operand" "r")
- (const_int 0)))
+ (neg:DI (ne:DI (match_operand:SI 1 "register_operand" "r")
+ (const_int 0))))
(clobber (reg:CC CC_REG))]
"TARGET_ARCH64"
"#"
- "&& 1"
- [(set (reg:CC_NOOV CC_REG) (compare:CC_NOOV (minus:SI (const_int 0)
- (match_dup 1))
- (const_int 0)))
- (set (match_dup 0) (zero_extend:DI (plus:SI (plus:SI (const_int 0)
- (const_int 0))
- (ltu:SI (reg:CC_NOOV CC_REG)
- (const_int 0)))))]
""
- [(set_attr "length" "2")])
-
-(define_insn_and_split "*neg_snesi_sign_extend"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (neg:DI (ne:DI (match_operand:SI 1 "register_operand" "r")
- (const_int 0))))
- (clobber (reg:CC CC_REG))]
- "TARGET_ARCH64"
- "#"
- "&& 1"
- [(set (reg:CC_NOOV CC_REG) (compare:CC_NOOV (minus:SI (const_int 0)
- (match_dup 1))
- (const_int 0)))
+ [(set (reg:CC_NOOV CC_REG) (compare:CC_NOOV (neg:SI (match_dup 1))
+ (const_int 0)))
(set (match_dup 0) (sign_extend:DI (neg:SI (ltu:SI (reg:CC CC_REG)
(const_int 0)))))]
""
""
[(set_attr "length" "2")])
-(define_insn_and_split "*seqsi_zero"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (eq:SI (match_operand:SI 1 "register_operand" "r")
+(define_insn_and_split "*seqsi<P:mode>_zero"
+ [(set (match_operand:P 0 "register_operand" "=r")
+ (eq:P (match_operand:SI 1 "register_operand" "r")
(const_int 0)))
(clobber (reg:CC CC_REG))]
""
""
[(set (reg:CC_NOOV CC_REG) (compare:CC_NOOV (neg:SI (match_dup 1))
(const_int 0)))
- (set (match_dup 0) (geu:SI (reg:CC CC_REG) (const_int 0)))]
+ (set (match_dup 0) (geu:P (reg:CC CC_REG) (const_int 0)))]
""
[(set_attr "length" "2")])
-(define_insn_and_split "*neg_seqsi_zero"
+(define_insn_and_split "*neg_seqsisi_zero"
[(set (match_operand:SI 0 "register_operand" "=r")
(neg:SI (eq:SI (match_operand:SI 1 "register_operand" "r")
(const_int 0))))
""
[(set_attr "length" "2")])
-(define_insn_and_split "*seqsi_zero_extend"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (eq:DI (match_operand:SI 1 "register_operand" "r")
- (const_int 0)))
- (clobber (reg:CC CC_REG))]
- "TARGET_ARCH64"
- "#"
- "&& 1"
- [(set (reg:CC_NOOV CC_REG) (compare:CC_NOOV (minus:SI (const_int 0)
- (match_dup 1))
- (const_int 0)))
- (set (match_dup 0) (zero_extend:DI (minus:SI (minus:SI (const_int 0)
- (const_int -1))
- (ltu:SI (reg:CC_NOOV CC_REG)
- (const_int 0)))))]
- ""
- [(set_attr "length" "2")])
-
-(define_insn_and_split "*neg_seqsi_sign_extend"
+(define_insn_and_split "*neg_seqsidi_zero"
[(set (match_operand:DI 0 "register_operand" "=r")
(neg:DI (eq:DI (match_operand:SI 1 "register_operand" "r")
(const_int 0))))
;; ??? The addx/subx insns use the 32 bit carry flag so there are no DImode
;; versions for v9.
-(define_insn "*sltu_insn"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ltu:SI (reg:CC CC_REG) (const_int 0)))]
+(define_insn "*sltu<P:mode>_insn"
+ [(set (match_operand:P 0 "register_operand" "=r")
+ (ltu:P (reg:CC CC_REG) (const_int 0)))]
""
"addx\t%%g0, 0, %0"
[(set_attr "type" "ialuX")])
"addxc\t%%g0, %%g0, %0"
[(set_attr "type" "ialuX")])
-(define_insn "*sltu_extend_sp64"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ltu:DI (reg:CC CC_REG) (const_int 0)))]
- "TARGET_ARCH64"
- "addx\t%%g0, 0, %0"
- [(set_attr "type" "ialuX")])
-
-(define_insn "*neg_sltu_insn"
+(define_insn "*neg_sltusi_insn"
[(set (match_operand:SI 0 "register_operand" "=r")
(neg:SI (ltu:SI (reg:CC CC_REG) (const_int 0))))]
""
"subx\t%%g0, 0, %0"
[(set_attr "type" "ialuX")])
-(define_insn "*neg_sltu_extend_sp64"
+(define_insn "*neg_sltudi_insn"
[(set (match_operand:DI 0 "register_operand" "=r")
(sign_extend:DI (neg:SI (ltu:SI (reg:CC CC_REG) (const_int 0)))))]
"TARGET_ARCH64"
"subx\t%%g0, 0, %0"
[(set_attr "type" "ialuX")])
-;; ??? Combine should canonicalize these next two to the same pattern.
(define_insn "*neg_sltu_minus_x"
[(set (match_operand:SI 0 "register_operand" "=r")
(minus:SI (neg:SI (ltu:SI (reg:CC CC_REG) (const_int 0)))
"subx\t%%g0, %1, %0"
[(set_attr "type" "ialuX")])
-(define_insn "*sgeu_insn"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (geu:SI (reg:CC CC_REG) (const_int 0)))]
+(define_insn "*sgeu<P:mode>_insn"
+ [(set (match_operand:P 0 "register_operand" "=r")
+ (geu:P (reg:CC CC_REG) (const_int 0)))]
""
"subx\t%%g0, -1, %0"
[(set_attr "type" "ialuX")])
-(define_insn "*sgeu_extend_sp64"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (geu:DI (reg:CC CC_REG) (const_int 0)))]
- "TARGET_ARCH64"
- "subx\t%%g0, -1, %0"
- [(set_attr "type" "ialuX")])
-
-(define_insn "*neg_sgeu_insn"
+(define_insn "*neg_sgeusi_insn"
[(set (match_operand:SI 0 "register_operand" "=r")
(neg:SI (geu:SI (reg:CC CC_REG) (const_int 0))))]
""
"addx\t%%g0, -1, %0"
[(set_attr "type" "ialuX")])
-(define_insn "*neg_sgeu_extend_sp64"
+(define_insn "*neg_sgeudi_insn"
[(set (match_operand:DI 0 "register_operand" "=r")
(sign_extend:DI (neg:SI (geu:SI (reg:CC CC_REG) (const_int 0)))))]
"TARGET_ARCH64"