mirror of
https://github.com/gcc-mirror/gcc.git
synced 2024-11-21 13:40:47 +00:00
AVR: target/114975 - Add combine-pattern for __parityqi2.
PR target/114975 gcc/ * config/avr/avr.md: Add combine pattern for 8-bit parity detection. gcc/testsuite/ * gcc.target/avr/pr114975-parity.c: New test.
This commit is contained in:
parent
c8f4bbb824
commit
41bc359c32
@ -8418,7 +8418,22 @@
|
||||
(set (match_dup 0)
|
||||
(reg:HI 24))])
|
||||
|
||||
(define_insn_and_split "*parityqihi2"
|
||||
(define_insn_and_split "*parityqihi2.1"
|
||||
[(set (match_operand:HI 0 "register_operand" "=r")
|
||||
(zero_extend:HI
|
||||
(parity:QI (match_operand:QI 1 "register_operand" "r"))))
|
||||
(clobber (reg:HI 24))]
|
||||
"!reload_completed"
|
||||
{ gcc_unreachable(); }
|
||||
"&& 1"
|
||||
[(set (reg:QI 24)
|
||||
(match_dup 1))
|
||||
(set (reg:HI 24)
|
||||
(zero_extend:HI (parity:QI (reg:QI 24))))
|
||||
(set (match_dup 0)
|
||||
(reg:HI 24))])
|
||||
|
||||
(define_insn_and_split "*parityqihi2.2"
|
||||
[(set (match_operand:HI 0 "register_operand" "=r")
|
||||
(parity:HI (match_operand:QI 1 "register_operand" "r")))
|
||||
(clobber (reg:HI 24))]
|
||||
|
17
gcc/testsuite/gcc.target/avr/pr114975-parity.c
Normal file
17
gcc/testsuite/gcc.target/avr/pr114975-parity.c
Normal file
@ -0,0 +1,17 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-additional-options "-Os" } */
|
||||
|
||||
typedef __UINT8_TYPE__ uint8_t;
|
||||
|
||||
uint8_t use_pary1 (int y, uint8_t x)
|
||||
{
|
||||
return 1 + __builtin_parity (x);
|
||||
}
|
||||
|
||||
uint8_t use_pary2 (uint8_t x)
|
||||
{
|
||||
x += 1;
|
||||
return 1 - __builtin_parity (x);
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler-times "__parityqi2" 2 } } */
|
Loading…
Reference in New Issue
Block a user