From: ro Date: Mon, 17 May 2010 20:28:56 +0000 (+0000) Subject: PR target/44074 X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=commitdiff_plain;h=fa1a750285740ce8a2a7f9e1278ed71e68105331 PR target/44074 * configure.ac (HAVE_AS_IX86_REP_LOCK_PREFIX): New test. * configure: Regenerate. * config.in: Regenerate. * config/i386/i386.c (print_operand) : Also print ; if !HAVE_AS_IX86_REP_LOCK_PREFIX. Don't emit whitespace. * config/i386/i386.md (*rep_movdi_rex64): Use {%;} after rep. (*rep_movsi): Likewise. (*rep_movsi_rex64): Likewise. (*rep_movqi): Likewise. (*rep_movqi_rex64): Likewise. (*rep_stosdi_rex64): Likewise. (*rep_stossi): Likewise. (*rep_stossi_rex64): Likewise. (*rep_stosqi): Likewise. (*rep_stosqi_rex64): Likewise. (*cmpstrnqi_nz_1): Use {%;} after repz. (*cmpstrnqi_nz_rex_1): Likewise. (*cmpstrnqi_1): Likewise. (*cmpstrnqi_rex_1): Likewise. (*strlenqi_1): Use {%;} after repnz. (*strlenqi_rex_1): Likewise. * config/i386/sync.md (memory_barrier_nosse): Replace {%;| } by {%;} . (*sync_compare_and_swap): Likewise. (sync_double_compare_and_swap): Likewise. (*sync_double_compare_and_swapdi_pic): Likewise. (sync_old_add): Likewise. (sync_add): Likewise. (sync_sub): Likewise. (sync_): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159512 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a7037602628..1e4e35d9fcd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,37 @@ +2010-05-17 Rainer Orth + + PR target/44074 + * configure.ac (HAVE_AS_IX86_REP_LOCK_PREFIX): New test. + * configure: Regenerate. + * config.in: Regenerate. + * config/i386/i386.c (print_operand) : Also print ; if + !HAVE_AS_IX86_REP_LOCK_PREFIX. + Don't emit whitespace. + * config/i386/i386.md (*rep_movdi_rex64): Use {%;} after rep. + (*rep_movsi): Likewise. + (*rep_movsi_rex64): Likewise. + (*rep_movqi): Likewise. + (*rep_movqi_rex64): Likewise. + (*rep_stosdi_rex64): Likewise. + (*rep_stossi): Likewise. + (*rep_stossi_rex64): Likewise. + (*rep_stosqi): Likewise. + (*rep_stosqi_rex64): Likewise. + (*cmpstrnqi_nz_1): Use {%;} after repz. + (*cmpstrnqi_nz_rex_1): Likewise. + (*cmpstrnqi_1): Likewise. + (*cmpstrnqi_rex_1): Likewise. + (*strlenqi_1): Use {%;} after repnz. + (*strlenqi_rex_1): Likewise. + * config/i386/sync.md (memory_barrier_nosse): Replace {%;| } by {%;} . + (*sync_compare_and_swap): Likewise. + (sync_double_compare_and_swap): Likewise. + (*sync_double_compare_and_swapdi_pic): Likewise. + (sync_old_add): Likewise. + (sync_add): Likewise. + (sync_sub): Likewise. + (sync_): Likewise. + 2010-05-17 Martin Jambor * cgraph.h (cgraph_indirect_call_info): New fields anc_offset, diff --git a/gcc/config.in b/gcc/config.in index 7b04bbcb856..64632e87407 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -309,6 +309,12 @@ #endif +/* Define true if the assembler supports 'rep , lock '. */ +#ifndef USED_FOR_TARGET +#undef HAVE_AS_IX86_REP_LOCK_PREFIX +#endif + + /* Define if your assembler supports the sahf mnemonic. */ #ifndef USED_FOR_TARGET #undef HAVE_AS_IX86_SAHF diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index b99586a52ae..a54651da4e7 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -12056,10 +12056,8 @@ print_operand (FILE *file, rtx x, int code) return; case ';': -#if TARGET_MACHO - fputs (" ; ", file); -#else - putc (' ', file); +#if TARGET_MACHO || !HAVE_AS_IX86_REP_LOCK_PREFIX + fputs (";", file); #endif return; diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index b98bce3ff98..35b2f215f28 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -15865,7 +15865,7 @@ (mem:BLK (match_dup 4))) (use (match_dup 5))] "TARGET_64BIT" - "rep movsq" + "rep{%;} movsq" [(set_attr "type" "str") (set_attr "prefix_rep" "1") (set_attr "memory" "both") @@ -15884,7 +15884,7 @@ (mem:BLK (match_dup 4))) (use (match_dup 5))] "!TARGET_64BIT" - "rep movs{l|d}" + "rep{%;} movs{l|d}" [(set_attr "type" "str") (set_attr "prefix_rep" "1") (set_attr "memory" "both") @@ -15903,7 +15903,7 @@ (mem:BLK (match_dup 4))) (use (match_dup 5))] "TARGET_64BIT" - "rep movs{l|d}" + "rep{%;} movs{l|d}" [(set_attr "type" "str") (set_attr "prefix_rep" "1") (set_attr "memory" "both") @@ -15920,7 +15920,7 @@ (mem:BLK (match_dup 4))) (use (match_dup 5))] "!TARGET_64BIT" - "rep movsb" + "rep{%;} movsb" [(set_attr "type" "str") (set_attr "prefix_rep" "1") (set_attr "memory" "both") @@ -15937,7 +15937,7 @@ (mem:BLK (match_dup 4))) (use (match_dup 5))] "TARGET_64BIT" - "rep movsb" + "rep{%;} movsb" [(set_attr "type" "str") (set_attr "prefix_rep" "1") (set_attr "memory" "both") @@ -16118,7 +16118,7 @@ (use (match_operand:DI 2 "register_operand" "a")) (use (match_dup 4))] "TARGET_64BIT" - "rep stosq" + "rep{%;} stosq" [(set_attr "type" "str") (set_attr "prefix_rep" "1") (set_attr "memory" "store") @@ -16135,7 +16135,7 @@ (use (match_operand:SI 2 "register_operand" "a")) (use (match_dup 4))] "!TARGET_64BIT" - "rep stos{l|d}" + "rep{%;} stos{l|d}" [(set_attr "type" "str") (set_attr "prefix_rep" "1") (set_attr "memory" "store") @@ -16152,7 +16152,7 @@ (use (match_operand:SI 2 "register_operand" "a")) (use (match_dup 4))] "TARGET_64BIT" - "rep stos{l|d}" + "rep{%;} stos{l|d}" [(set_attr "type" "str") (set_attr "prefix_rep" "1") (set_attr "memory" "store") @@ -16168,7 +16168,7 @@ (use (match_operand:QI 2 "register_operand" "a")) (use (match_dup 4))] "!TARGET_64BIT" - "rep stosb" + "rep{%;} stosb" [(set_attr "type" "str") (set_attr "prefix_rep" "1") (set_attr "memory" "store") @@ -16184,7 +16184,7 @@ (use (match_operand:QI 2 "register_operand" "a")) (use (match_dup 4))] "TARGET_64BIT" - "rep stosb" + "rep{%;} stosb" [(set_attr "type" "str") (set_attr "prefix_rep" "1") (set_attr "memory" "store") @@ -16300,7 +16300,7 @@ (clobber (match_operand:SI 1 "register_operand" "=D")) (clobber (match_operand:SI 2 "register_operand" "=c"))] "!TARGET_64BIT" - "repz cmpsb" + "repz{%;} cmpsb" [(set_attr "type" "str") (set_attr "mode" "QI") (set_attr "prefix_rep" "1")]) @@ -16315,7 +16315,7 @@ (clobber (match_operand:DI 1 "register_operand" "=D")) (clobber (match_operand:DI 2 "register_operand" "=c"))] "TARGET_64BIT" - "repz cmpsb" + "repz{%;} cmpsb" [(set_attr "type" "str") (set_attr "mode" "QI") (set_attr "prefix_rex" "0") @@ -16351,7 +16351,7 @@ (clobber (match_operand:SI 1 "register_operand" "=D")) (clobber (match_operand:SI 2 "register_operand" "=c"))] "!TARGET_64BIT" - "repz cmpsb" + "repz{%;} cmpsb" [(set_attr "type" "str") (set_attr "mode" "QI") (set_attr "prefix_rep" "1")]) @@ -16369,7 +16369,7 @@ (clobber (match_operand:DI 1 "register_operand" "=D")) (clobber (match_operand:DI 2 "register_operand" "=c"))] "TARGET_64BIT" - "repz cmpsb" + "repz{%;} cmpsb" [(set_attr "type" "str") (set_attr "mode" "QI") (set_attr "prefix_rex" "0") @@ -16417,7 +16417,7 @@ (clobber (match_operand:SI 1 "register_operand" "=D")) (clobber (reg:CC FLAGS_REG))] "!TARGET_64BIT" - "repnz scasb" + "repnz{%;} scasb" [(set_attr "type" "str") (set_attr "mode" "QI") (set_attr "prefix_rep" "1")]) @@ -16431,7 +16431,7 @@ (clobber (match_operand:DI 1 "register_operand" "=D")) (clobber (reg:CC FLAGS_REG))] "TARGET_64BIT" - "repnz scasb" + "repnz{%;} scasb" [(set_attr "type" "str") (set_attr "mode" "QI") (set_attr "prefix_rex" "0") diff --git a/gcc/config/i386/sync.md b/gcc/config/i386/sync.md index 0fb10bc972e..22f36487579 100644 --- a/gcc/config/i386/sync.md +++ b/gcc/config/i386/sync.md @@ -1,5 +1,5 @@ ;; GCC machine description for i386 synchronization instructions. -;; Copyright (C) 2005, 2006, 2007, 2008, 2009 +;; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 ;; Free Software Foundation, Inc. ;; ;; This file is part of GCC. @@ -47,7 +47,7 @@ (unspec:BLK [(match_dup 0)] UNSPEC_MFENCE)) (clobber (reg:CC FLAGS_REG))] "!(TARGET_64BIT || TARGET_SSE2)" - "lock{%;| }or{l}\t{$0, (%%esp)|DWORD PTR [esp], 0}" + "lock{%;} or{l}\t{$0, (%%esp)|DWORD PTR [esp], 0}" [(set_attr "memory" "unknown")]) ;; ??? It would be possible to use cmpxchg8b on pentium for DImode @@ -115,7 +115,7 @@ [(match_dup 1) (match_dup 2) (match_dup 3)] UNSPECV_CMPXCHG) (match_dup 2)))] "TARGET_CMPXCHG" - "lock{%;| }cmpxchg{}\t{%3, %1|%1, %3}") + "lock{%;} cmpxchg{}\t{%3, %1|%1, %3}") (define_insn "sync_double_compare_and_swap" [(set (match_operand:DCASMODE 0 "register_operand" "=A") @@ -134,7 +134,7 @@ UNSPECV_CMPXCHG) (match_dup 2)))] "" - "lock{%;| }cmpxchgb\t%1") + "lock{%;} cmpxchgb\t%1") ;; Theoretically we'd like to use constraint "r" (any reg) for operand ;; 3, but that includes ecx. If operand 3 and 4 are the same (like when @@ -162,7 +162,7 @@ UNSPECV_CMPXCHG) (match_dup 2)))] "!TARGET_64BIT && TARGET_CMPXCHG8B && flag_pic" - "xchg{l}\t%%ebx, %3\;lock{%;| }cmpxchg8b\t%1\;xchg{l}\t%%ebx, %3") + "xchg{l}\t%%ebx, %3\;lock{%;} cmpxchg8b\t%1\;xchg{l}\t%%ebx, %3") (define_insn "sync_old_add" [(set (match_operand:SWI 0 "register_operand" "=") @@ -173,7 +173,7 @@ (match_operand:SWI 2 "register_operand" "0"))) (clobber (reg:CC FLAGS_REG))] "TARGET_XADD" - "lock{%;| }xadd{}\t{%0, %1|%1, %0}") + "lock{%;} xadd{}\t{%0, %1|%1, %0}") ;; Recall that xchg implicitly sets LOCK#, so adding it again wastes space. (define_insn "sync_lock_test_and_set" @@ -197,15 +197,15 @@ if (TARGET_USE_INCDEC) { if (operands[1] == const1_rtx) - return "lock{%;| }inc{}\t%0"; + return "lock{%;} inc{}\t%0"; if (operands[1] == constm1_rtx) - return "lock{%;| }dec{}\t%0"; + return "lock{%;} dec{}\t%0"; } if (x86_maybe_negate_const_int (&operands[1], mode)) - return "lock{%;| }sub{}\t{%1, %0|%0, %1}"; + return "lock{%;} sub{}\t{%1, %0|%0, %1}"; - return "lock{%;| }add{}\t{%1, %0|%0, %1}"; + return "lock{%;} add{}\t{%1, %0|%0, %1}"; }) (define_insn "sync_sub" @@ -220,12 +220,12 @@ if (TARGET_USE_INCDEC) { if (operands[1] == const1_rtx) - return "lock{%;| }dec{}\t%0"; + return "lock{%;} dec{}\t%0"; if (operands[1] == constm1_rtx) - return "lock{%;| }inc{}\t%0"; + return "lock{%;} inc{}\t%0"; } - return "lock{%;| }sub{}\t{%1, %0|%0, %1}"; + return "lock{%;} sub{}\t{%1, %0|%0, %1}"; }) (define_insn "sync_" @@ -236,4 +236,4 @@ UNSPECV_LOCK)) (clobber (reg:CC FLAGS_REG))] "" - "lock{%;| }{}\t{%1, %0|%0, %1}") + "lock{%;} {}\t{%1, %0|%0, %1}") diff --git a/gcc/configure b/gcc/configure index 0f39e4ebfdc..2384f424917 100755 --- a/gcc/configure +++ b/gcc/configure @@ -23228,7 +23228,7 @@ $as_echo "#define HAVE_AS_IX86_DIFF_SECT_DELTA 1" >>confdefs.h fi - # This one is used unconditionally by i386.[ch]; it is to be defined + # These two are used unconditionally by i386.[ch]; it is to be defined # to 1 if the feature is present, 0 otherwise. { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for GOTOFF in data" >&5 $as_echo_n "checking assembler for GOTOFF in data... " >&6; } @@ -23269,6 +23269,40 @@ cat >>confdefs.h <<_ACEOF #define HAVE_AS_GOTOFF_IN_DATA `if test $gcc_cv_as_ix86_gotoff_in_data = yes; then echo 1; else echo 0; fi` _ACEOF + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for rep and lock prefix" >&5 +$as_echo_n "checking assembler for rep and lock prefix... " >&6; } +if test "${gcc_cv_as_ix86_rep_lock_prefix+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + gcc_cv_as_ix86_rep_lock_prefix=no + if test x$gcc_cv_as != x; then + echo 'rep movsl + lock orl $0, (%esp)' > conftest.s + if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } + then + gcc_cv_as_ix86_rep_lock_prefix=yes + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_ix86_rep_lock_prefix" >&5 +$as_echo "$gcc_cv_as_ix86_rep_lock_prefix" >&6; } + + +cat >>confdefs.h <<_ACEOF +#define HAVE_AS_IX86_REP_LOCK_PREFIX `if test $gcc_cv_as_ix86_rep_lock_prefix = yes; then echo 1; else echo 0; fi` +_ACEOF + + ;; ia64*-*-*) diff --git a/gcc/configure.ac b/gcc/configure.ac index 5c3a1e18c4f..743798e23cb 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -3276,7 +3276,7 @@ foo: nop [AC_DEFINE(HAVE_AS_IX86_DIFF_SECT_DELTA, 1, [Define if your assembler supports the subtraction of symbols in different sections.])]) - # This one is used unconditionally by i386.[ch]; it is to be defined + # These two are used unconditionally by i386.[ch]; it is to be defined # to 1 if the feature is present, 0 otherwise. gcc_GAS_CHECK_FEATURE([GOTOFF in data], gcc_cv_as_ix86_gotoff_in_data, [2,11,0],, @@ -3288,6 +3288,15 @@ foo: nop AC_DEFINE_UNQUOTED(HAVE_AS_GOTOFF_IN_DATA, [`if test $gcc_cv_as_ix86_gotoff_in_data = yes; then echo 1; else echo 0; fi`], [Define true if the assembler supports '.long foo@GOTOFF'.]) + + gcc_GAS_CHECK_FEATURE([rep and lock prefix], + gcc_cv_as_ix86_rep_lock_prefix,,, + [rep movsl + lock orl $0, (%esp)]) + AC_DEFINE_UNQUOTED(HAVE_AS_IX86_REP_LOCK_PREFIX, + [`if test $gcc_cv_as_ix86_rep_lock_prefix = yes; then echo 1; else echo 0; fi`], + [Define true if the assembler supports 'rep , lock '.]) + ;; ia64*-*-*)