Commit fb15e2ba by Richard Sandiford

aarch64: Fix SVE ACLE handling of SImode pointers

This long-overdue patch promotes SImode pointers to DImode addresses,
avoiding various ICEs in the existing tests.

2020-01-21  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* config/aarch64/aarch64-sve-builtins.h
	(function_expander::convert_to_pmode): Declare.
	* config/aarch64/aarch64-sve-builtins.cc
	(function_expander::convert_to_pmode): New function.
	(function_expander::get_contiguous_base): Use it.
	(function_expander::prepare_gather_address_operands): Likewise.
	* config/aarch64/aarch64-sve-builtins-sve2.cc
	(svwhilerw_svwhilewr_impl::expand): Likewise.
parent c292cfe5
2020-01-21 Richard Sandiford <richard.sandiford@arm.com>
* config/aarch64/aarch64-sve-builtins.h
(function_expander::convert_to_pmode): Declare.
* config/aarch64/aarch64-sve-builtins.cc
(function_expander::convert_to_pmode): New function.
(function_expander::get_contiguous_base): Use it.
(function_expander::prepare_gather_address_operands): Likewise.
* config/aarch64/aarch64-sve-builtins-sve2.cc
(svwhilerw_svwhilewr_impl::expand): Likewise.
2020-01-21 Szabolcs Nagy <szabolcs.nagy@arm.com> 2020-01-21 Szabolcs Nagy <szabolcs.nagy@arm.com>
PR target/92424 PR target/92424
......
...@@ -442,6 +442,8 @@ public: ...@@ -442,6 +442,8 @@ public:
rtx rtx
expand (function_expander &e) const OVERRIDE expand (function_expander &e) const OVERRIDE
{ {
for (unsigned int i = 0; i < 2; ++i)
e.args[i] = e.convert_to_pmode (e.args[i]);
return e.use_exact_insn (code_for_while (m_unspec, Pmode, e.gp_mode (0))); return e.use_exact_insn (code_for_while (m_unspec, Pmode, e.gp_mode (0)));
} }
......
...@@ -2602,12 +2602,21 @@ function_expander::overlaps_input_p (rtx x) ...@@ -2602,12 +2602,21 @@ function_expander::overlaps_input_p (rtx x)
return false; return false;
} }
/* Convert ptr_mode value X to Pmode. */
rtx
function_expander::convert_to_pmode (rtx x)
{
if (ptr_mode == SImode)
x = simplify_gen_unary (ZERO_EXTEND, DImode, x, SImode);
return x;
}
/* Return the base address for a contiguous load or store function. /* Return the base address for a contiguous load or store function.
MEM_MODE is the mode of the addressed memory. */ MEM_MODE is the mode of the addressed memory. */
rtx rtx
function_expander::get_contiguous_base (machine_mode mem_mode) function_expander::get_contiguous_base (machine_mode mem_mode)
{ {
rtx base = args[1]; rtx base = convert_to_pmode (args[1]);
if (mode_suffix_id == MODE_vnum) if (mode_suffix_id == MODE_vnum)
{ {
/* Use the size of the memory mode for extending loads and truncating /* Use the size of the memory mode for extending loads and truncating
...@@ -2814,9 +2823,7 @@ function_expander::prepare_gather_address_operands (unsigned int argno, ...@@ -2814,9 +2823,7 @@ function_expander::prepare_gather_address_operands (unsigned int argno,
{ {
/* Scalar base, vector displacement. This is the order that the md /* Scalar base, vector displacement. This is the order that the md
pattern wants. */ pattern wants. */
if (Pmode == SImode) args[argno] = convert_to_pmode (args[argno]);
args[argno] = simplify_gen_unary (ZERO_EXTEND, DImode,
args[argno], SImode);
vector_type = displacement_vector_type (); vector_type = displacement_vector_type ();
if (units == UNITS_elements && !scaled_p) if (units == UNITS_elements && !scaled_p)
shift_idx = argno + 1; shift_idx = argno + 1;
......
...@@ -526,6 +526,7 @@ public: ...@@ -526,6 +526,7 @@ public:
bool overlaps_input_p (rtx); bool overlaps_input_p (rtx);
rtx convert_to_pmode (rtx);
rtx get_contiguous_base (machine_mode); rtx get_contiguous_base (machine_mode);
rtx get_fallback_value (machine_mode, unsigned int, rtx get_fallback_value (machine_mode, unsigned int,
unsigned int, unsigned int &); unsigned int, unsigned int &);
......
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