[PATCH] D101209: [PowerPC] Provide fastmath sqrt and div functions in altivec.h

Qiu Chaofan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 25 21:31:05 PDT 2021


qiucf added inline comments.


================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:15122
+  case PPC::BI__builtin_ppc_rsqrtd: {
+    auto FMF = Builder.getFastMathFlags();
+    Builder.getFastMathFlags().setFast();
----------------
Seems FMF will be automatically restored without the three lines.

```
vector float test_recipdivd(vector float a, vector float b) {
  vector float x = vec_recipdiv(a, b);
  vector float y = x + b;
  return y;
}
```

```
define dso_local <4 x float> @test_recipdivd(<4 x float> %a, <4 x float> %b) {
entry:
  %recipdiv.i = fdiv fast <4 x float> %a, %b
  %add = fadd <4 x float> %recipdiv.i, %b
  ret <4 x float> %add
}
```

See https://reviews.llvm.org/D96231#inline-901337.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101209/new/

https://reviews.llvm.org/D101209



More information about the cfe-commits mailing list