<div dir="ltr">I believe support for trapping math is experimental/work in progress: <a href="https://reviews.llvm.org/D62731">https://reviews.llvm.org/D62731</a></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, May 26, 2020 at 10:36 PM kamlesh kumar via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Devs,<br>going by this link <a href="https://llvm.org/docs/LangRef.html#floatenv" target="_blank">https://llvm.org/docs/LangRef.html#floatenv</a><br>it says that floating point operation does not have side effects by defaults.<br>but when compile a test case<br>i.e.<br>cat a.c<br>float foo(float a, float b)<br>{<br>return a+b;<br>}<br><br>$clang a.c -O2 -S -emit-llvm<br>emit ir like:<div>$cat a.ll<br><div>--------------------------------------- <br>; ModuleID = 'a.c'<br>source_filename = "a.c"<br>target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"<br>target triple = "x86_64-unknown-linux-gnu"<br><br>; Function Attrs: norecurse nounwind readnone uwtable<br>define dso_local float @foo(float %a, float %b) local_unnamed_addr #0 {<br>entry:<br> %add = fadd float %a, %b<br> ret float %add<br>}<br><br>attributes #0 = { norecurse nounwind readnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" <font color="#ff0000">"no-trapping-math"="false"</font> "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }<br>---------------------<br>and the setting "no-trapping-math"="false" should mean -ftrapping-math but it does not and it also contradict with documentation.<br></div></div><div><br></div><div>I think clang should emit this "no-trapping-math"="true" by default if it goes with this assumption <a href="https://llvm.org/docs/LangRef.html#floatenv" target="_blank">https://llvm.org/docs/LangRef.html#floatenv</a> ?</div><div>what is default behavior of clang -fno-trapping-math or -ftrapping-math?</div><div>also clang default behavior does not match gcc?</div><div><a href="https://godbolt.org/z/B3YvxE" target="_blank">https://godbolt.org/z/B3YvxE</a><br></div><div><br></div><div>./kamlesh</div><div><br></div><div><br></div></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>