aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAlex Velenko <Alex.Velenko@arm.com>2014-12-08 18:10:39 +0000
committerAlex Velenko <avelenko@gcc.gnu.org>2014-12-08 18:10:39 +0000
commitcd8fc5ee0ded4801780f1998cd9025011abad152 (patch)
tree0e0e7de33750cbf8afae5fa276f1b95b32801372 /gcc
parent942f7f5af30171ea44db18d93ea9e7d30eddc676 (diff)
downloadgcc-cd8fc5ee0ded4801780f1998cd9025011abad152.zip
gcc-cd8fc5ee0ded4801780f1998cd9025011abad152.tar.gz
gcc-cd8fc5ee0ded4801780f1998cd9025011abad152.tar.bz2
Bics instruction generation for aarch64
gcc/ * config/aarch64/aarch64.md (and_one_cmpl<mode>3_compare0_no_reuse): New define_insn. * (and_one_cmpl_<SHIFT:optab><mode>3_compare0_no_reuse): Likewise. gcc/testsuite/ * gcc.target/aarch64/bics_3.c : New testcase. From-SVN: r218486
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/aarch64/aarch64.md26
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.target/aarch64/bics_3.c69
4 files changed, 106 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f01a99f..7591ec7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2014-12-08 Alex Velenko <Alex.Velenko@arm.com>
+
+ * config/aarch64/aarch64.md (and_one_cmpl<mode>3_compare0_no_reuse):
+ New define_insn.
+ * (and_one_cmpl_<SHIFT:optab><mode>3_compare0_no_reuse):
+ Likewise.
+
2014-12-08 Felix Yang <felix.yang@huawei.com>
Haijian Zhang <z.zhanghaijian@huawei.com>
Jiji Jiang <jiangjiji@huawei.com>
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index 97c1dff..1bbcc7b 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -3058,6 +3058,18 @@
[(set_attr "type" "logics_reg")]
)
+(define_insn "*and_one_cmpl<mode>3_compare0_no_reuse"
+ [(set (reg:CC_NZ CC_REGNUM)
+ (compare:CC_NZ
+ (and:GPI (not:GPI
+ (match_operand:GPI 0 "register_operand" "r"))
+ (match_operand:GPI 1 "register_operand" "r"))
+ (const_int 0)))]
+ ""
+ "bics\\t<w>zr, %<w>1, %<w>0"
+ [(set_attr "type" "logics_reg")]
+)
+
(define_insn "*<LOGICAL:optab>_one_cmpl_<SHIFT:optab><mode>3"
[(set (match_operand:GPI 0 "register_operand" "=r")
(LOGICAL:GPI (not:GPI
@@ -3107,6 +3119,20 @@
[(set_attr "type" "logics_shift_imm")]
)
+(define_insn "*and_one_cmpl_<SHIFT:optab><mode>3_compare0_no_reuse"
+ [(set (reg:CC_NZ CC_REGNUM)
+ (compare:CC_NZ
+ (and:GPI (not:GPI
+ (SHIFT:GPI
+ (match_operand:GPI 0 "register_operand" "r")
+ (match_operand:QI 1 "aarch64_shift_imm_<mode>" "n")))
+ (match_operand:GPI 2 "register_operand" "r"))
+ (const_int 0)))]
+ ""
+ "bics\\t<w>zr, %<w>2, %<w>0, <SHIFT:shift> %1"
+ [(set_attr "type" "logics_shift_imm")]
+)
+
(define_insn "clz<mode>2"
[(set (match_operand:GPI 0 "register_operand" "=r")
(clz:GPI (match_operand:GPI 1 "register_operand" "r")))]
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 11bfcb7..08289cc 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2014-12-08 Alex Velenko <Alex.Velenko@arm.com>
+
+ * gcc.target/aarch64/bics_3.c : New testcase.
+
2014-12-08 Felix Yang <felix.yang@huawei.com>
Haijian Zhang <z.zhanghaijian@huawei.com>
Jiji Jiang <jiangjiji@huawei.com>
diff --git a/gcc/testsuite/gcc.target/aarch64/bics_3.c b/gcc/testsuite/gcc.target/aarch64/bics_3.c
new file mode 100644
index 0000000..ecb53e9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/bics_3.c
@@ -0,0 +1,69 @@
+/* { dg-do run } */
+/* { dg-options "-O2 --save-temps" } */
+
+extern void abort (void);
+
+int __attribute__ ((noinline))
+bics_si_test (int a, int b)
+{
+ if (a & ~b)
+ return 1;
+ else
+ return 0;
+}
+
+int __attribute__ ((noinline))
+bics_si_test2 (int a, int b)
+{
+ if (a & ~ (b << 2))
+ return 1;
+ else
+ return 0;
+}
+
+typedef long long s64;
+
+int __attribute__ ((noinline))
+bics_di_test (s64 a, s64 b)
+{
+ if (a & ~b)
+ return 1;
+ else
+ return 0;
+}
+
+int __attribute__ ((noinline))
+bics_di_test2 (s64 a, s64 b)
+{
+ if (a & ~(b << 2))
+ return 1;
+ else
+ return 0;
+}
+
+int
+main (void)
+{
+ int a = 5;
+ int b = 5;
+ int c = 20;
+ s64 d = 5;
+ s64 e = 5;
+ s64 f = 20;
+ if (bics_si_test (a, b))
+ abort ();
+ if (bics_si_test2 (c, b))
+ abort ();
+ if (bics_di_test (d, e))
+ abort ();
+ if (bics_di_test2 (f, e))
+ abort ();
+ return 0;
+}
+
+/* { dg-final { scan-assembler-times "bics\twzr, w\[0-9\]+, w\[0-9\]+" 2 } } */
+/* { dg-final { scan-assembler-times "bics\twzr, w\[0-9\]+, w\[0-9\]+, lsl 2" 1 } } */
+/* { dg-final { scan-assembler-times "bics\txzr, x\[0-9\]+, x\[0-9\]+" 2 } } */
+/* { dg-final { scan-assembler-times "bics\txzr, x\[0-9\]+, x\[0-9\]+, lsl 2" 1 } } */
+
+/* { dg-final { cleanup-saved-temps } } */