Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP:Feature/arm64 simd support #414

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove static definitions and fix wrong alignments
  • Loading branch information
tdermendjiev committed Mar 21, 2018
commit 0841fd8b9f106b45731cdf2ba37ccf9d412d9648
28 changes: 14 additions & 14 deletions testsuite/libffi.call/simd_double_matrices.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ double doublesContainer[16] = {
simd_double2x2 getMatrixDouble2x2() {
simd_double2x2 result;
int i;
int u = 0;
for (i = 0; i < 2; i++) {
static int u = 0;
int y;
for (y = 0; y < 2; y++) {
result.columns[i][y] = doublesContainer[u];
Expand All @@ -32,8 +32,8 @@ simd_double2x2 getMatrixDouble2x2() {
simd_double2x3 getMatrixDouble2x3() {
simd_double2x3 result;
int i;
int u = 0;
for (i = 0; i < 2; i++) {
static int u = 0;
int y;
for (y = 0; y < 3; y++) {
result.columns[i][y] = doublesContainer[u];
Expand All @@ -46,8 +46,8 @@ simd_double2x3 getMatrixDouble2x3() {
simd_double2x4 getMatrixDouble2x4() {
simd_double2x4 result;
int i;
int u = 0;
for (i = 0; i < 2; i++) {
static int u = 0;
int y;
for (y = 0; y < 4; y++) {
result.columns[i][y] = doublesContainer[u];
Expand All @@ -60,8 +60,8 @@ simd_double2x4 getMatrixDouble2x4() {
simd_double3x2 getMatrixDouble3x2() {
simd_double3x2 result;
int i;
int u = 0;
for (i = 0; i < 3; i++) {
static int u = 0;
int y;
for (y = 0; y < 2; y++) {
result.columns[i][y] = doublesContainer[u];
Expand All @@ -74,8 +74,8 @@ simd_double3x2 getMatrixDouble3x2() {
simd_double3x3 getMatrixDouble3x3() {
simd_double3x3 result;
int i;
int u = 0;
for (i = 0; i < 3; i++) {
static int u = 0;
int y;
for (y = 0; y < 3; y++) {
result.columns[i][y] = doublesContainer[u];
Expand All @@ -88,8 +88,8 @@ simd_double3x3 getMatrixDouble3x3() {
simd_double3x4 getMatrixDouble3x4() {
simd_double3x4 result;
int i;
int u = 0;
for (i = 0; i < 3; i++) {
static int u = 0;
int y;
for (y = 0; y < 4; y++) {
result.columns[i][y] = doublesContainer[u];
Expand All @@ -102,8 +102,8 @@ simd_double3x4 getMatrixDouble3x4() {
simd_double4x2 getMatrixDouble4x2() {
simd_double4x2 result;
int i;
int u = 0;
for (i = 0; i < 4; i++) {
static int u = 0;
int y;
for (y = 0; y < 2; y++) {
result.columns[i][y] = doublesContainer[u];
Expand All @@ -116,8 +116,8 @@ simd_double4x2 getMatrixDouble4x2() {
simd_double4x3 getMatrixDouble4x3() {
simd_double4x3 result;
int i;
int u = 0;
for (i = 0; i < 4; i++) {
static int u = 0;
int y;
for (y = 0; y < 3; y++) {
result.columns[i][y] = doublesContainer[u];
Expand All @@ -130,8 +130,8 @@ simd_double4x3 getMatrixDouble4x3() {
simd_double4x4 getMatrixDouble4x4() {
simd_double4x4 result;
int i;
int u = 0;
for (i = 0; i < 4; i++) {
static int u = 0;
int y;
for (y = 0; y < 4; y++) {
result.columns[i][y] = doublesContainer[u];
Expand All @@ -148,9 +148,9 @@ int main(void) {
for (i = 0; i < 9; i++) {
int dimensions[2] = {matrixDimensionsArray[i][0], matrixDimensionsArray[i][1]};
ffi_cif cif;
int el_size = 8;
unsigned short alignment = dimensions[1] == 3 ? 4 : dimensions[1];
int bufferSize = el_size * dimensions[0] * alignment;
int el_size = sizeof(double);
unsigned short alignment = (dimensions[1] == 3 ? 4 : dimensions[1]) * el_size;
int bufferSize = dimensions[0] * alignment;
void* buffer = malloc(bufferSize);

ffi_type ffiType;
Expand All @@ -169,8 +169,8 @@ int main(void) {
ffiTypeVector.type = bufferSize/dimensions[0] > 16 ? FFI_TYPE_POINTER : FFI_TYPE_EXT_VECTOR;

ffi_type ffiTypeEl;
ffiTypeEl.size = 8;
ffiTypeEl.alignment = alignment;
ffiTypeEl.size = el_size;
ffiTypeEl.alignment = el_size;
ffiTypeEl.type = FFI_TYPE_DOUBLE;

ffi_type* colElements[2];
Expand Down
26 changes: 13 additions & 13 deletions testsuite/libffi.call/simd_float_matrices.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ simd_float2x2 getMatrixFloat2x2() {
simd_float2x3 getMatrixFloat2x3() {
simd_float2x3 result;
int i;
int u = 0;
for (i = 0; i < 2; i++) {
static int u = 0;
int y;
for (y = 0; y < 3; y++) {
result.columns[i][y] = floatsContainer[u];
Expand All @@ -60,8 +60,8 @@ simd_float2x3 getMatrixFloat2x3() {
simd_float2x4 getMatrixFloat2x4() {
simd_float2x4 result;
int i;
int u = 0;
for (i = 0; i < 2; i++) {
static int u = 0;
int y;
for (y = 0; y < 4; y++) {
result.columns[i][y] = floatsContainer[u];
Expand All @@ -74,8 +74,8 @@ simd_float2x4 getMatrixFloat2x4() {
simd_float3x2 getMatrixFloat3x2() {
simd_float3x2 result;
int i;
int u = 0;
for (i = 0; i < 3; i++) {
static int u = 0;
int y;
for (y = 0; y < 2; y++) {
result.columns[i][y] = floatsContainer[u];
Expand All @@ -88,8 +88,8 @@ simd_float3x2 getMatrixFloat3x2() {
simd_float3x3 getMatrixFloat3x3() {
simd_float3x3 result;
int i;
int u = 0;
for (i = 0; i < 3; i++) {
static int u = 0;
int y;
for (y = 0; y < 3; y++) {
result.columns[i][y] = floatsContainer[u];
Expand All @@ -102,8 +102,8 @@ simd_float3x3 getMatrixFloat3x3() {
simd_float3x4 getMatrixFloat3x4() {
simd_float3x4 result;
int i;
int u = 0;
for (i = 0; i < 3; i++) {
static int u = 0;
int y;
for (y = 0; y < 4; y++) {
result.columns[i][y] = floatsContainer[u];
Expand All @@ -116,8 +116,8 @@ simd_float3x4 getMatrixFloat3x4() {
simd_float4x2 getMatrixFloat4x2() {
simd_float4x2 result;
int i;
int u = 0;
for (i = 0; i < 4; i++) {
static int u = 0;
int y;
for (y = 0; y < 2; y++) {
result.columns[i][y] = floatsContainer[u];
Expand All @@ -130,8 +130,8 @@ simd_float4x2 getMatrixFloat4x2() {
simd_float4x3 getMatrixFloat4x3() {
simd_float4x3 result;
int i;
int u = 0;
for (i = 0; i < 4; i++) {
static int u = 0;
int y;
for (y = 0; y < 3; y++) {
result.columns[i][y] = floatsContainer[u];
Expand All @@ -144,8 +144,8 @@ simd_float4x3 getMatrixFloat4x3() {
simd_float4x4 getMatrixFloat4x4() {
simd_float4x4 result;
int i;
int u = 0;
for (i = 0; i < 4; i++) {
static int u = 0;
int y;
for (y = 0; y < 4; y++) {
result.columns[i][y] = floatsContainer[u];
Expand All @@ -162,9 +162,9 @@ int main(void) {
for (i = 0; i < 9; i++) {
int dimensions[2] = {matrixDimensionsArray[i][0], matrixDimensionsArray[i][1]};
ffi_cif cif;
int el_size = 4;
unsigned short alignment = dimensions[1] == 3 ? 4 : dimensions[1];
int bufferSize = el_size * dimensions[0] * alignment;
int el_size = sizeof(float);
int alignment = (dimensions[1] == 3 ? 4 : dimensions[1]) * el_size;
int bufferSize = dimensions[0] * alignment;
void* buffer = malloc(bufferSize);

ffi_type ffiType;
Expand All @@ -183,8 +183,8 @@ int main(void) {
ffiTypeVector.type = FFI_TYPE_EXT_VECTOR;

ffi_type ffiTypeEl;
ffiTypeEl.size = 4;
ffiTypeEl.alignment = alignment;
ffiTypeEl.size = el_size;
ffiTypeEl.alignment = el_size;
ffiTypeEl.type = FFI_TYPE_FLOAT;

ffi_type* colElements[2];
Expand Down