[LLVMbugs] [Bug 14529] New: clang should recognize C99 complex extract functions
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Dec 6 13:18:18 PST 2012
http://llvm.org/bugs/show_bug.cgi?id=14529
Bug #: 14529
Summary: clang should recognize C99 complex extract functions
Product: clang
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: daniel at zuster.org
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
We should pattern match C99 complex functions, like ICC does. The following
example should compile down to just trivial load instructions:
--
$ cat t2.c
#include <complex.h>
double f0(double complex z) {
return creal(z);
}
long double f1(long double complex z) {
return creall(z);
}
float f2(float complex z) {
return crealf(z);
}
double f3(double complex z) {
return cimag(z);
}
long double f4(long double complex z) {
return cimagl(z);
}
float f5(float complex z) {
return cimagf(z);
}
$ clang -O3 -S -o - t2.c
.section __TEXT,__text,regular,pure_instructions
.globl _f0
.align 4, 0x90
_f0: ## @f0
.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
popq %rbp
jmp _creal ## TAILCALL
.cfi_endproc
.globl _f1
.align 4, 0x90
_f1: ## @f1
.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
subq $64, %rsp
fldt 32(%rbp)
fldt 16(%rbp)
fstpt -32(%rbp)
fstpt -16(%rbp)
movaps -32(%rbp), %xmm0
movaps -16(%rbp), %xmm1
movaps %xmm1, 16(%rsp)
movaps %xmm0, (%rsp)
callq _creall
addq $64, %rsp
popq %rbp
ret
.cfi_endproc
.globl _f2
.align 4, 0x90
_f2: ## @f2
.cfi_startproc
## BB#0:
pushq %rbp
Ltmp12:
.cfi_def_cfa_offset 16
Ltmp13:
.cfi_offset %rbp, -16
movq %rsp, %rbp
Ltmp14:
.cfi_def_cfa_register %rbp
popq %rbp
jmp _crealf ## TAILCALL
.cfi_endproc
.globl _f3
.align 4, 0x90
_f3: ## @f3
.cfi_startproc
## BB#0:
pushq %rbp
Ltmp17:
.cfi_def_cfa_offset 16
Ltmp18:
.cfi_offset %rbp, -16
movq %rsp, %rbp
Ltmp19:
.cfi_def_cfa_register %rbp
popq %rbp
jmp _cimag ## TAILCALL
.cfi_endproc
.globl _f4
.align 4, 0x90
_f4: ## @f4
.cfi_startproc
## BB#0:
pushq %rbp
Ltmp22:
.cfi_def_cfa_offset 16
Ltmp23:
.cfi_offset %rbp, -16
movq %rsp, %rbp
Ltmp24:
.cfi_def_cfa_register %rbp
subq $64, %rsp
fldt 32(%rbp)
fldt 16(%rbp)
fstpt -32(%rbp)
fstpt -16(%rbp)
movaps -32(%rbp), %xmm0
movaps -16(%rbp), %xmm1
movaps %xmm1, 16(%rsp)
movaps %xmm0, (%rsp)
callq _cimagl
addq $64, %rsp
popq %rbp
ret
.cfi_endproc
.globl _f5
.align 4, 0x90
_f5: ## @f5
.cfi_startproc
## BB#0:
pushq %rbp
Ltmp27:
.cfi_def_cfa_offset 16
Ltmp28:
.cfi_offset %rbp, -16
movq %rsp, %rbp
Ltmp29:
.cfi_def_cfa_register %rbp
popq %rbp
jmp _cimagf ## TAILCALL
.cfi_endproc
.subsections_via_symbols
--
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