[clang] [clang] Add sincos builtin using `llvm.sincos` intrinsic (PR #114086)

via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 29 09:53:31 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 340cd4e631d72d02cd79f9aad74d2a354abc977e 3433ebee477c17f634fbc1b32ee7c297ff4c1942 --extensions c,cpp -- clang/test/CodeGen/AArch64/sincos.c clang/lib/CodeGen/CGBuiltin.cpp clang/test/CodeGen/X86/math-builtins.c clang/test/OpenMP/declare_simd_aarch64.c
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 5bb6851c3a..331b367e63 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -738,16 +738,18 @@ static void emitSincosBuiltin(CodeGenFunction &CGF, const CallExpr *E,
   LValue SinLV = CGF.MakeNaturalAlignAddrLValue(Dest0, DestPtrType);
   LValue CosLV = CGF.MakeNaturalAlignAddrLValue(Dest1, DestPtrType);
 
-  llvm::StoreInst *StoreSin = CGF.Builder.CreateStore(SinResult, SinLV.getAddress());
-  llvm::StoreInst *StoreCos = CGF.Builder.CreateStore(CosResult, CosLV.getAddress());
+  llvm::StoreInst *StoreSin =
+      CGF.Builder.CreateStore(SinResult, SinLV.getAddress());
+  llvm::StoreInst *StoreCos =
+      CGF.Builder.CreateStore(CosResult, CosLV.getAddress());
 
   // Mark the two stores as non-aliasing with eachother. The order of stores
   // emitted by this builtin is arbitrary, enforcing a particular order will
   // prevent optimizations later on.
   llvm::MDBuilder MDHelper(CGF.getLLVMContext());
-  MDNode* Domain = MDHelper.createAnonymousAliasScopeDomain();
-  MDNode* AliasScope = MDHelper.createAnonymousAliasScope(Domain);
-  MDNode* AliasScopeList = MDNode::get(Call->getContext(), AliasScope);
+  MDNode *Domain = MDHelper.createAnonymousAliasScopeDomain();
+  MDNode *AliasScope = MDHelper.createAnonymousAliasScope(Domain);
+  MDNode *AliasScopeList = MDNode::get(Call->getContext(), AliasScope);
   StoreSin->setMetadata(LLVMContext::MD_alias_scope, AliasScopeList);
   StoreCos->setMetadata(LLVMContext::MD_noalias, AliasScopeList);
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/114086


More information about the cfe-commits mailing list