From: Uros Bizjak Date: Sun, 13 Jun 2010 08:51:51 +0000 (+0200) Subject: re PR target/44481 (__builtin_parity() causes ICE in trunc_int_for_mode()) X-Git-Tag: releases/gcc-4.3.6~453 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7c367eb6e50b51fe9901999de74425e3503f0467;p=thirdparty%2Fgcc.git 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: r160672 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 26aadfa1c8d1..f831d4544574 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2010-06-13 Uros Bizjak + + 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-08 Uros Bizjak * config/i386/i386.md (*movsi_1) : Use %a modifier diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 990c4715bc05..a523bc9923f6 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -76,14 +76,15 @@ (UNSPEC_TLSDESC 23) ; Other random patterns + (UNSPEC_EH_RETURN 29) (UNSPEC_SCAS 30) (UNSPEC_FNSTSW 31) (UNSPEC_SAHF 32) - (UNSPEC_FSTCW 33) - (UNSPEC_ADD_CARRY 34) - (UNSPEC_FLDCW 35) - (UNSPEC_REP 36) - (UNSPEC_EH_RETURN 37) + (UNSPEC_PARITY 33) + (UNSPEC_FSTCW 34) + (UNSPEC_ADD_CARRY 35) + (UNSPEC_FLDCW 36) + (UNSPEC_REP 37) (UNSPEC_LD_MPIC 38) ; load_macho_picbase (UNSPEC_TRUNC_NOOP 39) @@ -15474,7 +15475,8 @@ (define_insn_and_split "paritydi2_cmp" [(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:SI 1 "=&r")) (clobber (match_scratch:HI 2 "=Q"))] @@ -15487,7 +15489,7 @@ (clobber (reg:CC FLAGS_REG))]) (parallel [(set (reg:CC FLAGS_REG) - (parity:CC (match_dup 1))) + (unspec:CC [(match_dup 1)] UNSPEC_PARITY)) (clobber (match_dup 1)) (clobber (match_dup 2))])] { @@ -15523,7 +15525,8 @@ (define_insn_and_split "paritysi2_cmp" [(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:HI 1 "=&Q"))] "! TARGET_POPCNT" @@ -15535,7 +15538,7 @@ (clobber (reg:CC FLAGS_REG))]) (parallel [(set (reg:CC FLAGS_REG) - (parity:CC (match_dup 1))) + (unspec:CC [(match_dup 1)] UNSPEC_PARITY)) (clobber (match_dup 1))])] { operands[3] = gen_lowpart (HImode, operands[2]); @@ -15546,20 +15549,13 @@ (define_insn "*parityhi2_cmp" [(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"))] "! TARGET_POPCNT" "xor{b}\t{%h0, %b0|%b0, %h0}" [(set_attr "length" "2") (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. ;; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a646a165a3ea..44021f1cdd12 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-06-13 Uros Bizjak + + PR target/44481 + * gcc.target/i386/pr44481.c: New test. + 2010-05-27 Jason Merrill PR c++/43555 diff --git a/gcc/testsuite/gcc.target/i386/pr44481.c b/gcc/testsuite/gcc.target/i386/pr44481.c new file mode 100644 index 000000000000..701268b56560 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr44481.c @@ -0,0 +1,14 @@ +/* { 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); +}