sparc: use AddCC, SubCC, MulCC
authorMatthias Braun <matze@braunis.de>
Fri, 14 Oct 2011 14:48:51 +0000 (16:48 +0200)
committerMatthias Braun <matze@braunis.de>
Mon, 17 Oct 2011 16:30:04 +0000 (18:30 +0200)
ir/be/sparc/sparc_spec.pl
ir/be/sparc/sparc_transform.c

index 36aa51e..a92a5b4 100644 (file)
@@ -269,12 +269,19 @@ Add => {
 },
 
 AddCC => {
-       irn_flags    => [ "rematerializable" ],
+       irn_flags    => [ "rematerializable", "modifies_flags" ],
        emit         => '. addcc %S0, %R1I, %D0',
        outs         => [ "res", "flags" ],
        constructors => \%binopcc_operand_constructors,
 },
 
+AddCCZero => {
+       irn_flags    => [ "rematerializable", "modifies_flags" ],
+       emit         => '. addcc %S0, %R1I, %%g0',
+       mode         => $mode_flags,
+       constructors => \%binopcczero_operand_constructors,
+},
+
 AddX => {
        # At the moment not rematerializable because of assert in beflags.c/
        # (it claims that spiller can't rematerialize flag stuff correctly)
@@ -305,12 +312,19 @@ Sub => {
 },
 
 SubCC => {
-       irn_flags    => [ "rematerializable" ],
+       irn_flags    => [ "rematerializable", "modifies_flags" ],
        emit         => '. subcc %S0, %R1I, %D0',
        outs         => [ "res", "flags" ],
        constructors => \%binopcc_operand_constructors,
 },
 
+SubCCZero => {
+       irn_flags    => [ "rematerializable", "modifies_flags" ],
+       emit         => '. subcc %S0, %R1I, %%g0',
+       mode         => $mode_flags,
+       constructors => \%binopcczero_operand_constructors,
+},
+
 SubX => {
        # Not rematerializable (see AddX)
        emit         => '. subx %S0, %R1I, %D0',
@@ -677,6 +691,13 @@ Mul => {
        constructors => \%binop_operand_constructors,
 },
 
+MulCCZero => {
+       irn_flags    => [ "rematerializable", "modifies_flags" ],
+       emit         => '. smulcc %S0, %R1I, %%g0',
+       mode         => $mode_flags,
+       constructors => \%binopcczero_operand_constructors,
+},
+
 SMulh => {
        irn_flags    => [ "rematerializable" ],
        outs         => [ "low", "high" ],
index a0fd236..e13284a 100644 (file)
@@ -1287,6 +1287,18 @@ static ir_node *gen_Cmp(ir_node *node)
                                                new_bd_sparc_XNorCCZero_reg,
                                                new_bd_sparc_XNorCCZero_imm,
                                                MATCH_NONE);
+               } else if (is_Add(op1)) {
+                       return gen_helper_binop(op1, MATCH_COMMUTATIVE,
+                                               new_bd_sparc_AddCCZero_reg,
+                                               new_bd_sparc_AddCCZero_imm);
+               } else if (is_Sub(op1)) {
+                       return gen_helper_binop(op1, MATCH_NONE,
+                                               new_bd_sparc_SubCCZero_reg,
+                                               new_bd_sparc_SubCCZero_imm);
+               } else if (is_Mul(op1)) {
+                       return gen_helper_binop(op1, MATCH_COMMUTATIVE,
+                                               new_bd_sparc_MulCCZero_reg,
+                                               new_bd_sparc_MulCCZero_imm);
                }
        }