Module Name:    src
Committed By:   kalvisd
Date:           Sun Sep 29 12:04:04 UTC 2024

Modified Files:
        src/external/gpl3/gcc/dist/gcc/config/vax: builtins.md

Log Message:
gcc: vax: tweak peephole optimisations for VAX

    ffs<mode>2 requires that references to memory be addressed
    in a mode-independent way (the ffs instruction uses byte
    addressing).  The defined peephole optimisation can undo this,
    so adjust the constraints to only match mode-independent
    memory references (everything else has to be loaded into a
    register first)

    OK rin@


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
    src/external/gpl3/gcc/dist/gcc/config/vax/builtins.md

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/config/vax/builtins.md
diff -u src/external/gpl3/gcc/dist/gcc/config/vax/builtins.md:1.13 src/external/gpl3/gcc/dist/gcc/config/vax/builtins.md:1.14
--- src/external/gpl3/gcc/dist/gcc/config/vax/builtins.md:1.13	Sun Jul 30 05:51:30 2023
+++ src/external/gpl3/gcc/dist/gcc/config/vax/builtins.md	Sun Sep 29 12:04:04 2024
@@ -138,6 +138,10 @@
 
 ;; This effectively combines the two peepholes above,
 ;; matching the sequence produced by `ffs<mode>2'.
+;;
+;; note - should really only do this for memory references
+;;        without a mode dependent address, or for
+;;        registers.
 (define_peephole2
   [(parallel
      [(set (match_operand:SI 0 "register_operand")
@@ -151,7 +155,13 @@
 	(compare:CCZ (match_dup 0)
 		     (const_int 0)))]
   "!rtx_equal_p (operands[0], operands[2])
-   && peep2_reg_dead_p (3, operands[0])"
+   && peep2_reg_dead_p (3, operands[0])
+   && (REG_P (operands[1])
+       || (MEM_P (operands[1])
+	   && !mode_dependent_address_p (XEXP (operands[1], 0),
+					 MEM_ADDR_SPACE (operands[1])))
+      )
+  "
   [(parallel
      [(set (reg:CCZ VAX_PSL_REGNUM)
 	   (compare:CCZ (match_dup 1)

Reply via email to