rs6000: New insns setnbc and setnbcr
authorSegher Boessenkool <segher@kernel.crashing.org>
Thu, 7 May 2020 23:31:27 +0000 (18:31 -0500)
committerBill Schmidt <wschmidt@linux.ibm.com>
Thu, 7 May 2020 23:31:27 +0000 (18:31 -0500)
setnbc[r] is like setbc[r], but it writes -1 instead of 1 to the GPR.

2020-05-07  Segher Boessenkool  <segher@kernel.crashing.org>

* config/rs6000/rs6000.md (*setnbc_<un>signed_<GPR:mode>): New
define_insn.
(*setnbcr_<un>signed_<GPR:mode>): New define_insn.
(*neg_eq_<mode>): Avoid for TARGET_FUTURE; add missing && 1.
(*neg_ne_<mode>): Likewise.

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

index a161162591f54c3652cebadb179da66f06b0de91..36226e00fc0318163d22348348b068d7efaaed93 100644 (file)
@@ -1,3 +1,11 @@
+2020-05-07  Segher Boessenkool  <segher@kernel.crashing.org>
+
+       * config/rs6000/rs6000.md (*setnbc_<un>signed_<GPR:mode>): New
+       define_insn.
+       (*setnbcr_<un>signed_<GPR:mode>): New define_insn.
+       (*neg_eq_<mode>): Avoid for TARGET_FUTURE; add missing && 1.
+       (*neg_ne_<mode>): Likewise.
+
 2020-05-07  Segher Boessenkool  <segher@kernel.crashing.org>
 
        * config/rs6000/rs6000.md (setbc_<un>signed_<GPR:mode>): New
index e8dc576779af19417e092dca9a7838f4b08290dd..c02c2e1de72bac4ece493502f0750100726344bb 100644 (file)
   "setbcr %0,%j1"
   [(set_attr "type" "isel")])
 
+; Set Negative Boolean Condition (Reverse)
+(define_insn "*setnbc_<un>signed_<GPR:mode>"
+  [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
+       (neg:GPR (match_operator:GPR 1 "scc_comparison_operator"
+                       [(match_operand:CCEITHER 2 "cc_reg_operand" "y")
+                        (const_int 0)])))]
+  "TARGET_FUTURE"
+  "setnbc %0,%j1"
+  [(set_attr "type" "isel")])
+
+(define_insn "*setnbcr_<un>signed_<GPR:mode>"
+  [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
+       (neg:GPR (match_operator:GPR 1 "scc_rev_comparison_operator"
+                       [(match_operand:CCEITHER 2 "cc_reg_operand" "y")
+                        (const_int 0)])))]
+  "TARGET_FUTURE"
+  "setnbcr %0,%j1"
+  [(set_attr "type" "isel")])
+
 ;; Floating point conditional move
 (define_expand "mov<mode>cc"
    [(set (match_operand:SFDF 0 "gpc_reg_operand")
    (clobber (match_scratch:P 3 "=r"))
    (clobber (match_scratch:P 4 "=r"))
    (clobber (reg:P CA_REGNO))]
-  ""
+  "!TARGET_FUTURE"
   "#"
-  ""
+  "&& 1"
   [(parallel [(set (match_dup 4)
                   (plus:P (match_dup 3)
                           (const_int -1)))
    (clobber (match_scratch:P 3 "=r"))
    (clobber (match_scratch:P 4 "=r"))
    (clobber (reg:P CA_REGNO))]
-  ""
+  "!TARGET_FUTURE"
   "#"
-  ""
+  "&& 1"
   [(parallel [(set (match_dup 4)
                   (neg:P (match_dup 3)))
              (set (reg:P CA_REGNO)