* add.c:6: incompatible types in assignment
@ 2004-11-30 11:07 Ankit Jain
2004-11-30 12:39 ` Frederic Marmond
0 siblings, 1 reply; 2+ messages in thread
From: Ankit Jain @ 2004-11-30 11:07 UTC (permalink / raw)
To: assembly
the program gives error at line 6
add.c:6: incompatible types in assignment
1 #include<stdio.h>
2 #include<inttypes.h>
3 int main()
4 {
5 uint8_t
a[8]={1,2,3,4,5,6,7,8},b[8]={1,2,3,4,5,6,7,8},i;
6 asm("movq (%1), %%mm0 \n"
7 "paddb (%0), %%mm0 \n"
8 "movq %%mm0, (%0) \n"
9 :"=r"(b)
10 :"r"(a)
11 :"%mm0"
12 );
13 for(i=0;i<8;i++)
14 printf("%d ",b[i]);
15 return 0;
16 }
________________________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping"
your friends today! Download Messenger Now
http://uk.messenger.yahoo.com/download/index.html
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: add.c:6: incompatible types in assignment
2004-11-30 11:07 add.c:6: incompatible types in assignment Ankit Jain
@ 2004-11-30 12:39 ` Frederic Marmond
0 siblings, 0 replies; 2+ messages in thread
From: Frederic Marmond @ 2004-11-30 12:39 UTC (permalink / raw)
To: Ankit Jain; +Cc: assembly
you mistake about data and pointer format.
Try somehing like this
#include<stdio.h>
#include<inttypes.h>
typedef union
{
char bytes[8];
long long u64;
}GoodType;
int main()
{
uint8_t a[8]={1,2,3,4,5,6,7,8},b[8]={1,2,3,4,5,6,7,8},i;
GoodType fooBar;
fooBar.bytes[0]=1;
fooBar.bytes[1]=2;
fooBar.bytes[2]=3;
fooBar.bytes[3]=4;
fooBar.bytes[4]=5;
fooBar.bytes[5]=6;
fooBar.bytes[6]=7;
fooBar.bytes[7]=8;
asm("movq (%1), %%mm0 \n"
"paddb (%0), %%mm0 \n"
"movq %%mm0, (%0) \n"
:"=r"(fooBar)
:"r"(a)
:"%mm0"
);
for(i=0;i<8;i++)
printf("%d ",fooBar.bytes[i]);
return 0;
}
Fred
Selon Ankit Jain <ankitjain1580@yahoo.com>:
> the program gives error at line 6
>
> add.c:6: incompatible types in assignment
>
> 1 #include<stdio.h>
> 2 #include<inttypes.h>
> 3 int main()
> 4 {
> 5 uint8_t
> a[8]={1,2,3,4,5,6,7,8},b[8]={1,2,3,4,5,6,7,8},i;
> 6 asm("movq (%1), %%mm0 \n"
> 7 "paddb (%0), %%mm0 \n"
> 8 "movq %%mm0, (%0) \n"
> 9 :"=r"(b)
> 10 :"r"(a)
> 11 :"%mm0"
> 12 );
> 13 for(i=0;i<8;i++)
> 14 printf("%d ",b[i]);
> 15 return 0;
> 16 }
>
>
> ________________________________________________________________________
> Yahoo! Messenger - Communicate instantly..."Ping"
> your friends today! Download Messenger Now
> http://uk.messenger.yahoo.com/download/index.html
> -
> To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Fred Marmond
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-11-30 12:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-30 11:07 add.c:6: incompatible types in assignment Ankit Jain
2004-11-30 12:39 ` Frederic Marmond
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 NNTP newsgroup(s).