public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/35624]  New: ARM embeded assembly result error
@ 2008-03-18  9:04 rurality dot wq at gmail dot com
  2008-03-18  9:30 ` [Bug c/35624] " rurality dot wq at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: rurality dot wq at gmail dot com @ 2008-03-18  9:04 UTC (permalink / raw)
  To: gcc-bugs

command is as below.

arm-elf-gcc -v -save-temps -O2 -ffreestanding -c -msoft-float -nostdinc test.c

Using built-in specs.
Target: arm-elf
Configured with: ./configure --target=arm-elf
--prefix=/rdisk1/users/wangqiang/tool-chain --enable-interwork
--enable-multilib --with-float=soft --enable-languages=c,c++ --with-newlib
--with-headers=/rdisk1/users/wangqiang/software/src/newlib-1.14.0/newlib/libc/include
Thread model: single
gcc version 4.1.1
 /rdisk5/xgsoc/ExDB/ARM/ARM_GCC/tool-chain/bin/../libexec/gcc/arm-elf/4.1.1/cc1
-E -quiet -nostdinc -v -iprefix
/rdisk5/xgsoc/ExDB/ARM/ARM_GCC/tool-chain/bin/../lib/gcc/arm-elf/4.1.1/
-D__USES_INITFINI__ test.c -msoft-float -ffreestanding -O2 -fpch-preprocess -o
test.i
#include "..." search starts here:
#include <...> search starts here:
End of search list.
 /rdisk5/xgsoc/ExDB/ARM/ARM_GCC/tool-chain/bin/../libexec/gcc/arm-elf/4.1.1/cc1
-fpreprocessed test.i -quiet -dumpbase test.c -msoft-float -auxbase test -O2
-version -ffreestanding -o test.s
GNU C version 4.1.1 (arm-elf)
        compiled by GNU C version 2.96 20000731 (Red Hat Linux 7.3 2.96-113).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 3cdb4d57ef011d2fa661601e3cf86274

/rdisk5/xgsoc/ExDB/ARM/ARM_GCC/tool-chain/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-elf/bin/as
-mfloat-abi=soft -o test.o test.s

Source Code is as below.
test.c
#define burst_copy(dst,src,len) {\
  __asm__ __volatile__ ( \
 "1: \n\t" \
   "ldmia %1!,{r3-r6} \n\t" \
   "stmia %0!,{r3-r6} \n\t" \
   "subs %2, %2, #1 \n\t" \
   "bne 1b \n\t" \
   ::"r"(dst),"r"(src),"r"(len) \
   :"r3","r4","r5","r6"); \
}

int main() {
  burst_copy(0xFFFF0000,0xC0000000,0x8);
  burst_copy(0xFFFF2000,0xFFFF0000,0x8);
}

Problem:
the destination of first burst_copy is the source of the second.

but source of the second burst_copy will use the result of first,as 
0xFFFF0080,and no the Address(0xFFFF0000) I surposed to.


-- 
           Summary: ARM embeded assembly result error
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rurality dot wq at gmail dot com
 GCC build triplet: ./configure --target=arm-elf --
                    prefix=/rdisk1/users/wangqiang/to
  GCC host triplet: CentOS release 4.6 (Final)(Kernel 2.6.9-67.ELsmp on an
                    i686)
GCC target triplet: arm-elf


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35624


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c/35624] ARM embeded assembly result error
  2008-03-18  9:04 [Bug c/35624] New: ARM embeded assembly result error rurality dot wq at gmail dot com
@ 2008-03-18  9:30 ` rurality dot wq at gmail dot com
  2008-03-19  5:05 ` hp at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rurality dot wq at gmail dot com @ 2008-03-18  9:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rurality dot wq at gmail dot com  2008-03-18 09:29 -------
Created an attachment (id=15341)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15341&action=view)
C source code


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35624


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c/35624] ARM embeded assembly result error
  2008-03-18  9:04 [Bug c/35624] New: ARM embeded assembly result error rurality dot wq at gmail dot com
  2008-03-18  9:30 ` [Bug c/35624] " rurality dot wq at gmail dot com
@ 2008-03-19  5:05 ` hp at gcc dot gnu dot org
  2008-03-21  9:34 ` rurality dot wq at gmail dot com
  2008-12-16 17:41 ` [Bug target/35624] " rearnsha at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: hp at gcc dot gnu dot org @ 2008-03-19  5:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from hp at gcc dot gnu dot org  2008-03-19 05:04 -------
You're updating the source and destination register but marking them only as
input in the asm. That's invalid.  You trick GCC into believing that as it
hasn't changed, it can re-use the register with the source-address.


-- 

hp at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID
            Summary|ARM embeded assembly result |ARM embeded assembly result
                   |error                       |error


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35624


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c/35624] ARM embeded assembly result error
  2008-03-18  9:04 [Bug c/35624] New: ARM embeded assembly result error rurality dot wq at gmail dot com
  2008-03-18  9:30 ` [Bug c/35624] " rurality dot wq at gmail dot com
  2008-03-19  5:05 ` hp at gcc dot gnu dot org
@ 2008-03-21  9:34 ` rurality dot wq at gmail dot com
  2008-12-16 17:41 ` [Bug target/35624] " rearnsha at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: rurality dot wq at gmail dot com @ 2008-03-21  9:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rurality dot wq at gmail dot com  2008-03-21 09:33 -------
I modified the source as below.
It seems that It does not work.
I am not sure whether it is a bug.Or gcc can not treat this situation?
// copy 128 bit one time
 #define burst_copy(dst,src,len) {\
   __asm__ __volatile__ ( \
 "1: \n\t" \
   "ldmia %1!,{r3-r6} \n\t" \
   "stmia %0!,{r3-r6} \n\t" \
   "subs %2, %2, #1 \n\t" \
   "bne 1b \n\t" \
   ::"r"(dst),"r"(src),"r"(len) \
   :"%0", "%1" , "%2","r3","r4","r5","r6" ); \
 }


-- 

rurality dot wq at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35624


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/35624] ARM embeded assembly result error
  2008-03-18  9:04 [Bug c/35624] New: ARM embeded assembly result error rurality dot wq at gmail dot com
                   ` (2 preceding siblings ...)
  2008-03-21  9:34 ` rurality dot wq at gmail dot com
@ 2008-12-16 17:41 ` rearnsha at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: rearnsha at gcc dot gnu dot org @ 2008-12-16 17:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rearnsha at gcc dot gnu dot org  2008-12-16 17:39 -------
Not a bug.  You need to write your macro like this:

#define burst_copy(dst,src,len) {\
  unsigned t1, t2, t3; \
  __asm__ __volatile__ ( \
 "1: \n\t" \
   "ldmia %1!,{r3-r6} \n\t" \
   "stmia %0!,{r3-r6} \n\t" \
   "subs %2, %2, #1 \n\t" \
   "bne 1b \n\t" \
   :"=r"(t1),"=r"(t2),"=r"(t3) \
   :"0"(dst),"1"(src),"2"(len) \
   :"r3","r4","r5","r6", "memory"); \
}

Note that the results are never used, but this informs the compiler that the
input values have been destroyed by the operation.  Also note the clobber of
"memory" to indicate that values in memory have been updated by the operation.

It might be better to use an inline function for this rather than a macro, then
you can use the input operands as your output operands and don't need to
declare the temporaries.   It would also give better error checking in some
circumstances.


-- 

rearnsha at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35624


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-12-16 17:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-18  9:04 [Bug c/35624] New: ARM embeded assembly result error rurality dot wq at gmail dot com
2008-03-18  9:30 ` [Bug c/35624] " rurality dot wq at gmail dot com
2008-03-19  5:05 ` hp at gcc dot gnu dot org
2008-03-21  9:34 ` rurality dot wq at gmail dot com
2008-12-16 17:41 ` [Bug target/35624] " rearnsha at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).