// Copyright 2021 Google LLC
//
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree.
//
// Auto-generated file. Do not edit!
//   Specification: test/xx-transpose.yaml
//   Generator: tools/generate-transpose-test.py


#include <gtest/gtest.h>

#include <xnnpack/common.h>
#include <xnnpack/isa-checks.h>

#include <xnnpack/transpose.h>
#include "transpose-microkernel-tester.h"


TEST(XX_TRANSPOSEV__1X1_MEMCPY_1, bh_1_bw_1) {
  TransposeMicrokernelTester()
    .input_stride(2)
    .output_stride(2)
    .block_width(1)
    .block_height(1)
    .element_size(1)
    .iterations(1)
    .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_1, bh_1_2_bw_1_2) {
  for(size_t i = 1; i <= 2; ++i){
    for(size_t j = 1; j <= 2; ++j){
      TransposeMicrokernelTester()
        .input_stride(j * 3)
        .output_stride(i * 7)
        .block_width(j)
        .block_height(i)
        .element_size(1)
        .iterations(1)
        .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
    }
  }
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_1, bh_1_bw_2) {
  TransposeMicrokernelTester()
    .input_stride(2)
    .output_stride(1)
    .block_width(2)
    .block_height(1)
    .element_size(1)
    .iterations(1)
    .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_1, bh_1_bw_2_2) {
  for(size_t i = 2; i < 2; ++i){
    TransposeMicrokernelTester()
      .input_stride(i)
      .output_stride(2)
      .block_width(i)
      .block_height(1)
      .element_size(1)
      .iterations(1)
      .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
  }
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_1, bh_2_bw_2_2) {
  for(size_t i = 2; i < 2; ++i){
    TransposeMicrokernelTester()
      .input_stride(i)
      .output_stride(2)
      .block_width(i)
      .block_height(2)
      .element_size(1)
      .iterations(1)
      .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
  }
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_1, bh_2_bw_1) {
  TransposeMicrokernelTester()
    .input_stride(1)
    .output_stride(7)
    .block_width(1)
    .block_height(2)
    .element_size(1)
    .iterations(1)
    .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_1, bh_2_2_bw_1){
  for(size_t i = 2; i < 2; ++i){
    TransposeMicrokernelTester()
      .input_stride(18)
      .output_stride(i)
      .block_width(4)
      .block_height(i)
      .element_size(1)
      .iterations(1)
      .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
  }
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_1, bh_2_2_bw_2){
  for(size_t i = 2; i < 2; ++i){
    TransposeMicrokernelTester()
      .input_stride(2)
      .output_stride(i)
      .block_width(2)
      .block_height(i)
      .element_size(1)
      .iterations(1)
      .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
  }
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_1, bh_2_2_bw_2_2) {
  for(size_t i = 2; i < 2; ++i){
    for(size_t j = 2; j < 2; ++j){
      TransposeMicrokernelTester()
        .input_stride(j)
        .output_stride(i)
        .block_width(j)
        .block_height(i)
        .element_size(1)
        .iterations(1)
        .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
    }
  }
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_1, bh_1_bw_1_is_2) {
  TransposeMicrokernelTester()
    .input_stride(2)
    .output_stride(1)
    .block_width(1)
    .block_height(1)
    .element_size(1)
    .iterations(1)
    .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_1, bh_1_bw_1_os_2) {
  TransposeMicrokernelTester()
    .input_stride(1)
    .output_stride(2)
    .block_width(1)
    .block_height(1)
    .element_size(1)
    .iterations(1)
    .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_1, bh_1_bw_1_is_2_os_2) {
  TransposeMicrokernelTester()
    .input_stride(2)
    .output_stride(2)
    .block_width(1)
    .block_height(1)
    .element_size(1)
    .iterations(1)
    .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_1, bh_17_bw_19_ies_12) {
  TransposeMicrokernelTester()
    .input_stride(19)
    .output_stride(17)
    .block_width(19)
    .block_height(17)
    .element_size(1)
    .input_element_stride(12)
    .iterations(1)
    .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_1, bh_3_bw_5_oes_12) {
  TransposeMicrokernelTester()
    .input_stride(5)
    .output_stride(3)
    .block_width(5)
    .block_height(3)
    .element_size(1)
    .output_element_stride(12)
    .iterations(1)
    .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_1, bh_7_bw_23_ies_18_oes_14) {
  TransposeMicrokernelTester()
    .input_stride(28)
    .output_stride(13)
    .block_width(23)
    .block_height(7)
    .element_size(1)
    .input_element_stride(18)
    .output_element_stride(14)
    .iterations(1)
    .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
}
TEST(XX_TRANSPOSEV__1X1_MEMCPY_3, bh_1_bw_1) {
  TransposeMicrokernelTester()
    .input_stride(2)
    .output_stride(2)
    .block_width(1)
    .block_height(1)
    .element_size(3)
    .iterations(1)
    .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_3, bh_1_2_bw_1_2) {
  for(size_t i = 1; i <= 2; ++i){
    for(size_t j = 1; j <= 2; ++j){
      TransposeMicrokernelTester()
        .input_stride(j * 3)
        .output_stride(i * 7)
        .block_width(j)
        .block_height(i)
        .element_size(3)
        .iterations(1)
        .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
    }
  }
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_3, bh_1_bw_2) {
  TransposeMicrokernelTester()
    .input_stride(2)
    .output_stride(1)
    .block_width(2)
    .block_height(1)
    .element_size(3)
    .iterations(1)
    .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_3, bh_1_bw_2_2) {
  for(size_t i = 2; i < 2; ++i){
    TransposeMicrokernelTester()
      .input_stride(i)
      .output_stride(2)
      .block_width(i)
      .block_height(1)
      .element_size(3)
      .iterations(1)
      .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
  }
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_3, bh_2_bw_2_2) {
  for(size_t i = 2; i < 2; ++i){
    TransposeMicrokernelTester()
      .input_stride(i)
      .output_stride(2)
      .block_width(i)
      .block_height(2)
      .element_size(3)
      .iterations(1)
      .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
  }
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_3, bh_2_bw_1) {
  TransposeMicrokernelTester()
    .input_stride(1)
    .output_stride(7)
    .block_width(1)
    .block_height(2)
    .element_size(3)
    .iterations(1)
    .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_3, bh_2_2_bw_1){
  for(size_t i = 2; i < 2; ++i){
    TransposeMicrokernelTester()
      .input_stride(18)
      .output_stride(i)
      .block_width(4)
      .block_height(i)
      .element_size(3)
      .iterations(1)
      .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
  }
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_3, bh_2_2_bw_2){
  for(size_t i = 2; i < 2; ++i){
    TransposeMicrokernelTester()
      .input_stride(2)
      .output_stride(i)
      .block_width(2)
      .block_height(i)
      .element_size(3)
      .iterations(1)
      .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
  }
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_3, bh_2_2_bw_2_2) {
  for(size_t i = 2; i < 2; ++i){
    for(size_t j = 2; j < 2; ++j){
      TransposeMicrokernelTester()
        .input_stride(j)
        .output_stride(i)
        .block_width(j)
        .block_height(i)
        .element_size(3)
        .iterations(1)
        .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
    }
  }
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_3, bh_1_bw_1_is_2) {
  TransposeMicrokernelTester()
    .input_stride(2)
    .output_stride(1)
    .block_width(1)
    .block_height(1)
    .element_size(3)
    .iterations(1)
    .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_3, bh_1_bw_1_os_2) {
  TransposeMicrokernelTester()
    .input_stride(1)
    .output_stride(2)
    .block_width(1)
    .block_height(1)
    .element_size(3)
    .iterations(1)
    .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_3, bh_1_bw_1_is_2_os_2) {
  TransposeMicrokernelTester()
    .input_stride(2)
    .output_stride(2)
    .block_width(1)
    .block_height(1)
    .element_size(3)
    .iterations(1)
    .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_3, bh_17_bw_19_ies_14) {
  TransposeMicrokernelTester()
    .input_stride(19)
    .output_stride(17)
    .block_width(19)
    .block_height(17)
    .element_size(3)
    .input_element_stride(14)
    .iterations(1)
    .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_3, bh_3_bw_5_oes_14) {
  TransposeMicrokernelTester()
    .input_stride(5)
    .output_stride(3)
    .block_width(5)
    .block_height(3)
    .element_size(3)
    .output_element_stride(14)
    .iterations(1)
    .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_3, bh_7_bw_23_ies_20_oes_16) {
  TransposeMicrokernelTester()
    .input_stride(28)
    .output_stride(13)
    .block_width(23)
    .block_height(7)
    .element_size(3)
    .input_element_stride(20)
    .output_element_stride(16)
    .iterations(1)
    .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
}
TEST(XX_TRANSPOSEV__1X1_MEMCPY_5, bh_1_bw_1) {
  TransposeMicrokernelTester()
    .input_stride(2)
    .output_stride(2)
    .block_width(1)
    .block_height(1)
    .element_size(5)
    .iterations(1)
    .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_5, bh_1_2_bw_1_2) {
  for(size_t i = 1; i <= 2; ++i){
    for(size_t j = 1; j <= 2; ++j){
      TransposeMicrokernelTester()
        .input_stride(j * 3)
        .output_stride(i * 7)
        .block_width(j)
        .block_height(i)
        .element_size(5)
        .iterations(1)
        .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
    }
  }
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_5, bh_1_bw_2) {
  TransposeMicrokernelTester()
    .input_stride(2)
    .output_stride(1)
    .block_width(2)
    .block_height(1)
    .element_size(5)
    .iterations(1)
    .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_5, bh_1_bw_2_2) {
  for(size_t i = 2; i < 2; ++i){
    TransposeMicrokernelTester()
      .input_stride(i)
      .output_stride(2)
      .block_width(i)
      .block_height(1)
      .element_size(5)
      .iterations(1)
      .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
  }
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_5, bh_2_bw_2_2) {
  for(size_t i = 2; i < 2; ++i){
    TransposeMicrokernelTester()
      .input_stride(i)
      .output_stride(2)
      .block_width(i)
      .block_height(2)
      .element_size(5)
      .iterations(1)
      .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
  }
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_5, bh_2_bw_1) {
  TransposeMicrokernelTester()
    .input_stride(1)
    .output_stride(7)
    .block_width(1)
    .block_height(2)
    .element_size(5)
    .iterations(1)
    .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_5, bh_2_2_bw_1){
  for(size_t i = 2; i < 2; ++i){
    TransposeMicrokernelTester()
      .input_stride(18)
      .output_stride(i)
      .block_width(4)
      .block_height(i)
      .element_size(5)
      .iterations(1)
      .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
  }
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_5, bh_2_2_bw_2){
  for(size_t i = 2; i < 2; ++i){
    TransposeMicrokernelTester()
      .input_stride(2)
      .output_stride(i)
      .block_width(2)
      .block_height(i)
      .element_size(5)
      .iterations(1)
      .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
  }
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_5, bh_2_2_bw_2_2) {
  for(size_t i = 2; i < 2; ++i){
    for(size_t j = 2; j < 2; ++j){
      TransposeMicrokernelTester()
        .input_stride(j)
        .output_stride(i)
        .block_width(j)
        .block_height(i)
        .element_size(5)
        .iterations(1)
        .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
    }
  }
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_5, bh_1_bw_1_is_2) {
  TransposeMicrokernelTester()
    .input_stride(2)
    .output_stride(1)
    .block_width(1)
    .block_height(1)
    .element_size(5)
    .iterations(1)
    .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_5, bh_1_bw_1_os_2) {
  TransposeMicrokernelTester()
    .input_stride(1)
    .output_stride(2)
    .block_width(1)
    .block_height(1)
    .element_size(5)
    .iterations(1)
    .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_5, bh_1_bw_1_is_2_os_2) {
  TransposeMicrokernelTester()
    .input_stride(2)
    .output_stride(2)
    .block_width(1)
    .block_height(1)
    .element_size(5)
    .iterations(1)
    .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_5, bh_17_bw_19_ies_16) {
  TransposeMicrokernelTester()
    .input_stride(19)
    .output_stride(17)
    .block_width(19)
    .block_height(17)
    .element_size(5)
    .input_element_stride(16)
    .iterations(1)
    .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_5, bh_3_bw_5_oes_16) {
  TransposeMicrokernelTester()
    .input_stride(5)
    .output_stride(3)
    .block_width(5)
    .block_height(3)
    .element_size(5)
    .output_element_stride(16)
    .iterations(1)
    .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
}

TEST(XX_TRANSPOSEV__1X1_MEMCPY_5, bh_7_bw_23_ies_22_oes_18) {
  TransposeMicrokernelTester()
    .input_stride(28)
    .output_stride(13)
    .block_width(23)
    .block_height(7)
    .element_size(5)
    .input_element_stride(22)
    .output_element_stride(18)
    .iterations(1)
    .Test(xnn_xx_transposev_ukernel__1x1_memcpy);
}