Commit 84be6032 by Alan Lawrence Committed by Alan Lawrence

[AArch64 3/3] Fix XOR_one_cmpl pattern; add SIMD-reg variants for BIC,ORN,EON

gcc/:

	* config/aarch64/aarch64.c (<LOGICAL:optab>_one_cmpl<mode>3):
	Reparameterize to...
	(<NLOGICAL:optab>_one_cmpl<mode>3): with extra SIMD-register variant.
	(xor_one_cmpl<mode>3): New define_insn_and_split.

	* config/aarch64/iterators.md (NLOGICAL): New define_code_iterator.

gcc/testsuite/:

	* gcc.target/aarch64/eon_1.c: New test.

From-SVN: r218961
parent fe82d1f2
2014-12-19 Alan Lawrence <alan.lawrence@arm.com> 2014-12-19 Alan Lawrence <alan.lawrence@arm.com>
* config/aarch64/aarch64.c (<LOGICAL:optab>_one_cmpl<mode>3):
Reparameterize to...
(<NLOGICAL:optab>_one_cmpl<mode>3): with extra SIMD-register variant.
(xor_one_cmpl<mode>3): New define_insn_and_split.
* config/aarch64/iterators.md (NLOGICAL): New define_code_iterator.
2014-12-19 Alan Lawrence <alan.lawrence@arm.com>
* config/aarch64/aarch64.md (<optab><mode>3, one_cmpl<mode>2): * config/aarch64/aarch64.md (<optab><mode>3, one_cmpl<mode>2):
Add SIMD-register variant. Add SIMD-register variant.
* config/aarch64/iterators.md (Vbtype): Add value for SI. * config/aarch64/iterators.md (Vbtype): Add value for SI.
...@@ -3015,14 +3015,36 @@ ...@@ -3015,14 +3015,36 @@
[(set_attr "type" "logic_shift_imm")] [(set_attr "type" "logic_shift_imm")]
) )
(define_insn "*<LOGICAL:optab>_one_cmpl<mode>3" ;; Binary logical operators negating one operand, i.e. (a & !b), (a | !b).
[(set (match_operand:GPI 0 "register_operand" "=r")
(LOGICAL:GPI (not:GPI (define_insn "*<NLOGICAL:optab>_one_cmpl<mode>3"
(match_operand:GPI 1 "register_operand" "r")) [(set (match_operand:GPI 0 "register_operand" "=r,w")
(match_operand:GPI 2 "register_operand" "r")))] (NLOGICAL:GPI (not:GPI (match_operand:GPI 1 "register_operand" "r,w"))
(match_operand:GPI 2 "register_operand" "r,w")))]
""
"@
<NLOGICAL:nlogical>\\t%<w>0, %<w>2, %<w>1
<NLOGICAL:nlogical>\\t%0.<Vbtype>, %2.<Vbtype>, %1.<Vbtype>"
[(set_attr "type" "logic_reg,neon_logic")
(set_attr "simd" "*,yes")]
)
;; (xor (not a) b) is simplify_rtx-ed down to (not (xor a b)).
;; eon does not operate on SIMD registers so the vector variant must be split.
(define_insn_and_split "*xor_one_cmpl<mode>3"
[(set (match_operand:GPI 0 "register_operand" "=r,w")
(not:GPI (xor:GPI (match_operand:GPI 1 "register_operand" "r,?w")
(match_operand:GPI 2 "register_operand" "r,w"))))]
""
"eon\\t%<w>0, %<w>1, %<w>2" ;; For GPR registers (only).
"reload_completed && (which_alternative == 1)" ;; For SIMD registers.
[(set (match_operand:GPI 0 "register_operand" "=w")
(xor:GPI (match_operand:GPI 1 "register_operand" "w")
(match_operand:GPI 2 "register_operand" "w")))
(set (match_dup 0) (not:GPI (match_dup 0)))]
"" ""
"<LOGICAL:nlogical>\\t%<w>0, %<w>2, %<w>1" [(set_attr "type" "logic_reg,multiple")
[(set_attr "type" "logic_reg")] (set_attr "simd" "*,yes")]
) )
(define_insn "*and_one_cmpl<mode>3_compare0" (define_insn "*and_one_cmpl<mode>3_compare0"
......
...@@ -665,6 +665,9 @@ ...@@ -665,6 +665,9 @@
;; Code iterator for logical operations ;; Code iterator for logical operations
(define_code_iterator LOGICAL [and ior xor]) (define_code_iterator LOGICAL [and ior xor])
;; Code iterator for logical operations whose :nlogical works on SIMD registers.
(define_code_iterator NLOGICAL [and ior])
;; Code iterator for sign/zero extension ;; Code iterator for sign/zero extension
(define_code_iterator ANY_EXTEND [sign_extend zero_extend]) (define_code_iterator ANY_EXTEND [sign_extend zero_extend])
......
2014-12-19 Alan Lawrence <alan.lawrence@arm.com>
* gcc.target/aarch64/eon_1.c: New test.
2014-12-19 Paolo Carlini <paolo.carlini@oracle.com> 2014-12-19 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/60493 PR c++/60493
......
/* { dg-do compile } */
/* { dg-options "-O2" } */
/* { dg-final { scan-assembler-not "\tf?mov\t" } } */
typedef long long int64_t;
typedef int64_t int64x1_t __attribute__ ((__vector_size__ (8)));
/* { dg-final { scan-assembler-times "\\teon\\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+" 1 } } */
int64_t
test_eon (int64_t a, int64_t b)
{
return a ^ ~b;
}
/* { dg-final { scan-assembler-times "\\tmvn\\tx\[0-9\]+, x\[0-9\]+" 1 } } */
int64_t
test_not (int64_t a)
{
return ~a;
}
/* There is no eon for SIMD regs; we prefer eor+mvn to mov+mov+eon+mov. */
/* { dg-final { scan-assembler-times "\\teor\\tv\[0-9\]+\.8b, v\[0-9\]+\.8b, v\[0-9\]+\.8b" 1 } } */
/* { dg-final { scan-assembler-times "\\tmvn\\tv\[0-9\]+\.8b, v\[0-9\]+\.8b" 2 } } */
int64x1_t
test_vec_eon (int64x1_t a, int64x1_t b)
{
return a ^ ~b;
}
int64x1_t
test_vec_not (int64x1_t a)
{
return ~a;
}
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