gcc/
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 13 Jan 2015 14:11:15 +0000 (14:11 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Tue, 13 Jan 2015 14:11:15 +0000 (14:11 +0000)
* config/aarch64/aarch64.md (subsi3, *subsi3_uxtw, subdi3)
(*sub_<optab><ALLX:mode>_<GPI:mode>, *sub_<optab><SHORT:mode>_si_uxtw)
(*sub_<optab><ALLX:mode>_shft_<GPI:mode>)
(*sub_<optab><SHORT:mode>_shft_si_uxtw, *sub_<optab><mode>_multp2)
(*sub_<optab>si_multp2_uxtw, *sub_uxt<mode>_multp2)
(*sub_uxtsi_multp2_uxtw): Add stack pointer sources.

gcc/testsuite/
* gcc.target/aarch64/subsp.c: New test.

From-SVN: r219533

gcc/ChangeLog
gcc/config/aarch64/aarch64.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/aarch64/subsp.c [new file with mode: 0644]

index 0248000ea77caca7c32aa0383895d666d2794315..491a6379ed7273940e87491b310cc152f4e40e78 100644 (file)
@@ -1,3 +1,12 @@
+2015-01-13  Richard Sandiford  <richard.sandiford@arm.com>
+
+       * config/aarch64/aarch64.md (subsi3, *subsi3_uxtw, subdi3)
+       (*sub_<optab><ALLX:mode>_<GPI:mode>, *sub_<optab><SHORT:mode>_si_uxtw)
+       (*sub_<optab><ALLX:mode>_shft_<GPI:mode>)
+       (*sub_<optab><SHORT:mode>_shft_si_uxtw, *sub_<optab><mode>_multp2)
+       (*sub_<optab>si_multp2_uxtw, *sub_uxt<mode>_multp2)
+       (*sub_uxtsi_multp2_uxtw): Add stack pointer sources.
+
 2015-01-13  Andrew Pinski   <apinski@cavium.com>
 
        * config/aarch64/aarch64.c (fusion_load_store): Check dest mode
index 12e105469c67e4bb11d41c31ca2ed13b6933be39..fc729515910718a6e4792de92b543d4e2524d568 100644 (file)
 
 (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")]
 (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"
 
 (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
 
 (define_insn "*sub_<optab><ALLX:mode>_<GPI:mode>"
   [(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"))))]
   ""
 (define_insn "*sub_<optab><SHORT:mode>_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")))))]
   ""
 
 (define_insn "*sub_<optab><ALLX:mode>_shft_<GPI:mode>"
   [(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"))))]
 (define_insn "*sub_<optab><SHORT:mode>_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")))))]
 
 (define_insn "*sub_<optab><mode>_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"))
 (define_insn "*sub_<optab>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"))
 
 (define_insn "*sub_uxt<mode>_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"))
 (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"))
index 4aad423598f8f759fa684b81354b4df4b518e7c6..e13ef893e3893aa8da7a6eae7b3e0fd9c5ac0be5 100644 (file)
@@ -1,3 +1,7 @@
+2015-01-13  Richard Sandiford  <richard.sandiford@arm.com>
+
+       * gcc.target/aarch64/subsp.c: New test.
+
 2015-01-13  Andrew Pinski  <apinski@cavium.com>
 
        * 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 (file)
index 0000000..70d848c
--- /dev/null
@@ -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" } } */