[llvm-bugs] [Bug 52566] New: -fapprox-funcs doesn't work correctly with #pragma float_control(precise, on)

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Nov 19 15:21:34 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=52566

            Bug ID: 52566
           Summary: -fapprox-funcs doesn't work correctly with #pragma
                    float_control(precise, on)
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: andrew.kaylor at intel.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

If I compile the following code with 'clang -O2 -fapprox-funcs' the
"approx-func-fp-math" attribute will be incorrectly set to 'true' and the 'afn'
flag will be set on the call to logf. The float_control pragma should disable
this.

```
#include <math.h>

#pragma float_control(precise, on)
float f(float x) {
  return logf(x);
}
```

```
define dso_local float @f(float %0) local_unnamed_addr #0 {
  %2 = tail call afn float @logf(float %0) #2
  ret float %2
}

attributes #0 = { mustprogress nofree nounwind uwtable willreturn
"approx-func-fp-math"="true" "frame-pointer"="none"
"min-legal-vector-width"="0" "no-trapping-math"="true"
"stack-protector-buffer-size"="8" "target-cpu"="x86-64"
"target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

```

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211119/002b198f/attachment.html>


More information about the llvm-bugs mailing list