Commit 23cb6f8e by Iain Sandoe Committed by Iain Sandoe

[Darwin, PPC, Mode Iterators 4/n] Update macho_high.

Drop the expander and use a mode iterator on the define_insn
for @macho_high_<mode> instead.

gcc/ChangeLog:

2019-09-28  Iain Sandoe  <iain@sandoe.co.uk>

	* config/darwin.c (gen_macho_high): Amend to include the mode
	argument.
	(machopic_indirect_data_reference): Amend gen_macho_high call
	to include mode argument.
	(machopic_legitimize_pic_address): Likewise.
	* config/rs6000/rs6000.c (rs6000_legitimize_address):
	* config/rs6000/darwin.md (@macho_high_<mode>): New, replaces
	the macho_high expander and two define_insn entries.

From-SVN: r276256
parent 60674b3f
2019-09-28 Iain Sandoe <iain@sandoe.co.uk>
* config/darwin.c (gen_macho_high): Amend to include the mode
argument.
(machopic_indirect_data_reference): Amend gen_macho_high call
to include mode argument.
(machopic_legitimize_pic_address): Likewise.
* config/rs6000/rs6000.c (rs6000_legitimize_address):
* config/rs6000/darwin.md (@macho_high_<mode>): New, replaces
the macho_high expander and two define_insn entries.
2019-09-28 Oleg Endo <olegendo@gcc.gnu.org> 2019-09-28 Oleg Endo <olegendo@gcc.gnu.org>
PR target/86805 PR target/86805
......
...@@ -47,6 +47,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -47,6 +47,7 @@ along with GCC; see the file COPYING3. If not see
#include "toplev.h" #include "toplev.h"
#include "lto-section-names.h" #include "lto-section-names.h"
#include "intl.h" #include "intl.h"
#include "optabs.h"
/* Darwin supports a feature called fix-and-continue, which is used /* Darwin supports a feature called fix-and-continue, which is used
for rapid turn around debugging. When code is compiled with the for rapid turn around debugging. When code is compiled with the
...@@ -108,7 +109,7 @@ section * darwin_sections[NUM_DARWIN_SECTIONS]; ...@@ -108,7 +109,7 @@ section * darwin_sections[NUM_DARWIN_SECTIONS];
/* While we transition to using in-tests instead of ifdef'd code. */ /* While we transition to using in-tests instead of ifdef'd code. */
#if !HAVE_lo_sum #if !HAVE_lo_sum
#define gen_macho_high(a,b) (a) #define gen_macho_high(m,a,b) (a)
#define gen_macho_low(a,b,c) (a) #define gen_macho_low(a,b,c) (a)
#endif #endif
...@@ -654,7 +655,7 @@ machopic_indirect_data_reference (rtx orig, rtx reg) ...@@ -654,7 +655,7 @@ machopic_indirect_data_reference (rtx orig, rtx reg)
{ {
/* Create a new register for CSE opportunities. */ /* Create a new register for CSE opportunities. */
rtx hi_reg = (!can_create_pseudo_p () ? reg : gen_reg_rtx (Pmode)); rtx hi_reg = (!can_create_pseudo_p () ? reg : gen_reg_rtx (Pmode));
emit_insn (gen_macho_high (hi_reg, orig)); emit_insn (gen_macho_high (Pmode, hi_reg, orig));
emit_insn (gen_macho_low (reg, hi_reg, orig)); emit_insn (gen_macho_low (reg, hi_reg, orig));
return reg; return reg;
} }
...@@ -858,7 +859,7 @@ machopic_legitimize_pic_address (rtx orig, machine_mode mode, rtx reg) ...@@ -858,7 +859,7 @@ machopic_legitimize_pic_address (rtx orig, machine_mode mode, rtx reg)
rtx asym = XEXP (orig, 0); rtx asym = XEXP (orig, 0);
rtx mem; rtx mem;
emit_insn (gen_macho_high (temp_reg, asym)); emit_insn (gen_macho_high (Pmode, temp_reg, asym));
mem = gen_const_mem (GET_MODE (orig), mem = gen_const_mem (GET_MODE (orig),
gen_rtx_LO_SUM (Pmode, temp_reg, gen_rtx_LO_SUM (Pmode, temp_reg,
copy_rtx (asym))); copy_rtx (asym)));
......
...@@ -150,31 +150,12 @@ You should have received a copy of the GNU General Public License ...@@ -150,31 +150,12 @@ You should have received a copy of the GNU General Public License
stfd %0,lo16(%2)(%1)" stfd %0,lo16(%2)(%1)"
[(set_attr "type" "store")]) [(set_attr "type" "store")])
;; Mach-O PIC trickery. ;; Mach-O PIC.
(define_expand "macho_high"
[(set (match_operand 0 "")
(high (match_operand 1 "")))]
"TARGET_MACHO"
{
if (TARGET_64BIT)
emit_insn (gen_macho_high_di (operands[0], operands[1]));
else
emit_insn (gen_macho_high_si (operands[0], operands[1]));
DONE; (define_insn "@macho_high_<mode>"
}) [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
(high:P (match_operand 1 "" "")))]
(define_insn "macho_high_si" "TARGET_MACHO && (DEFAULT_ABI == ABI_DARWIN)"
[(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
(high:SI (match_operand 1 "" "")))]
"TARGET_MACHO && ! TARGET_64BIT"
"lis %0,ha16(%1)")
(define_insn "macho_high_di"
[(set (match_operand:DI 0 "gpc_reg_operand" "=b*r")
(high:DI (match_operand 1 "" "")))]
"TARGET_MACHO && TARGET_64BIT"
"lis %0,ha16(%1)") "lis %0,ha16(%1)")
(define_expand "macho_low" (define_expand "macho_low"
......
...@@ -7978,7 +7978,7 @@ rs6000_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED, ...@@ -7978,7 +7978,7 @@ rs6000_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
if (TARGET_ELF) if (TARGET_ELF)
emit_insn (gen_elf_high (reg, x)); emit_insn (gen_elf_high (reg, x));
else else
emit_insn (gen_macho_high (reg, x)); emit_insn (gen_macho_high (Pmode, reg, x));
return gen_rtx_LO_SUM (Pmode, reg, x); return gen_rtx_LO_SUM (Pmode, reg, x);
} }
else if (TARGET_TOC else if (TARGET_TOC
...@@ -9691,7 +9691,7 @@ rs6000_emit_move (rtx dest, rtx source, machine_mode mode) ...@@ -9691,7 +9691,7 @@ rs6000_emit_move (rtx dest, rtx source, machine_mode mode)
return; return;
} }
#endif #endif
emit_insn (gen_macho_high (target, operands[1])); emit_insn (gen_macho_high (Pmode, target, operands[1]));
emit_insn (gen_macho_low (operands[0], target, operands[1])); emit_insn (gen_macho_low (operands[0], target, operands[1]));
return; return;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment