-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang][Interp] Start implementing vector types
Map them to primtive arrays, much like complex types.
- Loading branch information
Showing
6 changed files
with
80 additions
and
2 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
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
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
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
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
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,22 @@ | ||
// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -verify=expected,both %s | ||
// RUN: %clang_cc1 -verify=ref,both %s | ||
|
||
// both-no-diagnostics | ||
|
||
typedef int __attribute__((vector_size(16))) VI4; | ||
constexpr VI4 A = {1,2,3,4}; | ||
|
||
/// From constant-expression-cxx11.cpp | ||
namespace Vector { | ||
typedef int __attribute__((vector_size(16))) VI4; | ||
constexpr VI4 f(int n) { | ||
return VI4 { n * 3, n + 4, n - 5, n / 6 }; | ||
} | ||
constexpr auto v1 = f(10); | ||
|
||
typedef double __attribute__((vector_size(32))) VD4; | ||
constexpr VD4 g(int n) { | ||
return (VD4) { n / 2.0, n + 1.5, n - 5.4, n * 0.9 }; | ||
} | ||
constexpr auto v2 = g(4); | ||
} |