[LLVMbugs] [Bug 19047] New: use imul instead of lea to implement multiplication when the argument is call-by-reference

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Mar 4 16:23:27 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=19047

            Bug ID: 19047
           Summary: use imul instead of lea to implement multiplication
                    when the argument is call-by-reference
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: cfy1990 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

$  clang++ --version             
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix
$ cat test.cc                      
void foo(int &a,int &b){
    b = a * 5;//imull    $5, (%rdi), %eax
}
int foo(int a){
    return a *5; //leal    (%rdi,%rdi,4), %eax
}
$ clang++ -Ofast test.cc -c -S -o -
    .section    __TEXT,__text,regular,pure_instructions
    .globl    __Z3fooRiS_
    .align    4, 0x90
__Z3fooRiS_:                            ## @_Z3fooRiS_
    .cfi_startproc
## BB#0:
    pushq    %rbp
Ltmp2:
    .cfi_def_cfa_offset 16
Ltmp3:
    .cfi_offset %rbp, -16
    movq    %rsp, %rbp
Ltmp4:
    .cfi_def_cfa_register %rbp
    imull    $5, (%rdi), %eax
    movl    %eax, (%rsi)
    popq    %rbp
    ret
    .cfi_endproc

    .globl    __Z3fooi
    .align    4, 0x90
__Z3fooi:                               ## @_Z3fooi
    .cfi_startproc
## BB#0:
    pushq    %rbp
Ltmp7:
    .cfi_def_cfa_offset 16
Ltmp8:
    .cfi_offset %rbp, -16
    movq    %rsp, %rbp
Ltmp9:
    .cfi_def_cfa_register %rbp
    leal    (%rdi,%rdi,4), %eax
    popq    %rbp
    ret
    .cfi_endproc


.subsections_via_symbols

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140305/fb402b8d/attachment.html>


More information about the llvm-bugs mailing list