Commit b79a08f6 by Uros Bizjak

re PR target/44481 (__builtin_parity() causes ICE in trunc_int_for_mode())

	PR target/44481
	* config/i386/i386.md (UNSPEC_PARITY): New unspec.
	(paritydi2_cmp): Use UNSPEC_PARITY unspec insted of parity RTX.
	(partiysi2_cmp): Ditto.
	(*partiyhi2_cmp): Ditto.
	(*parityqi2_cmp): Remove.

testsuite/ChangeLog:

	PR target/44481
	* gcc.target/i386/pr44481.c: New test.

From-SVN: r160638
parent d5568f03
2010-06-11 Uros Bizjak <ubizjak@gmail.com>
PR target/44481
* config/i386/i386.md (UNSPEC_PARITY): New unspec.
(paritydi2_cmp): Use UNSPEC_PARITY unspec insted of parity RTX.
(partiysi2_cmp): Ditto.
(*partiyhi2_cmp): Ditto.
(*parityqi2_cmp): Remove.
2010-06-11 Jan Hubicka <jh@suse.cz> 2010-06-11 Jan Hubicka <jh@suse.cz>
* bitmap.h (+bmp_iter_next_bit): New. * bitmap.h (bmp_iter_next_bit): New.
(bmp_iter_set, bmp_iter_and, bmp_iter_and_compl): (bmp_iter_set, bmp_iter_and, bmp_iter_and_compl): Use it.
Use it.
2010-06-11 Sandra Loosemore <sandra@codesourcery.com> 2010-06-11 Sandra Loosemore <sandra@codesourcery.com>
Eric Botcazou <ebotcazou@adacore.com> Eric Botcazou <ebotcazou@adacore.com>
......
...@@ -97,6 +97,7 @@ ...@@ -97,6 +97,7 @@
UNSPEC_SCAS UNSPEC_SCAS
UNSPEC_FNSTSW UNSPEC_FNSTSW
UNSPEC_SAHF UNSPEC_SAHF
UNSPEC_PARITY
UNSPEC_FSTCW UNSPEC_FSTCW
UNSPEC_ADD_CARRY UNSPEC_ADD_CARRY
UNSPEC_FLDCW UNSPEC_FLDCW
...@@ -12186,7 +12187,8 @@ ...@@ -12186,7 +12187,8 @@
(define_insn_and_split "paritydi2_cmp" (define_insn_and_split "paritydi2_cmp"
[(set (reg:CC FLAGS_REG) [(set (reg:CC FLAGS_REG)
(parity:CC (match_operand:DI 3 "register_operand" "0"))) (unspec:CC [(match_operand:DI 3 "register_operand" "0")]
UNSPEC_PARITY))
(clobber (match_scratch:DI 0 "=r")) (clobber (match_scratch:DI 0 "=r"))
(clobber (match_scratch:SI 1 "=&r")) (clobber (match_scratch:SI 1 "=&r"))
(clobber (match_scratch:HI 2 "=Q"))] (clobber (match_scratch:HI 2 "=Q"))]
...@@ -12199,7 +12201,7 @@ ...@@ -12199,7 +12201,7 @@
(clobber (reg:CC FLAGS_REG))]) (clobber (reg:CC FLAGS_REG))])
(parallel (parallel
[(set (reg:CC FLAGS_REG) [(set (reg:CC FLAGS_REG)
(parity:CC (match_dup 1))) (unspec:CC [(match_dup 1)] UNSPEC_PARITY))
(clobber (match_dup 1)) (clobber (match_dup 1))
(clobber (match_dup 2))])] (clobber (match_dup 2))])]
{ {
...@@ -12216,7 +12218,8 @@ ...@@ -12216,7 +12218,8 @@
(define_insn_and_split "paritysi2_cmp" (define_insn_and_split "paritysi2_cmp"
[(set (reg:CC FLAGS_REG) [(set (reg:CC FLAGS_REG)
(parity:CC (match_operand:SI 2 "register_operand" "0"))) (unspec:CC [(match_operand:SI 2 "register_operand" "0")]
UNSPEC_PARITY))
(clobber (match_scratch:SI 0 "=r")) (clobber (match_scratch:SI 0 "=r"))
(clobber (match_scratch:HI 1 "=&Q"))] (clobber (match_scratch:HI 1 "=&Q"))]
"! TARGET_POPCNT" "! TARGET_POPCNT"
...@@ -12228,7 +12231,7 @@ ...@@ -12228,7 +12231,7 @@
(clobber (reg:CC FLAGS_REG))]) (clobber (reg:CC FLAGS_REG))])
(parallel (parallel
[(set (reg:CC FLAGS_REG) [(set (reg:CC FLAGS_REG)
(parity:CC (match_dup 1))) (unspec:CC [(match_dup 1)] UNSPEC_PARITY))
(clobber (match_dup 1))])] (clobber (match_dup 1))])]
{ {
operands[3] = gen_lowpart (HImode, operands[2]); operands[3] = gen_lowpart (HImode, operands[2]);
...@@ -12239,21 +12242,14 @@ ...@@ -12239,21 +12242,14 @@
(define_insn "*parityhi2_cmp" (define_insn "*parityhi2_cmp"
[(set (reg:CC FLAGS_REG) [(set (reg:CC FLAGS_REG)
(parity:CC (match_operand:HI 1 "register_operand" "0"))) (unspec:CC [(match_operand:HI 1 "register_operand" "0")]
UNSPEC_PARITY))
(clobber (match_scratch:HI 0 "=Q"))] (clobber (match_scratch:HI 0 "=Q"))]
"! TARGET_POPCNT" "! TARGET_POPCNT"
"xor{b}\t{%h0, %b0|%b0, %h0}" "xor{b}\t{%h0, %b0|%b0, %h0}"
[(set_attr "length" "2") [(set_attr "length" "2")
(set_attr "mode" "HI")]) (set_attr "mode" "HI")])
(define_insn "*parityqi2_cmp"
[(set (reg:CC FLAGS_REG)
(parity:CC (match_operand:QI 0 "register_operand" "q")))]
"! TARGET_POPCNT"
"test{b}\t%0, %0"
[(set_attr "length" "2")
(set_attr "mode" "QI")])
;; Thread-local storage patterns for ELF. ;; Thread-local storage patterns for ELF.
;; ;;
;; Note that these code sequences must appear exactly as shown ;; Note that these code sequences must appear exactly as shown
......
2010-06-11 Uros Bizjak <ubizjak@gmail.com>
PR target/44481
* gcc.target/i386/pr44481.c: New test.
2010-06-11 Eric Botcazou <ebotcazou@adacore.com> 2010-06-11 Eric Botcazou <ebotcazou@adacore.com>
* gcc.dg/pr42461.c: Compile at -O2 instead of -O. * gcc.dg/pr42461.c: Compile at -O2 instead of -O.
......
/* { dg-do compile } */
/* { dg-options "-O2" } */
static inline unsigned
parity (unsigned x)
{
return (unsigned) __builtin_parity (x);
}
unsigned
f (unsigned rpoly)
{
return parity (rpoly & 1) ^ parity (rpoly & 6);
}
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