From: Alex Velenko Date: Mon, 8 Dec 2014 18:10:39 +0000 (+0000) Subject: Bics instruction generation for aarch64 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cd8fc5ee0ded4801780f1998cd9025011abad152;p=gcc.git Bics instruction generation for aarch64 gcc/ * config/aarch64/aarch64.md (and_one_cmpl3_compare0_no_reuse): New define_insn. * (and_one_cmpl_3_compare0_no_reuse): Likewise. gcc/testsuite/ * gcc.target/aarch64/bics_3.c : New testcase. From-SVN: r218486 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f01a99fd2d5..7591ec7ee17 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2014-12-08 Alex Velenko + + * config/aarch64/aarch64.md (and_one_cmpl3_compare0_no_reuse): + New define_insn. + * (and_one_cmpl_3_compare0_no_reuse): + Likewise. + 2014-12-08 Felix Yang Haijian Zhang Jiji Jiang diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 97c1dff2ed6..1bbcc7bd567 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_cmpl3_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\\tzr, %1, %0" + [(set_attr "type" "logics_reg")] +) + (define_insn "*_one_cmpl_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_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_" "n"))) + (match_operand:GPI 2 "register_operand" "r")) + (const_int 0)))] + "" + "bics\\tzr, %2, %0, %1" + [(set_attr "type" "logics_shift_imm")] +) + (define_insn "clz2" [(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 11bfcb7580a..08289cca091 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2014-12-08 Alex Velenko + + * gcc.target/aarch64/bics_3.c : New testcase. + 2014-12-08 Felix Yang Haijian Zhang Jiji Jiang 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 00000000000..ecb53e9d8ba --- /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 } } */