From: Uros Bizjak Date: Thu, 11 Jun 2009 20:59:16 +0000 (+0200) Subject: backport: re PR target/38222 (gcc.target/i386/sse4_2-popcntl.c fails on i686-apple... X-Git-Tag: releases/gcc-4.3.4~136 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=148c60d70b8e7352e30cc2fdc6d619d589a7f3f1;p=thirdparty%2Fgcc.git backport: re PR target/38222 (gcc.target/i386/sse4_2-popcntl.c fails on i686-apple-darwin9) Backport from mainline: 2008-11-22 Uros Bizjak PR target/38222 * config/i386/i386.md (SWI248): New mode iterator. (popcount2): Rename from popcounthi2, popcountsi2 and popcounthi2 insn patterns. Macroize pattern using SWI248 mode iterator. Generate popcnt mnemonic without mode extensions for Darwin x86 targets. (*popcount2_cmp): Ditto. (*popcountsi2_cmp_zext): Generate popcnt mnemonic without mode extensions for Darwin x86 targets. From-SVN: r148397 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 417bc039f494..546a2051553f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2009-06-11 Uros Bizjak + + Backport from mainline: + 2008-11-22 Uros Bizjak + + PR target/38222 + * config/i386/i386.md (SWI248): New mode iterator. + (popcount2): Rename from popcounthi2, popcountsi2 and + popcounthi2 insn patterns. Macroize pattern using SWI248 mode + iterator. Generate popcnt mnemonic without mode extensions + for Darwin x86 targets. + (*popcount2_cmp): Ditto. + (*popcountsi2_cmp_zext): Generate popcnt mnemonic without mode + extensions for Darwin x86 targets. + + 2009-05-26 Richard Guenther Backport from mainline diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 69630d209942..ceb212ad6b9e 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -530,6 +530,9 @@ ;; All single word integer modes. (define_mode_iterator SWI [QI HI SI (DI "TARGET_64BIT")]) +;; Single word integer modes without QImode. +(define_mode_iterator SWI248 [HI SI (DI "TARGET_64BIT")]) + ;; Instruction suffix for integer modes. (define_mode_attr imodesuffix [(QI "b") (HI "w") (SI "l") (DI "q")]) @@ -15246,28 +15249,42 @@ [(set_attr "prefix_0f" "1") (set_attr "mode" "SI")]) -(define_insn "popcountsi2" - [(set (match_operand:SI 0 "register_operand" "=r") - (popcount:SI (match_operand:SI 1 "nonimmediate_operand" "rm"))) +(define_insn "popcount2" + [(set (match_operand:SWI248 0 "register_operand" "=r") + (popcount:SWI248 + (match_operand:SWI248 1 "nonimmediate_operand" "rm"))) (clobber (reg:CC FLAGS_REG))] "TARGET_POPCNT" - "popcnt{l}\t{%1, %0|%0, %1}" +{ +#if TARGET_MACHO + return "popcnt\t{%1, %0|%0, %1}"; +#else + return "popcnt{}\t{%1, %0|%0, %1}"; +#endif +} [(set_attr "prefix_rep" "1") (set_attr "type" "bitmanip") - (set_attr "mode" "SI")]) + (set_attr "mode" "")]) -(define_insn "*popcountsi2_cmp" +(define_insn "*popcount2_cmp" [(set (reg FLAGS_REG) (compare - (popcount:SI (match_operand:SI 1 "nonimmediate_operand" "rm")) + (popcount:SWI248 + (match_operand:SWI248 1 "nonimmediate_operand" "rm")) (const_int 0))) - (set (match_operand:SI 0 "register_operand" "=r") - (popcount:SI (match_dup 1)))] + (set (match_operand:SWI248 0 "register_operand" "=r") + (popcount:SWI248 (match_dup 1)))] "TARGET_POPCNT && ix86_match_ccmode (insn, CCZmode)" - "popcnt{l}\t{%1, %0|%0, %1}" +{ +#if TARGET_MACHO + return "popcnt\t{%1, %0|%0, %1}"; +#else + return "popcnt{}\t{%1, %0|%0, %1}"; +#endif +} [(set_attr "prefix_rep" "1") (set_attr "type" "bitmanip") - (set_attr "mode" "SI")]) + (set_attr "mode" "")]) (define_insn "*popcountsi2_cmp_zext" [(set (reg FLAGS_REG) @@ -15277,7 +15294,13 @@ (set (match_operand:DI 0 "register_operand" "=r") (zero_extend:DI(popcount:SI (match_dup 1))))] "TARGET_64BIT && TARGET_POPCNT && ix86_match_ccmode (insn, CCZmode)" - "popcnt{l}\t{%1, %0|%0, %1}" +{ +#if TARGET_MACHO + return "popcnt\t{%1, %0|%0, %1}"; +#else + return "popcnt{}\t{%1, %0|%0, %1}"; +#endif +} [(set_attr "prefix_rep" "1") (set_attr "type" "bitmanip") (set_attr "mode" "SI")]) @@ -15373,29 +15396,6 @@ [(set_attr "prefix_0f" "1") (set_attr "mode" "DI")]) -(define_insn "popcountdi2" - [(set (match_operand:DI 0 "register_operand" "=r") - (popcount:DI (match_operand:DI 1 "nonimmediate_operand" "rm"))) - (clobber (reg:CC FLAGS_REG))] - "TARGET_64BIT && TARGET_POPCNT" - "popcnt{q}\t{%1, %0|%0, %1}" - [(set_attr "prefix_rep" "1") - (set_attr "type" "bitmanip") - (set_attr "mode" "DI")]) - -(define_insn "*popcountdi2_cmp" - [(set (reg FLAGS_REG) - (compare - (popcount:DI (match_operand:DI 1 "nonimmediate_operand" "rm")) - (const_int 0))) - (set (match_operand:DI 0 "register_operand" "=r") - (popcount:DI (match_dup 1)))] - "TARGET_64BIT && TARGET_POPCNT && ix86_match_ccmode (insn, CCZmode)" - "popcnt{q}\t{%1, %0|%0, %1}" - [(set_attr "prefix_rep" "1") - (set_attr "type" "bitmanip") - (set_attr "mode" "DI")]) - (define_expand "clzhi2" [(parallel [(set (match_operand:HI 0 "register_operand" "") @@ -15434,29 +15434,6 @@ [(set_attr "prefix_0f" "1") (set_attr "mode" "HI")]) -(define_insn "popcounthi2" - [(set (match_operand:HI 0 "register_operand" "=r") - (popcount:HI (match_operand:HI 1 "nonimmediate_operand" "rm"))) - (clobber (reg:CC FLAGS_REG))] - "TARGET_POPCNT" - "popcnt{w}\t{%1, %0|%0, %1}" - [(set_attr "prefix_rep" "1") - (set_attr "type" "bitmanip") - (set_attr "mode" "HI")]) - -(define_insn "*popcounthi2_cmp" - [(set (reg FLAGS_REG) - (compare - (popcount:HI (match_operand:HI 1 "nonimmediate_operand" "rm")) - (const_int 0))) - (set (match_operand:HI 0 "register_operand" "=r") - (popcount:HI (match_dup 1)))] - "TARGET_POPCNT && ix86_match_ccmode (insn, CCZmode)" - "popcnt{w}\t{%1, %0|%0, %1}" - [(set_attr "prefix_rep" "1") - (set_attr "type" "bitmanip") - (set_attr "mode" "HI")]) - (define_expand "paritydi2" [(set (match_operand:DI 0 "register_operand" "") (parity:DI (match_operand:DI 1 "register_operand" "")))]