Skip to content

Commit 6a7e402

Browse files
authored
Merge pull request vortexgpgpu#239 from vortexgpgpu/bug_fixes
regression fix
2 parents 9929c42 + 18687d5 commit 6a7e402

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

kernel/include/vx_intrinsics.h

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@
1717
#ifndef __VX_INTRINSICS_H__
1818
#define __VX_INTRINSICS_H__
1919

20+
#include <stddef.h>
2021
#include <stdint.h>
2122
#include <VX_types.h>
2223

23-
typedef __SIZE_TYPE__ word_t;
24-
2524
#if defined(__clang__)
2625
#define __UNIFORM__ __attribute__((annotate("vortex.uniform")))
2726
#else
@@ -38,22 +37,22 @@ extern "C" {
3837
#define RISCV_CUSTOM3 0x7B
3938

4039
#define csr_read(csr) ({ \
41-
word_t __r; \
40+
size_t __r; \
4241
__asm__ __volatile__ ("csrr %0, %1" : "=r" (__r) : "i" (csr) : "memory"); \
4342
__r; \
4443
})
4544

4645
#define csr_write(csr, val) ({ \
47-
word_t __v = (word_t)(val); \
46+
size_t __v = (size_t)(val); \
4847
if (__builtin_constant_p(val) && __v < 32) \
4948
__asm__ __volatile__ ("csrw %0, %1" :: "i" (csr), "i" (__v) : "memory"); \
5049
else \
5150
__asm__ __volatile__ ("csrw %0, %1" :: "i" (csr), "r" (__v) : "memory"); \
5251
})
5352

5453
#define csr_swap(csr, val) ({ \
55-
word_t __r; \
56-
word_t __v = (word_t)(val); \
54+
size_t __r; \
55+
size_t __v = (size_t)(val); \
5756
if (__builtin_constant_p(val) && __v < 32) \
5857
__asm__ __volatile__ ("csrrw %0, %1, %2" : "=r" (__r) : "i" (csr), "i" (__v) : "memory"); \
5958
else \
@@ -62,8 +61,8 @@ extern "C" {
6261
})
6362

6463
#define csr_read_set(csr, val) ({ \
65-
word_t __r; \
66-
word_t __v = (word_t)(val); \
64+
size_t __r; \
65+
size_t __v = (size_t)(val); \
6766
if (__builtin_constant_p(val) && __v < 32) \
6867
__asm__ __volatile__ ("csrrs %0, %1, %2" : "=r" (__r) : "i" (csr), "i" (__v) : "memory"); \
6968
else \
@@ -72,16 +71,16 @@ extern "C" {
7271
})
7372

7473
#define csr_set(csr, val) ({ \
75-
word_t __v = (word_t)(val); \
74+
size_t __v = (size_t)(val); \
7675
if (__builtin_constant_p(val) && __v < 32) \
7776
__asm__ __volatile__ ("csrs %0, %1" :: "i" (csr), "i" (__v) : "memory"); \
7877
else \
7978
__asm__ __volatile__ ("csrs %0, %1" :: "i" (csr), "r" (__v) : "memory"); \
8079
})
8180

8281
#define csr_read_clear(csr, val) ({ \
83-
word_t __r; \
84-
word_t __v = (word_t)(val); \
82+
size_t __r; \
83+
size_t __v = (size_t)(val); \
8584
if (__builtin_constant_p(val) && __v < 32) \
8685
__asm__ __volatile__ ("csrrc %0, %1, %2" : "=r" (__r) : "i" (csr), "i" (__v) : "memory"); \
8786
else \
@@ -90,7 +89,7 @@ extern "C" {
9089
})
9190

9291
#define csr_clear(csr, val) ({ \
93-
word_t __v = (word_t)(val); \
92+
size_t __v = (size_t)(val); \
9493
if (__builtin_constant_p(val) && __v < 32) \
9594
__asm__ __volatile__ ("csrc %0, %1" :: "i" (csr), "i" (__v) : "memory"); \
9695
else \

0 commit comments

Comments
 (0)