<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"Lucida Sans Typewriter";
panose-1:2 11 5 9 3 5 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal>Hi folks,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>GNU GCC allows fused multiply add instruction generation in –std=gnu* modes (default mode in GCC) on both ARM 32-bit and 64-bit targets. See outputs below.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Clang 3.8 defaults to gnu11 for C programs, according to <a href="http://clang.llvm.org/docs/UsersManual.html#c-language-features">http://clang.llvm.org/docs/UsersManual.html#c-language-features</a> and function CompilerInvocation::setLangDefaults in ./lib/Frontend/CompilerInvocation.cpp in the Clang source code.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>So why fp-contract=fast is not made default in Clang as it is done in GNU GCC?<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Just trying to understand the rationale behind this decision. We know the instruction produces results with higher precision and compliant to IEEE 754 standard.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>This difference in default behavior in Clang/LLVM compared to GNU GCC is a performance disadvantage.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Thanks!<o:p></o:p></p><p class=MsoNormal>Ana.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'>$ cat t.c<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'>double f(double a, double b)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'>{<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'>return b*b+a*a;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'>}<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'>$ gcc-linaro-4.9-2015.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc -S -O3 -o- -std=c99 t.c<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> .cpu generic+fp+simd<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> .file "t.c"<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> .text<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> .align 2<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> .global f<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> .type f, %function<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'>f:<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> fmul d1, d1, d1<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> fmul d0, d0, d0<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> fadd d0, d1, d0<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> ret<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> .size f, .-f<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> .ident "GCC: (Linaro GCC 4.9-2015.05) 4.9.3 20150413 (prerelease)"<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> .section .note.GNU-stack,"",%progbits<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'>$ gcc-linaro-4.9-2015.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc -S -O3 -o- -std=gnu99 t.c<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> .cpu generic+fp+simd<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> .file "t.c"<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> .text<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> .align 2<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> .global f<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> .type f, %function<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'>f:<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> fmul d0, d0, d0<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> fmadd d0, d1, d1, d0<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> ret<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> .size f, .-f<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> .ident "GCC: (Linaro GCC 4.9-2015.05) 4.9.3 20150413 (prerelease)"<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> .section .note.GNU-stack,"",%progbits<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'>$ gcc-linaro-4.9-2015.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc -S -O3 -o- t.c<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> .cpu generic+fp+simd<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> .file "t.c"<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> .text<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> .align 2<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> .global f<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> .type f, %function<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'>f:<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> fmul d0, d0, d0<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> fmadd d0, d1, d1, d0<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> ret<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> .size f, .-f<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> .ident "GCC: (Linaro GCC 4.9-2015.05) 4.9.3 20150413 (prerelease)"<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-GB style='font-size:8.0pt;font-family:"Lucida Sans Typewriter"'> .section .note.GNU-stack,"",%progbits<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='color:black'>Ana Pazos</span><span style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black'><br></span><span style='color:black'>Qualcomm Innovation Center, Inc.</span><span style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black'><br></span><span style='color:black'>The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, </span><span style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black'><br></span><span style='color:black'>a Linux Foundation Collaborative Project.</span><span style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black'><br><br></span><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>