[clang] [Clang][OpenCL][AMDGPU] Allow _Float16 and half vector type compatibility (PR #170605)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 5 04:08:11 PST 2025
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 origin/main HEAD --extensions cpp,cl,c -- clang/test/CodeGen/half-float16-vector-compatibility.cl clang/test/SemaOpenCL/half-float16-vector-compatibility.cl clang/lib/AST/ASTContext.cpp clang/lib/Sema/SemaExpr.cpp clang/test/CodeGen/builtins-image-load.c clang/test/CodeGen/builtins-image-store.c clang/test/SemaOpenCL/builtins-image-load-param-gfx1100-err.cl clang/test/SemaOpenCL/builtins-image-load-param-gfx942-err.cl clang/test/SemaOpenCL/builtins-image-store-param-gfx1100-err.cl clang/test/SemaOpenCL/builtins-image-store-param-gfx942-err.cl --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 4baa80068..a8c2e39b4 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -9416,7 +9416,8 @@ AssignConvertType Sema::CheckAssignmentConstraints(QualType LHSType,
return AssignConvertType::Compatible;
}
// In OpenCL, allow compatible vector types (e.g. half to _Float16)
- if (Context.getLangOpts().OpenCL && Context.areCompatibleVectorTypes(LHSType, RHSType)) {
+ if (Context.getLangOpts().OpenCL &&
+ Context.areCompatibleVectorTypes(LHSType, RHSType)) {
Kind = CK_BitCast;
return AssignConvertType::Compatible;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/170605
More information about the cfe-commits
mailing list