search for: cimag

Displaying 7 results from an estimated 7 matches for "cimag".

Did you mean: imag
2012 Apr 27
2
[LLVMdev] complex library functions (creal and cimag)
When I compile this code which includes call to crealf, $ cat foo1.c #include <complex.h> float foo1(complex float z) { return crealf(z); } clang emits a call to crealf, $ clang foo1.c -S -o - -O3 foo1: # @foo1 .cfi_startproc # BB#0: # %entry jmp crealf # TAILCALL while gcc does it in two move
2012 Apr 27
0
[LLVMdev] complex library functions (creal and cimag)
On Fri, Apr 27, 2012 at 12:09 PM, Akira Hatanaka <ahatanak at gmail.com> wrote: > When I compile this code which includes call to crealf, > > $ cat foo1.c > #include <complex.h> > > float foo1(complex float z) { return crealf(z); } > > clang emits a call to crealf, > > $ clang  foo1.c -S -o - -O3 > foo1:                                   # @foo1 >
2012 Apr 28
1
[LLVMdev] complex library functions (creal and cimag)
On Apr 27, 2012, at 2:02 PM, Eli Friedman wrote: > On Fri, Apr 27, 2012 at 12:09 PM, Akira Hatanaka <ahatanak at gmail.com> wrote: >> while gcc does it in two move instructions: >> >> $ gcc foo1.c -S -o -O3 >> foo1: >> .LFB0: >> .cfi_startproc >> movq %xmm0, -8(%rsp) >> movss -8(%rsp), %xmm0 >> >>
2019 Jul 02
2
RFC: Complex in LLVM
...t are your plans for the reverse? I assume we don't want the only > way to materialize a complex to be via memory so an insertvalue > equivalent (or maybe using insertvalue/extractvalue directly?) and a > literal value would probably be useful. Good points. Originally I put the creal/cimag intrinsics in the proposal when the layout of the complex type was left unspecified. After internal feedback, I changed it to an explicitly-specified layout (real followed by imaginary). Maybe creal/cimag should go away. Then we wouldn't have to teach the optimizer about them and it already u...
2019 Jul 01
14
RFC: Complex in LLVM
...declare double @llvm.fabs.c64(c64 %Val) In addition, new intrinsics will be used for complex-specific operations: llvm.creal.* - Overloaded intrinsic to extract the real part of a complex value declare float @llvm.creal.c32(c32 %Val) declare double @llvm.creal.c64(c64 %Val) llvm.cimag.* - Overloaded intrinsic to extract the imaginary part of a complex value declare float @llvm.cimag.c32(c32 %Val) declare double @llvm.cimag.c64(c64 %Val) llvm.cconj.* - Overloaded intrinsic to compute the conjugate of a complex value declare c32 @llvm.cconj.c32(c32...
2009 Feb 26
2
[LLVMdev] Impressive performance result for LLVM: complex arithmetic
...re is still 20% room for improvement but LLVM is >4x faster than gcc here. Sweet. Here's the code: #include <stdio.h> #include <stdlib.h> #include <complex.h> int max_i = 65536; double sqr(double x) { return x*x; } double cnorm2(complex z) { return sqr(creal(z)) + sqr(cimag(z)); } int loop(complex c) { complex z=c; int i=1; while (cnorm2(z) <= 4.0 && i++ < max_i) z = z*z + c; return i; } int main() { for (int j = -39; j < 39; ++j) { for (int i = -39; i < 39; ++i) printf(loop(j/40.0-0.5 + i/40.0*I) &...
2009 Feb 27
0
[LLVMdev] Impressive performance result for LLVM: complex arithmetic
...ter than gcc here. > Sweet. > > Here's the code: > > #include <stdio.h> > #include <stdlib.h> > #include <complex.h> > > int max_i = 65536; > > double sqr(double x) { return x*x; } > > double cnorm2(complex z) { return sqr(creal(z)) + sqr(cimag(z)); } > > int loop(complex c) { >    complex z=c; >    int i=1; >    while (cnorm2(z) <= 4.0 && i++ < max_i) >        z = z*z + c; >    return i; > } > > int main() { >    for (int j = -39; j < 39; ++j) { >        for (int i = -39; i < 39; ++...