[PATCH] D88265: Fix comma with half vectors.
Alexandre Rames via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 29 10:01:38 PDT 2020
arames updated this revision to Diff 295025.
arames marked an inline comment as done.
arames added a comment.
Addressed review comments.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D88265/new/
https://reviews.llvm.org/D88265
Files:
clang/lib/Sema/SemaExpr.cpp
clang/test/Sema/fp16vec-sema.c
Index: clang/test/Sema/fp16vec-sema.c
===================================================================
--- clang/test/Sema/fp16vec-sema.c
+++ clang/test/Sema/fp16vec-sema.c
@@ -28,6 +28,8 @@
sv0 = hv0 >= hv1;
sv0 = hv0 || hv1; // expected-error{{logical expression with vector types 'half4' (vector of 4 '__fp16' values) and 'half4' is only supported in C++}}
sv0 = hv0 && hv1; // expected-error{{logical expression with vector types 'half4' (vector of 4 '__fp16' values) and 'half4' is only supported in C++}}
+ hv0, 1; // expected-warning 2 {{expression result unused}}
+ 1, hv0; // expected-warning 2 {{expression result unused}}
// Implicit conversion between half vectors and float vectors are not allowed.
hv0 = fv0; // expected-error{{assigning to}}
Index: clang/lib/Sema/SemaExpr.cpp
===================================================================
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -13933,9 +13933,10 @@
// float vectors and truncating the result back to half vector. For now, we do
// this only when HalfArgsAndReturn is set (that is, when the target is arm or
// arm64).
- assert(isVector(RHS.get()->getType(), Context.HalfTy) ==
- isVector(LHS.get()->getType(), Context.HalfTy) &&
- "both sides are half vectors or neither sides are");
+ assert(
+ (Opc == BO_Comma || isVector(RHS.get()->getType(), Context.HalfTy) ==
+ isVector(LHS.get()->getType(), Context.HalfTy)) &&
+ "both sides are half vectors or neither sides are");
ConvertHalfVec =
needsConversionOfHalfVec(ConvertHalfVec, Context, LHS.get(), RHS.get());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88265.295025.patch
Type: text/x-patch
Size: 1664 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200929/5ad19d68/attachment.bin>
More information about the cfe-commits
mailing list