Help: How to define vector element type bool (v8i1) in C builtin function




Help: How to define vector element type bool (v8i1) in C builtin function
hello everyone,I have defined intrinsic function like this:
def int_mips_add_32 : GCCBuiltin<“__builtin_dongxin_add_32”>, Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty,llvm_v8i1_ty]>;


Then I write a test code :
typedef int v4i32 attribute ((vector_size(16)));
typedef bool v8i1 attribute ((vector_size(1)));

void foo() {
v4i32 v4i32_r1,v4i32_r2,v4i32_r3;
v8i1 vm_1;
v4i32_r1 = __builtin_dongxin_add_32(v4i32_r2,v4i32_r2,vm_1);
}


but when I compile : clang -cc1 -triple mipsel-unknown-linux-gnu -emit-llvm intrinstest.c -o test.ll
I got the error:
intrinstest.c:4:9: error: unknown type name ‘bool’
typedef bool v8i1 attribute ((vector_size(1)));
^
intrinstest.c:4:36: error: vector size not an integral multiple of component size
typedef bool v8i1 attribute ((vector_size(1)));
^ ~
intrinstest.c:9:57: error: passing ‘v8i1’ (aka ‘int’) to parameter of incompatible type ‘attribute((vector_size(8 * sizeof(_Bool)))) _Bool’ (vector of 8 ‘_Bool’ values)
v4i32_r1 = __builtin_dongxin_add_32(v4i32_r2,v4i32_r2,vm_1);



I searched online ,bool is sizeof 1 byte,and Bool size is also bigger than 1bit. Is there a way I can define a variable which type is v8i1 .



Thanks


YuLiu








liuyu11@ict.ac.cn




|

bg.jpg