avr.md ("mcu_enhanced"): New attribute.
authorDenis Chertykov <denisc@overta.ru>
Sun, 17 Sep 2000 15:08:35 +0000 (15:08 +0000)
committerDenis Chertykov <denisc@gcc.gnu.org>
Sun, 17 Sep 2000 15:08:35 +0000 (19:08 +0400)
* config/avr/avr.md ("mcu_enhanced"): New attribute.
("mcu_mega"): Likewise.
("extendhisi2"): Use "mcu_enhanced".
("zero_extendhisi2"): Likewise.
("call_insn"): Use "mcu_enhanced" and "mcu_mega".
("call_value_insn"): Likewise.
("*sbrx_branch"): Use "mcu_mega".
("*sbrx_and_branchsi"): Likewise.
("*sbrx_and_branchhi"): Likewise.
("*tablejump_lib"): Likewise.

From-SVN: r36474

gcc/ChangeLog
gcc/config/avr/avr.md

index 4eca4b1..42fe52b 100644 (file)
@@ -1,3 +1,16 @@
+Sun Sep 17 18:48:32 2000  Denis Chertykov  <denisc@overta.ru>
+
+       * config/avr/avr.md ("mcu_enhanced"): New attribute.
+       ("mcu_mega"): Likewise.
+       ("extendhisi2"): Use "mcu_enhanced".
+       ("zero_extendhisi2"): Likewise.
+       ("call_insn"): Use "mcu_enhanced" and "mcu_mega".
+       ("call_value_insn"): Likewise.
+       ("*sbrx_branch"): Use "mcu_mega".
+       ("*sbrx_and_branchsi"): Likewise.
+       ("*sbrx_and_branchhi"): Likewise.
+       ("*tablejump_lib"): Likewise.
+
 Sun Sep 17 10:46:17 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
        * c-decl.c (grokdeclarator): Reorder tests to avoid looking at
index fbd00a5..e48dab7 100644 (file)
 (define_attr "type" "branch,branch1,arith"
   (const_string "arith"))
 
+(define_attr "mcu_enhanced" "yes,no"
+  (const (if_then_else (symbol_ref "AVR_ENHANCED")
+                      (const_string "yes")
+                      (const_string "no"))))
+
+(define_attr "mcu_mega" "yes,no"
+  (const (if_then_else (symbol_ref "AVR_MEGA")
+                      (const_string "yes")
+                      (const_string "no"))))
+  
+
 ;; The size of instructions in bytes.
 ;; XXX may depend from "cc"
 
   "@
        clr %C0\;sbrc %B0,7\;com %C0\;mov %D0,%C0
        {mov %A0,%A1\;mov %B0,%B1|movw %A0,%A1}\;clr %C0\;sbrc %B0,7\;com %C0\;mov %D0,%C0"
-  [(set (attr "length")
-       (if_then_else
-        (eq (symbol_ref "AVR_ENHANCED") (const_int 0))
-        (if_then_else (eq (symbol_ref "which_alternative") (const_int 0))
-                      (const_int 4)
-                      (const_int 6))
-        (if_then_else (eq (symbol_ref "which_alternative") (const_int 0))
-                      (const_int 4)
-                      (const_int 5))))
+  [(set_attr_alternative "length"
+                        [(const_int 4)
+                         (if_then_else (eq_attr "mcu_enhanced" "yes")
+                                       (const_int 5)
+                                       (const_int 6))])
    (set_attr "cc" "clobber,clobber")])
 
 ;; xx<---x xx<---x xx<---x xx<---x xx<---x xx<---x xx<---x xx<---x xx<---x
   "@
        clr %C0\;clr %D0
        {mov %A0,%A1\;mov %B0,%B1|movw %A0,%B0}\;clr %C0\;clr %D0"
-  [(set (attr "length")
-       (if_then_else
-        (eq (symbol_ref "AVR_ENHANCED") (const_int 0))
-        (if_then_else (eq (symbol_ref "which_alternative") (const_int 0))
-                      (const_int 2)
-                      (const_int 4))
-        (if_then_else (eq (symbol_ref "which_alternative") (const_int 0))
-                      (const_int 2)
-                      (const_int 3))))
+  [(set_attr_alternative "length"
+                        [(const_int 2)
+                         (if_then_else (eq_attr "mcu_enhanced" "yes")
+                                       (const_int 3)
+                                       (const_int 4))])
    (set_attr "cc" "set_n,set_n")])
 
 ;;<=><=><=><=><=><=><=><=><=><=><=><=><=><=><=><=><=><=><=><=><=><=><=><=><=>
        return (AS1 (rjmp,_PC_+4) CR_TAB
                AS1 (jmp,%3));
      }"
-  [(set (attr "length") (if_then_else (and (ge (minus (pc) (match_dup 3))
-                                              (const_int -2046))
-                                          (le (minus (pc) (match_dup 3))
-                                              (const_int 2046)))
-                                     (const_int 2)
-                                     (if_then_else (eq (symbol_ref "AVR_MEGA")
-                                                       (const_int 0))
-                                                   (const_int 2)
-                                                   (const_int 4))))
+  [(set (attr "length")
+       (if_then_else (and (ge (minus (pc) (match_dup 3)) (const_int -2046))
+                          (le (minus (pc) (match_dup 3)) (const_int 2046)))
+                     (const_int 2)
+                     (if_then_else (eq_attr "mcu_mega" "no")
+                                   (const_int 2)
+                                   (const_int 4))))
    (set_attr "cc" "clobber")])
 
 (define_insn "*sbrx_and_branchsi"
        return (AS1 (rjmp,_PC_+4) CR_TAB
                AS1 (jmp,%3));
      }"
-  [(set (attr "length") (if_then_else (and (ge (minus (pc) (match_dup 3))
-                                              (const_int -2046))
-                                          (le (minus (pc) (match_dup 3))
-                                              (const_int 2046)))
-                                     (const_int 2)
-                                     (if_then_else (eq (symbol_ref "AVR_MEGA")
-                                                       (const_int 0))
-                                                   (const_int 2)
-                                                   (const_int 4))))
+  [(set (attr "length")
+       (if_then_else (and (ge (minus (pc) (match_dup 3)) (const_int -2046))
+                          (le (minus (pc) (match_dup 3)) (const_int 2046)))
+                     (const_int 2)
+                     (if_then_else (eq_attr "mcu_mega" "no")
+                                   (const_int 2)
+                                   (const_int 4))))
    (set_attr "cc" "clobber")])
 
 (define_insn "*sbrx_and_branchhi"
        return (AS1 (rjmp,_PC_+4) CR_TAB
                AS1 (jmp,%3));
      }"
-  [(set (attr "length") (if_then_else (and (ge (minus (pc) (match_dup 3))
-                                              (const_int -2046))
-                                          (le (minus (pc) (match_dup 3))
-                                              (const_int 2046)))
-                                     (const_int 2)
-                                     (if_then_else (eq (symbol_ref "AVR_MEGA")
-                                                       (const_int 0))
-                                                   (const_int 2)
-                                                   (const_int 4))))
+  [(set (attr "length")
+       (if_then_else (and (ge (minus (pc) (match_dup 3)) (const_int -2046))
+                          (le (minus (pc) (match_dup 3)) (const_int 2046)))
+                     (const_int 2)
+                     (if_then_else (eq_attr "mcu_mega" "no")
+                                   (const_int 2)
+                                   (const_int 4))))
    (set_attr "cc" "clobber")])
 
 ;; ************************************************************************
   ""
   "*{
   if (AVR_MEGA && get_attr_length (insn) != 1)
-    return \"jmp %0\";
-  return \"rjmp %0\";
+    return AS1 (jmp,%0);
+  return AS1 (rjmp,%0);
 }"
-  [(set (attr "length") (if_then_else (and (ge (minus (pc) (match_dup 0))
-                                              (const_int -2047))
-                                          (le (minus (pc) (match_dup 0))
-                                              (const_int 2047)))
-                                     (const_int 1)
-                                     (const_int 2)))
+  [(set (attr "length")
+       (if_then_else (and (ge (minus (pc) (match_dup 0)) (const_int -2047))
+                          (le (minus (pc) (match_dup 0)) (const_int 2047)))
+                     (const_int 1)
+                     (const_int 2)))
    (set_attr "cc" "none")])
 
 ;; call
   return AS1(call,%c0);
 }"
   [(set_attr "cc" "clobber,clobber,clobber")
-   (set (attr "length")
-       (cond [(eq (symbol_ref "which_alternative") (const_int 0))
-              (const_int 1)
-              (eq (symbol_ref "(which_alternative == 1 && AVR_ENHANCED)")
-                   (const_int 1))
-              (const_int 2)
-              (eq (symbol_ref "(which_alternative == 1 && !AVR_ENHANCED)")
-                   (const_int 1))
-              (const_int 3)
-              (eq (symbol_ref "!AVR_MEGA") (const_int 0))
-              (const_int 2)]
-       (const_int 1)))])
+   (set_attr_alternative "length"
+                        [(const_int 1)
+                         (if_then_else (eq_attr "mcu_enhanced" "yes")
+                                       (const_int 2)
+                                       (const_int 3))
+                         (if_then_else (eq_attr "mcu_mega" "yes")
+                                       (const_int 2)
+                                       (const_int 1))])])
 
 (define_insn "call_value_insn"
   [(set (match_operand 0 "register_operand" "=r,r,r")
   return AS1(call,%c1);
 }"
   [(set_attr "cc" "clobber,clobber,clobber")
-   (set (attr "length")
-       (cond [(eq (symbol_ref "which_alternative") (const_int 0))
-              (const_int 1)
-              (eq (symbol_ref "(which_alternative == 1 && AVR_ENHANCED)")
-                   (const_int 1))
-              (const_int 2)
-              (eq (symbol_ref "(which_alternative == 1 && !AVR_ENHANCED)")
-                   (const_int 1))
-              (const_int 3)
-              (eq (symbol_ref "!AVR_MEGA")
-                  (const_int 0))
-              (const_int 2)]
-             (const_int 1)))])
+   (set_attr_alternative "length"
+                        [(const_int 1)
+                         (if_then_else (eq_attr "mcu_enhanced" "yes")
+                                       (const_int 2)
+                                       (const_int 3))
+                         (if_then_else (eq_attr "mcu_mega" "yes")
+                                       (const_int 2)
+                                       (const_int 1))])])
 
 (define_insn "nop"
   [(const_int 0)]
           : AS1 (rjmp,__tablejump__));
   }"
   [(set_attr "cc" "clobber")
-   (set (attr "length")
-       (if_then_else (eq (symbol_ref "AVR_MEGA")
-                         (const_int 0))
-                     (const_int 3)
-                     (const_int 4)))])
+   (set (attr "length") (if_then_else (eq_attr "mcu_mega" "no")
+                                     (const_int 3)
+                                     (const_int 4)))])
 
 
 (define_insn "*tablejump_enh"