-
Notifications
You must be signed in to change notification settings - Fork 751
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYCL][E2E] Add a test showing pre-existing swizzle-related bugs (#16352
- Loading branch information
1 parent
40f0a6a
commit f0b7493
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// RUN: %clangxx -fsycl %s -o %t_default.out | ||
// RUN: %t_default.out | ||
|
||
// FIXME: Everything should compile cleanly. | ||
// RUN: %clangxx -fsycl -fsycl-device-only -DCHECK_ERRORS -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note,error %s | ||
|
||
#include <sycl/vector.hpp> | ||
|
||
int main() { | ||
sycl::vec<int, 4> v{1, 2, 3, 4}; | ||
auto sw = v.swizzle<1, 2>(); | ||
assert(sw.lo()[0] == 2); | ||
assert(sw.hi()[0] == 3); | ||
|
||
// FIXME: Should be "4": | ||
assert((sw + sw).lo()[0] == 2); | ||
|
||
// FIXME: The below should compile. | ||
#if CHECK_ERRORS | ||
// expected-error-re@+1 {{no template named 'swizzle' in {{.*}}}} | ||
assert(sw.swizzle<0>()[0] == 2); | ||
// expected-error-re@+1 {{no template named 'swizzle' in {{.*}}}} | ||
assert(sw.swizzle<1>()[0] == 3); | ||
|
||
{ | ||
// expected-error-re@+1 {{no template named 'swizzle' in {{.*}}}} | ||
auto tmp = sw.swizzle<1, 0>(); | ||
assert(tmp[0] == 3); | ||
assert(tmp[1] == 2); | ||
} | ||
|
||
{ | ||
// expected-error-re@+1 {{no template named 'swizzle' in {{.*}}}} | ||
auto tmp = (sw + sw).swizzle<1, 0>(); | ||
assert(tmp[0] == 6); | ||
assert(tmp[1] == 4); | ||
} | ||
#endif | ||
|
||
return 0; | ||
} |