Skip to content

Commit

Permalink
Fix tests on i586
Browse files Browse the repository at this point in the history
  • Loading branch information
MihailMihov committed Mar 22, 2024
1 parent 5cb3c18 commit ecf44c8
Show file tree
Hide file tree
Showing 34 changed files with 472 additions and 501 deletions.
35 changes: 17 additions & 18 deletions test/Arrays/ArrayInputsReverseMode.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

//CHECK-NOT: {{.*error|warning|note:.*}}
// XFAIL: asserts
// XFAIL: target={{i586.*}}

#include "clad/Differentiator/Differentiator.h"

Expand All @@ -19,7 +18,7 @@ double addArr(const double *arr, int n) {

//CHECK: void addArr_pullback(const double *arr, int n, double _d_y, double *_d_arr, int *_d_n) {
//CHECK-NEXT: double _d_ret = 0;
//CHECK-NEXT: unsigned long _t0;
//CHECK-NEXT: unsigned {{int|long}} _t0;
//CHECK-NEXT: int _d_i = 0;
//CHECK-NEXT: int i = 0;
//CHECK-NEXT: clad::tape<double> _t1 = {};
Expand Down Expand Up @@ -67,7 +66,7 @@ float func(float* a, float* b) {

//CHECK: void func_grad(float *a, float *b, float *_d_a, float *_d_b) {
//CHECK-NEXT: float _d_sum = 0;
//CHECK-NEXT: unsigned long _t0;
//CHECK-NEXT: unsigned {{int|long}} _t0;
//CHECK-NEXT: int _d_i = 0;
//CHECK-NEXT: int i = 0;
//CHECK-NEXT: clad::tape<float> _t1 = {};
Expand Down Expand Up @@ -120,7 +119,7 @@ float func2(float* a) {

//CHECK: void func2_grad(float *a, float *_d_a) {
//CHECK-NEXT: float _d_sum = 0;
//CHECK-NEXT: unsigned long _t0;
//CHECK-NEXT: unsigned {{int|long}} _t0;
//CHECK-NEXT: int _d_i = 0;
//CHECK-NEXT: int i = 0;
//CHECK-NEXT: clad::tape<float> _t1 = {};
Expand Down Expand Up @@ -153,7 +152,7 @@ float func3(float* a, float* b) {

//CHECK: void func3_grad(float *a, float *b, float *_d_a, float *_d_b) {
//CHECK-NEXT: float _d_sum = 0;
//CHECK-NEXT: unsigned long _t0;
//CHECK-NEXT: unsigned {{int|long}} _t0;
//CHECK-NEXT: int _d_i = 0;
//CHECK-NEXT: int i = 0;
//CHECK-NEXT: clad::tape<float> _t1 = {};
Expand Down Expand Up @@ -190,9 +189,9 @@ double func4(double x) {
}

//CHECK: void func4_grad(double x, double *_d_x) {
//CHECK-NEXT: clad::array<double> _d_arr(3UL);
//CHECK-NEXT: clad::array<double> _d_arr({{3U|3UL}});
//CHECK-NEXT: double _d_sum = 0;
//CHECK-NEXT: unsigned long _t0;
//CHECK-NEXT: unsigned {{int|long}} _t0;
//CHECK-NEXT: int _d_i = 0;
//CHECK-NEXT: int i = 0;
//CHECK-NEXT: clad::tape<double> _t1 = {};
Expand Down Expand Up @@ -239,12 +238,12 @@ double func5(int k) {

//CHECK: void func5_grad(int k, int *_d_k) {
//CHECK-NEXT: int _d_n = 0;
//CHECK-NEXT: unsigned long _t0;
//CHECK-NEXT: unsigned {{int|long}} _t0;
//CHECK-NEXT: int _d_i = 0;
//CHECK-NEXT: int i = 0;
//CHECK-NEXT: clad::tape<double> _t1 = {};
//CHECK-NEXT: double _d_sum = 0;
//CHECK-NEXT: unsigned long _t2;
//CHECK-NEXT: unsigned {{int|long}} _t2;
//CHECK-NEXT: int _d_i0 = 0;
//CHECK-NEXT: int i0 = 0;
//CHECK-NEXT: clad::tape<double> _t3 = {};
Expand Down Expand Up @@ -300,12 +299,12 @@ double func6(double seed) {

//CHECK: void func6_grad(double seed, double *_d_seed) {
//CHECK-NEXT: double _d_sum = 0;
//CHECK-NEXT: unsigned long _t0;
//CHECK-NEXT: unsigned {{int|long}} _t0;
//CHECK-NEXT: int _d_i = 0;
//CHECK-NEXT: int i = 0;
//CHECK-NEXT: clad::tape<clad::array<double> > _t1 = {};
//CHECK-NEXT: clad::array<double> _d_arr(3UL);
//CHECK-NEXT: clad::array<double> arr(3UL);
//CHECK-NEXT: clad::array<double> _d_arr({{3U|3UL}});
//CHECK-NEXT: clad::array<double> arr({{3U|3UL}});
//CHECK-NEXT: clad::tape<double> _t2 = {};
//CHECK-NEXT: double sum = 0;
//CHECK-NEXT: _t0 = 0;
Expand Down Expand Up @@ -365,12 +364,12 @@ double func7(double *params) {

//CHECK: void func7_grad(double *params, double *_d_params) {
//CHECK-NEXT: double _d_out = 0;
//CHECK-NEXT: unsigned long _t0;
//CHECK-NEXT: unsigned {{int|long}} _t0;
//CHECK-NEXT: std::size_t _d_i = 0;
//CHECK-NEXT: std::size_t i = 0;
//CHECK-NEXT: clad::tape<clad::array<double> > _t1 = {};
//CHECK-NEXT: clad::array<double> _d_paramsPrime(1UL);
//CHECK-NEXT: clad::array<double> paramsPrime(1UL);
//CHECK-NEXT: clad::array<double> _d_paramsPrime({{1U|1UL}});
//CHECK-NEXT: clad::array<double> paramsPrime({{1U|1UL}});
//CHECK-NEXT: clad::tape<double> _t2 = {};
//CHECK-NEXT: double out = 0.;
//CHECK-NEXT: _t0 = 0;
Expand Down Expand Up @@ -484,8 +483,8 @@ double func9(double i, double j) {


//CHECK: void func9_grad(double i, double j, double *_d_i, double *_d_j) {
//CHECK-NEXT: clad::array<double> _d_arr(5UL);
//CHECK-NEXT: unsigned long _t0;
//CHECK-NEXT: clad::array<double> _d_arr({{5U|5UL}});
//CHECK-NEXT: unsigned {{int|long}} _t0;
//CHECK-NEXT: int _d_idx = 0;
//CHECK-NEXT: int idx = 0;
//CHECK-NEXT: clad::tape<double> _t1 = {};
Expand Down Expand Up @@ -549,7 +548,7 @@ double func10(double *arr, int n) {
//CHECK: void func10_grad_0(double *arr, int n, double *_d_arr) {
//CHECK-NEXT: int _d_n = 0;
//CHECK-NEXT: double _d_res = 0;
//CHECK-NEXT: unsigned long _t0;
//CHECK-NEXT: unsigned {{int|long}} _t0;
//CHECK-NEXT: int _d_i = 0;
//CHECK-NEXT: int i = 0;
//CHECK-NEXT: clad::tape<double> _t1 = {};
Expand Down
30 changes: 15 additions & 15 deletions test/Arrays/ArrayInputsVectorForwardMode.C
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ double multiply(const double *arr) {
}

// CHECK: void multiply_dvec(const double *arr, clad::array_ref<double> _d_arr) {
// CHECK-NEXT: unsigned long indepVarCount = _d_arr.size();
// CHECK-NEXT: clad::matrix<double> _d_vector_arr = clad::identity_matrix(_d_arr.size(), indepVarCount, 0UL);
// CHECK-NEXT: unsigned {{int|long}} indepVarCount = _d_arr.size();
// CHECK-NEXT: clad::matrix<double> _d_vector_arr = clad::identity_matrix(_d_arr.size(), indepVarCount, {{0U|0UL}});
// CHECK-NEXT: {
// CHECK-NEXT: clad::array<double> _d_vector_return(clad::array<double>(indepVarCount, (_d_vector_arr[0]) * arr[1] + arr[0] * (_d_vector_arr[1])));
// CHECK-NEXT: _d_arr = _d_vector_return.slice(0UL, _d_arr.size());
// CHECK-NEXT: _d_arr = _d_vector_return.slice({{0U|0UL}}, _d_arr.size());
// CHECK-NEXT: return;
// CHECK-NEXT: }
// CHECK-NEXT: }
Expand All @@ -26,11 +26,11 @@ double divide(double *arr) {
}

// CHECK: void divide_dvec(double *arr, clad::array_ref<double> _d_arr) {
// CHECK-NEXT: unsigned long indepVarCount = _d_arr.size();
// CHECK-NEXT: clad::matrix<double> _d_vector_arr = clad::identity_matrix(_d_arr.size(), indepVarCount, 0UL);
// CHECK-NEXT: unsigned {{int|long}} indepVarCount = _d_arr.size();
// CHECK-NEXT: clad::matrix<double> _d_vector_arr = clad::identity_matrix(_d_arr.size(), indepVarCount, {{0U|0UL}});
// CHECK-NEXT: {
// CHECK-NEXT: clad::array<double> _d_vector_return(clad::array<double>(indepVarCount, ((_d_vector_arr[0]) * arr[1] - arr[0] * (_d_vector_arr[1])) / (arr[1] * arr[1])));
// CHECK-NEXT: _d_arr = _d_vector_return.slice(0UL, _d_arr.size());
// CHECK-NEXT: _d_arr = _d_vector_return.slice({{0U|0UL}}, _d_arr.size());
// CHECK-NEXT: return;
// CHECK-NEXT: }
// CHECK-NEXT: }
Expand All @@ -44,8 +44,8 @@ double addArr(const double *arr, int n) {
}

// CHECK: void addArr_dvec_0(const double *arr, int n, clad::array_ref<double> _d_arr) {
// CHECK-NEXT: unsigned long indepVarCount = _d_arr.size();
// CHECK-NEXT: clad::matrix<double> _d_vector_arr = clad::identity_matrix(_d_arr.size(), indepVarCount, 0UL);
// CHECK-NEXT: unsigned {{int|long}} indepVarCount = _d_arr.size();
// CHECK-NEXT: clad::matrix<double> _d_vector_arr = clad::identity_matrix(_d_arr.size(), indepVarCount, {{0U|0UL}});
// CHECK-NEXT: clad::array<int> _d_vector_n = clad::zero_vector(indepVarCount);
// CHECK-NEXT: clad::array<double> _d_vector_ret(clad::array<double>(indepVarCount, 0));
// CHECK-NEXT: double ret = 0;
Expand All @@ -58,7 +58,7 @@ double addArr(const double *arr, int n) {
// CHECK-NEXT: }
// CHECK-NEXT: {
// CHECK-NEXT: clad::array<double> _d_vector_return(clad::array<double>(indepVarCount, _d_vector_ret));
// CHECK-NEXT: _d_arr = _d_vector_return.slice(0UL, _d_arr.size());
// CHECK-NEXT: _d_arr = _d_vector_return.slice({{0U|0UL}}, _d_arr.size());
// CHECK-NEXT: return;
// CHECK-NEXT: }
// CHECK-NEXT: }
Expand All @@ -76,11 +76,11 @@ double maskedSum(const double *arr, int n, int *signedMask, double alpha, double
}

// CHECK: void maskedSum_dvec_0_3_4(const double *arr, int n, int *signedMask, double alpha, double beta, clad::array_ref<double> _d_arr, double *_d_alpha, double *_d_beta) {
// CHECK-NEXT: unsigned long indepVarCount = _d_arr.size() + 2UL;
// CHECK-NEXT: clad::matrix<double> _d_vector_arr = clad::identity_matrix(_d_arr.size(), indepVarCount, 0UL);
// CHECK-NEXT: unsigned {{int|long}} indepVarCount = _d_arr.size() + {{2U|2UL}};
// CHECK-NEXT: clad::matrix<double> _d_vector_arr = clad::identity_matrix(_d_arr.size(), indepVarCount, {{0U|0UL}});
// CHECK-NEXT: clad::array<int> _d_vector_n = clad::zero_vector(indepVarCount);
// CHECK-NEXT: clad::array<double> _d_vector_alpha = clad::one_hot_vector(indepVarCount, _d_arr.size());
// CHECK-NEXT: clad::array<double> _d_vector_beta = clad::one_hot_vector(indepVarCount, _d_arr.size() + 1UL);
// CHECK-NEXT: clad::array<double> _d_vector_beta = clad::one_hot_vector(indepVarCount, _d_arr.size() + {{1U|1UL}});
// CHECK-NEXT: clad::array<double> _d_vector_ret(clad::array<double>(indepVarCount, 0));
// CHECK-NEXT: double ret = 0;
// CHECK-NEXT: {
Expand All @@ -97,9 +97,9 @@ double maskedSum(const double *arr, int n, int *signedMask, double alpha, double
// CHECK-NEXT: }
// CHECK-NEXT: {
// CHECK-NEXT: clad::array<double> _d_vector_return(clad::array<double>(indepVarCount, _d_vector_ret));
// CHECK-NEXT: _d_arr = _d_vector_return.slice(0UL, _d_arr.size());
// CHECK-NEXT: _d_arr = _d_vector_return.slice({{0U|0UL}}, _d_arr.size());
// CHECK-NEXT: *_d_alpha = _d_vector_return[_d_arr.size()];
// CHECK-NEXT: *_d_beta = _d_vector_return[_d_arr.size() + 1UL];
// CHECK-NEXT: *_d_beta = _d_vector_return[_d_arr.size() + {{1U|1UL}}];
// CHECK-NEXT: return;
// CHECK-NEXT: }
// CHECK-NEXT: }
Expand Down Expand Up @@ -142,4 +142,4 @@ int main() {
printf("Result (d_alpha, d_beta) = (%.2f, %.2f)\n", dalpha, dbeta); // CHECK-EXEC: Result (d_alpha, d_beta) = (4.00, -2.00)

return 0;
}
}
5 changes: 2 additions & 3 deletions test/Arrays/Arrays.C
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// RUN: ./Arrays.out | FileCheck -check-prefix=CHECK-EXEC %s

//CHECK-NOT: {{.*error|warning|note:.*}}
// XFAIL: target={{i586.*}}

#include "clad/Differentiator/Differentiator.h"
#include <cmath>
Expand Down Expand Up @@ -93,8 +92,8 @@ double const_dot_product(double x, double y, double z) {
//CHECK-NEXT: }

//CHECK: void const_dot_product_grad(double x, double y, double z, double *_d_x, double *_d_y, double *_d_z) {
//CHECK-NEXT: clad::array<double> _d_vars(3UL);
//CHECK-NEXT: clad::array<double> _d_consts(3UL);
//CHECK-NEXT: clad::array<double> _d_vars({{3U|3UL}});
//CHECK-NEXT: clad::array<double> _d_consts({{3U|3UL}});
//CHECK-NEXT: double vars[3] = {x, y, z};
//CHECK-NEXT: double consts[3] = {1, 2, 3};
//CHECK-NEXT: goto _label0;
Expand Down
9 changes: 4 additions & 5 deletions test/ErrorEstimation/LoopsAndArrays.C
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// RUN: %cladclang -I%S/../../include -oLoopsAndArrays.out %s 2>&1 | FileCheck %s
// CHECK-NOT: {{.*error|warning|note:.*}}
// XFAIL: target={{i586.*}}

#include "clad/Differentiator/Differentiator.h"

Expand All @@ -17,7 +16,7 @@ float func(float* p, int n) {

//CHECK: void func_grad(float *p, int n, float *_d_p, int *_d_n, double &_final_error) {
//CHECK-NEXT: float _d_sum = 0;
//CHECK-NEXT: unsigned long _t0;
//CHECK-NEXT: unsigned {{int|long}} _t0;
//CHECK-NEXT: int _d_i = 0;
//CHECK-NEXT: int i = 0;
//CHECK-NEXT: clad::tape<float> _t1 = {};
Expand Down Expand Up @@ -60,7 +59,7 @@ float func2(float x) {

//CHECK: void func2_grad(float x, float *_d_x, double &_final_error) {
//CHECK-NEXT: float _d_z = 0;
//CHECK-NEXT: unsigned long _t0;
//CHECK-NEXT: unsigned {{int|long}} _t0;
//CHECK-NEXT: int _d_i = 0;
//CHECK-NEXT: int i = 0;
//CHECK-NEXT: clad::tape<float> _t1 = {};
Expand Down Expand Up @@ -108,7 +107,7 @@ float func3(float x, float y) {
}

//CHECK: void func3_grad(float x, float y, float *_d_x, float *_d_y, double &_final_error) {
//CHECK-NEXT: clad::array<double> _d_arr(3UL);
//CHECK-NEXT: clad::array<double> _d_arr({{3U|3UL}});
//CHECK-NEXT: double _t0;
//CHECK-NEXT: double _t1;
//CHECK-NEXT: double _t2;
Expand Down Expand Up @@ -161,7 +160,7 @@ float func4(float x[10], float y[10]) {

//CHECK: void func4_grad(float x[10], float y[10], float *_d_x, float *_d_y, double &_final_error) {
//CHECK-NEXT: float _d_sum = 0;
//CHECK-NEXT: unsigned long _t0;
//CHECK-NEXT: unsigned {{int|long}} _t0;
//CHECK-NEXT: int _d_i = 0;
//CHECK-NEXT: int i = 0;
//CHECK-NEXT: unsigned long x_size = 0;
Expand Down
11 changes: 5 additions & 6 deletions test/ErrorEstimation/LoopsAndArraysExec.C
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// RUN: ./LoopsAndArraysExec.out | FileCheck -check-prefix=CHECK-EXEC %s

// CHECK-NOT: {{.*error|warning|note:.*}}
// XFAIL: target={{i586.*}}

#include "clad/Differentiator/Differentiator.h"

Expand All @@ -18,7 +17,7 @@ double runningSum(float* f, int n) {

//CHECK: void runningSum_grad(float *f, int n, float *_d_f, int *_d_n, double &_final_error) {
//CHECK-NEXT: double _d_sum = 0;
//CHECK-NEXT: unsigned long _t0;
//CHECK-NEXT: unsigned {{int|long}} _t0;
//CHECK-NEXT: int _d_i = 0;
//CHECK-NEXT: int i = 0;
//CHECK-NEXT: clad::tape<double> _t1 = {};
Expand Down Expand Up @@ -62,10 +61,10 @@ double mulSum(float* a, float* b, int n) {

//CHECK: void mulSum_grad(float *a, float *b, int n, float *_d_a, float *_d_b, int *_d_n, double &_final_error) {
//CHECK-NEXT: double _d_sum = 0;
//CHECK-NEXT: unsigned long _t0;
//CHECK-NEXT: unsigned {{int|long}} _t0;
//CHECK-NEXT: int _d_i = 0;
//CHECK-NEXT: int i = 0;
//CHECK-NEXT: clad::tape<unsigned long> _t1 = {};
//CHECK-NEXT: clad::tape<unsigned {{int|long}}> _t1 = {};
//CHECK-NEXT: clad::tape<int> _t2 = {};
//CHECK-NEXT: int _d_j = 0;
//CHECK-NEXT: int j = 0;
Expand All @@ -76,7 +75,7 @@ double mulSum(float* a, float* b, int n) {
//CHECK-NEXT: _t0 = 0;
//CHECK-NEXT: for (i = 0; i < n; i++) {
//CHECK-NEXT: _t0++;
//CHECK-NEXT: clad::push(_t1, 0UL);
//CHECK-NEXT: clad::push(_t1, {{0U|0UL}});
//CHECK-NEXT: for (clad::push(_t2, j) , j = 0; j < n; j++) {
//CHECK-NEXT: clad::back(_t1)++;
//CHECK-NEXT: clad::push(_t3, sum);
Expand Down Expand Up @@ -125,7 +124,7 @@ double divSum(float* a, float* b, int n) {

//CHECK: void divSum_grad(float *a, float *b, int n, float *_d_a, float *_d_b, int *_d_n, double &_final_error) {
//CHECK-NEXT: double _d_sum = 0;
//CHECK-NEXT: unsigned long _t0;
//CHECK-NEXT: unsigned {{int|long}} _t0;
//CHECK-NEXT: int _d_i = 0;
//CHECK-NEXT: int i = 0;
//CHECK-NEXT: clad::tape<double> _t1 = {};
Expand Down
7 changes: 3 additions & 4 deletions test/FirstDerivative/BasicArithmeticMulDiv.C
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// RUN: ./BasicArithmeticMulDiv.out | FileCheck -check-prefix=CHECK-EXEC %s

//CHECK-NOT: {{.*error|warning|note:.*}}
// XFAIL: target={{i586.*}}

#include "clad/Differentiator/Differentiator.h"

Expand Down Expand Up @@ -116,9 +115,9 @@ double m_11(double x) {
// CHECK-NEXT: double _d_x = 1;
// CHECK-NEXT: const size_t _d_maxN = 0;
// CHECK-NEXT: const size_t maxN = 53;
// CHECK-NEXT: bool _t0 = maxN < 64UL;
// CHECK-NEXT: const size_t _d_m = _t0 ? _d_maxN : 0UL;
// CHECK-NEXT: const size_t m = _t0 ? maxN : 64UL;
// CHECK-NEXT: bool _t0 = maxN < {{64U|64UL}};
// CHECK-NEXT: const size_t _d_m = _t0 ? _d_maxN : {{0U|0UL}};
// CHECK-NEXT: const size_t m = _t0 ? maxN : {{64U|64UL}};
// CHECK-NEXT: return _d_x * m + x * _d_m;
// CHECK-NEXT: }

Expand Down
Loading

0 comments on commit ecf44c8

Please sign in to comment.