[Bug target/48803] New: arm: Bad assembler produced by bit extract/shift

2011-04-28 Thread david.gilbert at linaro dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48803

   Summary: arm: Bad assembler produced by bit extract/shift
   Product: gcc
   Version: 4.5.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: david.gilb...@linaro.org


Created attachment 24123
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24123
Produces bad assembler

This was originally reported as Linaro-gcc bug in Launchpad here:
https://bugs.launchpad.net/gcc-linaro/+bug/771903

The attached small test case fails with the assembler error:
gcc -O3 arm_bit_extract.c
/tmp/ccOOK26S.s: Assembler messages:
/tmp/ccOOK26S.s:97: Error: bit-field extends past end of register -- `ubfx
r0,r0,#30,#10'

when compiled -O3 for ARMv7 on Ubuntu's gcc 4.5.2-8ubuntu1.
I'm told it also fails on vanilla 4.5.2

The shift that the source is trying to do is a bit bogus, however it shouldn't
produce bad assembler.

Dave


[Bug target/48126] arm_output_sync_loop: misplaced memory barrier, missing clrex / dummy strex

2011-06-22 Thread david.gilbert at linaro dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48126

Dr. David Alan Gilbert  changed:

   What|Removed |Added

 CC||david.gilbert at linaro dot
   ||org

--- Comment #5 from Dr. David Alan Gilbert  
2011-06-22 16:40:07 UTC ---
Michael:
I think I agree with you on the need for the barrier in the branch out case;
gcc's info page (section 6.49 'Built-in functions for atomic memory access')
state:

-
 In most cases, these builtins are considered a "full barrier".  That
is, no memory operand will be moved across the operation, either
forward or backward.  Further, instructions will be issued as necessary
to prevent the processor from speculating loads across the operation
and from queuing stores after the operation.
--

so it does look like that last barrier would be needed to stop a subsequent
load floating backwards before the ldrex.

If I understand correctly however most cases wouldn't need it - I think most
cases are use the compare&swap to take some form of lock, and then once you
know you have the lock go and do your accesses - and in that case the ordering
is guaranteed, where as if you couldn't take the lock you wouldn't use the
subsequent access anyway.


Dave