This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/81478] By default, GCC emits a function call for complex multiplication, should partially inline that
- From: "smcallis at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 19 Jul 2017 23:01:42 +0000
- Subject: [Bug middle-end/81478] By default, GCC emits a function call for complex multiplication, should partially inline that
- Auto-submitted: auto-generated
- References: <bug-81478-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81478
--- Comment #6 from Sean McAllister <smcallis at gmail dot com> ---
FWIW, it seems the compute, check, re-compute if necessary is what clang does.
Rather than "setp %al" and "jne" on that, they just use the "jp" instruction
directly after ucomiss:
0x00000000004005d5 <+133>: subss %xmm6,%xmm0 ; compute real part
0x00000000004005d9 <+137>: addss %xmm4,%xmm5 ; compute imaginary
part
0x00000000004005dd <+141>: ucomiss %xmm0,%xmm0 ; check for NaN on
real
0x00000000004005e0 <+144>: jnp 0x4005e7 <main+151> ; if OK, continue
0x00000000004005e2 <+146>: ucomiss %xmm5,%xmm5 ; check for NaN on
imag
0x00000000004005e5 <+149>: jp 0x400602 <main+178> ; recompute if bad
result
0x00000000004005e7 <+151>: cvtss2sd %xmm0,%xmm0
0x00000000004005eb <+155>: cvtss2sd %xmm5,%xmm1
0x00000000004005ef <+159>: mov $0x400944,%edi
0x00000000004005f4 <+164>: mov $0x2,%al
0x00000000004005f6 <+166>: callq 0x400430 <printf@plt>
0x00000000004005fb <+171>: xor %eax,%eax
0x00000000004005fd <+173>: add $0x18,%rsp
0x0000000000400601 <+177>: retq
0x0000000000400602 <+178>: movaps %xmm7,%xmm0
0x0000000000400605 <+181>: callq 0x400620 <__mulsc3>
0x000000000040060a <+186>: movaps %xmm0,%xmm5
0x000000000040060d <+189>: shufps $0xe5,%xmm5,%xmm5
0x0000000000400611 <+193>: jmp 0x4005e7 <main+151>