[AArch64] Tighten direct call pattern for sibcall to repair -fno-plt
authorJiong Wang <jiong.wang@arm.com>
Thu, 6 Aug 2015 16:02:16 +0000 (16:02 +0000)
committerJiong Wang <jiwang@gcc.gnu.org>
Thu, 6 Aug 2015 16:02:16 +0000 (16:02 +0000)
2015-08-06  Jiong Wang  <jiong.wang@arm.com>

gcc/
  * config/aarch64/constraints.md (Usf): Add the test of
  aarch64_is_noplt_call_p.

gcc/testsuite/
  * gcc.target/aarch64/noplt_3.c: New testcase.

From-SVN: r226682

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

index 2b364ce83b940a35b41d0a3719952af0a6c182d6..795867a165640ee2e3aa4aa8e1ce3d3e15a8cccc 100644 (file)
@@ -1,3 +1,8 @@
+2015-08-06  Jiong Wang  <jiong.wang@arm.com>
+
+       * config/aarch64/constraints.md (Usf): Add the test of
+       aarch64_is_noplt_call_p.
+
 2015-08-06  Jiong Wang  <jiong.wang@arm.com>
 
        * config/aarch64/aarch64-protos.h (aarch64_is_noplt_call_p): New declaration.
index 5b189ea9d460ccbfb38a6ac1790aa4cfc5e94419..9dc21089154b1f44cbbd24681a710a3752b4ff2c 100644 (file)
        (match_test "(unsigned HOST_WIDE_INT) ival < 64")))
 
 (define_constraint "Usf"
-  "@internal Usf is a symbol reference."
-  (match_code "symbol_ref"))
+  "@internal Usf is a symbol reference under the context where plt stub allowed."
+  (and (match_code "symbol_ref")
+       (match_test "!aarch64_is_noplt_call_p (op)")))
 
 (define_constraint "UsM"
   "@internal
index fb3bf07f58f8ff4c39ed2f99871bb124a204dfb3..0cd004b4c1d29ecc17aef3176eff5e55a13f7c10 100644 (file)
@@ -1,3 +1,7 @@
+2015-08-06  Jiong Wang  <jiong.wang@arm.com>
+
+       * gcc.target/aarch64/noplt_3.c: New testcase.
+
 2015-08-06  Jiong Wang  <jiong.wang@arm.com>
 
        * gcc.target/aarch64/noplt_1.c: New testcase.
diff --git a/gcc/testsuite/gcc.target/aarch64/noplt_3.c b/gcc/testsuite/gcc.target/aarch64/noplt_3.c
new file mode 100644 (file)
index 0000000..c1993b6
--- /dev/null
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fpic -fno-plt" } */
+/* { dg-skip-if "-mcmodel=large, no support for -fpic" { aarch64-*-* }  { "-mcmodel=large" } { "" } } */
+
+int dec (int);
+
+int
+cal (int a)
+{
+  return dec (a);
+}
+
+void
+cal_novalue (int a)
+{
+  dec (a);
+}
+
+/* { dg-final { scan-assembler-times "#:got:" 2 { target { aarch64_tiny || aarch64_small } } } } */
+/* { dg-final { scan-assembler-times "#:got_lo12:" 2 { target aarch64_small } } } */