[LLVMbugs] [Bug 3457] New: scheduling (?) severely pessimizing scimark2 montecarlo loop
    bugzilla-daemon at cs.uiuc.edu 
    bugzilla-daemon at cs.uiuc.edu
       
    Sun Feb  1 22:16:17 PST 2009
    
    
  
http://llvm.org/bugs/show_bug.cgi?id=3457
           Summary: scheduling (?) severely pessimizing scimark2 montecarlo
                    loop
           Product: libraries
           Version: 1.0
          Platform: PC
        OS/Version: All
            Status: NEW
          Keywords: code-quality
          Severity: normal
          Priority: P2
         Component: Common Code Generator Code
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: clattner at apple.com
                CC: llvmbugs at cs.uiuc.edu
Created an attachment (id=2486)
 --> (http://llvm.org/bugs/attachment.cgi?id=2486)
testcase 
The main loop in MonteCarlo_integrate is:
        %2 = tail call double @Random_nextDouble(%struct.anon* %0) nounwind    
        ; <double> [#uses=2]
        %3 = tail call double @Random_nextDouble(%struct.anon* %0) nounwind    
        ; <double> [#uses=2]
        %4 = mul double %2, %2          ; <double> [#uses=1]
        %5 = mul double %3, %3          ; <double> [#uses=1]
        %6 = add double %4, %5          ; <double> [#uses=1]
...
We compile this to:
        movl    %esi, (%esp)
        call    L_Random_nextDouble$stub
        fstpt   -56(%ebp)
        movl    %esi, (%esp)
        call    L_Random_nextDouble$stub
        fstpl   -32(%ebp)
        fldt    -56(%ebp)
        fstpl   -24(%ebp)
        movsd   -24(%ebp), %xmm0
        mulsd   %xmm0, %xmm0
...
This is horrible because the conversion from long double to double got
scheduled after the second call, so we now get fstpt/fldt instructions (80-bit
fp load/stores), which are really really really slow (10x slower than fstpl.  I
really want to see something like:
        movl    %esi, (%esp)
        call    L_Random_nextDouble$stub
        fstpl   -24(%ebp)
        movl    %esi, (%esp)
        call    L_Random_nextDouble$stub
        fstpl   -32(%ebp)
        movsd   -24(%ebp), %xmm0
        mulsd   %xmm0, %xmm0
...
One less spill, and no crazy 80-bit fp load and stores!
-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
    
    
More information about the llvm-bugs
mailing list