+2012-11-11 Eric Botcazou <ebotcazou@adacore.com>
+ H.J. Lu <hongjiu.lu@intel.com>
+
+ PR rtl-optimization/55247
+ PR middle-end/55259
+ * emit-rtl.c (adjust_address_1): If POINTERS_EXTEND_UNSIGNED > 0,
+ handle ZERO_EXTEND.
+ * recog.c (offsettable_address_addr_space_p): Likewise.
+
2012-11-11 Steven Bosscher <steven@gcc.gnu.org>
PR middle-end/55263
rtx new_rtx;
enum machine_mode address_mode;
int pbits;
- struct mem_attrs attrs, *defattrs;
+ struct mem_attrs attrs = *get_mem_attrs (memref), *defattrs;
unsigned HOST_WIDE_INT max_align;
-
- attrs = *get_mem_attrs (memref);
+#ifdef POINTERS_EXTEND_UNSIGNED
+ enum machine_mode pointer_mode
+ = targetm.addr_space.pointer_mode (attrs.addrspace);
+#endif
/* If there are no changes, just return the original memory reference. */
if (mode == GET_MODE (memref) && !offset
addr = gen_rtx_LO_SUM (address_mode, XEXP (addr, 0),
plus_constant (address_mode,
XEXP (addr, 1), offset));
+#ifdef POINTERS_EXTEND_UNSIGNED
+ /* If MEMREF is a ZERO_EXTEND from pointer_mode and the offset is valid
+ in that mode, we merge it into the ZERO_EXTEND. We take advantage of
+ the fact that pointers are not allowed to overflow. */
+ else if (POINTERS_EXTEND_UNSIGNED > 0
+ && GET_CODE (addr) == ZERO_EXTEND
+ && GET_MODE (XEXP (addr, 0)) == pointer_mode
+ && trunc_int_for_mode (offset, pointer_mode) == offset)
+ addr = gen_rtx_ZERO_EXTEND (address_mode,
+ plus_constant (pointer_mode,
+ XEXP (addr, 0), offset));
+#endif
else
addr = plus_constant (address_mode, addr, offset);
}
(strictp ? strict_memory_address_addr_space_p
: memory_address_addr_space_p);
unsigned int mode_sz = GET_MODE_SIZE (mode);
+#ifdef POINTERS_EXTEND_UNSIGNED
+ enum machine_mode pointer_mode = targetm.addr_space.pointer_mode (as);
+#endif
if (CONSTANT_ADDRESS_P (y))
return 1;
z = gen_rtx_LO_SUM (GET_MODE (y), XEXP (y, 0),
plus_constant (GET_MODE (y), XEXP (y, 1),
mode_sz - 1));
+#ifdef POINTERS_EXTEND_UNSIGNED
+ /* Likewise for a ZERO_EXTEND from pointer_mode. */
+ else if (POINTERS_EXTEND_UNSIGNED > 0
+ && GET_CODE (y) == ZERO_EXTEND
+ && GET_MODE (XEXP (y, 0)) == pointer_mode)
+ z = gen_rtx_ZERO_EXTEND (GET_MODE (y),
+ plus_constant (pointer_mode, XEXP (y, 0),
+ mode_sz - 1));
+#endif
else
z = plus_constant (GET_MODE (y), y, mode_sz - 1);
+2012-11-11 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR middle-end/55247
+ PR middle-end/55259
+ * gcc.target/i386/pr55247-2.c: New file.
+
2012-11-11 Steven Bosscher <steven@gcc.gnu.org>
PR middle-end/55263
--- /dev/null
+/* { dg-do compile { target { ! { ia32 } } } } */
+/* { dg-require-effective-target maybe_x32 } */
+/* { dg-options "-O2 -mx32 -mtune=generic -maddress-mode=long" } */
+
+typedef unsigned int uint32_t;
+typedef uint32_t Elf32_Word;
+typedef uint32_t Elf32_Addr;
+typedef struct {
+ Elf32_Word st_name;
+ Elf32_Addr st_value;
+ Elf32_Word st_size;
+ unsigned char st_other;
+} Elf32_Sym;
+typedef struct {
+ Elf32_Word r_info;
+}
+Elf32_Rela;
+typedef struct {
+ union {
+ Elf32_Addr d_ptr;
+ }
+ d_un;
+} Elf32_Dyn;
+struct link_map {
+ Elf32_Dyn *l_info[34];
+};
+extern void symbind32 (Elf32_Sym *);
+void
+_dl_profile_fixup (struct link_map *l, Elf32_Word reloc_arg)
+{
+ const Elf32_Sym *const symtab = (const void *) l->l_info[6]->d_un.d_ptr;
+ const Elf32_Rela *const reloc = (const void *) (l->l_info[23]->d_un.d_ptr + reloc_arg * sizeof (Elf32_Rela));
+ Elf32_Sym sym = symtab[(reloc->r_info) >> 8];
+ symbind32 (&sym);
+}
+
+/* { dg-final { scan-assembler-not "%xmm\[0-9\]" } } */