From ed33417a64bfe3d5d8159e29751532c34cb54990 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Sun, 16 Sep 2018 19:37:44 +0000 Subject: [PATCH] re PR fortran/37802 (Improve wording for matmul bound checking) 2018-09-16 Thomas Koenig PR fortran/37802 * frontend-passes.c (B_ERROR): New macro for matmul bounds checking error messages. (C_ERROR): Likewise. (inline_matmul_assign): Reorganize bounds checking, use B_ERROR and C_ERROR macros. 2018-09-16 Thomas Koenig PR fortran/37802 * gfortran.dg/matmul_bounds_13.f90: New test case. * gfortran.dg/inline_matmul_15.f90: Adjust test for runtime error. * gfortran.dg/matmul_5.f90: Likewise. * gfortran.dg/matmul_bounds_10.f90: Likewise. * gfortran.dg/matmul_bounds_11.f90: Likewise. * gfortran.dg/matmul_bounds_2.f90: Likewise. * gfortran.dg/matmul_bounds_4.f90: Likewise. * gfortran.dg/matmul_bounds_5.f90: Likewise. 2018-09-16 Thomas Koenig PR fortran/37802 * m4/matmul_internal.m4: Adjust error messages. * generated/matmul_c10.c: Regenerated. * generated/matmul_c16.c: Regenerated. * generated/matmul_c4.c: Regenerated. * generated/matmul_c8.c: Regenerated. * generated/matmul_i1.c: Regenerated. * generated/matmul_i16.c: Regenerated. * generated/matmul_i2.c: Regenerated. * generated/matmul_i4.c: Regenerated. * generated/matmul_i8.c: Regenerated. * generated/matmul_r10.c: Regenerated. * generated/matmul_r16.c: Regenerated. * generated/matmul_r4.c: Regenerated. * generated/matmul_r8.c: Regenerated. * generated/matmulavx128_c10.c: Regenerated. * generated/matmulavx128_c16.c: Regenerated. * generated/matmulavx128_c4.c: Regenerated. * generated/matmulavx128_c8.c: Regenerated. * generated/matmulavx128_i1.c: Regenerated. * generated/matmulavx128_i16.c: Regenerated. * generated/matmulavx128_i2.c: Regenerated. * generated/matmulavx128_i4.c: Regenerated. * generated/matmulavx128_i8.c: Regenerated. * generated/matmulavx128_r10.c: Regenerated. * generated/matmulavx128_r16.c: Regenerated. * generated/matmulavx128_r4.c: Regenerated. * generated/matmulavx128_r8.c: Regenerated. From-SVN: r264349 --- gcc/fortran/ChangeLog | 9 + gcc/fortran/frontend-passes.c | 223 ++++++++---------- gcc/testsuite/ChangeLog | 13 + .../gfortran.dg/inline_matmul_15.f90 | 2 +- gcc/testsuite/gfortran.dg/matmul_5.f90 | 2 +- .../gfortran.dg/matmul_bounds_10.f90 | 2 +- .../gfortran.dg/matmul_bounds_11.f90 | 2 +- .../gfortran.dg/matmul_bounds_13.f90 | 13 + gcc/testsuite/gfortran.dg/matmul_bounds_2.f90 | 2 +- gcc/testsuite/gfortran.dg/matmul_bounds_3.f90 | 2 +- gcc/testsuite/gfortran.dg/matmul_bounds_4.f90 | 2 +- gcc/testsuite/gfortran.dg/matmul_bounds_5.f90 | 2 +- gcc/testsuite/gfortran.dg/matmul_bounds_8.f90 | 2 +- libgfortran/ChangeLog | 31 +++ libgfortran/generated/matmul_c10.c | 175 +++++++++----- libgfortran/generated/matmul_c16.c | 175 +++++++++----- libgfortran/generated/matmul_c4.c | 175 +++++++++----- libgfortran/generated/matmul_c8.c | 175 +++++++++----- libgfortran/generated/matmul_i1.c | 175 +++++++++----- libgfortran/generated/matmul_i16.c | 175 +++++++++----- libgfortran/generated/matmul_i2.c | 175 +++++++++----- libgfortran/generated/matmul_i4.c | 175 +++++++++----- libgfortran/generated/matmul_i8.c | 175 +++++++++----- libgfortran/generated/matmul_r10.c | 175 +++++++++----- libgfortran/generated/matmul_r16.c | 175 +++++++++----- libgfortran/generated/matmul_r4.c | 175 +++++++++----- libgfortran/generated/matmul_r8.c | 175 +++++++++----- libgfortran/generated/matmulavx128_c10.c | 70 ++++-- libgfortran/generated/matmulavx128_c16.c | 70 ++++-- libgfortran/generated/matmulavx128_c4.c | 70 ++++-- libgfortran/generated/matmulavx128_c8.c | 70 ++++-- libgfortran/generated/matmulavx128_i1.c | 70 ++++-- libgfortran/generated/matmulavx128_i16.c | 70 ++++-- libgfortran/generated/matmulavx128_i2.c | 70 ++++-- libgfortran/generated/matmulavx128_i4.c | 70 ++++-- libgfortran/generated/matmulavx128_i8.c | 70 ++++-- libgfortran/generated/matmulavx128_r10.c | 70 ++++-- libgfortran/generated/matmulavx128_r16.c | 70 ++++-- libgfortran/generated/matmulavx128_r4.c | 70 ++++-- libgfortran/generated/matmulavx128_r8.c | 70 ++++-- libgfortran/m4/matmul_internal.m4 | 35 ++- 41 files changed, 2293 insertions(+), 1234 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/matmul_bounds_13.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index becc184828c..6f4872e65d6 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,12 @@ +2018-09-16 Thomas Koenig + + PR fortran/37802 + * frontend-passes.c (B_ERROR): New macro for matmul bounds + checking error messages. + (C_ERROR): Likewise. + (inline_matmul_assign): Reorganize bounds checking, use B_ERROR + and C_ERROR macros. + 2018-09-13 Bernd Edlinger * trans-array.c (gfc_conv_array_initializer): Remove excess precision diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c index 0a5e8937015..80a65fc9a21 100644 --- a/gcc/fortran/frontend-passes.c +++ b/gcc/fortran/frontend-passes.c @@ -3748,6 +3748,15 @@ check_conjg_transpose_variable (gfc_expr *e, bool *conjg, bool *transpose) return NULL; } +/* Macros for unified error messages. */ + +#define B_ERROR(n) _("Incorrect extent in argument B in MATMUL intrinsic in " \ + "dimension " #n ": is %ld, should be %ld") + +#define C_ERROR(n) _("Array bound mismatch for dimension " #n " of array " \ + "(%ld/%ld)") + + /* Inline assignments of the form c = matmul(a,b). Handle only the cases currently where b and c are rank-two arrays. @@ -3793,6 +3802,7 @@ inline_matmul_assign (gfc_code **c, int *walk_subtrees, gfc_code *if_limit = NULL; gfc_code **next_code_point; bool conjg_a, conjg_b, transpose_a, transpose_b; + bool realloc_c; if (co->op != EXEC_ASSIGN) return 0; @@ -3958,169 +3968,140 @@ inline_matmul_assign (gfc_code **c, int *walk_subtrees, assign_zero->expr1->no_bounds_check = 1; assign_zero->expr2 = zero_e; - /* Handle the reallocation, if needed. */ - if (flag_realloc_lhs && gfc_is_reallocatable_lhs (expr1)) - { - gfc_code *lhs_alloc; + realloc_c = flag_realloc_lhs && gfc_is_reallocatable_lhs (expr1); - /* Only need to check a single dimension for the A2B2 case for - bounds checking, the rest will be allocated. Also check this - for A2B1. */ + if (gfc_option.rtcheck & GFC_RTCHECK_BOUNDS) + { + gfc_code *test; + gfc_expr *a2, *b1, *c1, *c2, *a1, *b2; - if (gfc_option.rtcheck & GFC_RTCHECK_BOUNDS) + switch (m_case) { - gfc_code *test; - if (m_case == A2B2 || m_case == A2B1) - { - gfc_expr *a2, *b1; + case A2B1: - a2 = get_array_inq_function (GFC_ISYM_SIZE, matrix_a, 2); - b1 = get_array_inq_function (GFC_ISYM_SIZE, matrix_b, 1); - test = runtime_error_ne (b1, a2, "Dimension of array B incorrect " - "in MATMUL intrinsic: Is %ld, should be %ld"); - *next_code_point = test; - next_code_point = &test->next; - } - else if (m_case == A1B2) - { - gfc_expr *a1, *b1; + b1 = get_array_inq_function (GFC_ISYM_SIZE, matrix_b, 1); + a2 = get_array_inq_function (GFC_ISYM_SIZE, matrix_a, 2); + test = runtime_error_ne (b1, a2, B_ERROR(1)); + *next_code_point = test; + next_code_point = &test->next; + if (!realloc_c) + { + c1 = get_array_inq_function (GFC_ISYM_SIZE, expr1, 1); a1 = get_array_inq_function (GFC_ISYM_SIZE, matrix_a, 1); - b1 = get_array_inq_function (GFC_ISYM_SIZE, matrix_b, 1); - test = runtime_error_ne (b1, a1, "Dimension of array B incorrect " - "in MATMUL intrinsic: Is %ld, should be %ld"); + test = runtime_error_ne (c1, a1, C_ERROR(1)); *next_code_point = test; next_code_point = &test->next; } - } - - lhs_alloc = matmul_lhs_realloc (expr1, matrix_a, matrix_b, m_case); - - *next_code_point = lhs_alloc; - next_code_point = &lhs_alloc->next; + break; - } - else if (gfc_option.rtcheck & GFC_RTCHECK_BOUNDS) - { - gfc_code *test; - gfc_expr *a2, *b1, *c1, *c2, *a1, *b2; + case A1B2: - if (m_case == A2B2 || m_case == A2B1) - { - a2 = get_array_inq_function (GFC_ISYM_SIZE, matrix_a, 2); b1 = get_array_inq_function (GFC_ISYM_SIZE, matrix_b, 1); - test = runtime_error_ne (b1, a2, "Dimension of array B incorrect " - "in MATMUL intrinsic: Is %ld, should be %ld"); + a1 = get_array_inq_function (GFC_ISYM_SIZE, matrix_a, 1); + test = runtime_error_ne (b1, a1, B_ERROR(1)); *next_code_point = test; next_code_point = &test->next; - c1 = get_array_inq_function (GFC_ISYM_SIZE, expr1, 1); - a1 = get_array_inq_function (GFC_ISYM_SIZE, matrix_a, 1); - - if (m_case == A2B2) - test = runtime_error_ne (c1, a1, "Incorrect extent in return array in " - "MATMUL intrinsic for dimension 1: " - "is %ld, should be %ld"); - else if (m_case == A2B1) - test = runtime_error_ne (c1, a1, "Incorrect extent in return array in " - "MATMUL intrinsic: " - "is %ld, should be %ld"); + if (!realloc_c) + { + c1 = get_array_inq_function (GFC_ISYM_SIZE, expr1, 1); + b2 = get_array_inq_function (GFC_ISYM_SIZE, matrix_b, 2); + test = runtime_error_ne (c1, b2, C_ERROR(1)); + *next_code_point = test; + next_code_point = &test->next; + } + break; + case A2B2: - *next_code_point = test; - next_code_point = &test->next; - } - else if (m_case == A1B2) - { - a1 = get_array_inq_function (GFC_ISYM_SIZE, matrix_a, 1); b1 = get_array_inq_function (GFC_ISYM_SIZE, matrix_b, 1); - test = runtime_error_ne (b1, a1, "Dimension of array B incorrect " - "in MATMUL intrinsic: Is %ld, should be %ld"); + a2 = get_array_inq_function (GFC_ISYM_SIZE, matrix_a, 2); + test = runtime_error_ne (b1, a2, B_ERROR(1)); *next_code_point = test; next_code_point = &test->next; - c1 = get_array_inq_function (GFC_ISYM_SIZE, expr1, 1); - b2 = get_array_inq_function (GFC_ISYM_SIZE, matrix_b, 2); + if (!realloc_c) + { + c1 = get_array_inq_function (GFC_ISYM_SIZE, expr1, 1); + a1 = get_array_inq_function (GFC_ISYM_SIZE, matrix_a, 1); + test = runtime_error_ne (c1, a1, C_ERROR(1)); + *next_code_point = test; + next_code_point = &test->next; - test = runtime_error_ne (c1, b2, "Incorrect extent in return array in " - "MATMUL intrinsic: " - "is %ld, should be %ld"); + c2 = get_array_inq_function (GFC_ISYM_SIZE, expr1, 2); + b2 = get_array_inq_function (GFC_ISYM_SIZE, matrix_b, 2); + test = runtime_error_ne (c2, b2, C_ERROR(2)); + *next_code_point = test; + next_code_point = &test->next; + } + break; - *next_code_point = test; - next_code_point = &test->next; - } + case A2B2T: - if (m_case == A2B2) - { - c2 = get_array_inq_function (GFC_ISYM_SIZE, expr1, 2); b2 = get_array_inq_function (GFC_ISYM_SIZE, matrix_b, 2); - test = runtime_error_ne (c2, b2, "Incorrect extent in return array in " - "MATMUL intrinsic for dimension 2: is %ld, should be %ld"); - + a2 = get_array_inq_function (GFC_ISYM_SIZE, matrix_a, 2); + /* matrix_b is transposed, hence dimension 1 for the error message. */ + test = runtime_error_ne (b2, a2, B_ERROR(1)); *next_code_point = test; next_code_point = &test->next; - } - if (m_case == A2B2T) - { - c1 = get_array_inq_function (GFC_ISYM_SIZE, expr1, 1); - a1 = get_array_inq_function (GFC_ISYM_SIZE, matrix_a, 1); - test = runtime_error_ne (c1, a1, "Incorrect extent in return array in " - "MATMUL intrinsic for dimension 1: " - "is %ld, should be %ld"); + if (!realloc_c) + { + c1 = get_array_inq_function (GFC_ISYM_SIZE, expr1, 1); + a1 = get_array_inq_function (GFC_ISYM_SIZE, matrix_a, 1); + test = runtime_error_ne (c1, a1, C_ERROR(1)); + *next_code_point = test; + next_code_point = &test->next; - *next_code_point = test; - next_code_point = &test->next; + c2 = get_array_inq_function (GFC_ISYM_SIZE, expr1, 2); + b1 = get_array_inq_function (GFC_ISYM_SIZE, matrix_b, 1); + test = runtime_error_ne (c2, b1, C_ERROR(2)); + *next_code_point = test; + next_code_point = &test->next; + } + break; + + case A2TB2: - c2 = get_array_inq_function (GFC_ISYM_SIZE, expr1, 2); b1 = get_array_inq_function (GFC_ISYM_SIZE, matrix_b, 1); - test = runtime_error_ne (c2, b1, "Incorrect extent in return array in " - "MATMUL intrinsic for dimension 2: " - "is %ld, should be %ld"); + a1 = get_array_inq_function (GFC_ISYM_SIZE, matrix_a, 1); + test = runtime_error_ne (b1, a1, B_ERROR(1)); *next_code_point = test; next_code_point = &test->next; - a2 = get_array_inq_function (GFC_ISYM_SIZE, matrix_a, 2); - b2 = get_array_inq_function (GFC_ISYM_SIZE, matrix_b, 2); + if (!realloc_c) + { + c1 = get_array_inq_function (GFC_ISYM_SIZE, expr1, 1); + a2 = get_array_inq_function (GFC_ISYM_SIZE, matrix_a, 2); + test = runtime_error_ne (c1, a2, C_ERROR(1)); + *next_code_point = test; + next_code_point = &test->next; - test = runtime_error_ne (b2, a2, "Incorrect extent in argument B in " - "MATMUL intrnisic for dimension 2: " - "is %ld, should be %ld"); - *next_code_point = test; - next_code_point = &test->next; + c2 = get_array_inq_function (GFC_ISYM_SIZE, expr1, 2); + b2 = get_array_inq_function (GFC_ISYM_SIZE, matrix_b, 2); + test = runtime_error_ne (c2, b2, C_ERROR(2)); + *next_code_point = test; + next_code_point = &test->next; + } + break; + default: + gcc_unreachable (); } + } - if (m_case == A2TB2) - { - c1 = get_array_inq_function (GFC_ISYM_SIZE, expr1, 1); - a2 = get_array_inq_function (GFC_ISYM_SIZE, matrix_a, 2); - - test = runtime_error_ne (c1, a2, "Incorrect extent in return array in " - "MATMUL intrinsic for dimension 1: " - "is %ld, should be %ld"); - - *next_code_point = test; - next_code_point = &test->next; + /* Handle the reallocation, if needed. */ - c2 = get_array_inq_function (GFC_ISYM_SIZE, expr1, 2); - b2 = get_array_inq_function (GFC_ISYM_SIZE, matrix_b, 2); - test = runtime_error_ne (c2, b2, "Incorrect extent in return array in " - "MATMUL intrinsic for dimension 2: " - "is %ld, should be %ld"); - *next_code_point = test; - next_code_point = &test->next; + if (realloc_c) + { + gfc_code *lhs_alloc; - a1 = get_array_inq_function (GFC_ISYM_SIZE, matrix_a, 1); - b1 = get_array_inq_function (GFC_ISYM_SIZE, matrix_b, 1); + lhs_alloc = matmul_lhs_realloc (expr1, matrix_a, matrix_b, m_case); - test = runtime_error_ne (b1, a1, "Incorrect extent in argument B in " - "MATMUL intrnisic for dimension 2: " - "is %ld, should be %ld"); - *next_code_point = test; - next_code_point = &test->next; + *next_code_point = lhs_alloc; + next_code_point = &lhs_alloc->next; - } } *next_code_point = assign_zero; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 847f57ba95c..e37c1773bff 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,16 @@ +2018-09-16 Thomas Koenig + + PR fortran/37802 + * gfortran.dg/matmul_bounds_13.f90: New test case. + * gfortran.dg/inline_matmul_15.f90: Adjust test for runtime + error. + * gfortran.dg/matmul_5.f90: Likewise. + * gfortran.dg/matmul_bounds_10.f90: Likewise. + * gfortran.dg/matmul_bounds_11.f90: Likewise. + * gfortran.dg/matmul_bounds_2.f90: Likewise. + * gfortran.dg/matmul_bounds_4.f90: Likewise. + * gfortran.dg/matmul_bounds_5.f90: Likewise. + 2018-09-15 Eric Botcazou * gcc.c-torture/compile/20180915-1.c: New test. diff --git a/gcc/testsuite/gfortran.dg/inline_matmul_15.f90 b/gcc/testsuite/gfortran.dg/inline_matmul_15.f90 index c822248c49a..47da01c2b9f 100644 --- a/gcc/testsuite/gfortran.dg/inline_matmul_15.f90 +++ b/gcc/testsuite/gfortran.dg/inline_matmul_15.f90 @@ -9,4 +9,4 @@ program main call random_number(b) print *,matmul(a,b) end program main -! { dg-output "Fortran runtime error: Dimension of array B incorrect in MATMUL intrinsic.*" } +! { dg-output "Fortran runtime error: Incorrect extent in argument B in MATMUL intrinsic in dimension 1" } diff --git a/gcc/testsuite/gfortran.dg/matmul_5.f90 b/gcc/testsuite/gfortran.dg/matmul_5.f90 index 5f1402889d3..79de7bf8079 100644 --- a/gcc/testsuite/gfortran.dg/matmul_5.f90 +++ b/gcc/testsuite/gfortran.dg/matmul_5.f90 @@ -9,4 +9,4 @@ program main call random_number(b) print *,matmul(a,b) end program main -! { dg-output "Fortran runtime error: dimension of array B incorrect in MATMUL intrinsic.*" } +! { dg-output "Fortran runtime error: Incorrect extent in argument B in MATMUL intrinsic in dimension 1" } diff --git a/gcc/testsuite/gfortran.dg/matmul_bounds_10.f90 b/gcc/testsuite/gfortran.dg/matmul_bounds_10.f90 index 6608b49dae9..38992460add 100644 --- a/gcc/testsuite/gfortran.dg/matmul_bounds_10.f90 +++ b/gcc/testsuite/gfortran.dg/matmul_bounds_10.f90 @@ -13,4 +13,4 @@ program main allocate(ret(4,3)) ret = matmul(a,transpose(b)) ! This should throw an error. end program main -! { dg-output "Fortran runtime error: Incorrect extent in return array in MATMUL intrinsic for dimension 1: is 4, should be 3" } +! { dg-output "Fortran runtime error: Array bound mismatch for dimension 1 of array.*" } diff --git a/gcc/testsuite/gfortran.dg/matmul_bounds_11.f90 b/gcc/testsuite/gfortran.dg/matmul_bounds_11.f90 index 9209760e50b..ee52a7b1ead 100644 --- a/gcc/testsuite/gfortran.dg/matmul_bounds_11.f90 +++ b/gcc/testsuite/gfortran.dg/matmul_bounds_11.f90 @@ -11,5 +11,5 @@ program main res = matmul(a,b) print *,res end program main -! { dg-output "Fortran runtime error: Dimension of array B incorrect in MATMUL intrinsic.*" } +! { dg-output "Fortran runtime error: Incorrect extent in argument B in MATMUL intrinsic in dimension 1: is 3, should be 2" } diff --git a/gcc/testsuite/gfortran.dg/matmul_bounds_13.f90 b/gcc/testsuite/gfortran.dg/matmul_bounds_13.f90 new file mode 100644 index 00000000000..154b13397fe --- /dev/null +++ b/gcc/testsuite/gfortran.dg/matmul_bounds_13.f90 @@ -0,0 +1,13 @@ +! { dg-do run } +! { dg-options "-fcheck=bounds" } +! { dg-shouldfail "Fortran runtime error: Incorrect extent in argument B in MATMUL intrinsic in dimension 1" } +program main + real, dimension(:,:), allocatable :: a, b, c + character(len=100) :: line + allocate (a(3,2)) + allocate (b(2,4)) + call random_number(a) + call random_number(b) + write (unit=line, fmt=*) matmul(a,transpose(b)) +end program main +! { dg-output "Fortran runtime error: Incorrect extent in argument B in MATMUL intrinsic in dimension 1" } diff --git a/gcc/testsuite/gfortran.dg/matmul_bounds_2.f90 b/gcc/testsuite/gfortran.dg/matmul_bounds_2.f90 index 978751e70e6..7a1deb35ff2 100644 --- a/gcc/testsuite/gfortran.dg/matmul_bounds_2.f90 +++ b/gcc/testsuite/gfortran.dg/matmul_bounds_2.f90 @@ -13,4 +13,4 @@ program main allocate(ret(3,2)) ret = matmul(a,b) ! This should throw an error. end program main -! { dg-output "Fortran runtime error: Incorrect extent in return array in MATMUL intrinsic for dimension 2: is 2, should be 3" } +! { dg-output "Fortran runtime error: Array bound mismatch for dimension 2 of array.*" } diff --git a/gcc/testsuite/gfortran.dg/matmul_bounds_3.f90 b/gcc/testsuite/gfortran.dg/matmul_bounds_3.f90 index 4b80f8c2be8..8c8ae4340f6 100644 --- a/gcc/testsuite/gfortran.dg/matmul_bounds_3.f90 +++ b/gcc/testsuite/gfortran.dg/matmul_bounds_3.f90 @@ -13,4 +13,4 @@ program main allocate(ret(2,3)) ret = matmul(a,b) ! This should throw an error. end program main -! { dg-output "Fortran runtime error: Incorrect extent in return array in MATMUL intrinsic for dimension 1: is 2, should be 3" } +! { dg-output "Fortran runtime error: Array bound mismatch for dimension 1 of array" } diff --git a/gcc/testsuite/gfortran.dg/matmul_bounds_4.f90 b/gcc/testsuite/gfortran.dg/matmul_bounds_4.f90 index 94add6ce8e7..2dac29fe6e3 100644 --- a/gcc/testsuite/gfortran.dg/matmul_bounds_4.f90 +++ b/gcc/testsuite/gfortran.dg/matmul_bounds_4.f90 @@ -13,4 +13,4 @@ program main allocate(ret(3)) ret = matmul(a,b) ! This should throw an error. end program main -! { dg-output "Fortran runtime error: Incorrect extent in return array in MATMUL intrinsic: is 3, should be 2" } +! { dg-output "Fortran runtime error: Array bound mismatch for dimension 1 of array" } diff --git a/gcc/testsuite/gfortran.dg/matmul_bounds_5.f90 b/gcc/testsuite/gfortran.dg/matmul_bounds_5.f90 index 5261e8e443a..d2013ea906c 100644 --- a/gcc/testsuite/gfortran.dg/matmul_bounds_5.f90 +++ b/gcc/testsuite/gfortran.dg/matmul_bounds_5.f90 @@ -13,4 +13,4 @@ program main allocate(ret(3)) ret = matmul(a,b) ! This should throw an error. end program main -! { dg-output "Fortran runtime error: Incorrect extent in return array in MATMUL intrinsic: is 3, should be 2" } +! { dg-output "Fortran runtime error: Array bound mismatch for dimension 1 of array" } diff --git a/gcc/testsuite/gfortran.dg/matmul_bounds_8.f90 b/gcc/testsuite/gfortran.dg/matmul_bounds_8.f90 index 2764cf38adf..11f58870f10 100644 --- a/gcc/testsuite/gfortran.dg/matmul_bounds_8.f90 +++ b/gcc/testsuite/gfortran.dg/matmul_bounds_8.f90 @@ -13,4 +13,4 @@ program main allocate(ret(3,2)) ret = matmul(a,transpose(b)) ! This should throw an error. end program main -! { dg-output "Fortran runtime error: Incorrect extent in return array in MATMUL intrinsic for dimension 2: is 2, should be 3" } +! { dg-output "Fortran runtime error: Array bound mismatch for dimension 2 of array" } diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 56828b1bee5..4c20390656f 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,34 @@ +2018-09-16 Thomas Koenig + + PR fortran/37802 + * m4/matmul_internal.m4: Adjust error messages. + * generated/matmul_c10.c: Regenerated. + * generated/matmul_c16.c: Regenerated. + * generated/matmul_c4.c: Regenerated. + * generated/matmul_c8.c: Regenerated. + * generated/matmul_i1.c: Regenerated. + * generated/matmul_i16.c: Regenerated. + * generated/matmul_i2.c: Regenerated. + * generated/matmul_i4.c: Regenerated. + * generated/matmul_i8.c: Regenerated. + * generated/matmul_r10.c: Regenerated. + * generated/matmul_r16.c: Regenerated. + * generated/matmul_r4.c: Regenerated. + * generated/matmul_r8.c: Regenerated. + * generated/matmulavx128_c10.c: Regenerated. + * generated/matmulavx128_c16.c: Regenerated. + * generated/matmulavx128_c4.c: Regenerated. + * generated/matmulavx128_c8.c: Regenerated. + * generated/matmulavx128_i1.c: Regenerated. + * generated/matmulavx128_i16.c: Regenerated. + * generated/matmulavx128_i2.c: Regenerated. + * generated/matmulavx128_i4.c: Regenerated. + * generated/matmulavx128_i8.c: Regenerated. + * generated/matmulavx128_r10.c: Regenerated. + * generated/matmulavx128_r16.c: Regenerated. + * generated/matmulavx128_r4.c: Regenerated. + * generated/matmulavx128_r8.c: Regenerated. + 2018-09-14 Kyrylo Tkachov * io/unix.c (fallback_access): Avoid calling close on diff --git a/libgfortran/generated/matmul_c10.c b/libgfortran/generated/matmul_c10.c index 462d71e23f5..ac42158a2c1 100644 --- a/libgfortran/generated/matmul_c10.c +++ b/libgfortran/generated/matmul_c10.c @@ -144,8 +144,8 @@ matmul_c10_avx (gfc_array_c10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -153,8 +153,8 @@ matmul_c10_avx (gfc_array_c10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -162,17 +162,15 @@ matmul_c10_avx (gfc_array_c10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -213,7 +211,9 @@ matmul_c10_avx (gfc_array_c10 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -258,7 +258,18 @@ matmul_c10_avx (gfc_array_c10 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -701,8 +712,8 @@ matmul_c10_avx2 (gfc_array_c10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -710,8 +721,8 @@ matmul_c10_avx2 (gfc_array_c10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -719,17 +730,15 @@ matmul_c10_avx2 (gfc_array_c10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -770,7 +779,9 @@ matmul_c10_avx2 (gfc_array_c10 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -815,7 +826,18 @@ matmul_c10_avx2 (gfc_array_c10 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -1258,8 +1280,8 @@ matmul_c10_avx512f (gfc_array_c10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1267,8 +1289,8 @@ matmul_c10_avx512f (gfc_array_c10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -1276,17 +1298,15 @@ matmul_c10_avx512f (gfc_array_c10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -1327,7 +1347,9 @@ matmul_c10_avx512f (gfc_array_c10 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1372,7 +1394,18 @@ matmul_c10_avx512f (gfc_array_c10 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -1829,8 +1862,8 @@ matmul_c10_vanilla (gfc_array_c10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1838,8 +1871,8 @@ matmul_c10_vanilla (gfc_array_c10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -1847,17 +1880,15 @@ matmul_c10_vanilla (gfc_array_c10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -1898,7 +1929,9 @@ matmul_c10_vanilla (gfc_array_c10 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1943,7 +1976,18 @@ matmul_c10_vanilla (gfc_array_c10 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -2460,8 +2504,8 @@ matmul_c10 (gfc_array_c10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -2469,8 +2513,8 @@ matmul_c10 (gfc_array_c10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -2478,17 +2522,15 @@ matmul_c10 (gfc_array_c10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -2529,7 +2571,9 @@ matmul_c10 (gfc_array_c10 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -2574,7 +2618,18 @@ matmul_c10 (gfc_array_c10 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; diff --git a/libgfortran/generated/matmul_c16.c b/libgfortran/generated/matmul_c16.c index 2062739ce1f..ad2246c43b0 100644 --- a/libgfortran/generated/matmul_c16.c +++ b/libgfortran/generated/matmul_c16.c @@ -144,8 +144,8 @@ matmul_c16_avx (gfc_array_c16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -153,8 +153,8 @@ matmul_c16_avx (gfc_array_c16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -162,17 +162,15 @@ matmul_c16_avx (gfc_array_c16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -213,7 +211,9 @@ matmul_c16_avx (gfc_array_c16 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -258,7 +258,18 @@ matmul_c16_avx (gfc_array_c16 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -701,8 +712,8 @@ matmul_c16_avx2 (gfc_array_c16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -710,8 +721,8 @@ matmul_c16_avx2 (gfc_array_c16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -719,17 +730,15 @@ matmul_c16_avx2 (gfc_array_c16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -770,7 +779,9 @@ matmul_c16_avx2 (gfc_array_c16 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -815,7 +826,18 @@ matmul_c16_avx2 (gfc_array_c16 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -1258,8 +1280,8 @@ matmul_c16_avx512f (gfc_array_c16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1267,8 +1289,8 @@ matmul_c16_avx512f (gfc_array_c16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -1276,17 +1298,15 @@ matmul_c16_avx512f (gfc_array_c16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -1327,7 +1347,9 @@ matmul_c16_avx512f (gfc_array_c16 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1372,7 +1394,18 @@ matmul_c16_avx512f (gfc_array_c16 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -1829,8 +1862,8 @@ matmul_c16_vanilla (gfc_array_c16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1838,8 +1871,8 @@ matmul_c16_vanilla (gfc_array_c16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -1847,17 +1880,15 @@ matmul_c16_vanilla (gfc_array_c16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -1898,7 +1929,9 @@ matmul_c16_vanilla (gfc_array_c16 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1943,7 +1976,18 @@ matmul_c16_vanilla (gfc_array_c16 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -2460,8 +2504,8 @@ matmul_c16 (gfc_array_c16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -2469,8 +2513,8 @@ matmul_c16 (gfc_array_c16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -2478,17 +2522,15 @@ matmul_c16 (gfc_array_c16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -2529,7 +2571,9 @@ matmul_c16 (gfc_array_c16 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -2574,7 +2618,18 @@ matmul_c16 (gfc_array_c16 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; diff --git a/libgfortran/generated/matmul_c4.c b/libgfortran/generated/matmul_c4.c index 91d193dca37..7793fc1b547 100644 --- a/libgfortran/generated/matmul_c4.c +++ b/libgfortran/generated/matmul_c4.c @@ -144,8 +144,8 @@ matmul_c4_avx (gfc_array_c4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -153,8 +153,8 @@ matmul_c4_avx (gfc_array_c4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -162,17 +162,15 @@ matmul_c4_avx (gfc_array_c4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -213,7 +211,9 @@ matmul_c4_avx (gfc_array_c4 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -258,7 +258,18 @@ matmul_c4_avx (gfc_array_c4 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -701,8 +712,8 @@ matmul_c4_avx2 (gfc_array_c4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -710,8 +721,8 @@ matmul_c4_avx2 (gfc_array_c4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -719,17 +730,15 @@ matmul_c4_avx2 (gfc_array_c4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -770,7 +779,9 @@ matmul_c4_avx2 (gfc_array_c4 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -815,7 +826,18 @@ matmul_c4_avx2 (gfc_array_c4 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -1258,8 +1280,8 @@ matmul_c4_avx512f (gfc_array_c4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1267,8 +1289,8 @@ matmul_c4_avx512f (gfc_array_c4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -1276,17 +1298,15 @@ matmul_c4_avx512f (gfc_array_c4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -1327,7 +1347,9 @@ matmul_c4_avx512f (gfc_array_c4 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1372,7 +1394,18 @@ matmul_c4_avx512f (gfc_array_c4 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -1829,8 +1862,8 @@ matmul_c4_vanilla (gfc_array_c4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1838,8 +1871,8 @@ matmul_c4_vanilla (gfc_array_c4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -1847,17 +1880,15 @@ matmul_c4_vanilla (gfc_array_c4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -1898,7 +1929,9 @@ matmul_c4_vanilla (gfc_array_c4 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1943,7 +1976,18 @@ matmul_c4_vanilla (gfc_array_c4 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -2460,8 +2504,8 @@ matmul_c4 (gfc_array_c4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -2469,8 +2513,8 @@ matmul_c4 (gfc_array_c4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -2478,17 +2522,15 @@ matmul_c4 (gfc_array_c4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -2529,7 +2571,9 @@ matmul_c4 (gfc_array_c4 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -2574,7 +2618,18 @@ matmul_c4 (gfc_array_c4 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; diff --git a/libgfortran/generated/matmul_c8.c b/libgfortran/generated/matmul_c8.c index 425af85d1bb..8525dc853aa 100644 --- a/libgfortran/generated/matmul_c8.c +++ b/libgfortran/generated/matmul_c8.c @@ -144,8 +144,8 @@ matmul_c8_avx (gfc_array_c8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -153,8 +153,8 @@ matmul_c8_avx (gfc_array_c8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -162,17 +162,15 @@ matmul_c8_avx (gfc_array_c8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -213,7 +211,9 @@ matmul_c8_avx (gfc_array_c8 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -258,7 +258,18 @@ matmul_c8_avx (gfc_array_c8 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -701,8 +712,8 @@ matmul_c8_avx2 (gfc_array_c8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -710,8 +721,8 @@ matmul_c8_avx2 (gfc_array_c8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -719,17 +730,15 @@ matmul_c8_avx2 (gfc_array_c8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -770,7 +779,9 @@ matmul_c8_avx2 (gfc_array_c8 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -815,7 +826,18 @@ matmul_c8_avx2 (gfc_array_c8 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -1258,8 +1280,8 @@ matmul_c8_avx512f (gfc_array_c8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1267,8 +1289,8 @@ matmul_c8_avx512f (gfc_array_c8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -1276,17 +1298,15 @@ matmul_c8_avx512f (gfc_array_c8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -1327,7 +1347,9 @@ matmul_c8_avx512f (gfc_array_c8 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1372,7 +1394,18 @@ matmul_c8_avx512f (gfc_array_c8 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -1829,8 +1862,8 @@ matmul_c8_vanilla (gfc_array_c8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1838,8 +1871,8 @@ matmul_c8_vanilla (gfc_array_c8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -1847,17 +1880,15 @@ matmul_c8_vanilla (gfc_array_c8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -1898,7 +1929,9 @@ matmul_c8_vanilla (gfc_array_c8 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1943,7 +1976,18 @@ matmul_c8_vanilla (gfc_array_c8 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -2460,8 +2504,8 @@ matmul_c8 (gfc_array_c8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -2469,8 +2513,8 @@ matmul_c8 (gfc_array_c8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -2478,17 +2522,15 @@ matmul_c8 (gfc_array_c8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -2529,7 +2571,9 @@ matmul_c8 (gfc_array_c8 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -2574,7 +2618,18 @@ matmul_c8 (gfc_array_c8 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; diff --git a/libgfortran/generated/matmul_i1.c b/libgfortran/generated/matmul_i1.c index 0c9335d4322..bb5bddba4c3 100644 --- a/libgfortran/generated/matmul_i1.c +++ b/libgfortran/generated/matmul_i1.c @@ -144,8 +144,8 @@ matmul_i1_avx (gfc_array_i1 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -153,8 +153,8 @@ matmul_i1_avx (gfc_array_i1 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -162,17 +162,15 @@ matmul_i1_avx (gfc_array_i1 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -213,7 +211,9 @@ matmul_i1_avx (gfc_array_i1 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -258,7 +258,18 @@ matmul_i1_avx (gfc_array_i1 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -701,8 +712,8 @@ matmul_i1_avx2 (gfc_array_i1 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -710,8 +721,8 @@ matmul_i1_avx2 (gfc_array_i1 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -719,17 +730,15 @@ matmul_i1_avx2 (gfc_array_i1 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -770,7 +779,9 @@ matmul_i1_avx2 (gfc_array_i1 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -815,7 +826,18 @@ matmul_i1_avx2 (gfc_array_i1 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -1258,8 +1280,8 @@ matmul_i1_avx512f (gfc_array_i1 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1267,8 +1289,8 @@ matmul_i1_avx512f (gfc_array_i1 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -1276,17 +1298,15 @@ matmul_i1_avx512f (gfc_array_i1 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -1327,7 +1347,9 @@ matmul_i1_avx512f (gfc_array_i1 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1372,7 +1394,18 @@ matmul_i1_avx512f (gfc_array_i1 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -1829,8 +1862,8 @@ matmul_i1_vanilla (gfc_array_i1 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1838,8 +1871,8 @@ matmul_i1_vanilla (gfc_array_i1 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -1847,17 +1880,15 @@ matmul_i1_vanilla (gfc_array_i1 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -1898,7 +1929,9 @@ matmul_i1_vanilla (gfc_array_i1 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1943,7 +1976,18 @@ matmul_i1_vanilla (gfc_array_i1 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -2460,8 +2504,8 @@ matmul_i1 (gfc_array_i1 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -2469,8 +2513,8 @@ matmul_i1 (gfc_array_i1 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -2478,17 +2522,15 @@ matmul_i1 (gfc_array_i1 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -2529,7 +2571,9 @@ matmul_i1 (gfc_array_i1 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -2574,7 +2618,18 @@ matmul_i1 (gfc_array_i1 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; diff --git a/libgfortran/generated/matmul_i16.c b/libgfortran/generated/matmul_i16.c index b9334b3278f..4f36a5b96ce 100644 --- a/libgfortran/generated/matmul_i16.c +++ b/libgfortran/generated/matmul_i16.c @@ -144,8 +144,8 @@ matmul_i16_avx (gfc_array_i16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -153,8 +153,8 @@ matmul_i16_avx (gfc_array_i16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -162,17 +162,15 @@ matmul_i16_avx (gfc_array_i16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -213,7 +211,9 @@ matmul_i16_avx (gfc_array_i16 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -258,7 +258,18 @@ matmul_i16_avx (gfc_array_i16 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -701,8 +712,8 @@ matmul_i16_avx2 (gfc_array_i16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -710,8 +721,8 @@ matmul_i16_avx2 (gfc_array_i16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -719,17 +730,15 @@ matmul_i16_avx2 (gfc_array_i16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -770,7 +779,9 @@ matmul_i16_avx2 (gfc_array_i16 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -815,7 +826,18 @@ matmul_i16_avx2 (gfc_array_i16 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -1258,8 +1280,8 @@ matmul_i16_avx512f (gfc_array_i16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1267,8 +1289,8 @@ matmul_i16_avx512f (gfc_array_i16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -1276,17 +1298,15 @@ matmul_i16_avx512f (gfc_array_i16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -1327,7 +1347,9 @@ matmul_i16_avx512f (gfc_array_i16 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1372,7 +1394,18 @@ matmul_i16_avx512f (gfc_array_i16 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -1829,8 +1862,8 @@ matmul_i16_vanilla (gfc_array_i16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1838,8 +1871,8 @@ matmul_i16_vanilla (gfc_array_i16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -1847,17 +1880,15 @@ matmul_i16_vanilla (gfc_array_i16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -1898,7 +1929,9 @@ matmul_i16_vanilla (gfc_array_i16 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1943,7 +1976,18 @@ matmul_i16_vanilla (gfc_array_i16 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -2460,8 +2504,8 @@ matmul_i16 (gfc_array_i16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -2469,8 +2513,8 @@ matmul_i16 (gfc_array_i16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -2478,17 +2522,15 @@ matmul_i16 (gfc_array_i16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -2529,7 +2571,9 @@ matmul_i16 (gfc_array_i16 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -2574,7 +2618,18 @@ matmul_i16 (gfc_array_i16 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; diff --git a/libgfortran/generated/matmul_i2.c b/libgfortran/generated/matmul_i2.c index e4246e948df..2aea3b4a605 100644 --- a/libgfortran/generated/matmul_i2.c +++ b/libgfortran/generated/matmul_i2.c @@ -144,8 +144,8 @@ matmul_i2_avx (gfc_array_i2 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -153,8 +153,8 @@ matmul_i2_avx (gfc_array_i2 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -162,17 +162,15 @@ matmul_i2_avx (gfc_array_i2 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -213,7 +211,9 @@ matmul_i2_avx (gfc_array_i2 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -258,7 +258,18 @@ matmul_i2_avx (gfc_array_i2 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -701,8 +712,8 @@ matmul_i2_avx2 (gfc_array_i2 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -710,8 +721,8 @@ matmul_i2_avx2 (gfc_array_i2 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -719,17 +730,15 @@ matmul_i2_avx2 (gfc_array_i2 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -770,7 +779,9 @@ matmul_i2_avx2 (gfc_array_i2 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -815,7 +826,18 @@ matmul_i2_avx2 (gfc_array_i2 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -1258,8 +1280,8 @@ matmul_i2_avx512f (gfc_array_i2 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1267,8 +1289,8 @@ matmul_i2_avx512f (gfc_array_i2 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -1276,17 +1298,15 @@ matmul_i2_avx512f (gfc_array_i2 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -1327,7 +1347,9 @@ matmul_i2_avx512f (gfc_array_i2 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1372,7 +1394,18 @@ matmul_i2_avx512f (gfc_array_i2 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -1829,8 +1862,8 @@ matmul_i2_vanilla (gfc_array_i2 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1838,8 +1871,8 @@ matmul_i2_vanilla (gfc_array_i2 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -1847,17 +1880,15 @@ matmul_i2_vanilla (gfc_array_i2 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -1898,7 +1929,9 @@ matmul_i2_vanilla (gfc_array_i2 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1943,7 +1976,18 @@ matmul_i2_vanilla (gfc_array_i2 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -2460,8 +2504,8 @@ matmul_i2 (gfc_array_i2 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -2469,8 +2513,8 @@ matmul_i2 (gfc_array_i2 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -2478,17 +2522,15 @@ matmul_i2 (gfc_array_i2 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -2529,7 +2571,9 @@ matmul_i2 (gfc_array_i2 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -2574,7 +2618,18 @@ matmul_i2 (gfc_array_i2 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; diff --git a/libgfortran/generated/matmul_i4.c b/libgfortran/generated/matmul_i4.c index 78cf27c4fcd..4ef9a0a7c74 100644 --- a/libgfortran/generated/matmul_i4.c +++ b/libgfortran/generated/matmul_i4.c @@ -144,8 +144,8 @@ matmul_i4_avx (gfc_array_i4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -153,8 +153,8 @@ matmul_i4_avx (gfc_array_i4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -162,17 +162,15 @@ matmul_i4_avx (gfc_array_i4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -213,7 +211,9 @@ matmul_i4_avx (gfc_array_i4 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -258,7 +258,18 @@ matmul_i4_avx (gfc_array_i4 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -701,8 +712,8 @@ matmul_i4_avx2 (gfc_array_i4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -710,8 +721,8 @@ matmul_i4_avx2 (gfc_array_i4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -719,17 +730,15 @@ matmul_i4_avx2 (gfc_array_i4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -770,7 +779,9 @@ matmul_i4_avx2 (gfc_array_i4 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -815,7 +826,18 @@ matmul_i4_avx2 (gfc_array_i4 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -1258,8 +1280,8 @@ matmul_i4_avx512f (gfc_array_i4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1267,8 +1289,8 @@ matmul_i4_avx512f (gfc_array_i4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -1276,17 +1298,15 @@ matmul_i4_avx512f (gfc_array_i4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -1327,7 +1347,9 @@ matmul_i4_avx512f (gfc_array_i4 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1372,7 +1394,18 @@ matmul_i4_avx512f (gfc_array_i4 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -1829,8 +1862,8 @@ matmul_i4_vanilla (gfc_array_i4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1838,8 +1871,8 @@ matmul_i4_vanilla (gfc_array_i4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -1847,17 +1880,15 @@ matmul_i4_vanilla (gfc_array_i4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -1898,7 +1929,9 @@ matmul_i4_vanilla (gfc_array_i4 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1943,7 +1976,18 @@ matmul_i4_vanilla (gfc_array_i4 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -2460,8 +2504,8 @@ matmul_i4 (gfc_array_i4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -2469,8 +2513,8 @@ matmul_i4 (gfc_array_i4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -2478,17 +2522,15 @@ matmul_i4 (gfc_array_i4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -2529,7 +2571,9 @@ matmul_i4 (gfc_array_i4 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -2574,7 +2618,18 @@ matmul_i4 (gfc_array_i4 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; diff --git a/libgfortran/generated/matmul_i8.c b/libgfortran/generated/matmul_i8.c index cf8c401400d..e0c93ce3e7e 100644 --- a/libgfortran/generated/matmul_i8.c +++ b/libgfortran/generated/matmul_i8.c @@ -144,8 +144,8 @@ matmul_i8_avx (gfc_array_i8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -153,8 +153,8 @@ matmul_i8_avx (gfc_array_i8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -162,17 +162,15 @@ matmul_i8_avx (gfc_array_i8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -213,7 +211,9 @@ matmul_i8_avx (gfc_array_i8 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -258,7 +258,18 @@ matmul_i8_avx (gfc_array_i8 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -701,8 +712,8 @@ matmul_i8_avx2 (gfc_array_i8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -710,8 +721,8 @@ matmul_i8_avx2 (gfc_array_i8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -719,17 +730,15 @@ matmul_i8_avx2 (gfc_array_i8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -770,7 +779,9 @@ matmul_i8_avx2 (gfc_array_i8 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -815,7 +826,18 @@ matmul_i8_avx2 (gfc_array_i8 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -1258,8 +1280,8 @@ matmul_i8_avx512f (gfc_array_i8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1267,8 +1289,8 @@ matmul_i8_avx512f (gfc_array_i8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -1276,17 +1298,15 @@ matmul_i8_avx512f (gfc_array_i8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -1327,7 +1347,9 @@ matmul_i8_avx512f (gfc_array_i8 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1372,7 +1394,18 @@ matmul_i8_avx512f (gfc_array_i8 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -1829,8 +1862,8 @@ matmul_i8_vanilla (gfc_array_i8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1838,8 +1871,8 @@ matmul_i8_vanilla (gfc_array_i8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -1847,17 +1880,15 @@ matmul_i8_vanilla (gfc_array_i8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -1898,7 +1929,9 @@ matmul_i8_vanilla (gfc_array_i8 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1943,7 +1976,18 @@ matmul_i8_vanilla (gfc_array_i8 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -2460,8 +2504,8 @@ matmul_i8 (gfc_array_i8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -2469,8 +2513,8 @@ matmul_i8 (gfc_array_i8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -2478,17 +2522,15 @@ matmul_i8 (gfc_array_i8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -2529,7 +2571,9 @@ matmul_i8 (gfc_array_i8 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -2574,7 +2618,18 @@ matmul_i8 (gfc_array_i8 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; diff --git a/libgfortran/generated/matmul_r10.c b/libgfortran/generated/matmul_r10.c index e4309c80a6b..5d90454a9e6 100644 --- a/libgfortran/generated/matmul_r10.c +++ b/libgfortran/generated/matmul_r10.c @@ -144,8 +144,8 @@ matmul_r10_avx (gfc_array_r10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -153,8 +153,8 @@ matmul_r10_avx (gfc_array_r10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -162,17 +162,15 @@ matmul_r10_avx (gfc_array_r10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -213,7 +211,9 @@ matmul_r10_avx (gfc_array_r10 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -258,7 +258,18 @@ matmul_r10_avx (gfc_array_r10 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -701,8 +712,8 @@ matmul_r10_avx2 (gfc_array_r10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -710,8 +721,8 @@ matmul_r10_avx2 (gfc_array_r10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -719,17 +730,15 @@ matmul_r10_avx2 (gfc_array_r10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -770,7 +779,9 @@ matmul_r10_avx2 (gfc_array_r10 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -815,7 +826,18 @@ matmul_r10_avx2 (gfc_array_r10 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -1258,8 +1280,8 @@ matmul_r10_avx512f (gfc_array_r10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1267,8 +1289,8 @@ matmul_r10_avx512f (gfc_array_r10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -1276,17 +1298,15 @@ matmul_r10_avx512f (gfc_array_r10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -1327,7 +1347,9 @@ matmul_r10_avx512f (gfc_array_r10 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1372,7 +1394,18 @@ matmul_r10_avx512f (gfc_array_r10 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -1829,8 +1862,8 @@ matmul_r10_vanilla (gfc_array_r10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1838,8 +1871,8 @@ matmul_r10_vanilla (gfc_array_r10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -1847,17 +1880,15 @@ matmul_r10_vanilla (gfc_array_r10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -1898,7 +1929,9 @@ matmul_r10_vanilla (gfc_array_r10 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1943,7 +1976,18 @@ matmul_r10_vanilla (gfc_array_r10 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -2460,8 +2504,8 @@ matmul_r10 (gfc_array_r10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -2469,8 +2513,8 @@ matmul_r10 (gfc_array_r10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -2478,17 +2522,15 @@ matmul_r10 (gfc_array_r10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -2529,7 +2571,9 @@ matmul_r10 (gfc_array_r10 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -2574,7 +2618,18 @@ matmul_r10 (gfc_array_r10 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; diff --git a/libgfortran/generated/matmul_r16.c b/libgfortran/generated/matmul_r16.c index 1ab554660d7..dab10b06b4b 100644 --- a/libgfortran/generated/matmul_r16.c +++ b/libgfortran/generated/matmul_r16.c @@ -144,8 +144,8 @@ matmul_r16_avx (gfc_array_r16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -153,8 +153,8 @@ matmul_r16_avx (gfc_array_r16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -162,17 +162,15 @@ matmul_r16_avx (gfc_array_r16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -213,7 +211,9 @@ matmul_r16_avx (gfc_array_r16 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -258,7 +258,18 @@ matmul_r16_avx (gfc_array_r16 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -701,8 +712,8 @@ matmul_r16_avx2 (gfc_array_r16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -710,8 +721,8 @@ matmul_r16_avx2 (gfc_array_r16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -719,17 +730,15 @@ matmul_r16_avx2 (gfc_array_r16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -770,7 +779,9 @@ matmul_r16_avx2 (gfc_array_r16 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -815,7 +826,18 @@ matmul_r16_avx2 (gfc_array_r16 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -1258,8 +1280,8 @@ matmul_r16_avx512f (gfc_array_r16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1267,8 +1289,8 @@ matmul_r16_avx512f (gfc_array_r16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -1276,17 +1298,15 @@ matmul_r16_avx512f (gfc_array_r16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -1327,7 +1347,9 @@ matmul_r16_avx512f (gfc_array_r16 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1372,7 +1394,18 @@ matmul_r16_avx512f (gfc_array_r16 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -1829,8 +1862,8 @@ matmul_r16_vanilla (gfc_array_r16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1838,8 +1871,8 @@ matmul_r16_vanilla (gfc_array_r16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -1847,17 +1880,15 @@ matmul_r16_vanilla (gfc_array_r16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -1898,7 +1929,9 @@ matmul_r16_vanilla (gfc_array_r16 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1943,7 +1976,18 @@ matmul_r16_vanilla (gfc_array_r16 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -2460,8 +2504,8 @@ matmul_r16 (gfc_array_r16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -2469,8 +2513,8 @@ matmul_r16 (gfc_array_r16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -2478,17 +2522,15 @@ matmul_r16 (gfc_array_r16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -2529,7 +2571,9 @@ matmul_r16 (gfc_array_r16 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -2574,7 +2618,18 @@ matmul_r16 (gfc_array_r16 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; diff --git a/libgfortran/generated/matmul_r4.c b/libgfortran/generated/matmul_r4.c index 97dba9825b1..c9c31df0756 100644 --- a/libgfortran/generated/matmul_r4.c +++ b/libgfortran/generated/matmul_r4.c @@ -144,8 +144,8 @@ matmul_r4_avx (gfc_array_r4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -153,8 +153,8 @@ matmul_r4_avx (gfc_array_r4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -162,17 +162,15 @@ matmul_r4_avx (gfc_array_r4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -213,7 +211,9 @@ matmul_r4_avx (gfc_array_r4 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -258,7 +258,18 @@ matmul_r4_avx (gfc_array_r4 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -701,8 +712,8 @@ matmul_r4_avx2 (gfc_array_r4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -710,8 +721,8 @@ matmul_r4_avx2 (gfc_array_r4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -719,17 +730,15 @@ matmul_r4_avx2 (gfc_array_r4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -770,7 +779,9 @@ matmul_r4_avx2 (gfc_array_r4 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -815,7 +826,18 @@ matmul_r4_avx2 (gfc_array_r4 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -1258,8 +1280,8 @@ matmul_r4_avx512f (gfc_array_r4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1267,8 +1289,8 @@ matmul_r4_avx512f (gfc_array_r4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -1276,17 +1298,15 @@ matmul_r4_avx512f (gfc_array_r4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -1327,7 +1347,9 @@ matmul_r4_avx512f (gfc_array_r4 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1372,7 +1394,18 @@ matmul_r4_avx512f (gfc_array_r4 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -1829,8 +1862,8 @@ matmul_r4_vanilla (gfc_array_r4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1838,8 +1871,8 @@ matmul_r4_vanilla (gfc_array_r4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -1847,17 +1880,15 @@ matmul_r4_vanilla (gfc_array_r4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -1898,7 +1929,9 @@ matmul_r4_vanilla (gfc_array_r4 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1943,7 +1976,18 @@ matmul_r4_vanilla (gfc_array_r4 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -2460,8 +2504,8 @@ matmul_r4 (gfc_array_r4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -2469,8 +2513,8 @@ matmul_r4 (gfc_array_r4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -2478,17 +2522,15 @@ matmul_r4 (gfc_array_r4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -2529,7 +2571,9 @@ matmul_r4 (gfc_array_r4 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -2574,7 +2618,18 @@ matmul_r4 (gfc_array_r4 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; diff --git a/libgfortran/generated/matmul_r8.c b/libgfortran/generated/matmul_r8.c index 5e4c9500260..4c5823f8242 100644 --- a/libgfortran/generated/matmul_r8.c +++ b/libgfortran/generated/matmul_r8.c @@ -144,8 +144,8 @@ matmul_r8_avx (gfc_array_r8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -153,8 +153,8 @@ matmul_r8_avx (gfc_array_r8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -162,17 +162,15 @@ matmul_r8_avx (gfc_array_r8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -213,7 +211,9 @@ matmul_r8_avx (gfc_array_r8 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -258,7 +258,18 @@ matmul_r8_avx (gfc_array_r8 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -701,8 +712,8 @@ matmul_r8_avx2 (gfc_array_r8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -710,8 +721,8 @@ matmul_r8_avx2 (gfc_array_r8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -719,17 +730,15 @@ matmul_r8_avx2 (gfc_array_r8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -770,7 +779,9 @@ matmul_r8_avx2 (gfc_array_r8 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -815,7 +826,18 @@ matmul_r8_avx2 (gfc_array_r8 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -1258,8 +1280,8 @@ matmul_r8_avx512f (gfc_array_r8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1267,8 +1289,8 @@ matmul_r8_avx512f (gfc_array_r8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -1276,17 +1298,15 @@ matmul_r8_avx512f (gfc_array_r8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -1327,7 +1347,9 @@ matmul_r8_avx512f (gfc_array_r8 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1372,7 +1394,18 @@ matmul_r8_avx512f (gfc_array_r8 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -1829,8 +1862,8 @@ matmul_r8_vanilla (gfc_array_r8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1838,8 +1871,8 @@ matmul_r8_vanilla (gfc_array_r8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -1847,17 +1880,15 @@ matmul_r8_vanilla (gfc_array_r8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -1898,7 +1929,9 @@ matmul_r8_vanilla (gfc_array_r8 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -1943,7 +1976,18 @@ matmul_r8_vanilla (gfc_array_r8 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -2460,8 +2504,8 @@ matmul_r8 (gfc_array_r8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -2469,8 +2513,8 @@ matmul_r8 (gfc_array_r8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -2478,17 +2522,15 @@ matmul_r8 (gfc_array_r8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -2529,7 +2571,9 @@ matmul_r8 (gfc_array_r8 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -2574,7 +2618,18 @@ matmul_r8 (gfc_array_r8 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; diff --git a/libgfortran/generated/matmulavx128_c10.c b/libgfortran/generated/matmulavx128_c10.c index 5cb0f6ad6f3..03914715d5c 100644 --- a/libgfortran/generated/matmulavx128_c10.c +++ b/libgfortran/generated/matmulavx128_c10.c @@ -109,8 +109,8 @@ matmul_c10_avx128_fma3 (gfc_array_c10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -118,8 +118,8 @@ matmul_c10_avx128_fma3 (gfc_array_c10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -127,17 +127,15 @@ matmul_c10_avx128_fma3 (gfc_array_c10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -178,7 +176,9 @@ matmul_c10_avx128_fma3 (gfc_array_c10 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -223,7 +223,18 @@ matmul_c10_avx128_fma3 (gfc_array_c10 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -667,8 +678,8 @@ matmul_c10_avx128_fma4 (gfc_array_c10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -676,8 +687,8 @@ matmul_c10_avx128_fma4 (gfc_array_c10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -685,17 +696,15 @@ matmul_c10_avx128_fma4 (gfc_array_c10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -736,7 +745,9 @@ matmul_c10_avx128_fma4 (gfc_array_c10 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -781,7 +792,18 @@ matmul_c10_avx128_fma4 (gfc_array_c10 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; diff --git a/libgfortran/generated/matmulavx128_c16.c b/libgfortran/generated/matmulavx128_c16.c index 66272fefaf9..876fc691ed8 100644 --- a/libgfortran/generated/matmulavx128_c16.c +++ b/libgfortran/generated/matmulavx128_c16.c @@ -109,8 +109,8 @@ matmul_c16_avx128_fma3 (gfc_array_c16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -118,8 +118,8 @@ matmul_c16_avx128_fma3 (gfc_array_c16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -127,17 +127,15 @@ matmul_c16_avx128_fma3 (gfc_array_c16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -178,7 +176,9 @@ matmul_c16_avx128_fma3 (gfc_array_c16 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -223,7 +223,18 @@ matmul_c16_avx128_fma3 (gfc_array_c16 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -667,8 +678,8 @@ matmul_c16_avx128_fma4 (gfc_array_c16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -676,8 +687,8 @@ matmul_c16_avx128_fma4 (gfc_array_c16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -685,17 +696,15 @@ matmul_c16_avx128_fma4 (gfc_array_c16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -736,7 +745,9 @@ matmul_c16_avx128_fma4 (gfc_array_c16 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -781,7 +792,18 @@ matmul_c16_avx128_fma4 (gfc_array_c16 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; diff --git a/libgfortran/generated/matmulavx128_c4.c b/libgfortran/generated/matmulavx128_c4.c index f6e06e2e88f..a577887d0bd 100644 --- a/libgfortran/generated/matmulavx128_c4.c +++ b/libgfortran/generated/matmulavx128_c4.c @@ -109,8 +109,8 @@ matmul_c4_avx128_fma3 (gfc_array_c4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -118,8 +118,8 @@ matmul_c4_avx128_fma3 (gfc_array_c4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -127,17 +127,15 @@ matmul_c4_avx128_fma3 (gfc_array_c4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -178,7 +176,9 @@ matmul_c4_avx128_fma3 (gfc_array_c4 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -223,7 +223,18 @@ matmul_c4_avx128_fma3 (gfc_array_c4 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -667,8 +678,8 @@ matmul_c4_avx128_fma4 (gfc_array_c4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -676,8 +687,8 @@ matmul_c4_avx128_fma4 (gfc_array_c4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -685,17 +696,15 @@ matmul_c4_avx128_fma4 (gfc_array_c4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -736,7 +745,9 @@ matmul_c4_avx128_fma4 (gfc_array_c4 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -781,7 +792,18 @@ matmul_c4_avx128_fma4 (gfc_array_c4 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; diff --git a/libgfortran/generated/matmulavx128_c8.c b/libgfortran/generated/matmulavx128_c8.c index accc69c4d1a..2ca47010612 100644 --- a/libgfortran/generated/matmulavx128_c8.c +++ b/libgfortran/generated/matmulavx128_c8.c @@ -109,8 +109,8 @@ matmul_c8_avx128_fma3 (gfc_array_c8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -118,8 +118,8 @@ matmul_c8_avx128_fma3 (gfc_array_c8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -127,17 +127,15 @@ matmul_c8_avx128_fma3 (gfc_array_c8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -178,7 +176,9 @@ matmul_c8_avx128_fma3 (gfc_array_c8 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -223,7 +223,18 @@ matmul_c8_avx128_fma3 (gfc_array_c8 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -667,8 +678,8 @@ matmul_c8_avx128_fma4 (gfc_array_c8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -676,8 +687,8 @@ matmul_c8_avx128_fma4 (gfc_array_c8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -685,17 +696,15 @@ matmul_c8_avx128_fma4 (gfc_array_c8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -736,7 +745,9 @@ matmul_c8_avx128_fma4 (gfc_array_c8 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -781,7 +792,18 @@ matmul_c8_avx128_fma4 (gfc_array_c8 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; diff --git a/libgfortran/generated/matmulavx128_i1.c b/libgfortran/generated/matmulavx128_i1.c index 48b15c8074a..1af28d1672f 100644 --- a/libgfortran/generated/matmulavx128_i1.c +++ b/libgfortran/generated/matmulavx128_i1.c @@ -109,8 +109,8 @@ matmul_i1_avx128_fma3 (gfc_array_i1 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -118,8 +118,8 @@ matmul_i1_avx128_fma3 (gfc_array_i1 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -127,17 +127,15 @@ matmul_i1_avx128_fma3 (gfc_array_i1 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -178,7 +176,9 @@ matmul_i1_avx128_fma3 (gfc_array_i1 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -223,7 +223,18 @@ matmul_i1_avx128_fma3 (gfc_array_i1 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -667,8 +678,8 @@ matmul_i1_avx128_fma4 (gfc_array_i1 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -676,8 +687,8 @@ matmul_i1_avx128_fma4 (gfc_array_i1 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -685,17 +696,15 @@ matmul_i1_avx128_fma4 (gfc_array_i1 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -736,7 +745,9 @@ matmul_i1_avx128_fma4 (gfc_array_i1 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -781,7 +792,18 @@ matmul_i1_avx128_fma4 (gfc_array_i1 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; diff --git a/libgfortran/generated/matmulavx128_i16.c b/libgfortran/generated/matmulavx128_i16.c index 319321eca49..37a41252870 100644 --- a/libgfortran/generated/matmulavx128_i16.c +++ b/libgfortran/generated/matmulavx128_i16.c @@ -109,8 +109,8 @@ matmul_i16_avx128_fma3 (gfc_array_i16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -118,8 +118,8 @@ matmul_i16_avx128_fma3 (gfc_array_i16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -127,17 +127,15 @@ matmul_i16_avx128_fma3 (gfc_array_i16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -178,7 +176,9 @@ matmul_i16_avx128_fma3 (gfc_array_i16 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -223,7 +223,18 @@ matmul_i16_avx128_fma3 (gfc_array_i16 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -667,8 +678,8 @@ matmul_i16_avx128_fma4 (gfc_array_i16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -676,8 +687,8 @@ matmul_i16_avx128_fma4 (gfc_array_i16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -685,17 +696,15 @@ matmul_i16_avx128_fma4 (gfc_array_i16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -736,7 +745,9 @@ matmul_i16_avx128_fma4 (gfc_array_i16 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -781,7 +792,18 @@ matmul_i16_avx128_fma4 (gfc_array_i16 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; diff --git a/libgfortran/generated/matmulavx128_i2.c b/libgfortran/generated/matmulavx128_i2.c index 4d8945b10a2..033133a4729 100644 --- a/libgfortran/generated/matmulavx128_i2.c +++ b/libgfortran/generated/matmulavx128_i2.c @@ -109,8 +109,8 @@ matmul_i2_avx128_fma3 (gfc_array_i2 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -118,8 +118,8 @@ matmul_i2_avx128_fma3 (gfc_array_i2 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -127,17 +127,15 @@ matmul_i2_avx128_fma3 (gfc_array_i2 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -178,7 +176,9 @@ matmul_i2_avx128_fma3 (gfc_array_i2 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -223,7 +223,18 @@ matmul_i2_avx128_fma3 (gfc_array_i2 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -667,8 +678,8 @@ matmul_i2_avx128_fma4 (gfc_array_i2 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -676,8 +687,8 @@ matmul_i2_avx128_fma4 (gfc_array_i2 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -685,17 +696,15 @@ matmul_i2_avx128_fma4 (gfc_array_i2 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -736,7 +745,9 @@ matmul_i2_avx128_fma4 (gfc_array_i2 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -781,7 +792,18 @@ matmul_i2_avx128_fma4 (gfc_array_i2 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; diff --git a/libgfortran/generated/matmulavx128_i4.c b/libgfortran/generated/matmulavx128_i4.c index acaa00a30bb..7cc2ba817bb 100644 --- a/libgfortran/generated/matmulavx128_i4.c +++ b/libgfortran/generated/matmulavx128_i4.c @@ -109,8 +109,8 @@ matmul_i4_avx128_fma3 (gfc_array_i4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -118,8 +118,8 @@ matmul_i4_avx128_fma3 (gfc_array_i4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -127,17 +127,15 @@ matmul_i4_avx128_fma3 (gfc_array_i4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -178,7 +176,9 @@ matmul_i4_avx128_fma3 (gfc_array_i4 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -223,7 +223,18 @@ matmul_i4_avx128_fma3 (gfc_array_i4 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -667,8 +678,8 @@ matmul_i4_avx128_fma4 (gfc_array_i4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -676,8 +687,8 @@ matmul_i4_avx128_fma4 (gfc_array_i4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -685,17 +696,15 @@ matmul_i4_avx128_fma4 (gfc_array_i4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -736,7 +745,9 @@ matmul_i4_avx128_fma4 (gfc_array_i4 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -781,7 +792,18 @@ matmul_i4_avx128_fma4 (gfc_array_i4 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; diff --git a/libgfortran/generated/matmulavx128_i8.c b/libgfortran/generated/matmulavx128_i8.c index 56e85167a3f..5628064d887 100644 --- a/libgfortran/generated/matmulavx128_i8.c +++ b/libgfortran/generated/matmulavx128_i8.c @@ -109,8 +109,8 @@ matmul_i8_avx128_fma3 (gfc_array_i8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -118,8 +118,8 @@ matmul_i8_avx128_fma3 (gfc_array_i8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -127,17 +127,15 @@ matmul_i8_avx128_fma3 (gfc_array_i8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -178,7 +176,9 @@ matmul_i8_avx128_fma3 (gfc_array_i8 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -223,7 +223,18 @@ matmul_i8_avx128_fma3 (gfc_array_i8 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -667,8 +678,8 @@ matmul_i8_avx128_fma4 (gfc_array_i8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -676,8 +687,8 @@ matmul_i8_avx128_fma4 (gfc_array_i8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -685,17 +696,15 @@ matmul_i8_avx128_fma4 (gfc_array_i8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -736,7 +745,9 @@ matmul_i8_avx128_fma4 (gfc_array_i8 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -781,7 +792,18 @@ matmul_i8_avx128_fma4 (gfc_array_i8 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; diff --git a/libgfortran/generated/matmulavx128_r10.c b/libgfortran/generated/matmulavx128_r10.c index 880c9d921b2..68c0ef33a23 100644 --- a/libgfortran/generated/matmulavx128_r10.c +++ b/libgfortran/generated/matmulavx128_r10.c @@ -109,8 +109,8 @@ matmul_r10_avx128_fma3 (gfc_array_r10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -118,8 +118,8 @@ matmul_r10_avx128_fma3 (gfc_array_r10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -127,17 +127,15 @@ matmul_r10_avx128_fma3 (gfc_array_r10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -178,7 +176,9 @@ matmul_r10_avx128_fma3 (gfc_array_r10 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -223,7 +223,18 @@ matmul_r10_avx128_fma3 (gfc_array_r10 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -667,8 +678,8 @@ matmul_r10_avx128_fma4 (gfc_array_r10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -676,8 +687,8 @@ matmul_r10_avx128_fma4 (gfc_array_r10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -685,17 +696,15 @@ matmul_r10_avx128_fma4 (gfc_array_r10 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -736,7 +745,9 @@ matmul_r10_avx128_fma4 (gfc_array_r10 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -781,7 +792,18 @@ matmul_r10_avx128_fma4 (gfc_array_r10 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; diff --git a/libgfortran/generated/matmulavx128_r16.c b/libgfortran/generated/matmulavx128_r16.c index 328e251a3a1..fadff1d6d63 100644 --- a/libgfortran/generated/matmulavx128_r16.c +++ b/libgfortran/generated/matmulavx128_r16.c @@ -109,8 +109,8 @@ matmul_r16_avx128_fma3 (gfc_array_r16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -118,8 +118,8 @@ matmul_r16_avx128_fma3 (gfc_array_r16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -127,17 +127,15 @@ matmul_r16_avx128_fma3 (gfc_array_r16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -178,7 +176,9 @@ matmul_r16_avx128_fma3 (gfc_array_r16 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -223,7 +223,18 @@ matmul_r16_avx128_fma3 (gfc_array_r16 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -667,8 +678,8 @@ matmul_r16_avx128_fma4 (gfc_array_r16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -676,8 +687,8 @@ matmul_r16_avx128_fma4 (gfc_array_r16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -685,17 +696,15 @@ matmul_r16_avx128_fma4 (gfc_array_r16 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -736,7 +745,9 @@ matmul_r16_avx128_fma4 (gfc_array_r16 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -781,7 +792,18 @@ matmul_r16_avx128_fma4 (gfc_array_r16 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; diff --git a/libgfortran/generated/matmulavx128_r4.c b/libgfortran/generated/matmulavx128_r4.c index 013a1804a11..accec42ce17 100644 --- a/libgfortran/generated/matmulavx128_r4.c +++ b/libgfortran/generated/matmulavx128_r4.c @@ -109,8 +109,8 @@ matmul_r4_avx128_fma3 (gfc_array_r4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -118,8 +118,8 @@ matmul_r4_avx128_fma3 (gfc_array_r4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -127,17 +127,15 @@ matmul_r4_avx128_fma3 (gfc_array_r4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -178,7 +176,9 @@ matmul_r4_avx128_fma3 (gfc_array_r4 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -223,7 +223,18 @@ matmul_r4_avx128_fma3 (gfc_array_r4 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -667,8 +678,8 @@ matmul_r4_avx128_fma4 (gfc_array_r4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -676,8 +687,8 @@ matmul_r4_avx128_fma4 (gfc_array_r4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -685,17 +696,15 @@ matmul_r4_avx128_fma4 (gfc_array_r4 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -736,7 +745,9 @@ matmul_r4_avx128_fma4 (gfc_array_r4 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -781,7 +792,18 @@ matmul_r4_avx128_fma4 (gfc_array_r4 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; diff --git a/libgfortran/generated/matmulavx128_r8.c b/libgfortran/generated/matmulavx128_r8.c index 4da59f9e69c..06e0437b606 100644 --- a/libgfortran/generated/matmulavx128_r8.c +++ b/libgfortran/generated/matmulavx128_r8.c @@ -109,8 +109,8 @@ matmul_r8_avx128_fma3 (gfc_array_r8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -118,8 +118,8 @@ matmul_r8_avx128_fma3 (gfc_array_r8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -127,17 +127,15 @@ matmul_r8_avx128_fma3 (gfc_array_r8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -178,7 +176,9 @@ matmul_r8_avx128_fma3 (gfc_array_r8 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -223,7 +223,18 @@ matmul_r8_avx128_fma3 (gfc_array_r8 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; @@ -667,8 +678,8 @@ matmul_r8_avx128_fma4 (gfc_array_r8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -676,8 +687,8 @@ matmul_r8_avx128_fma4 (gfc_array_r8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -685,17 +696,15 @@ matmul_r8_avx128_fma4 (gfc_array_r8 * const restrict retarray, arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -736,7 +745,9 @@ matmul_r8_avx128_fma4 (gfc_array_r8 * const restrict retarray, if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -781,7 +792,18 @@ matmul_r8_avx128_fma4 (gfc_array_r8 * const restrict retarray, if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; diff --git a/libgfortran/m4/matmul_internal.m4 b/libgfortran/m4/matmul_internal.m4 index 2020e8a50df..32a1e01e12f 100644 --- a/libgfortran/m4/matmul_internal.m4 +++ b/libgfortran/m4/matmul_internal.m4 @@ -59,8 +59,8 @@ arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -68,8 +68,8 @@ arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic: is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } else @@ -77,17 +77,15 @@ arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 1:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 1 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) - runtime_error ("Incorrect extent in return array in" - " MATMUL intrinsic for dimension 2:" - " is %ld, should be %ld", + runtime_error ("Array bound mismatch for dimension 2 of " + "array (%ld/%ld) ", (long int) ret_extent, (long int) arg_extent); } } @@ -129,7 +127,9 @@ sinclude(`matmul_asm_'rtype_code`.m4')dnl if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) - runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); + runtime_error ("Incorrect extent in argument B in MATMUL intrinsic " + "in dimension 1: is %ld, should be %ld", + (long int) GFC_DESCRIPTOR_EXTENT(b,0), (long int) count); } if (GFC_DESCRIPTOR_RANK (b) == 1) @@ -174,7 +174,18 @@ sinclude(`matmul_asm_'rtype_code`.m4')dnl if (lda > 0 && ldb > 0 && ldc > 0 && m > 1 && n > 1 && k > 1) { assert (gemm != NULL); - gemm (axstride == 1 ? "N" : "T", bxstride == 1 ? "N" : "T", &m, + const char *transa, *transb; + if (try_blas & 2) + transa = "C"; + else + transa = axstride == 1 ? "N" : "T"; + + if (try_blas & 4) + transb = "C"; + else + transb = bxstride == 1 ? "N" : "T"; + + gemm (transa, transb , &m, &n, &k, &one, abase, &lda, bbase, &ldb, &zero, dest, &ldc, 1, 1); return; -- 2.30.2