From 5f5c5e0f07c9ce7bff0498a028e9abbdf5a74183 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 5 Apr 2017 11:48:02 +0000 Subject: [PATCH] re PR target/78002 (gcc.target/aarch64/stack-checking.c ICEs with -mabi=ilp32) PR target/78002 * config/aarch64/aarch64.c (aarch64_emit_probe_stack_range): Replace ptr_mode with Pmode throughout. * config/aarch64/aarch64.md (probe_stack_range_ + + PR target/78002 + * config/aarch64/aarch64.c (aarch64_emit_probe_stack_range): Replace + ptr_mode with Pmode throughout. + * config/aarch64/aarch64.md (probe_stack_range_ PR target/79890 diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 4f769a40a4e..721ced1831a 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -2610,7 +2610,7 @@ aarch64_libgcc_cmp_return_mode (void) static void aarch64_emit_probe_stack_range (HOST_WIDE_INT first, HOST_WIDE_INT size) { - rtx reg1 = gen_rtx_REG (ptr_mode, PROBE_STACK_FIRST_REG); + rtx reg1 = gen_rtx_REG (Pmode, PROBE_STACK_FIRST_REG); /* See the same assertion on PROBE_INTERVAL above. */ gcc_assert ((first % ARITH_FACTOR) == 0); @@ -2622,9 +2622,9 @@ aarch64_emit_probe_stack_range (HOST_WIDE_INT first, HOST_WIDE_INT size) const HOST_WIDE_INT base = ROUND_UP (size, ARITH_FACTOR); emit_set_insn (reg1, - plus_constant (ptr_mode, + plus_constant (Pmode, stack_pointer_rtx, -(first + base))); - emit_stack_probe (plus_constant (ptr_mode, reg1, base - size)); + emit_stack_probe (plus_constant (Pmode, reg1, base - size)); } /* The run-time loop is made up of 8 insns in the generic case while the @@ -2634,7 +2634,7 @@ aarch64_emit_probe_stack_range (HOST_WIDE_INT first, HOST_WIDE_INT size) HOST_WIDE_INT i, rem; emit_set_insn (reg1, - plus_constant (ptr_mode, + plus_constant (Pmode, stack_pointer_rtx, -(first + PROBE_INTERVAL))); emit_stack_probe (reg1); @@ -2645,7 +2645,7 @@ aarch64_emit_probe_stack_range (HOST_WIDE_INT first, HOST_WIDE_INT size) for (i = 2 * PROBE_INTERVAL; i < size; i += PROBE_INTERVAL) { emit_set_insn (reg1, - plus_constant (ptr_mode, reg1, -PROBE_INTERVAL)); + plus_constant (Pmode, reg1, -PROBE_INTERVAL)); emit_stack_probe (reg1); } @@ -2654,11 +2654,11 @@ aarch64_emit_probe_stack_range (HOST_WIDE_INT first, HOST_WIDE_INT size) { const HOST_WIDE_INT base = ROUND_UP (rem, ARITH_FACTOR); - emit_set_insn (reg1, plus_constant (ptr_mode, reg1, -base)); - emit_stack_probe (plus_constant (ptr_mode, reg1, base - rem)); + emit_set_insn (reg1, plus_constant (Pmode, reg1, -base)); + emit_stack_probe (plus_constant (Pmode, reg1, base - rem)); } else - emit_stack_probe (plus_constant (ptr_mode, reg1, -rem)); + emit_stack_probe (plus_constant (Pmode, reg1, -rem)); } /* Otherwise, do the same as above, but in a loop. Note that we must be @@ -2668,7 +2668,7 @@ aarch64_emit_probe_stack_range (HOST_WIDE_INT first, HOST_WIDE_INT size) equality test for the loop condition. */ else { - rtx reg2 = gen_rtx_REG (ptr_mode, PROBE_STACK_SECOND_REG); + rtx reg2 = gen_rtx_REG (Pmode, PROBE_STACK_SECOND_REG); /* Step 1: round SIZE to the previous multiple of the interval. */ @@ -2679,11 +2679,11 @@ aarch64_emit_probe_stack_range (HOST_WIDE_INT first, HOST_WIDE_INT size) /* TEST_ADDR = SP + FIRST. */ emit_set_insn (reg1, - plus_constant (ptr_mode, stack_pointer_rtx, -first)); + plus_constant (Pmode, stack_pointer_rtx, -first)); /* LAST_ADDR = SP + FIRST + ROUNDED_SIZE. */ emit_set_insn (reg2, - plus_constant (ptr_mode, stack_pointer_rtx, + plus_constant (Pmode, stack_pointer_rtx, -(first + rounded_size))); @@ -2699,10 +2699,7 @@ aarch64_emit_probe_stack_range (HOST_WIDE_INT first, HOST_WIDE_INT size) probes at FIRST + N * PROBE_INTERVAL for values of N from 1 until it is equal to ROUNDED_SIZE. */ - if (ptr_mode == DImode) - emit_insn (gen_probe_stack_range_di (reg1, reg1, reg2)); - else - emit_insn (gen_probe_stack_range_si (reg1, reg1, reg2)); + emit_insn (gen_probe_stack_range (reg1, reg1, reg2)); /* Step 4: probe at FIRST + SIZE if we cannot assert at compile-time @@ -2716,11 +2713,11 @@ aarch64_emit_probe_stack_range (HOST_WIDE_INT first, HOST_WIDE_INT size) { const HOST_WIDE_INT base = ROUND_UP (rem, ARITH_FACTOR); - emit_set_insn (reg2, plus_constant (ptr_mode, reg2, -base)); - emit_stack_probe (plus_constant (ptr_mode, reg2, base - rem)); + emit_set_insn (reg2, plus_constant (Pmode, reg2, -base)); + emit_stack_probe (plus_constant (Pmode, reg2, base - rem)); } else - emit_stack_probe (plus_constant (ptr_mode, reg2, -rem)); + emit_stack_probe (plus_constant (Pmode, reg2, -rem)); } } diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 5adc5edb8dd..51368e29f2d 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -5412,11 +5412,11 @@ (set_attr "type" "block")] ) -(define_insn "probe_stack_range_" - [(set (match_operand:PTR 0 "register_operand" "=r") - (unspec_volatile:PTR [(match_operand:PTR 1 "register_operand" "0") - (match_operand:PTR 2 "register_operand" "r")] - UNSPECV_PROBE_STACK_RANGE))] +(define_insn "probe_stack_range" + [(set (match_operand:DI 0 "register_operand" "=r") + (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "0") + (match_operand:DI 2 "register_operand" "r")] + UNSPECV_PROBE_STACK_RANGE))] "" { return aarch64_output_probe_stack_range (operands[0], operands[2]); -- 2.30.2