Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Herb Sutter on Heterosexual Computing

Name: Anonymous 2011-06-17 7:51

Looks like Microsoft is tired of HomogenousHomosexual Computing (ie. Apple/Macs) and paints a possible future of mainstream HeterogenousHeterosexual Computing.
 
http://media.ch9.ms/ch9/7655/e3d5a308-d1fb-4693-998e-9f04000f7655/AMDFusionHerbSutterKeynoteAMP_high_ch9.mp4

It's a bit Microsoft biased, made me cringe a bit in a few spots, but the bulk of the talk is rather interesting. Herb Sutter used to be the chairperson of the ISO/IEC C and C++ language committees, by the way. I wonder how the Linux kernel will adapt to heterogeneous computing? We already have OpenCL, but the kernel isn't using it itself--is there any application for this kind of stuff inside of a kernel?

Name: Anonymous 2011-06-17 11:02

>>10
Maybe you're using an older version, I just used a recent version from the SVN trunk with -O2 -fvisibility=hidden and got:

    .hidden    _Z10fact_iter2iii
    .globl    _Z10fact_iter2iii
    .align    16, 0x90
    .type    _Z10fact_iter2iii,@function
_Z10fact_iter2iii:                      # @_Z10fact_iter2iii
.Ltmp6:
    .cfi_startproc
# BB#0:                                 # %entry
    subl    %edx, %edi
    jmp    _Z9fact_iterii          # TAILCALL
.Ltmp7:
    .size    _Z10fact_iter2iii, .Ltmp7-_Z10fact_iter2iii
.Ltmp8:
    .cfi_endproc
.Leh_func_end2:


Which shows fact_iter2 tail calling fact_iter, so (int,int,int) -> (int,int) is handled.

As far as your infinite loop, apparently Clang can determine when functions don't have any side-effect and optimize out independent cycles, change it to:


int f() { return f() }
int main() { return f(); }


so that the result of the main function has a dependency on f thus ensuring the optimizer can't optimize it out and you get your tail-call optimized infinite loop. This is expected behavior of C++ and is documented in the latest C++0x draft for the new memory model and data dependencies.

Name: Anonymous 2011-06-17 11:28

>>13
Yes.

$ cat aaa.cpp
void f() { return f(); }
int main() { f(); return 0; }
$ clang aaa.cpp -fvisibility=hidden -O2 -S; cat aaa.s
    .file    "aaa.cpp"
    .text
    .hidden    _Z1fv
    .globl    _Z1fv
    .align    16, 0x90
    .type    _Z1fv,@function
[b]_Z1fv:                                  # @_Z1fv
# BB#0:
    ret[/b]
.Ltmp0:
    .size    _Z1fv, .Ltmp0-_Z1fv

    .hidden    main
    .globl    main
    .align    16, 0x90
    .type    main,@function
main:                                   # @main
# BB#0:
    xorl    %eax, %eax
    ret
.Ltmp1:
    .size    main, .Ltmp1-main


    .section    ".note.GNU-stack","",@progbits
$ clang aaa.cpp -fvisibility=hidden -O2; ./a.out
$ clang --version
clang version 2.9 (tags/RELEASE_29/final)
Target: i386-pc-linux-gnu
Thread model: posix


I'm getting the SVN trunk now.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List