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 -- [EMAIL PROTECTED] -- http://www.rfc1149.net/

Reply via email to