[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to package SuperCollider (or, whats the deal with multiarch)



Mario Lang wrote:

> In this specific case, that is a very hypothetical thesis...  I cant really
> imagine an arch which does say 80bit or 128bit floating point math
> faster than 64bit...

M68K comes to mind, I think that might do 80bit FP faster than it does
64-bit (because the FPU does 80-bit). I'd have to pull out my M68K books...

> I've looked at it, and it is doable.  However, I think it would require
> some preprocessor magic, since currently, copying slots is done by
> assignment, which is definitely faster than a memcpy of a struct...

The assignment operator ought to be fairly well optimized. Actually,
memcpy might be, too. Remember, memcpy is a part of the C standard
library; the compiler is perfectly free to implement it any way it
choses --- it need not be a function call. I think GCC might actually do
this.

Let's find out:

anthony@feynman:tmp$ cat test-memcpy.c
#include <string.h>

int test(int *a, int *b, int *c, int *d) {
        memcpy(b, a, sizeof(int));
        *c = *d;
        return 0;
}

anthony@feynman:tmp$ gcc -O3 test-memcpy.c -c
anthony@feynman:tmp$ objdump -d test-memcpy.o

test-memcpy.o:     file format elf64-x86-64

Disassembly of section .text:

0000000000000000 <test>:
   0:   8b 07                   mov    (%rdi),%eax
   2:   89 06                   mov    %eax,(%rsi)
   4:   8b 01                   mov    (%rcx),%eax
   6:   89 02                   mov    %eax,(%rdx)
   8:   31 c0                   xor    %eax,%eax
   a:   c3                      retq

And, yep, gcc performs that optimization.



Reply to: