]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
rs6000: Change the length attribute default
authorSegher Boessenkool <segher@kernel.crashing.org>
Thu, 16 Aug 2018 19:40:07 +0000 (21:40 +0200)
committerSegher Boessenkool <segher@gcc.gnu.org>
Thu, 16 Aug 2018 19:40:07 +0000 (21:40 +0200)
This moves what is currently the default of the length attribute to
the only branch instruction patterns where it applies, namely, the
B-form instructions.  It was used for the "jump" instruction as well
before, but that is an I-form instruction and always has length 4.

* config/rs6000/rs6000.md (length): Always define as const_int 4.
(unnamed conditional branch define_insn): Set length to 4 or 8
depending on offset.
(<bd>_<mode>): Similar, for alternative 0.
(<bd>tf_<mode>): Ditto.

From-SVN: r263601

gcc/ChangeLog
gcc/config/rs6000/rs6000.md

index 62969666e092a783d8e5415b2dea911df4658ce5..02a20b5b7c8ae0d162452b4d544b7454bf6ffbd8 100644 (file)
@@ -1,3 +1,11 @@
+2018-08-16  Segher Boessenkool  <segher@kernel.crashing.org>
+
+       * config/rs6000/rs6000.md (length): Always define as const_int 4.
+       (unnamed conditional branch define_insn): Set length to 4 or 8
+       depending on offset.
+       (<bd>_<mode>): Similar, for alternative 0.
+       (<bd>tf_<mode>): Ditto.
+
 2018-08-16  Tamar Christina  <tamar.christina@arm.com>
 
        * expr.c (copy_blkmode_to_reg): Perform larger copies when safe.
index d70b01b8ca78c98e0b334ad1f1b84716246d88db..45e42ffade11204cf2da8aeb490b0cef223149ca 100644 (file)
 ;; Is copying of this instruction disallowed?
 (define_attr "cannot_copy" "no,yes" (const_string "no"))
 
-;; Length (in bytes).
-; '(pc)' in the following doesn't include the instruction itself; it is
-; calculated as if the instruction had zero size.
-(define_attr "length" ""
-  (if_then_else (eq_attr "type" "branch")
-               (if_then_else (and (ge (minus (match_dup 0) (pc))
-                                      (const_int -32768))
-                                  (lt (minus (match_dup 0) (pc))
-                                      (const_int 32764)))
-                             (const_int 4)
-                             (const_int 8))
-               (const_int 4)))
+;; Length of the instruction (in bytes).
+(define_attr "length" "" (const_int 4))
 
 ;; Processor type -- this attribute must exactly match the processor_type
 ;; enumeration in rs6000-opts.h.
 {
   return output_cbranch (operands[1], "%l0", 0, insn);
 }
-  [(set_attr "type" "branch")])
+  [(set_attr "type" "branch")
+   (set (attr "length")
+       (if_then_else (and (ge (minus (match_dup 0) (pc))
+                              (const_int -32768))
+                          (lt (minus (match_dup 0) (pc))
+                              (const_int 32764)))
+                     (const_int 4)
+                     (const_int 8)))])
 
 (define_insn ""
   [(set (pc)
     return "<bd_neg> $+8\;b %l0";
 }
   [(set_attr "type" "branch")
-   (set_attr "length" "*,16,20,20")])
+   (set (attr "length")
+       (cond [(eq (symbol_ref "which_alternative") (const_int 0))
+                 (if_then_else (and (ge (minus (match_dup 0) (pc))
+                                        (const_int -32768))
+                                    (lt (minus (match_dup 0) (pc))
+                                        (const_int 32764)))
+                               (const_int 4)
+                               (const_int 8))
+              (eq (symbol_ref "which_alternative") (const_int 1))
+                 (const_int 16)]
+          (const_int 20)))])
 
 ;; Now the splitter if we could not allocate the CTR register
 (define_split
     }
 }
   [(set_attr "type" "branch")
-   (set_attr "length" "*,16,20,20")])
+   (set (attr "length")
+       (cond [(eq (symbol_ref "which_alternative") (const_int 0))
+                 (if_then_else (and (ge (minus (match_dup 0) (pc))
+                                        (const_int -32768))
+                                    (lt (minus (match_dup 0) (pc))
+                                        (const_int 32764)))
+                               (const_int 4)
+                               (const_int 8))
+              (eq (symbol_ref "which_alternative") (const_int 1))
+                 (const_int 16)]
+            (const_int 20)))])
 
 ;; Now the splitter if we could not allocate the CTR register
 (define_split