The ldp/stp patterns call plus_constant which forces the mode to Pmode. However in ILP32 addresses are SImode. This may result in an assert if an ldp/stp pattern is tested with a SImode pointer. Fix this by using the mode of the pointer rather than Pmode.
This fixes a failure in gcc.target/aarch64/reload-valid-spoff.c triggered by https://gcc.gnu.org/ml/gcc-patches/2017-06/msg01367.html. OK for commit? ChangeLog: 2017-06-26 Wilco Dijkstra <wdijk...@arm.com> * config/aarch64/aarch64.md (load_pairsi): Avoid Pmode. (store_pairsi): Likewise. (load_pairdi): Likewise. (store_pairdi): Likewise. (load_pairsf): Likewise. (store_pairsf): Likewise. (load_pairdf): Likewise. (store_pairdf): Likewise. (load_pair_extendsidi2_aarch64): Likewise. (load_pair_zero_extendsidi2_aarch64): Likewise. * config/aarch64/aarch64-simd.md (load_pair<mode>): Likewise. (store_pair<mode>): Likewise. -- diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index d6e10427b324449eee90871682a59ed4c7d03b42..46816f7766d4a830536c9bc52e52f013d44bee40 100644 --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -173,7 +173,7 @@ (define_insn "load_pair<mode>" (match_operand:VD 3 "memory_operand" "m"))] "TARGET_SIMD && rtx_equal_p (XEXP (operands[3], 0), - plus_constant (Pmode, + plus_constant (GET_MODE (XEXP (operands[1], 0)), XEXP (operands[1], 0), GET_MODE_SIZE (<MODE>mode)))" "ldp\\t%d0, %d2, %1" @@ -187,7 +187,7 @@ (define_insn "store_pair<mode>" (match_operand:VD 3 "register_operand" "w"))] "TARGET_SIMD && rtx_equal_p (XEXP (operands[2], 0), - plus_constant (Pmode, + plus_constant (GET_MODE (XEXP (operands[0], 0)), XEXP (operands[0], 0), GET_MODE_SIZE (<MODE>mode)))" "stp\\t%d1, %d3, %0" diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 82f9f2d6af89db327eae3cb8eadcde850183dfb6..48c4c566d72c989c9d8d509866422039478f4b39 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -1185,7 +1185,7 @@ (define_insn "load_pairsi" (set (match_operand:SI 2 "register_operand" "=r,*w") (match_operand:SI 3 "memory_operand" "m,m"))] "rtx_equal_p (XEXP (operands[3], 0), - plus_constant (Pmode, + plus_constant (GET_MODE (XEXP (operands[1], 0)), XEXP (operands[1], 0), GET_MODE_SIZE (SImode)))" "@ @@ -1201,7 +1201,7 @@ (define_insn "load_pairdi" (set (match_operand:DI 2 "register_operand" "=r,*w") (match_operand:DI 3 "memory_operand" "m,m"))] "rtx_equal_p (XEXP (operands[3], 0), - plus_constant (Pmode, + plus_constant (GET_MODE (XEXP (operands[1], 0)), XEXP (operands[1], 0), GET_MODE_SIZE (DImode)))" "@ @@ -1220,7 +1220,7 @@ (define_insn "store_pairsi" (set (match_operand:SI 2 "memory_operand" "=m,m") (match_operand:SI 3 "aarch64_reg_or_zero" "rZ,*w"))] "rtx_equal_p (XEXP (operands[2], 0), - plus_constant (Pmode, + plus_constant (GET_MODE (XEXP (operands[0], 0)), XEXP (operands[0], 0), GET_MODE_SIZE (SImode)))" "@ @@ -1236,7 +1236,7 @@ (define_insn "store_pairdi" (set (match_operand:DI 2 "memory_operand" "=m,m") (match_operand:DI 3 "aarch64_reg_or_zero" "rZ,*w"))] "rtx_equal_p (XEXP (operands[2], 0), - plus_constant (Pmode, + plus_constant (GET_MODE (XEXP (operands[0], 0)), XEXP (operands[0], 0), GET_MODE_SIZE (DImode)))" "@ @@ -1254,7 +1254,7 @@ (define_insn "load_pairsf" (set (match_operand:SF 2 "register_operand" "=w,*r") (match_operand:SF 3 "memory_operand" "m,m"))] "rtx_equal_p (XEXP (operands[3], 0), - plus_constant (Pmode, + plus_constant (GET_MODE (XEXP (operands[1], 0)), XEXP (operands[1], 0), GET_MODE_SIZE (SFmode)))" "@ @@ -1270,7 +1270,7 @@ (define_insn "load_pairdf" (set (match_operand:DF 2 "register_operand" "=w,*r") (match_operand:DF 3 "memory_operand" "m,m"))] "rtx_equal_p (XEXP (operands[3], 0), - plus_constant (Pmode, + plus_constant (GET_MODE (XEXP (operands[1], 0)), XEXP (operands[1], 0), GET_MODE_SIZE (DFmode)))" "@ @@ -1288,7 +1288,7 @@ (define_insn "store_pairsf" (set (match_operand:SF 2 "memory_operand" "=m,m") (match_operand:SF 3 "aarch64_reg_or_fp_zero" "w,*rY"))] "rtx_equal_p (XEXP (operands[2], 0), - plus_constant (Pmode, + plus_constant (GET_MODE (XEXP (operands[0], 0)), XEXP (operands[0], 0), GET_MODE_SIZE (SFmode)))" "@ @@ -1304,7 +1304,7 @@ (define_insn "store_pairdf" (set (match_operand:DF 2 "memory_operand" "=m,m") (match_operand:DF 3 "aarch64_reg_or_fp_zero" "w,*rY"))] "rtx_equal_p (XEXP (operands[2], 0), - plus_constant (Pmode, + plus_constant (GET_MODE (XEXP (operands[0], 0)), XEXP (operands[0], 0), GET_MODE_SIZE (DFmode)))" "@ @@ -1406,7 +1406,7 @@ (define_insn "*load_pair_extendsidi2_aarch64" (set (match_operand:DI 2 "register_operand" "=r") (sign_extend:DI (match_operand:SI 3 "memory_operand" "m")))] "rtx_equal_p (XEXP (operands[3], 0), - plus_constant (Pmode, + plus_constant (GET_MODE (XEXP (operands[1], 0)), XEXP (operands[1], 0), GET_MODE_SIZE (SImode)))" "ldpsw\\t%0, %2, %1" @@ -1429,7 +1429,7 @@ (define_insn "*load_pair_zero_extendsidi2_aarch64" (set (match_operand:DI 2 "register_operand" "=r") (zero_extend:DI (match_operand:SI 3 "memory_operand" "m")))] "rtx_equal_p (XEXP (operands[3], 0), - plus_constant (Pmode, + plus_constant (GET_MODE (XEXP (operands[1], 0)), XEXP (operands[1], 0), GET_MODE_SIZE (SImode)))" "ldp\\t%w0, %w2, %1"