]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
rs6000: New type attribute value "halfmul"
authorSegher Boessenkool <segher@kernel.crashing.org>
Fri, 23 May 2014 16:34:01 +0000 (18:34 +0200)
committerSegher Boessenkool <segher@gcc.gnu.org>
Fri, 23 May 2014 16:34:01 +0000 (18:34 +0200)
This is for the legacy integer multiply-accumulate instructions.
Quite a mouthful, and "mulhw" is also a terrible name since we already
have a machine instruction called exactly that.  Hence "halfmul".

Also fixes the titan automaton description for this.

From-SVN: r210866

gcc/ChangeLog
gcc/config/rs6000/40x.md
gcc/config/rs6000/440.md
gcc/config/rs6000/476.md
gcc/config/rs6000/rs6000.md
gcc/config/rs6000/titan.md

index 68712dad363613cca82185e9bc6e1e95f153887b..ab244b00b3a05753a49f268da256d1be3eb82eb0 100644 (file)
@@ -1,3 +1,19 @@
+2014-05-23  Segher Boessenkool  <segher@kernel.crashing.org>
+
+       * config/rs6000/rs6000.md (type): Add new value "halfmul".
+       (*macchwc, *macchw, *macchwuc, *macchwu, *machhwc, *machhw,
+       *machhwuc, *machhwu, *maclhwc, *maclhw, *maclhwuc, *maclhwu,
+       *nmacchwc, *nmacchw, *nmachhwc, *nmachhw, *nmaclhwc, *nmaclhw,
+       *mulchwc, *mulchw, *mulchwuc, *mulchwu, *mulhhwc, *mulhhw,
+       *mulhhwuc, *mulhhwu, *mullhwc, *mullhw, *mullhwuc, *mullhwu):
+       Use it.
+       * config/rs6000/40x.md (ppc405-imul3): Add type halfmul.
+       * config/rs6000/440.md (ppc440-imul2): Add type halfmul.
+       * config/rs6000/476.md (ppc476-imul): Add type halfmul.
+       * config/rs6000/titan.md: Delete nonsensical comment.
+       (titan_imul): Add type imul3.
+       (titan_mulhw): Remove type imul3; add type halfmul.
+
 2014-05-23  Segher Boessenkool  <segher@kernel.crashing.org>
 
        * config/rs6000/rs6000.md (type): Reorder, reformat.
index ed236a418f4e3ab5d5bacc9ec90b1a7dd6d5665b..5510767ab073f2b2489296842703f3bfd311098e 100644 (file)
@@ -73,7 +73,7 @@
   "iu_40x*2")
 
 (define_insn_reservation "ppc405-imul3" 2
-  (and (eq_attr "type" "imul3")
+  (and (eq_attr "type" "imul3,halfmul")
        (eq_attr "cpu" "ppc405"))
   "iu_40x")
 
index 2dcc58d696975bc062d34a6d0eac17e39d36739f..df3a3b5ecf11efeb9c57b036826a271457582029 100644 (file)
@@ -76,7 +76,7 @@
   "ppc440_issue,ppc440_i_pipe")
 
 (define_insn_reservation "ppc440-imul2" 2
-  (and (eq_attr "type" "imul2,imul3")
+  (and (eq_attr "type" "imul2,imul3,halfmul")
        (eq_attr "cpu" "ppc440"))
   "ppc440_issue,ppc440_i_pipe")
 
index 8b4e65f04259ebf109260e67846d95269566f9c1..acfe063f1ebe651a47c273355852227e5e793529 100644 (file)
@@ -82,7 +82,7 @@
    ppc476_i_pipe")
 
 (define_insn_reservation "ppc476-imul" 4
-  (and (eq_attr "type" "imul,imul_compare,imul2,imul3")
+  (and (eq_attr "type" "imul,imul_compare,imul2,imul3,halfmul")
        (eq_attr "cpu" "ppc476"))
   "ppc476_issue,\
    ppc476_i_pipe")
index c5984e738533ff1bd09065a4e03e94b710acb1bd..408d20ad3158fdf8db159e67adacb907f64255ae 100644 (file)
 (define_attr "type"
   "integer,two,three,
    shift,var_shift_rotate,insert_word,insert_dword,
-   imul,imul2,imul3,lmul,idiv,ldiv,
+   imul,imul2,imul3,lmul,halfmul,idiv,ldiv,
    exts,cntlz,popcnt,isel,
    load,store,fpload,fpstore,vecload,vecstore,
    cmp,
                  (match_dup 4)))]
   "TARGET_MULHW"
   "macchw. %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 
 (define_insn "*macchw"
   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
                  (match_operand:SI 3 "gpc_reg_operand" "0")))]
   "TARGET_MULHW"
   "macchw %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 
 (define_insn "*macchwuc"
   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
                  (match_dup 4)))]
   "TARGET_MULHW"
   "macchwu. %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 
 (define_insn "*macchwu"
   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
                  (match_operand:SI 3 "gpc_reg_operand" "0")))]
   "TARGET_MULHW"
   "macchwu %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 
 (define_insn "*machhwc"
   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
                  (match_dup 4)))]
   "TARGET_MULHW"
   "machhw. %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 
 (define_insn "*machhw"
   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
                  (match_operand:SI 3 "gpc_reg_operand" "0")))]
   "TARGET_MULHW"
   "machhw %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 
 (define_insn "*machhwuc"
   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
                  (match_dup 4)))]
   "TARGET_MULHW"
   "machhwu. %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 
 (define_insn "*machhwu"
   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
                  (match_operand:SI 3 "gpc_reg_operand" "0")))]
   "TARGET_MULHW"
   "machhwu %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 
 (define_insn "*maclhwc"
   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
                  (match_dup 4)))]
   "TARGET_MULHW"
   "maclhw. %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 
 (define_insn "*maclhw"
   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
                  (match_operand:SI 3 "gpc_reg_operand" "0")))]
   "TARGET_MULHW"
   "maclhw %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 
 (define_insn "*maclhwuc"
   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
                  (match_dup 4)))]
   "TARGET_MULHW"
   "maclhwu. %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 
 (define_insn "*maclhwu"
   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
                  (match_operand:SI 3 "gpc_reg_operand" "0")))]
   "TARGET_MULHW"
   "maclhwu %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 
 (define_insn "*nmacchwc"
   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
                             (match_dup 1)))))]
   "TARGET_MULHW"
   "nmacchw. %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 
 (define_insn "*nmacchw"
   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
                             (match_operand:HI 1 "gpc_reg_operand" "r")))))]
   "TARGET_MULHW"
   "nmacchw %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 
 (define_insn "*nmachhwc"
   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
                             (const_int 16)))))]
   "TARGET_MULHW"
   "nmachhw. %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 
 (define_insn "*nmachhw"
   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
                             (const_int 16)))))]
   "TARGET_MULHW"
   "nmachhw %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 
 (define_insn "*nmaclhwc"
   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
                             (match_dup 2)))))]
   "TARGET_MULHW"
   "nmaclhw. %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 
 (define_insn "*nmaclhw"
   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
                             (match_operand:HI 2 "gpc_reg_operand" "r")))))]
   "TARGET_MULHW"
   "nmaclhw %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 
 (define_insn "*mulchwc"
   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
                   (match_dup 1))))]
   "TARGET_MULHW"
   "mulchw. %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 
 (define_insn "*mulchw"
   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
                   (match_operand:HI 1 "gpc_reg_operand" "r"))))]
   "TARGET_MULHW"
   "mulchw %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 
 (define_insn "*mulchwuc"
   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
                   (match_dup 1))))]
   "TARGET_MULHW"
   "mulchwu. %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 
 (define_insn "*mulchwu"
   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
                   (match_operand:HI 1 "gpc_reg_operand" "r"))))]
   "TARGET_MULHW"
   "mulchwu %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 
 (define_insn "*mulhhwc"
   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
                   (const_int 16))))]
   "TARGET_MULHW"
   "mulhhw. %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 
 (define_insn "*mulhhw"
   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
                   (const_int 16))))]
   "TARGET_MULHW"
   "mulhhw %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 
 (define_insn "*mulhhwuc"
   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
                   (const_int 16))))]
   "TARGET_MULHW"
   "mulhhwu. %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 
 (define_insn "*mulhhwu"
   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
                   (const_int 16))))]
   "TARGET_MULHW"
   "mulhhwu %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 
 (define_insn "*mullhwc"
   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
                   (match_dup 2))))]
   "TARGET_MULHW"
   "mullhw. %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 
 (define_insn "*mullhw"
   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
                   (match_operand:HI 2 "gpc_reg_operand" "r"))))]
   "TARGET_MULHW"
   "mullhw %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 
 (define_insn "*mullhwuc"
   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
                   (match_dup 2))))]
   "TARGET_MULHW"
   "mullhwu. %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 
 (define_insn "*mullhwu"
   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
                   (match_operand:HI 2 "gpc_reg_operand" "r"))))]
   "TARGET_MULHW"
   "mullhwu %0,%1,%2"
-  [(set_attr "type" "imul3")])
+  [(set_attr "type" "halfmul")])
 \f
 ;; IBM 405, 440, 464 and 476 string-search dlmzb instruction support.
 (define_insn "dlmzb"
index 1adbee58fff6ffbaf582bc05b1003c7bc187bab8..6bb4792ab404121231f325e6a31d1d39e1efc1ae 100644 (file)
        (eq_attr "cpu" "titan"))
   "titan_issue,titan_fxu_sh")
 
-;; Keep the titan_imul and titan_mulhw (half-word) rules in order, to
-;; ensure the proper match: the half-word instructions are tagged as
-;; imul3 only, whereas regular multiplys will always carry a imul tag.
-
 (define_insn_reservation "titan_imul" 5
-  (and (eq_attr "type" "imul,imul2,imul_compare")
+  (and (eq_attr "type" "imul,imul2,imul3,imul_compare")
        (eq_attr "cpu" "titan"))       
   "titan_issue,titan_fxu_sh,nothing*5,titan_fxu_wb")  
 
 (define_insn_reservation "titan_mulhw" 4
-  (and (eq_attr "type" "imul3")
+  (and (eq_attr "type" "halfmul")
        (eq_attr "cpu" "titan"))
   "titan_issue,titan_fxu_sh,nothing*4,titan_fxu_wb")