blob: df680e4f3f6f82f88294a78e3d143a06c3551a1b [file] [log] [blame]
/*
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef VECTOR_TESTS_INCLUDE_TEST_VECTOR_H_
#define VECTOR_TESTS_INCLUDE_TEST_VECTOR_H_
#include <stdbool.h>
#include <stdint.h>
#include <assert.h>
#ifndef _TEST_VLEN
#define _TEST_VLEN 512
#endif
#define _TEST_VLENB _TEST_VLEN >> 3
#define VSET(VLEN, VTYPE, LMUL) \
__asm__ volatile("vsetvli t0, %[A]," #VTYPE "," #LMUL \
", tu, mu\n" ::[A] "r"(VLEN));
#define COPY_SCALAR_REG(DST) \
__asm__ volatile("sw t0, 0(%[A])\n" ::[A] "r"(&DST));
extern bool test_vector(void);
bool test_main(void);
uint32_t get_vtype_e8(uint8_t, bool, bool);
uint32_t get_vtype_e16(uint8_t, bool, bool);
uint32_t get_vtype_e32(uint8_t, bool, bool);
uint32_t get_vtype_e64(uint8_t, bool, bool);
#endif // VECTOR_TESTS_INCLUDE_TEST_VECTOR_H_