bmahjour requested changes to this revision. bmahjour added inline comments. This revision now requires changes to proceed.
================ Comment at: clang/lib/CodeGen/CGBuiltin.cpp:15130 + Value *Y = EmitScalarExpr(E->getArg(1)); + auto Ret = Builder.CreateFDiv(X, Y, "recipdiv"); + Builder.setFastMathFlags(FMF); ---------------- I wonder if we can do better than "fdiv fast"... does the current lowering of "fdiv fast" employ an estimation algorithm via iterative refinement on POWER? ================ Comment at: clang/lib/CodeGen/CGBuiltin.cpp:15134 + } + llvm::Function *F = CGM.getIntrinsic(Intrinsic::sqrt, ResultType); + auto Ret = Builder.CreateCall(F, X); ---------------- This doesn't implement a reciprocal square root, it just performs a square root! At the very least we need a divide instruction following the call to the intrinsic, but I'm not sure if that'll result in the most optimal codegen at the end. Perhaps we need a new builtin? ================ Comment at: clang/test/CodeGen/builtins-ppc-vsx.c:2297 + // CHECK-LABEL: test_rsqrtd + // CHECK: call fast <2 x double> @llvm.sqrt.v2f64 + // CHECK-LE-LABEL: test_rsqrtd ---------------- See my comment above about the missing reciprocal operation. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D101209/new/ https://reviews.llvm.org/D101209 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits