LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
楼主: Lightning

9.10上海交流会的龙芯主题录像已经上传

[复制链接]
发表于 2006-9-21 12:23:27 | 显示全部楼层
也许吧,这样也说得过去。

不过一个开发用的64位系统怎么装了32位的gcc来演示,准备还不充分啊
回复 支持 反对

使用道具 举报

发表于 2006-9-21 12:24:14 | 显示全部楼层
Post by 超级用户
他们没必要搞那么复杂吧?

不过那天看到龙芯的板子,心里就有些凉,(啥嘛,还没有我朋友的nios2板子好)

如果这个东西是那个研究生/本科生团队做出来的,那我绝对服他们,毕竟涉及了不少方面。但要是这个东西代表作为中国科学院的最高水平……!@#¥%……&×()

不管怎么说,等明年吧,等他们能提供开发板卖了,还是要买一块的。


恩,样机和开发板都想买,好好端详一下
回复 支持 反对

使用道具 举报

发表于 2006-9-21 12:31:20 | 显示全部楼层
64位的sizeof(int)本来就是4的.long是8
这个gcc是64位的吧.
  1. yangtse@yangtse:~/Desktop$ i686-pc-linux-gnu-gcc test.c
  2. yangtse@yangtse:~/Desktop$ ./a.out
  3. int 4
  4. long 4
  5. yangtse@yangtse:~/Desktop$ x86_64-pc-linux-gnu-gcc test.c
  6. yangtse@yangtse:~/Desktop$ ./a.out
  7. int 4
  8. long 8
  9. yangtse@yangtse:~/Desktop$ x86_64-pc-linux-gnu-gcc32 test.c
  10. yangtse@yangtse:~/Desktop$ ./a.out
  11. int 4
  12. long 4
  13. yangtse@yangtse:~/Desktop$ winegcc test.c
  14. yangtse@yangtse:~/Desktop$ ./a.out
  15. int 4
  16. long 4
  17. yangtse@yangtse:~/Desktop$ file a.out
  18. a.out: Bourne shell script text executable
  19. yangtse@yangtse:~/Desktop$ gcc test.c
  20. yangtse@yangtse:~/Desktop$ ./a.out
  21. int 4
  22. long 8
  23. yangtse@yangtse:~/Desktop$ file a.out
  24. a.out: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
复制代码
回复 支持 反对

使用道具 举报

发表于 2006-9-21 12:41:03 | 显示全部楼层
不知道为什么。在我的电脑上要比这个快这么多呢?
我的电脑也就一个普通的p4,编译也没有加任何优化选项。
像我下面的这样有什么问题吗?

[php]

ailantian@vax:~/mypg$ gcc -o a a.c
ailantian@vax:~/mypg$ time ./a

real        0m0.577s
user        0m0.564s
sys        0m0.000s
ailantian@vax:~/mypg$ cat a.c
#include <stdio.h>
int main()
{
        long long a,i,times;
        for(times=0;times<1000000LL;times++)
        {
        a=1;
                for(i=1;i<30;i++)
                {
       
                a*=i;
                }
        }
        return 0;
}
ailantian@vax:~/mypg$

ailantian@vax:~/mypg$ cat /proc/cpuinfo
processor        : 0
vendor_id        : GenuineIntel
cpu family        : 15
model                : 2
model name        : Intel(R) Pentium(R) 4 CPU 2.40GHz
stepping        : 7
cpu MHz                : 2412.550
cache size        : 512 KB
fdiv_bug        : no
hlt_bug                : no
f00f_bug        : no
coma_bug        : no
fpu                : yes
fpu_exception        : yes
cpuid level        : 2
wp                : yes
flags                : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe cid
bogomips        : 4784.12

ailantian@vax:~/mypg$
ailantian@vax:~/mypg$ gcc -v
Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.5/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --enable-__cxa_atexit --with-system-zlib --enable-nls --without-included-gettext --enable-clocale=gnu --enable-debug --enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i486-linux
Thread model: posix
gcc version 3.3.5 (Debian 1:3.3.5-13)

[/php]
回复 支持 反对

使用道具 举报

发表于 2006-9-21 12:41:14 | 显示全部楼层
别看了别看了,都是拉圾,中国是造不出好东西来的,你说国产的有哪样比国外的好?特别是电子产品。
回复 支持 反对

使用道具 举报

发表于 2006-9-21 12:42:28 | 显示全部楼层
Post by 种草得草
64位的sizeof(int)本来就是4的.long是8
这个gcc是64位的吧.
  1. yangtse@yangtse:~/Desktop$ i686-pc-linux-gnu-gcc test.c
  2. yangtse@yangtse:~/Desktop$ ./a.out
  3. int 4
  4. long 4
  5. yangtse@yangtse:~/Desktop$ x86_64-pc-linux-gnu-gcc test.c
  6. yangtse@yangtse:~/Desktop$ ./a.out
  7. int 4
  8. long 8
  9. yangtse@yangtse:~/Desktop$ x86_64-pc-linux-gnu-gcc32 test.c
  10. yangtse@yangtse:~/Desktop$ ./a.out
  11. int 4
  12. long 4
  13. yangtse@yangtse:~/Desktop$ winegcc test.c
  14. yangtse@yangtse:~/Desktop$ ./a.out
  15. int 4
  16. long 4
  17. yangtse@yangtse:~/Desktop$ file a.out
  18. a.out: Bourne shell script text executable
  19. yangtse@yangtse:~/Desktop$ gcc test.c
  20. yangtse@yangtse:~/Desktop$ ./a.out
  21. int 4
  22. long 8
  23. yangtse@yangtse:~/Desktop$ file a.out
  24. a.out: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
复制代码


我被这些编译器的规定搞混了。。。。有些说是int 64位,有些又是32位。。。
回复 支持 反对

使用道具 举报

发表于 2006-9-21 12:50:27 | 显示全部楼层
另外那个也不是1000000的阶乘的程序吧
是算1000000次30的阶乘啊
回复 支持 反对

使用道具 举报

发表于 2006-9-21 13:05:06 | 显示全部楼层
这个也太弱了,最好叫他们把汇编代码贴出来看看
[php]
ailantian@vax:~/mypg$ objdump -d a >a.txt
ailantian@vax:~/mypg$ vi a.txt
ailantian@vax:~/mypg$ cat a.txt

a:     file format elf32-i386

Disassembly of section .init:

08048234 <_init>:
8048234:        55                           push   %ebp
8048235:        89 e5                        mov    %esp,%ebp
8048237:        83 ec 08                     sub    $0x8,%esp
804823a:        e8 65 00 00 00               call   80482a4 <call_gmon_start>
804823f:        e8 cc 00 00 00               call   8048310 <frame_dummy>
8048244:        e8 77 02 00 00               call   80484c0 <__do_global_ctors_aux>
8048249:        c9                           leave  
804824a:        c3                           ret   
Disassembly of section .plt:

0804824c <__libc_start_main@plt-0x10>:
804824c:        ff 35 fc 95 04 08            pushl  0x80495fc
8048252:        ff 25 00 96 04 08            jmp    *0x8049600
8048258:        00 00                        add    %al,(%eax)
        ...

0804825c <__libc_start_main@plt>:
804825c:        ff 25 04 96 04 08            jmp    *0x8049604
8048262:        68 00 00 00 00               push   $0x0
8048267:        e9 e0 ff ff ff               jmp    804824c <_init+0x18>

0804826c <__gmon_start__@plt>:
804826c:        ff 25 08 96 04 08            jmp    *0x8049608
8048272:        68 08 00 00 00               push   $0x8
8048277:        e9 d0 ff ff ff               jmp    804824c <_init+0x18>
Disassembly of section .text:

08048280 <_start>:
8048280:        31 ed                        xor    %ebp,%ebp
8048282:        5e                           pop    %esi
8048283:        89 e1                        mov    %esp,%ecx
8048285:        83 e4 f0                     and    $0xfffffff0,%esp
8048288:        50                           push   %eax
8048289:        54                           push   %esp
804828a:        52                           push   %edx
804828b:        68 10 84 04 08               push   $0x8048410
8048290:        68 60 84 04 08               push   $0x8048460
8048295:        51                           push   %ecx
8048296:        56                           push   %esi
8048297:        68 44 83 04 08               push   $0x8048344
804829c:        e8 bb ff ff ff               call   804825c <__libc_start_main@plt>
80482a1:        f4                           hlt   
80482a2:        90                           nop   
80482a3:        90                           nop   

080482a4 <call_gmon_start>:
80482a4:        55                           push   %ebp
80482a5:        89 e5                        mov    %esp,%ebp
80482a7:        53                           push   %ebx
80482a8:        83 ec 04                     sub    $0x4,%esp
80482ab:        e8 00 00 00 00               call   80482b0 <call_gmon_start+0xc>
80482b0:        5b                           pop    %ebx
80482b1:        81 c3 48 13 00 00            add    $0x1348,%ebx
80482b7:        8b 93 fc ff ff ff            mov    0xfffffffc(%ebx),%edx
80482bd:        85 d2                        test   %edx,%edx
80482bf:        74 05                        je     80482c6 <call_gmon_start+0x22>
80482c1:        e8 a6 ff ff ff               call   804826c <__gmon_start__@plt>
80482c6:        58                           pop    %eax
80482c7:        5b                           pop    %ebx
80482c8:        c9                           leave  
80482c9:        c3                           ret   
80482ca:        90                           nop   
80482cb:        90                           nop   
80482cc:        90                           nop   
80482cd:        90                           nop   
80482ce:        90                           nop   
80482cf:        90                           nop   

080482d0 <__do_global_dtors_aux>:
80482d0:        55                           push   %ebp
80482d1:        89 e5                        mov    %esp,%ebp
80482d3:        83 ec 08                     sub    $0x8,%esp
80482d6:        80 3d 18 96 04 08 00         cmpb   $0x0,0x8049618
80482dd:        75 2d                        jne    804830c <__do_global_dtors_aux+0x3c>
80482df:        a1 14 96 04 08               mov    0x8049614,%eax
80482e4:        8b 10                        mov    (%eax),%edx
80482e6:        85 d2                        test   %edx,%edx
80482e8:        74 1b                        je     8048305 <__do_global_dtors_aux+0x35>
80482ea:        8d b6 00 00 00 00            lea    0x0(%esi),%esi
80482f0:        83 c0 04                     add    $0x4,%eax
80482f3:        a3 14 96 04 08               mov    %eax,0x8049614
80482f8:        ff d2                        call   *%edx
80482fa:        a1 14 96 04 08               mov    0x8049614,%eax
80482ff:        8b 10                        mov    (%eax),%edx
8048301:        85 d2                        test   %edx,%edx
8048303:        75 eb                        jne    80482f0 <__do_global_dtors_aux+0x20>
8048305:        c6 05 18 96 04 08 01         movb   $0x1,0x8049618
804830c:        c9                           leave  
804830d:        c3                           ret   
804830e:        89 f6                        mov    %esi,%esi

08048310 <frame_dummy>:
8048310:        55                           push   %ebp
8048311:        89 e5                        mov    %esp,%ebp
8048313:        83 ec 08                     sub    $0x8,%esp
8048316:        a1 28 95 04 08               mov    0x8049528,%eax
804831b:        85 c0                        test   %eax,%eax
804831d:        74 21                        je     8048340 <frame_dummy+0x30>
804831f:        b8 00 00 00 00               mov    $0x0,%eax
8048324:        85 c0                        test   %eax,%eax
8048326:        74 18                        je     8048340 <frame_dummy+0x30>
8048328:        c7 04 24 28 95 04 08         movl   $0x8049528,(%esp)
804832f:        e8 cc 7c fb f7               call   0 <_init-0x8048234>
8048334:        8d b6 00 00 00 00            lea    0x0(%esi),%esi
804833a:        8d bf 00 00 00 00            lea    0x0(%edi),%edi
8048340:        89 ec                        mov    %ebp,%esp
8048342:        5d                           pop    %ebp
8048343:        c3                           ret   

08048344 <main>:
8048344:        55                           push   %ebp
8048345:        89 e5                        mov    %esp,%ebp
8048347:        53                           push   %ebx
8048348:        83 ec 34                     sub    $0x34,%esp
804834b:        83 e4 f0                     and    $0xfffffff0,%esp
804834e:        b8 00 00 00 00               mov    $0x0,%eax
8048353:        29 c4                        sub    %eax,%esp
8048355:        c7 45 e0 00 00 00 00         movl   $0x0,0xffffffe0(%ebp)
804835c:        c7 45 e4 00 00 00 00         movl   $0x0,0xffffffe4(%ebp)
8048363:        83 7d e4 00                  cmpl   $0x0,0xffffffe4(%ebp)
8048367:        78 18                        js     8048381 <main+0x3d>
8048369:        83 7d e4 00                  cmpl   $0x0,0xffffffe4(%ebp)
804836d:        0f 8f 91 00 00 00            jg     8048404 <main+0xc0>
8048373:        81 7d e0 3f 42 0f 00         cmpl   $0xf423f,0xffffffe0(%ebp)
804837a:        76 05                        jbe    8048381 <main+0x3d>
804837c:        e9 83 00 00 00               jmp    8048404 <main+0xc0>
8048381:        c7 45 f0 01 00 00 00         movl   $0x1,0xfffffff0(%ebp)
8048388:        c7 45 f4 00 00 00 00         movl   $0x0,0xfffffff4(%ebp)
804838f:        c7 45 e8 01 00 00 00         movl   $0x1,0xffffffe8(%ebp)
8048396:        c7 45 ec 00 00 00 00         movl   $0x0,0xffffffec(%ebp)
804839d:        83 7d ec 00                  cmpl   $0x0,0xffffffec(%ebp)
80483a1:        78 0e                        js     80483b1 <main+0x6d>
80483a3:        83 7d ec 00                  cmpl   $0x0,0xffffffec(%ebp)
80483a7:        7f 4c                        jg     80483f5 <main+0xb1>
80483a9:        83 7d e8 1d                  cmpl   $0x1d,0xffffffe8(%ebp)
80483ad:        76 02                        jbe    80483b1 <main+0x6d>
80483af:        eb 44                        jmp    80483f5 <main+0xb1>
80483b1:        8b 45 e8                     mov    0xffffffe8(%ebp),%eax
80483b4:        89 45 d4                     mov    %eax,0xffffffd4(%ebp)
80483b7:        8b 45 d4                     mov    0xffffffd4(%ebp),%eax
80483ba:        f7 65 f0                     mull   0xfffffff0(%ebp)
80483bd:        89 45 d8                     mov    %eax,0xffffffd8(%ebp)
80483c0:        89 55 dc                     mov    %edx,0xffffffdc(%ebp)
80483c3:        8b 45 f0                     mov    0xfffffff0(%ebp),%eax
80483c6:        89 c3                        mov    %eax,%ebx
80483c8:        0f af 5d ec                  imul   0xffffffec(%ebp),%ebx
80483cc:        8b 45 dc                     mov    0xffffffdc(%ebp),%eax
80483cf:        01 d8                        add    %ebx,%eax
80483d1:        8b 5d e8                     mov    0xffffffe8(%ebp),%ebx
80483d4:        0f af 5d f4                  imul   0xfffffff4(%ebp),%ebx
80483d8:        01 d8                        add    %ebx,%eax
80483da:        89 45 dc                     mov    %eax,0xffffffdc(%ebp)
80483dd:        8b 45 d8                     mov    0xffffffd8(%ebp),%eax
80483e0:        8b 55 dc                     mov    0xffffffdc(%ebp),%edx
80483e3:        89 45 f0                     mov    %eax,0xfffffff0(%ebp)
80483e6:        89 55 f4                     mov    %edx,0xfffffff4(%ebp)
80483e9:        8d 45 e8                     lea    0xffffffe8(%ebp),%eax
80483ec:        83 00 01                     addl   $0x1,(%eax)
80483ef:        83 50 04 00                  adcl   $0x0,0x4(%eax)
80483f3:        eb a8                        jmp    804839d <main+0x59>
80483f5:        8d 45 e0                     lea    0xffffffe0(%ebp),%eax
80483f8:        83 00 01                     addl   $0x1,(%eax)
80483fb:        83 50 04 00                  adcl   $0x0,0x4(%eax)
80483ff:        e9 5f ff ff ff               jmp    8048363 <main+0x1f>
8048404:        b8 00 00 00 00               mov    $0x0,%eax
8048409:        8b 5d fc                     mov    0xfffffffc(%ebp),%ebx
804840c:        c9                           leave  
804840d:        c3                           ret   
804840e:        90                           nop   
804840f:        90                           nop   

08048410 <__libc_csu_fini>:
8048410:        55                           push   %ebp
8048411:        89 e5                        mov    %esp,%ebp
8048413:        57                           push   %edi
8048414:        56                           push   %esi
8048415:        53                           push   %ebx
8048416:        e8 98 00 00 00               call   80484b3 <__i686.get_pc_thunk.bx>
804841b:        81 c3 dd 11 00 00            add    $0x11dd,%ebx
8048421:        83 ec 0c                     sub    $0xc,%esp
8048424:        8d 83 20 ff ff ff            lea    0xffffff20(%ebx),%eax
804842a:        8d bb 20 ff ff ff            lea    0xffffff20(%ebx),%edi
8048430:        29 f8                        sub    %edi,%eax
8048432:        c1 f8 02                     sar    $0x2,%eax
8048435:        8d 70 ff                     lea    0xffffffff(%eax),%esi
8048438:        83 fe ff                     cmp    $0xffffffff,%esi
804843b:        74 0c                        je     8048449 <__libc_csu_fini+0x39>
804843d:        8d 76 00                     lea    0x0(%esi),%esi
8048440:        ff 14 b7                     call   *(%edi,%esi,4)
8048443:        4e                           dec    %esi
8048444:        83 fe ff                     cmp    $0xffffffff,%esi
8048447:        75 f7                        jne    8048440 <__libc_csu_fini+0x30>
8048449:        8d b4 26 00 00 00 00         lea    0x0(%esi),%esi
8048450:        e8 9b 00 00 00               call   80484f0 <_fini>
8048455:        83 c4 0c                     add    $0xc,%esp
8048458:        5b                           pop    %ebx
8048459:        5e                           pop    %esi
804845a:        5f                           pop    %edi
804845b:        5d                           pop    %ebp
804845c:        c3                           ret   
804845d:        8d 76 00                     lea    0x0(%esi),%esi

08048460 <__libc_csu_init>:
8048460:        55                           push   %ebp
8048461:        89 e5                        mov    %esp,%ebp
8048463:        57                           push   %edi
8048464:        56                           push   %esi
8048465:        53                           push   %ebx
8048466:        e8 48 00 00 00               call   80484b3 <__i686.get_pc_thunk.bx>
804846b:        81 c3 8d 11 00 00            add    $0x118d,%ebx
8048471:        83 ec 0c                     sub    $0xc,%esp
8048474:        e8 bb fd ff ff               call   8048234 <_init>
8048479:        8d 83 20 ff ff ff            lea    0xffffff20(%ebx),%eax
804847f:        8d 93 20 ff ff ff            lea    0xffffff20(%ebx),%edx
8048485:        29 d0                        sub    %edx,%eax
8048487:        c1 f8 02                     sar    $0x2,%eax
804848a:        89 45 f0                     mov    %eax,0xfffffff0(%ebp)
804848d:        74 1c                        je     80484ab <__libc_csu_init+0x4b>
804848f:        31 ff                        xor    %edi,%edi
8048491:        89 d6                        mov    %edx,%esi
8048493:        8d b6 00 00 00 00            lea    0x0(%esi),%esi
8048499:        8d bc 27 00 00 00 00         lea    0x0(%edi),%edi
80484a0:        47                           inc    %edi
80484a1:        ff 16                        call   *(%esi)
80484a3:        83 c6 04                     add    $0x4,%esi
80484a6:        39 7d f0                     cmp    %edi,0xfffffff0(%ebp)
80484a9:        75 f5                        jne    80484a0 <__libc_csu_init+0x40>
80484ab:        83 c4 0c                     add    $0xc,%esp
80484ae:        5b                           pop    %ebx
80484af:        5e                           pop    %esi
80484b0:        5f                           pop    %edi
80484b1:        5d                           pop    %ebp
80484b2:        c3                           ret   

080484b3 <__i686.get_pc_thunk.bx>:
80484b3:        8b 1c 24                     mov    (%esp),%ebx
80484b6:        c3                           ret   
80484b7:        90                           nop   
80484b8:        90                           nop   
80484b9:        90                           nop   
80484ba:        90                           nop   
80484bb:        90                           nop   
80484bc:        90                           nop   
80484bd:        90                           nop   
80484be:        90                           nop   
80484bf:        90                           nop   

080484c0 <__do_global_ctors_aux>:
80484c0:        55                           push   %ebp
80484c1:        89 e5                        mov    %esp,%ebp
80484c3:        53                           push   %ebx
80484c4:        83 ec 04                     sub    $0x4,%esp
80484c7:        bb 18 95 04 08               mov    $0x8049518,%ebx
80484cc:        a1 18 95 04 08               mov    0x8049518,%eax
80484d1:        83 f8 ff                     cmp    $0xffffffff,%eax
80484d4:        74 16                        je     80484ec <__do_global_ctors_aux+0x2c>
80484d6:        8d 76 00                     lea    0x0(%esi),%esi
80484d9:        8d bc 27 00 00 00 00         lea    0x0(%edi),%edi
80484e0:        83 eb 04                     sub    $0x4,%ebx
80484e3:        ff d0                        call   *%eax
80484e5:        8b 03                        mov    (%ebx),%eax
80484e7:        83 f8 ff                     cmp    $0xffffffff,%eax
80484ea:        75 f4                        jne    80484e0 <__do_global_ctors_aux+0x20>
80484ec:        58                           pop    %eax
80484ed:        5b                           pop    %ebx
80484ee:        5d                           pop    %ebp
80484ef:        c3                           ret   
Disassembly of section .fini:

080484f0 <_fini>:
80484f0:        55                           push   %ebp
80484f1:        89 e5                        mov    %esp,%ebp
80484f3:        53                           push   %ebx
80484f4:        83 ec 04                     sub    $0x4,%esp
80484f7:        e8 00 00 00 00               call   80484fc <_fini+0xc>
80484fc:        5b                           pop    %ebx
80484fd:        81 c3 fc 10 00 00            add    $0x10fc,%ebx
8048503:        e8 c8 fd ff ff               call   80482d0 <__do_global_dtors_aux>
8048508:        59                           pop    %ecx
8048509:        5b                           pop    %ebx
804850a:        c9                           leave  
804850b:        c3                           ret   
ailantian@vax:~/mypg$

[/php]
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-9-21 13:30:42 | 显示全部楼层
Post by ailantian
不知道为什么。在我的电脑上要比这个快这么多呢?
我的电脑也就一个普通的p4,编译也没有加任何优化选项。
像我下面的这样有什么问题吗?


你没有弄错,在现场的一台R50e上,跑下来的结果是0.4s。
回复 支持 反对

使用道具 举报

发表于 2006-9-21 13:45:54 | 显示全部楼层
在C语言中,sizeof(int)不管在32位或64位都是4。楼上的是不是冤枉龙芯了。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表