mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Zwane Mwaikambo <zwane@arm.linux.org.uk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH][2.6] constant_test_bit doesn't like my gcc
Date: Wed, 15 Oct 2003 21:10:12 -0700	[thread overview]
Message-ID: <20031015211012.5daac8fc.akpm@osdl.org> (raw)
In-Reply-To: <Pine.LNX.4.53.0310152244330.2328@montezuma.fsmlabs.com>

Zwane Mwaikambo <zwane@arm.linux.org.uk> wrote:
>
>  cpu_has_foo and friends don't work at all with my gcc 3.2.2-5 and i'm 
>  branching off into all sorts of tests (which is another story...). i also 
>  took the liberty of removing the const volatile...

The volatile is rather important.


static inline int constant_test_bit(int nr, const unsigned long *addr)
{
        return ((1UL << (nr & 31)) & (((const unsigned long *) addr)[nr >> 5])) != 0;
}

foo(unsigned long *p)
{
        while (constant_test_bit(0, p))
                ;
}


        .file   "a.c"
        .text
        .align 2
        .p2align 2,,3
.globl foo
        .type   foo,@function
foo:
        pushl   %ebp
        movl    %esp, %ebp
        movl    8(%ebp), %eax
        testb   $1, (%eax)
        .p2align 2,,3
.L2:
        jne     .L2
        leave
        ret
.Lfe1:
        .size   foo,.Lfe1-foo
        .ident  "GCC: (GNU) 3.2 20020903 (Red Hat Linux 8.0 3.2-7)"


See, the little busywait loop doesn't reevaluate the test each time around:
it locks up instead.


  reply	other threads:[~2003-10-16  4:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-16  3:13 Zwane Mwaikambo
2003-10-16  4:10 ` Andrew Morton [this message]
2003-10-16  4:12   ` Zwane Mwaikambo
2003-10-16  4:21     ` Andrew Morton
2003-10-16  4:22       ` Zwane Mwaikambo
2003-10-16 10:55         ` Ingo Oeser
2003-10-16 14:55           ` Andrew Morton
2003-10-16 21:58           ` bill davidsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20031015211012.5daac8fc.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zwane@arm.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®