]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[RISCV] Fix PR 106632 and PR 106588 a few constraints in bitmanip.md
authorAndrew Pinski <apinski@marvell.com>
Mon, 15 Aug 2022 22:58:09 +0000 (22:58 +0000)
committerAndrew Pinski <apinski@marvell.com>
Wed, 24 Aug 2022 19:15:33 +0000 (12:15 -0700)
The constraints should be n instead of i. Also there
needs to a check for out of bounds zero_extract for
*bexti.

gcc/ChangeLog:

PR target/106632
PR target/106588
* config/riscv/bitmanip.md (*shNadduw): Use n constraint
instead of i.
(*slliuw): Likewise.
(*bexti): Likewise. Also add a check for operands[2] to be less
than the mode bitsize.

gcc/config/riscv/bitmanip.md

index 2c0c8bb7f30c952595fbe389e1cb038adf851c9d..b44fb9517e7a60913b639d71560cd0f69fd2f329 100644 (file)
@@ -44,7 +44,7 @@
        (plus:DI
          (and:DI (ashift:DI (match_operand:DI 1 "register_operand" "r")
                             (match_operand:QI 2 "imm123_operand" "Ds3"))
-                (match_operand 3 "immediate_operand" ""))
+                (match_operand 3 "immediate_operand" "n"))
          (match_operand:DI 4 "register_operand" "r")))]
   "TARGET_64BIT && TARGET_ZBA
    && (INTVAL (operands[3]) >> INTVAL (operands[2])) == 0xffffffff"
   [(set (match_operand:DI 0 "register_operand" "=r")
        (and:DI (ashift:DI (match_operand:DI 1 "register_operand" "r")
                           (match_operand:QI 2 "immediate_operand" "I"))
-               (match_operand 3 "immediate_operand" "")))]
+               (match_operand 3 "immediate_operand" "n")))]
   "TARGET_64BIT && TARGET_ZBA
    && (INTVAL (operands[3]) >> INTVAL (operands[2])) == 0xffffffff"
   "slli.uw\t%0,%1,%2"
   [(set (match_operand:X 0 "register_operand" "=r")
        (zero_extract:X (match_operand:X 1 "register_operand" "r")
                        (const_int 1)
-                       (match_operand 2 "immediate_operand" "i")))]
-  "TARGET_ZBS"
+                       (match_operand 2 "immediate_operand" "n")))]
+  "TARGET_ZBS && UINTVAL (operands[2]) < GET_MODE_BITSIZE (<MODE>mode)"
   "bexti\t%0,%1,%2"
   [(set_attr "type" "bitmanip")])