Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rpg@rpg$ cat test.c
- #include <stdio.h>
- #include <stdlib.h>
- typedef float v4sf __attribute__ ((vector_size (16)));
- union f4vector
- {
- v4sf v;
- float f[4];
- };
- const v4sf half = {0.5,0.5,0.5,0.5};
- int main()
- {
- union f4vector b = {(float)rand(),(float)rand(),(float)rand(),(float)rand()};
- union f4vector c = {(float)rand(),(float)rand(),(float)rand(),(float)rand()};
- union f4vector data = {0.34, 0.29, 0.97, 0.0};
- union f4vector data2 = {0.0, 0.0, 0.0, 0.0};
- int i;
- for (i=0;i<1024*1024*100;i++)
- {
- //~ b = (float)clock();
- data2.v = (data.v+half)*c.v+b.v-half;
- }
- //~ float data3[4];
- //~ data3 = data2;
- printf("%f %f %f\n", data2.f[0],data2.f[1],data2.f[2]);
- }rpg@rpg$ gcc -S -O2 test.c
- rpg@rpg$ cat test.s
- .file "test.c"
- .section .rodata.str1.1,"aMS",@progbits,1
- .LC4:
- .string "%f %f %f\n"
- .text
- .p2align 4,,15
- .globl main
- .type main, @function
- main:
- pushl %ebp
- movl %esp, %ebp
- andl $-16, %esp
- pushl %edi
- pushl %esi
- pushl %ebx
- subl $164, %esp
- call rand
- movl %eax, %edi
- call rand
- movl %eax, %esi
- call rand
- movl %eax, %ebx
- call rand
- movl %edi, 44(%esp)
- fildl 44(%esp)
- fstps 48(%esp)
- movl %esi, 44(%esp)
- fildl 44(%esp)
- fstps 52(%esp)
- movl %ebx, 44(%esp)
- fildl 44(%esp)
- movl %eax, 44(%esp)
- movl 48(%esp), %eax
- fstps 56(%esp)
- fildl 44(%esp)
- fstps 60(%esp)
- movl %eax, 144(%esp)
- movl 52(%esp), %eax
- movl %eax, 148(%esp)
- movl 56(%esp), %eax
- movl %eax, 152(%esp)
- movl 60(%esp), %eax
- movl %eax, 156(%esp)
- call rand
- movl %eax, %edi
- call rand
- movl %eax, %esi
- call rand
- movl %eax, %ebx
- call rand
- movl %edi, 44(%esp)
- fildl 44(%esp)
- fstps 48(%esp)
- movl %esi, 44(%esp)
- fildl 44(%esp)
- fstps 52(%esp)
- movl %ebx, 44(%esp)
- fildl 44(%esp)
- movl %eax, 44(%esp)
- movl 48(%esp), %eax
- fstps 56(%esp)
- fildl 44(%esp)
- fstps 60(%esp)
- movl %eax, 128(%esp)
- movl 52(%esp), %eax
- movl %eax, 132(%esp)
- movl 56(%esp), %eax
- flds 132(%esp)
- movl %eax, 136(%esp)
- movl 60(%esp), %eax
- flds 136(%esp)
- movl %eax, 140(%esp)
- flds 140(%esp)
- flds .LC0
- fmuls 128(%esp)
- fstps 48(%esp)
- fxch %st(2)
- movl 48(%esp), %eax
- fmuls .LC1
- fstps 52(%esp)
- fmuls .LC2
- fstps 56(%esp)
- flds .LC3
- fmul %st, %st(1)
- fxch %st(1)
- fstps 60(%esp)
- movl %eax, 112(%esp)
- flds 112(%esp)
- fadds 144(%esp)
- movl 52(%esp), %eax
- fstps 48(%esp)
- movl %eax, 116(%esp)
- flds 148(%esp)
- fadds 116(%esp)
- movl 56(%esp), %eax
- fstps 52(%esp)
- movl %eax, 120(%esp)
- flds 152(%esp)
- fadds 120(%esp)
- movl 60(%esp), %eax
- fstps 56(%esp)
- movl %eax, 124(%esp)
- flds 156(%esp)
- fadds 124(%esp)
- movl 48(%esp), %eax
- fstps 60(%esp)
- movl %eax, 96(%esp)
- movl 52(%esp), %eax
- flds 96(%esp)
- fsub %st(1), %st
- movl %eax, 100(%esp)
- movl 56(%esp), %eax
- fstps 48(%esp)
- flds 100(%esp)
- fsub %st(1), %st
- movl %eax, 104(%esp)
- movl 60(%esp), %eax
- fstps 52(%esp)
- flds 104(%esp)
- fsub %st(1), %st
- movl %eax, 108(%esp)
- fstps 56(%esp)
- fsubrs 108(%esp)
- fstps 60(%esp)
- movl 48(%esp), %eax
- movl $.LC4, 4(%esp)
- movl $1, (%esp)
- movl %eax, 64(%esp)
- movl 52(%esp), %eax
- movl %eax, 68(%esp)
- movl 56(%esp), %eax
- movl %eax, 72(%esp)
- movl 60(%esp), %eax
- flds 72(%esp)
- fstpl 24(%esp)
- movl %eax, 76(%esp)
- flds 68(%esp)
- fstpl 16(%esp)
- flds 64(%esp)
- fstpl 8(%esp)
- call __printf_chk
- addl $164, %esp
- popl %ebx
- popl %esi
- popl %edi
- movl %ebp, %esp
- popl %ebp
- ret
- .size main, .-main
- .globl half
- .section .rodata
- .align 16
- .type half, @object
- .size half, 16
- half:
- .long 1056964608
- .long 1056964608
- .long 1056964608
- .long 1056964608
- .section .rodata.cst4,"aM",@progbits,4
- .align 4
- .LC0:
- .long 1062668862
- .align 4
- .LC1:
- .long 1061830000
- .align 4
- .LC2:
- .long 1069295862
- .align 4
- .LC3:
- .long 1056964608
- .ident "GCC: (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2"
- .section .note.GNU-stack,"",@progbits
- rpg@rpg$ gcc -S -O2 -msse test.c
- rpg@rpg$ cat test.s
- .file "test.c"
- .section .rodata.str1.1,"aMS",@progbits,1
- .LC2:
- .string "%f %f %f\n"
- .text
- .p2align 4,,15
- .globl main
- .type main, @function
- main:
- pushl %ebp
- movl %esp, %ebp
- andl $-16, %esp
- pushl %edi
- pushl %esi
- pushl %ebx
- subl $100, %esp
- call rand
- movl %eax, %ebx
- call rand
- movl %eax, 48(%esp)
- call rand
- movl %eax, 72(%esp)
- call rand
- movl %eax, 68(%esp)
- call rand
- movl %eax, 44(%esp)
- call rand
- movl %eax, %edi
- call rand
- movl %eax, %esi
- call rand
- movl 44(%esp), %edx
- movl 48(%esp), %ecx
- movl %edx, 76(%esp)
- fildl 76(%esp)
- fstps 64(%esp)
- movl %edi, 76(%esp)
- fildl 76(%esp)
- fstps 60(%esp)
- movl %esi, 76(%esp)
- fildl 76(%esp)
- fstps 56(%esp)
- movl %eax, 76(%esp)
- fildl 76(%esp)
- fstps 52(%esp)
- movl %ebx, 76(%esp)
- fildl 76(%esp)
- movss 64(%esp), %xmm3
- movl %ecx, 76(%esp)
- fstps 64(%esp)
- movss 60(%esp), %xmm4
- movss 52(%esp), %xmm2
- movss 56(%esp), %xmm1
- fildl 76(%esp)
- unpcklps %xmm4, %xmm3
- fstps 60(%esp)
- fildl 72(%esp)
- unpcklps %xmm2, %xmm1
- fstps 72(%esp)
- fildl 68(%esp)
- fstps 68(%esp)
- movaps %xmm1, %xmm0
- movaps %xmm3, %xmm1
- movlhps %xmm0, %xmm1
- movss 68(%esp), %xmm3
- movss 72(%esp), %xmm0
- movss 64(%esp), %xmm4
- mulps .LC0, %xmm1
- unpcklps %xmm3, %xmm0
- movss 60(%esp), %xmm3
- movaps %xmm0, %xmm2
- unpcklps %xmm3, %xmm4
- movaps %xmm4, %xmm0
- movlhps %xmm2, %xmm0
- addps %xmm1, %xmm0
- subps .LC1, %xmm0
- movaps %xmm0, 80(%esp)
- flds 88(%esp)
- fstpl 24(%esp)
- movl $.LC2, 4(%esp)
- flds 84(%esp)
- fstpl 16(%esp)
- movl $1, (%esp)
- flds 80(%esp)
- fstpl 8(%esp)
- call __printf_chk
- addl $100, %esp
- popl %ebx
- popl %esi
- popl %edi
- movl %ebp, %esp
- popl %ebp
- ret
- .size main, .-main
- .globl half
- .section .rodata
- .align 16
- .type half, @object
- .size half, 16
- half:
- .long 1056964608
- .long 1056964608
- .long 1056964608
- .long 1056964608
- .section .rodata.cst16,"aM",@progbits,16
- .align 16
- .LC0:
- .long 1062668862
- .long 1061830000
- .long 1069295862
- .long 1056964608
- .align 16
- .LC1:
- .long 1056964608
- .long 1056964608
- .long 1056964608
- .long 1056964608
- .ident "GCC: (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2"
- .section .note.GNU-stack,"",@progbits
- rpg@rpg$
Advertisement
Add Comment
Please, Sign In to add comment