[PATCH] D151532: [test] Test ext_vector_type operators with implicit conversions
Cassie Jones via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu May 25 21:14:36 PDT 2023
porglezomp created this revision.
porglezomp added reviewers: aaron.ballman, fhahn.
Herald added a subscriber: StephenFan.
Herald added a project: All.
porglezomp requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
An extra test for implicit conversion issues discovered while testing D151060 <https://reviews.llvm.org/D151060>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D151532
Files:
clang/test/SemaCXX/vector.cpp
Index: clang/test/SemaCXX/vector.cpp
===================================================================
--- clang/test/SemaCXX/vector.cpp
+++ clang/test/SemaCXX/vector.cpp
@@ -772,3 +772,27 @@
}
#endif
}
+
+namespace {
+// Test ext_vector_type builtin operators in the presence of implicit conversions
+
+typedef int __attribute__((ext_vector_type(4))) vec4i;
+
+struct simd4i {
+ vec4i x;
+
+ simd4i(const vec4i& val): x(val) {}
+ operator vec4i() const { return x; }
+};
+
+simd4i operator| (const simd4i& lhs, const simd4i& rhs) { return vec4i(lhs) | vec4i(rhs); }
+simd4i& operator|= (simd4i& lhs, const simd4i& rhs) { return lhs = lhs | rhs; }
+
+simd4i test1(simd4i a, vec4i b) {
+ return a |= b;
+}
+
+simd4i test2(simd4i a, vec4i b) {
+ return a | b;
+}
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151532.525937.patch
Type: text/x-patch
Size: 784 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230526/1fcd60a8/attachment.bin>
More information about the cfe-commits
mailing list