Module Name:    src
Committed By:   rin
Date:           Sat Oct  7 12:10:38 UTC 2023

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

Log Message:
gcc.old: vax: PR port-vax/57646 patch provided by Kalvis Duckmanton [20/21]

If in PIC mode, and the source operand to extv is a memory reference, and th
e address of the memory location is an external symbol, load the address into a
temporary register before expanding the instruction.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 \
    src/external/gpl3/gcc.old/dist/gcc/config/vax/vax.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.old/dist/gcc/config/vax/vax.md
diff -u src/external/gpl3/gcc.old/dist/gcc/config/vax/vax.md:1.16 src/external/gpl3/gcc.old/dist/gcc/config/vax/vax.md:1.17
--- src/external/gpl3/gcc.old/dist/gcc/config/vax/vax.md:1.16	Sat Oct  7 12:10:18 2023
+++ src/external/gpl3/gcc.old/dist/gcc/config/vax/vax.md	Sat Oct  7 12:10:38 2023
@@ -982,7 +982,40 @@
   ""
   "cmpzv %2,%1,%0,%3")
 
-(define_insn "extv"
+(define_expand "extv"
+  [(set (match_operand:SI 0 "general_operand" "")
+	(sign_extract:SI (match_dup 4)
+			 (match_operand:QI 2 "general_operand" "")
+			 (match_operand:SI 3 "general_operand" ""))
+   )]
+  ""
+  "{
+      /*
+       * If the source operand is a memory reference, and the address
+       * is a symbol, and we're in PIC mode, load the address into a
+       * register.  Don't evaluate the field start or width at this time.
+       */
+      operands[4] = operands[1];
+      if (flag_pic
+       /* && !reload_completed */
+	  && MEM_P (operands[1])
+	  && !mode_dependent_address_p (XEXP (operands[1], 0),
+					MEM_ADDR_SPACE (operands[1]))
+          && SYMBOL_REF_P (XEXP (operands[1], 0))
+	  && !SYMBOL_REF_LOCAL_P (XEXP (operands[1], 0))
+	 )
+	{
+	  rtx address = XEXP (operands[1], 0);
+	  rtx temp = gen_reg_rtx (Pmode);
+	  emit_move_insn (temp, address);
+	  /* copy the original memory reference, replacing the address */
+	  operands[4] = change_address (operands[1], VOIDmode, temp);
+	  set_mem_align (operands[4], MEM_ALIGN (operands[1]));
+	}
+  }"
+)
+
+(define_insn ""
   [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
 	(sign_extract:SI (match_operand:QI 1 "memory_operand" "m")
 			 (match_operand:QI 2 "general_operand" "g")

Reply via email to