minor updates

This commit is contained in:
Blaise Tine 2021-03-27 21:27:08 -04:00
parent 39a8579c27
commit 0b2f2a27ac
4 changed files with 7 additions and 20 deletions

View file

@ -1,6 +1,5 @@
#include <stdint.h>
#include <vx_intrinsics.h>
#include <vx_tex.h>
#include "common.h"
uint32_t ilog2 (uint32_t value) {

View file

@ -52,6 +52,13 @@ extern "C" {
__asm__ __volatile__ ("csrc " __ASM_STR(csr) ", %0" :: "rK" (__v) : "memory"); \
})
// Texture load
#define vx_tex(unit, u, v, l) ({ \
register unsigned __r; \
__asm__ __volatile__ (".insn r4 0x6b, 5, " __ASM_STR(unit) ", %0, %1, %2, %3" : "=r"(__r) : "r"(u), "r"(v), "r"(l)); \
__r; \
})
// Set thread mask
inline void vx_tmc(unsigned num_threads) {
asm volatile (".insn s 0x6b, 0, x0, 0(%0)" :: "r"(num_threads));

View file

@ -1,19 +0,0 @@
#ifndef VX_TEX_H
#define VX_TEX_H
#ifdef __cplusplus
extern "C" {
#endif
unsigned vx_tex(unsigned unit, unsigned u, unsigned v, unsigned lod) {
unsigned result;
unsigned lod_unit = (unit << 24) | lod;
asm volatile (".insn r4 0x6b, 5, 0, %0, %1, %2, %3" : "=r"(result) : "r"(u), "r"(v), "r"(lod_unit));
return result;
}
#ifdef __cplusplus
}
#endif
#endif

Binary file not shown.