Commit cd8fc5ee by Alex Velenko Committed by Alex Velenko

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
parent 942f7f5a
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>
......@@ -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")))]
......
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>
......
/* { 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 } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment