]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[PATCH] RX: Restrict displacement ranges in "Q" constraint
authorYoshinori Sato <ysato@users.sourceforge.jp>
Wed, 29 Jan 2025 15:07:15 +0000 (08:07 -0700)
committerJeff Law <jlaw@ventanamicro.com>
Wed, 29 Jan 2025 15:07:15 +0000 (08:07 -0700)
When using the "Q" constraint in the inline assembler, the displacement value
could exceed the range specified by the instruction.
To avoid this issue, a displacement range check is added to the "Q" constraint.

gcc/
* config/rx/constraints.md (Q): Also check that the address
passes rx_is_restricted_memory-address.

gcc/config/rx/constraints.md

index 4fc242667ab4e2d623946d05df0a3be12cd0fea0..4b81ae6aa75bfe254deba7aadfdeb7c6cf718ea3 100644 (file)
@@ -80,7 +80,8 @@
        (ior (match_code "reg" "0")
            (and (match_code "plus" "0")
                 (and (match_code "reg,subreg" "00")
-                     (match_code "const_int" "01")
+                     (and (match_code "const_int" "01")
+                          (match_test "rx_is_restricted_memory_address (XEXP (op, 0), mode)"))
                 )
            )
        )