-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Labels
Description
| Bugzilla Link | 3701 |
| Resolution | FIXED |
| Resolved on | Mar 05, 2009 16:38 |
| Version | 1.0 |
| OS | FreeBSD |
| Attachments | test case, generated asm |
| Reporter | LLVM Bugzilla Contributor |
| CC | @EdSchouten,@efriedma-quic,@sunfishcode,@pwo |
Extended Description
hi.. when compiling the attached test case I am getting attached asm output. here's a snippet of it:
if (pq->curr == xfer) { /* we are currently scheduled for callback */ USB_BUS_UNLOCK(xfer->xroot->bus); return (1); } /* we are not pending */ USB_BUS_UNLOCK(xfer->xroot->bus); return (0);(in the actual test case this is run through ccc -E so it's expanded)
this is translated to this asm via "ccc -O2 -S -ffreestanding usb.c" (note that the -O2 is important) to this (snippet):
(1) cmpq %rbx, 56(%rax) #APP movl %fs:0,%rax #NO_APP movq 104(%rbx), %rcx movq 296(%rcx), %rcx movl $4, %edx #APP (2) lock ; cmpxchgl %edx,736(%rcx) ; sete %al ; 1: # atomic_cmpset_int</ASM code>
note that the result of the cmpq at (1) is never used. and this cmpq corresponds to the "if (pq->curr == xfer)" above. thus 1 is always returned.