This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

-fno-tree-cselim not working?


With yesterday's SVN sources, the following source produces the same
result with -ftree-cselim and -fno-tree-cselim on x86:

#include <pthread.h>

static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
static int acquires_count = 0;

int
trylock()
{
  int res;

  res = pthread_mutex_trylock(&mutex);
  if (res == 0)
    ++acquires_count;

  return res;
}

trylock:
        subl    $12, %esp
        movl    $mutex, (%esp)
        call    pthread_mutex_trylock
        movl    acquires_count, %edx
        cmpl    $1, %eax
        adcl    $0, %edx
        movl    %edx, acquires_count
        addl    $12, %esp
        ret

Shouldn't the conditional store be preserved when -fno-tree-cselim is
set?

  Sam
-- 
Samuel Tardieu -- sam@rfc1149.net -- http://www.rfc1149.net/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]