From 7eb8fb77fae9189b159424dacb060d3b1ca5a66d Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Tue, 13 Jan 2015 14:11:15 +0000 Subject: [PATCH] gcc/ * config/aarch64/aarch64.md (subsi3, *subsi3_uxtw, subdi3) (*sub__, *sub__si_uxtw) (*sub__shft_) (*sub__shft_si_uxtw, *sub__multp2) (*sub_si_multp2_uxtw, *sub_uxt_multp2) (*sub_uxtsi_multp2_uxtw): Add stack pointer sources. gcc/testsuite/ * gcc.target/aarch64/subsp.c: New test. From-SVN: r219533 --- gcc/ChangeLog | 9 ++++++++ gcc/config/aarch64/aarch64.md | 26 ++++++++++++------------ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.target/aarch64/subsp.c | 19 +++++++++++++++++ 4 files changed, 45 insertions(+), 13 deletions(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/subsp.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0248000ea77..491a6379ed7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2015-01-13 Richard Sandiford + + * config/aarch64/aarch64.md (subsi3, *subsi3_uxtw, subdi3) + (*sub__, *sub__si_uxtw) + (*sub__shft_) + (*sub__shft_si_uxtw, *sub__multp2) + (*sub_si_multp2_uxtw, *sub_uxt_multp2) + (*sub_uxtsi_multp2_uxtw): Add stack pointer sources. + 2015-01-13 Andrew Pinski * config/aarch64/aarch64.c (fusion_load_store): Check dest mode diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 12e105469c6..fc729515910 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -1889,8 +1889,8 @@ (define_insn "subsi3" [(set (match_operand:SI 0 "register_operand" "=rk") - (minus:SI (match_operand:SI 1 "register_operand" "r") - (match_operand:SI 2 "register_operand" "r")))] + (minus:SI (match_operand:SI 1 "register_operand" "rk") + (match_operand:SI 2 "register_operand" "r")))] "" "sub\\t%w0, %w1, %w2" [(set_attr "type" "alu_sreg")] @@ -1900,7 +1900,7 @@ (define_insn "*subsi3_uxtw" [(set (match_operand:DI 0 "register_operand" "=rk") (zero_extend:DI - (minus:SI (match_operand:SI 1 "register_operand" "r") + (minus:SI (match_operand:SI 1 "register_operand" "rk") (match_operand:SI 2 "register_operand" "r"))))] "" "sub\\t%w0, %w1, %w2" @@ -1909,8 +1909,8 @@ (define_insn "subdi3" [(set (match_operand:DI 0 "register_operand" "=rk,w") - (minus:DI (match_operand:DI 1 "register_operand" "r,w") - (match_operand:DI 2 "register_operand" "r,w")))] + (minus:DI (match_operand:DI 1 "register_operand" "rk,w") + (match_operand:DI 2 "register_operand" "r,w")))] "" "@ sub\\t%x0, %x1, %x2 @@ -2013,7 +2013,7 @@ (define_insn "*sub__" [(set (match_operand:GPI 0 "register_operand" "=rk") - (minus:GPI (match_operand:GPI 1 "register_operand" "r") + (minus:GPI (match_operand:GPI 1 "register_operand" "rk") (ANY_EXTEND:GPI (match_operand:ALLX 2 "register_operand" "r"))))] "" @@ -2025,7 +2025,7 @@ (define_insn "*sub__si_uxtw" [(set (match_operand:DI 0 "register_operand" "=rk") (zero_extend:DI - (minus:SI (match_operand:SI 1 "register_operand" "r") + (minus:SI (match_operand:SI 1 "register_operand" "rk") (ANY_EXTEND:SI (match_operand:SHORT 2 "register_operand" "r")))))] "" @@ -2035,7 +2035,7 @@ (define_insn "*sub__shft_" [(set (match_operand:GPI 0 "register_operand" "=rk") - (minus:GPI (match_operand:GPI 1 "register_operand" "r") + (minus:GPI (match_operand:GPI 1 "register_operand" "rk") (ashift:GPI (ANY_EXTEND:GPI (match_operand:ALLX 2 "register_operand" "r")) (match_operand 3 "aarch64_imm3" "Ui3"))))] @@ -2048,7 +2048,7 @@ (define_insn "*sub__shft_si_uxtw" [(set (match_operand:DI 0 "register_operand" "=rk") (zero_extend:DI - (minus:SI (match_operand:SI 1 "register_operand" "r") + (minus:SI (match_operand:SI 1 "register_operand" "rk") (ashift:SI (ANY_EXTEND:SI (match_operand:SHORT 2 "register_operand" "r")) (match_operand 3 "aarch64_imm3" "Ui3")))))] @@ -2059,7 +2059,7 @@ (define_insn "*sub__multp2" [(set (match_operand:GPI 0 "register_operand" "=rk") - (minus:GPI (match_operand:GPI 4 "register_operand" "r") + (minus:GPI (match_operand:GPI 4 "register_operand" "rk") (ANY_EXTRACT:GPI (mult:GPI (match_operand:GPI 1 "register_operand" "r") (match_operand 2 "aarch64_pwr_imm3" "Up3")) @@ -2074,7 +2074,7 @@ (define_insn "*sub_si_multp2_uxtw" [(set (match_operand:DI 0 "register_operand" "=rk") (zero_extend:DI - (minus:SI (match_operand:SI 4 "register_operand" "r") + (minus:SI (match_operand:SI 4 "register_operand" "rk") (ANY_EXTRACT:SI (mult:SI (match_operand:SI 1 "register_operand" "r") (match_operand 2 "aarch64_pwr_imm3" "Up3")) @@ -2113,7 +2113,7 @@ (define_insn "*sub_uxt_multp2" [(set (match_operand:GPI 0 "register_operand" "=rk") - (minus:GPI (match_operand:GPI 4 "register_operand" "r") + (minus:GPI (match_operand:GPI 4 "register_operand" "rk") (and:GPI (mult:GPI (match_operand:GPI 1 "register_operand" "r") (match_operand 2 "aarch64_pwr_imm3" "Up3")) @@ -2130,7 +2130,7 @@ (define_insn "*sub_uxtsi_multp2_uxtw" [(set (match_operand:DI 0 "register_operand" "=rk") (zero_extend:DI - (minus:SI (match_operand:SI 4 "register_operand" "r") + (minus:SI (match_operand:SI 4 "register_operand" "rk") (and:SI (mult:SI (match_operand:SI 1 "register_operand" "r") (match_operand 2 "aarch64_pwr_imm3" "Up3")) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4aad423598f..e13ef893e38 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-01-13 Richard Sandiford + + * gcc.target/aarch64/subsp.c: New test. + 2015-01-13 Andrew Pinski * gcc.target/aarch64/store-pair-1.c: New testcase. diff --git a/gcc/testsuite/gcc.target/aarch64/subsp.c b/gcc/testsuite/gcc.target/aarch64/subsp.c new file mode 100644 index 00000000000..70d848c59d1 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/subsp.c @@ -0,0 +1,19 @@ +/* { dg-options "-O" } */ + +int foo (void *); + +int +f1 (int *x, long y) +{ + return foo (__builtin_alloca (y)); +} + +int +f2 (int *x, int y) +{ + char a[y + 1][16]; + return foo (a); +} + +/* { dg-final { scan-assembler "sub\tsp, sp, x\[0-9\]*\n" } } */ +/* { dg-final { scan-assembler "sub\tsp, sp, x\[0-9\]*, sxtw 4\n" } } */ -- 2.30.2