rs6000: Delete "delayed_cr" insn type
authorSegher Boessenkool <segher@kernel.crashing.org>
Mon, 15 Jan 2018 23:02:03 +0000 (00:02 +0100)
committerSegher Boessenkool <segher@gcc.gnu.org>
Mon, 15 Jan 2018 23:02:03 +0000 (00:02 +0100)
"delayed_cr" is just "cr_logical" with the second source operand not
equal to the destination operand.  This patch changes it to be
expressed as type "cr_logical", with a new boolean attribute
"cr_logical_3op" added.  This simplifies code.

* config/rs6000/rs6000.md (define_attr "type"): Remove delayed_cr.
(define_attr "cr_logical_3op"): New.
(cceq_ior_compare): Adjust.
(cceq_ior_compare_complement): Adjust.
(*cceq_rev_compare): Adjust.
* config/rs6000/rs6000.c (rs6000_adjust_cost): Adjust.
(is_cracked_insn): Adjust.
(insn_must_be_first_in_group): Adjust.
* config/rs6000/40x.md: Adjust.
* config/rs6000/440.md: Adjust.
* config/rs6000/476.md: Adjust.
* config/rs6000/601.md: Adjust.
* config/rs6000/603.md: Adjust.
* config/rs6000/6xx.md: Adjust.
* config/rs6000/7450.md: Adjust.
* config/rs6000/7xx.md: Adjust.
* config/rs6000/8540.md: Adjust.
* config/rs6000/cell.md: Adjust.
* config/rs6000/e300c2c3.md: Adjust.
* config/rs6000/e500mc.md: Adjust.
* config/rs6000/e500mc64.md: Adjust.
* config/rs6000/e5500.md: Adjust.
* config/rs6000/e6500.md: Adjust.
* config/rs6000/mpc.md: Adjust.
* config/rs6000/power4.md: Adjust.
* config/rs6000/power5.md: Adjust.
* config/rs6000/power6.md: Adjust.
* config/rs6000/power7.md: Adjust.
* config/rs6000/power8.md: Adjust.
* config/rs6000/power9.md: Adjust.
* config/rs6000/rs64.md: Adjust.
* config/rs6000/titan.md: Adjust.

From-SVN: r256716

27 files changed:
gcc/ChangeLog
gcc/config/rs6000/40x.md
gcc/config/rs6000/440.md
gcc/config/rs6000/476.md
gcc/config/rs6000/601.md
gcc/config/rs6000/603.md
gcc/config/rs6000/6xx.md
gcc/config/rs6000/7450.md
gcc/config/rs6000/7xx.md
gcc/config/rs6000/8540.md
gcc/config/rs6000/cell.md
gcc/config/rs6000/e300c2c3.md
gcc/config/rs6000/e500mc.md
gcc/config/rs6000/e500mc64.md
gcc/config/rs6000/e5500.md
gcc/config/rs6000/e6500.md
gcc/config/rs6000/mpc.md
gcc/config/rs6000/power4.md
gcc/config/rs6000/power5.md
gcc/config/rs6000/power6.md
gcc/config/rs6000/power7.md
gcc/config/rs6000/power8.md
gcc/config/rs6000/power9.md
gcc/config/rs6000/rs6000.c
gcc/config/rs6000/rs6000.md
gcc/config/rs6000/rs64.md
gcc/config/rs6000/titan.md

index 3e92ee9aaa50cc79924980dd5902c9610b9364e0..b2acae1c1e15150badfbdfc04cf2111b4701a685 100644 (file)
@@ -1,3 +1,38 @@
+2018-01-15  Segher Boessenkool  <segher@kernel.crashing.org>
+
+       * config/rs6000/rs6000.md (define_attr "type"): Remove delayed_cr.
+       (define_attr "cr_logical_3op"): New.
+       (cceq_ior_compare): Adjust.
+       (cceq_ior_compare_complement): Adjust.
+       (*cceq_rev_compare): Adjust.
+       * config/rs6000/rs6000.c (rs6000_adjust_cost): Adjust.
+       (is_cracked_insn): Adjust.
+       (insn_must_be_first_in_group): Adjust.
+       * config/rs6000/40x.md: Adjust.
+       * config/rs6000/440.md: Adjust.
+       * config/rs6000/476.md: Adjust.
+       * config/rs6000/601.md: Adjust.
+       * config/rs6000/603.md: Adjust.
+       * config/rs6000/6xx.md: Adjust.
+       * config/rs6000/7450.md: Adjust.
+       * config/rs6000/7xx.md: Adjust.
+       * config/rs6000/8540.md: Adjust.
+       * config/rs6000/cell.md: Adjust.
+       * config/rs6000/e300c2c3.md: Adjust.
+       * config/rs6000/e500mc.md: Adjust.
+       * config/rs6000/e500mc64.md: Adjust.
+       * config/rs6000/e5500.md: Adjust.
+       * config/rs6000/e6500.md: Adjust.
+       * config/rs6000/mpc.md: Adjust.
+       * config/rs6000/power4.md: Adjust.
+       * config/rs6000/power5.md: Adjust.
+       * config/rs6000/power6.md: Adjust.
+       * config/rs6000/power7.md: Adjust.
+       * config/rs6000/power8.md: Adjust.
+       * config/rs6000/power9.md: Adjust.
+       * config/rs6000/rs64.md: Adjust.
+       * config/rs6000/titan.md: Adjust.
+
 2018-01-15  H.J. Lu  <hongjiu.lu@intel.com>
 
        * config/i386/predicates.md (indirect_branch_operand): Rewrite
index 67df59d53cbbd7e40d82ae9a326d768547b64ab8..5a36bd244f1ed438e8c23a2889815c59919ce31f 100644 (file)
   "bpu_40x")
 
 (define_insn_reservation "ppc403-cr" 2
-  (and (eq_attr "type" "cr_logical,delayed_cr")
+  (and (eq_attr "type" "cr_logical")
        (eq_attr "cpu" "ppc403,ppc405"))
   "bpu_40x")
 
index d78ee8d9dfc99470965755d9eff84c7759dd4fa0..fb5c3725f2633f5e026f7dc45966790fe5042135 100644 (file)
@@ -95,7 +95,7 @@
   "ppc440_issue,ppc440_i_pipe")
 
 (define_insn_reservation "ppc440-compare" 2
-  (and (ior (eq_attr "type" "cmp,cr_logical,delayed_cr,mfcr")
+  (and (ior (eq_attr "type" "cmp,cr_logical,mfcr")
            (and (eq_attr "type" "add,logical,shift,exts")
                 (eq_attr "dot" "yes")))
        (eq_attr "cpu" "ppc440"))
index 9727a91b321e38c124032531e6908765a9d40fae..3ee92b83388ce80da0928e596c79ab935f52f87d 100644 (file)
@@ -71,7 +71,7 @@
    ppc476_i_pipe|ppc476_lj_pipe")
 
 (define_insn_reservation "ppc476-complex-integer" 1
-  (and (eq_attr "type" "cmp,cr_logical,delayed_cr,cntlz,isel,isync,sync,trap,popcnt")
+  (and (eq_attr "type" "cmp,cr_logical,cntlz,isel,isync,sync,trap,popcnt")
        (eq_attr "cpu" "ppc476"))
   "ppc476_issue,\
    ppc476_i_pipe")
index d92a518a1e63d55022b35e4f9cc75131f3bb7c62..0e386e3c5574638bb6751d5e16368ac7e04510b0 100644 (file)
   "iu_ppc601,bpu_ppc601")
 
 (define_insn_reservation "ppc601-crlogical" 4
-  (and (eq_attr "type" "cr_logical,delayed_cr")
+  (and (eq_attr "type" "cr_logical")
        (eq_attr "cpu" "ppc601"))
   "bpu_ppc601")
 
index 21676426933acec94ed3084de8fb1bc26afd98db..b27c31c9b63bff98915bf3b43c047188dc27ed52 100644 (file)
   "fpu_603*33")
 
 (define_insn_reservation "ppc603-crlogical" 2
-  (and (eq_attr "type" "cr_logical,delayed_cr,mfcr,mtcr")
+  (and (eq_attr "type" "cr_logical,mfcr,mtcr")
        (eq_attr "cpu" "ppc603"))
   "sru_603")
 
index dd81c4306d318c7976f76e8965a438bd8160424f..527356b5425f75344033db9937b81879ae546d39 100644 (file)
   "iu1_6xx|iu2_6xx")
 
 (define_insn_reservation "ppc604-crlogical" 2
-  (and (eq_attr "type" "cr_logical,delayed_cr")
+  (and (eq_attr "type" "cr_logical")
        (eq_attr "cpu" "ppc604"))
   "bpu_6xx")
 
 (define_insn_reservation "ppc604e-crlogical" 2
-  (and (eq_attr "type" "cr_logical,delayed_cr")
+  (and (eq_attr "type" "cr_logical")
        (eq_attr "cpu" "ppc604e,ppc620,ppc630"))
   "cru_6xx")
 
index 9c27c519f5a16d798d143ac84fb4598277b738a6..f4177b483694ada4ba5b20b5fa54c13aafdfe2a9 100644 (file)
   "ppc7450_du,mciu_7450")
 
 (define_insn_reservation "ppc7450-crlogical" 1
-  (and (eq_attr "type" "cr_logical,delayed_cr")
+  (and (eq_attr "type" "cr_logical")
        (eq_attr "cpu" "ppc7450"))
   "ppc7450_du,mciu_7450")
 
index ae314c0aa60ca2210dee956208ac55c629692903..10032490d3409c1ecbad6c69d753978c18726859 100644 (file)
   "ppc750_du,iu1_7xx")
 
 (define_insn_reservation "ppc750-crlogical" 3
-  (and (eq_attr "type" "cr_logical,delayed_cr")
+  (and (eq_attr "type" "cr_logical")
        (eq_attr "cpu" "ppc750,ppc7400"))
   "nothing,sru_7xx*2")
 
index 5221e28923fe45d91201341a4f95900ef6efcdf1..e26553009a950a21b52331955f9ef50dd88f5986 100644 (file)
 
 ;; CR logical
 (define_insn_reservation "ppc8540_cr_logical" 1
-  (and (eq_attr "type" "cr_logical,delayed_cr")
+  (and (eq_attr "type" "cr_logical")
        (eq_attr "cpu" "ppc8540,ppc8548"))
   "ppc8540_decode,ppc8540_bu,ppc8540_retire")
 
index 00f203c3f03055fa4792d9f7ed1c7025bc03eed1..9ea1f5c7f2ee86ce969eecde0f6ab5585916563e 100644 (file)
 ;; page 90, special cases for CR hazard, only one instr can access cr per cycle
 ;; if insn reads CR following a stwcx, pipeline stall till stwcx finish
 (define_insn_reservation "cell-crlogical" 1
-  (and (eq_attr "type" "cr_logical,delayed_cr")
+  (and (eq_attr "type" "cr_logical")
        (eq_attr "cpu" "cell"))
   "bru_cell+slot01")
 
index 1f3f33af107c752356944705ed5696aa86058bf8..cef19c6db756f48a30db45b5270375ae257f1e17 100644 (file)
 
 ;; CR logical
 (define_insn_reservation "ppce300c3_cr_logical" 1
-  (and (eq_attr "type" "cr_logical,delayed_cr")
+  (and (eq_attr "type" "cr_logical")
        (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3")))
   "ppce300c3_decode,ppce300c3_issue+ppce300c3_sru_stage0+ppce300c3_retire")
 
index 75f757e6da15b703b95821f4c36343820cf0f5b8..fde6ed7885aef76151cd3baf445b630b90b7c767 100644 (file)
 
 ;; CR logical.
 (define_insn_reservation "e500mc_cr_logical" 1
-  (and (eq_attr "type" "cr_logical,delayed_cr")
+  (and (eq_attr "type" "cr_logical")
        (eq_attr "cpu" "ppce500mc"))
   "e500mc_decode,e500mc_bu,e500mc_retire")
 
index 166f662457c6dda1be187de9d2b2aadf55d00fd0..be0033e00f4304bd2959271eb398670f94f259ab 100644 (file)
 
 ;; CR logical.
 (define_insn_reservation "e500mc64_cr_logical" 1
-  (and (eq_attr "type" "cr_logical,delayed_cr")
+  (and (eq_attr "type" "cr_logical")
        (eq_attr "cpu" "ppce500mc64"))
   "e500mc64_decode,e500mc64_bu,e500mc64_retire")
 
index 2833b8fe77c1df600e7c9ce80098406b77ff2701..fe9b5540088be46d3a640a4bcdda82002d4b0839 100644 (file)
 
 ;; BU - CR logical.
 (define_insn_reservation "e5500_cr_logical" 1
-  (and (eq_attr "type" "cr_logical,delayed_cr")
+  (and (eq_attr "type" "cr_logical")
        (eq_attr "cpu" "ppce5500"))
   "e5500_decode,e5500_bu")
index dfd3c7c88abb47f8e736722340f17d778f6a7a9d..a11663e62d5f38bb2a35399cb07a930b0f810b19 100644 (file)
 
 ;; BU - CR logical.
 (define_insn_reservation "e6500_cr_logical" 1
-  (and (eq_attr "type" "cr_logical,delayed_cr")
+  (and (eq_attr "type" "cr_logical")
        (eq_attr "cpu" "ppce6500"))
   "e6500_decode,e6500_bu")
 
index 58e40fa9ea4f3ed96b8f6350bf17087cead0efde..93247908fc297eadf0c65035e3e7219923b7b9fd 100644 (file)
   "bpu_mpc")
 
 (define_insn_reservation "mpccore-jmpreg" 1
-  (and (eq_attr "type" "jmpreg,branch,cr_logical,delayed_cr,mfcr,mtcr,isync")
+  (and (eq_attr "type" "jmpreg,branch,cr_logical,mfcr,mtcr,isync")
        (eq_attr "cpu" "mpccore"))
   "bpu_mpc")
 
index df362215b8a73d706843ec29624c86634410bba5..4070fd11eda0c0602307a42460d63ccf5db070a6 100644 (file)
 ; Condition Register logical ops are split if non-destructive (RT != RB)
 (define_insn_reservation "power4-crlogical" 2
   (and (eq_attr "type" "cr_logical")
+       (eq_attr "cr_logical_3op" "no")
        (eq_attr "cpu" "power4"))
   "du1_power4,cru_power4")
 
 (define_insn_reservation "power4-delayedcr" 4
-  (and (eq_attr "type" "delayed_cr")
+  (and (eq_attr "type" "cr_logical")
+       (eq_attr "cr_logical_3op" "yes")
        (eq_attr "cpu" "power4"))
   "du1_power4+du2_power4,cru_power4,cru_power4")
 
index 7e4d194b1701a9decb492eb16fb0fc290ae3824f..af1e5ce313195fe4cb2d5232a4d6112ebe641f64 100644 (file)
 ; Condition Register logical ops are split if non-destructive (RT != RB)
 (define_insn_reservation "power5-crlogical" 2
   (and (eq_attr "type" "cr_logical")
+       (eq_attr "cr_logical_3op" "no")
        (eq_attr "cpu" "power5"))
   "du1_power5,cru_power5")
 
 (define_insn_reservation "power5-delayedcr" 4
-  (and (eq_attr "type" "delayed_cr")
+  (and (eq_attr "type" "cr_logical")
+       (eq_attr "cr_logical_3op" "yes")
        (eq_attr "cpu" "power5"))
   "du1_power5+du2_power5,cru_power5,cru_power5")
 
index e0f61be3e07c6d53be65cfbd147393c5c4748310..4b19c04e507ecbf70b196dde136c33d1dde509a7 100644 (file)
 
 (define_bypass 3 "power6-crlogical" "power6-branch")
 
-(define_insn_reservation "power6-delayedcr" 3
-  (and (eq_attr "type" "delayed_cr")
-       (eq_attr "cpu" "power6"))
-  "BRU_power6")
-
 (define_insn_reservation "power6-mfcr" 6 ; N/A
   (and (eq_attr "type" "mfcr")
        (eq_attr "cpu" "power6"))
index 3cd6b71102188aa4d0241ddc0c3aec60b62250be..a9381c6c99ec4606423149878d0320bda6af9df5 100644 (file)
        (eq_attr "cpu" "power7"))
   "DU2F_power7,FXU_power7,FXU_power7")
 
-(define_bypass 3 "power7-cmp,power7-compare" "power7-crlogical,power7-delayedcr")
+(define_bypass 3 "power7-cmp,power7-compare" "power7-crlogical")
 
 (define_insn_reservation "power7-mul" 4
   (and (eq_attr "type" "mul")
        (eq_attr "cpu" "power7"))
   "du1_power7,cru_power7")
 
-(define_insn_reservation "power7-delayedcr" 3
-  (and (eq_attr "type" "delayed_cr")
-       (eq_attr "cpu" "power7"))
-  "du1_power7,cru_power7")
-
 (define_insn_reservation "power7-mfcr" 6
   (and (eq_attr "type" "mfcr")
        (eq_attr "cpu" "power7"))
index 6402fe56e9935a6ada0a0f654ade52ff75c7f31a..71b7ae4f3ed0fff4733d7ece6b803db6ae04b115 100644 (file)
   "DU_first_power8,cru_power8+FXU_power8")
 
 (define_insn_reservation "power8-crlogical" 3
-  (and (eq_attr "type" "cr_logical,delayed_cr")
+  (and (eq_attr "type" "cr_logical")
        (eq_attr "cpu" "power8"))
   "DU_first_power8,cru_power8")
 
index bf872c4878d46d5534c71087d8025e40e54b54d8..79ebbe47e08dc4e8d8fff6a67beaad2d571cab16 100644 (file)
   "DU_even_power9,fx_div0_power9*8|fx_div1_power9*8")
 
 (define_insn_reservation "power9-crlogical" 2
-  (and (eq_attr "type" "cr_logical,delayed_cr")
+  (and (eq_attr "type" "cr_logical")
        (eq_attr "cpu" "power9"))
   "DU_any_power9,VSU_power9")
 
index 09bb2d0c7bb52d4d22621ffaac6637e0ff3b0fed..8cda17febc9f821d7d2d6f3c191565b4d4717ec6 100644 (file)
@@ -30654,7 +30654,6 @@ rs6000_adjust_cost (rtx_insn *insn, int dep_type, rtx_insn *dep_insn, int cost,
                 case TYPE_CMP:
                 case TYPE_FPCOMPARE:
                 case TYPE_CR_LOGICAL:
-                case TYPE_DELAYED_CR:
                  return cost + 2;
                 case TYPE_EXTS:
                 case TYPE_MUL:
@@ -30950,7 +30949,8 @@ is_cracked_insn (rtx_insn *insn)
              && get_attr_indexed (insn) == INDEXED_NO)
          || ((type == TYPE_FPLOAD || type == TYPE_FPSTORE)
              && get_attr_update (insn) == UPDATE_YES)
-         || type == TYPE_DELAYED_CR
+         || (type == TYPE_CR_LOGICAL
+             && get_attr_cr_logical_3op (insn) == CR_LOGICAL_3OP_YES)
          || (type == TYPE_EXTS
              && get_attr_dot (insn) == DOT_YES)
          || (type == TYPE_SHIFT
@@ -31941,7 +31941,6 @@ insn_must_be_first_in_group (rtx_insn *insn)
         case TYPE_MFCR:
         case TYPE_MFCRF:
         case TYPE_MTCR:
-        case TYPE_DELAYED_CR:
         case TYPE_CR_LOGICAL:
         case TYPE_MTJMPR:
         case TYPE_MFJMPR:
@@ -32044,7 +32043,6 @@ insn_must_be_first_in_group (rtx_insn *insn)
       switch (type)
         {
         case TYPE_CR_LOGICAL:
-        case TYPE_DELAYED_CR:
         case TYPE_MFCR:
         case TYPE_MFCRF:
         case TYPE_MTCR:
index b2e4bad6c358cbcfd0ad99360eaef88b52411d2e..dc8745ca038eaabb05d2190136e8bf5a57f45319 100644 (file)
    load,store,fpload,fpstore,vecload,vecstore,
    cmp,
    branch,jmpreg,mfjmpr,mtjmpr,trap,isync,sync,load_l,store_c,
-   cr_logical,delayed_cr,mfcr,mfcrf,mtcr,
+   cr_logical,mfcr,mfcrf,mtcr,
    fpcompare,fp,fpsimple,dmul,qmul,sdiv,ddiv,ssqrt,dsqrt,
    vecsimple,veccomplex,vecdiv,veccmp,veccmpsimple,vecperm,
    vecfloat,vecfdiv,vecdouble,mffgpr,mftgpr,crypto,
 ;; This is used for load insns.
 (define_attr "sign_extend" "no,yes" (const_string "no"))
 
+;; Does this cr_logical instruction have three operands?  That is, BT != BB.
+(define_attr "cr_logical_3op" "no,yes" (const_string "no"))
+
 ;; Does this instruction use indexed (that is, reg+reg) addressing?
 ;; This is used for load and store insns.  If operand 0 or 1 is a MEM
 ;; it is automatically set based on that.  If a load or store instruction
                      (const_int 1)))]
   ""
   "cr%q1 %E0,%j2,%j4"
-  [(set_attr "type" "cr_logical,delayed_cr")])
+  [(set_attr "type" "cr_logical")
+   (set_attr "cr_logical_3op" "no,yes")])
 
 ; Why is the constant -1 here, but 1 in the previous pattern?
 ; Because ~1 has all but the low bit set.
                      (const_int -1)))]
   ""
   "cr%q1 %E0,%j2,%j4"
-  [(set_attr "type" "cr_logical,delayed_cr")])
+  [(set_attr "type" "cr_logical")
+   (set_attr "cr_logical_3op" "no,yes")])
 
 (define_insn "*cceq_rev_compare"
   [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
                      (const_int 0)))]
   ""
   "crnot %E0,%j1"
-  [(set_attr "type" "cr_logical,delayed_cr")])
+  [(set_attr "type" "cr_logical")
+   (set_attr "cr_logical_3op" "no,yes")])
 
 ;; If we are comparing the result of two comparisons, this can be done
 ;; using creqv or crxor.
index 7ec84ed4d45249d5587063a1f93a035941a9bf9e..62582e3b9fe6ee9029f2ed6c3755f2a12032c282 100644 (file)
   "lsu_rs64")
 
 (define_insn_reservation "rs64a-jmpreg" 1
-  (and (eq_attr "type" "jmpreg,branch,cr_logical,delayed_cr")
+  (and (eq_attr "type" "jmpreg,branch,cr_logical")
        (eq_attr "cpu" "rs64a"))
   "bpu_rs64")
 
index 3c101bc00b099d1dac09aaa24e07607cbdb920a2..4242a3984e1f50f0d00655994bb8c5b78fc01f64 100644 (file)
@@ -85,7 +85,7 @@
 (define_cpu_unit "titan_bpu_sh" "titan_bpu")
 
 (define_insn_reservation "titan_bpu" 2
-  (and (eq_attr "type" "branch,jmpreg,cr_logical,delayed_cr")
+  (and (eq_attr "type" "branch,jmpreg,cr_logical")
        (eq_attr "cpu" "titan"))
   "titan_issue,titan_bpu_sh")