+2008-03-25 Naveen.H.S <naveen.hs@kpitcummins.com>
+
+ * config/sh/sh.c (sh_expand_t_scc): Emit movrt for SH2A if
+ possible.
+ * config/sh/sh.md (xorsi3_movrt, movrt): New insns.
+
2008-03-25 Naveen.H.S <naveen.hs@kpitcummins.com>
* config/sh/sh.md (prefetch): Add condition for SH2A target.
val = INTVAL (sh_compare_op1);
if ((code == EQ && val == 1) || (code == NE && val == 0))
emit_insn (gen_movt (result));
+ else if (TARGET_SH2A && ((code == EQ && val == 0)
+ || (code == NE && val == 1)))
+ emit_insn (gen_movrt (result));
else if ((code == EQ && val == 0) || (code == NE && val == 1))
{
emit_insn (gen_rtx_CLOBBER (VOIDmode, result));
xori %1, %2, %0"
[(set_attr "type" "arith_media")])
+;; Store the complements of the T bit in a register.
+(define_insn "xorsi3_movrt"
+ [(set (match_operand:SI 0 "arith_reg_dest" "=r")
+ (xor:SI (reg:SI T_REG)
+ (const_int 1)))]
+ "TARGET_SH2A"
+ "movrt\\t%0"
+ [(set_attr "type" "arith")])
+
(define_insn "xordi3"
[(set (match_operand:DI 0 "arith_reg_dest" "=r,r")
(xor:DI (match_operand:DI 1 "arith_reg_operand" "%r,r")
"movt %0"
[(set_attr "type" "arith")])
+;; complements the T bit and stores the result in a register
+(define_insn "movrt"
+ [(set (match_operand:SI 0 "arith_reg_dest" "=r")
+ (if_then_else (eq:SI (reg:SI T_REG) (const_int 0))
+ (const_int 1)
+ (const_int 0)))]
+ "TARGET_SH2A"
+ "movrt\\t%0"
+ [(set_attr "type" "arith")])
+
(define_expand "seq"
[(set (match_operand:SI 0 "arith_reg_dest" "")
(match_dup 1))]
+2008-03-25 Naveen.H.S <naveen.hs@kpitcummins.com>
+
+ * gcc.target/sh/sh2a-movrt.c: New test.
+
2008-03-25 Naveen.H.S <naveen.hs@kpitcummins.com>
* gcc.target/sh/sh2a-prefetch.c: New test.
--- /dev/null
+/* Testcase to check generation of a SH2A specific instruction for
+ 'MOVRT Rn'. */
+/* { dg-do assemble {target sh*-*-*}} */
+/* { dg-options "-O1" } */
+/* { dg-skip-if "" { "sh*-*-*" } "*" "-m2a -m2a-nofpu -m2a-single -m2a-single-only" } */
+/* { dg-final { scan-assembler "movrt"} } */
+
+int
+foo (void)
+{
+ int a, b, g, stop;
+ if (stop = ((a + b) % 2 != g))
+ ;
+ return stop;
+}