liuyu11@ict.ac.cn via llvm-dev
2018-Apr-24 07:45 UTC
[llvm-dev] 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 at ict.ac.cn
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20180424/68242f46/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bg.jpg
Type: image/jpeg
Size: 25008 bytes
Desc: not available
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20180424/68242f46/attachment-0001.jpg>
Apparently Analagous Threads
- Subject: How to define vector element type bool in builtin function
- [LLVMdev] [AVX512] Inconsistent mask types for intrinsics?
- Vectorizer has trouble with vpmovmskb and store
- [LLVMdev] Vector select/compare support in LLVM
- Question about VectorLegalizer::ExpandStore() with v4i1
