[PATCH] D101209: [PowerPC] Provide fastmath sqrt and div functions in altivec.h
Nemanja Ivanovic via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 26 12:07:17 PDT 2021
nemanjai added inline comments.
================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:15122
+ case PPC::BI__builtin_ppc_rsqrtd: {
+ auto FMF = Builder.getFastMathFlags();
+ Builder.getFastMathFlags().setFast();
----------------
qiucf wrote:
> 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.
Thanks for finding that. I did notice that and was wondering how the FMF flags return to what they were in the X86 code. So I added the reset of the flags just to be on the safe side. Now that I see that, I'll get rid of those.
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