<html><head><meta http-equiv="content-type" content="text/html; charset=us-ascii"><style>body { line-height: 1.5; }body { font-size: 10.5pt; font-family: ????; color: rgb(0, 0, 0); line-height: 1.5; }</style></head><body>
<table width="99.99%" height="100%" style="padding: 10px; background-color: transparent;" border="0" cellpadding="0" cellspacing="0" background="cid:_Foxmail.1@e5a9e27b-87f8-20da-8fed-88deced48d81">
<tbody><tr>
<td valign="top" style="width:100%;height:100%;">
<div style="">
<div><span></span><div>Help: How to define vector element type  bool (v8i1)  in C builtin function</div><div>hello everyone,<span style="background-color: transparent; line-height: 1.5;">I have defined  intrinsic function like this:</span></div><div><span style="background-color: rgba(0, 0, 0, 0); line-height: 1.5;">def int_mips_add_32 : GCCBuiltin<"__builtin_dongxin_add_32">,</span><span style="background-color: rgba(0, 0, 0, 0); line-height: 1.5;"> Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty,llvm_v8i1_ty]>;</span></div><div><br><div><span style="color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">Then I write a test code :</span></div><div><span style="color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">typedef int v4i32  __attribute__ ((vector_size(16)));<br>typedef bool v8i1  __attribute__ ((vector_size(1)));<br><br>void foo() {<br>  v4i32 v4i32_r1,v4i32_r2,v4i32_r3;<br>  v8i1 vm_1;<br>  v4i32_r1 = __builtin_dongxin_add_32(v4i32_r2,v4i32_r2,vm_1);<br>}</span><span style="color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);"><br></span><div><span style="background-color: transparent; line-height: 1.5;">          </span></div><div>but when I compile :  <span style="background-color: rgba(0, 0, 0, 0); line-height: 1.5;">clang -cc1  -triple mipsel-unknown-linux-gnu -emit-llvm  intrinstest.c -o test.ll</span></div><div><span style="background-color: rgba(0, 0, 0, 0); line-height: 1.5;">I got the error:</span></div><div><span style="color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">intrinstest.c:4:9: error: unknown type name 'bool'<br>typedef bool v8i1  __attribute__ ((vector_size(1)));<br>        ^<br>intrinstest.c:4:36: error: vector size not an integral multiple of component size<br>typedef bool v8i1  __attribute__ ((vector_size(1)));<br>                                   ^           ~<br>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)<br>  v4i32_r1 = __builtin_dongxin_add_32(v4i32_r2,v4i32_r2,vm_1);<br></span></div><div><br></div><div>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 .</div></div></div></div><div><span style="background-color: rgba(0, 0, 0, 0); font-size: 16px; line-height: 1.5;">Thanks </span></div><div><span style="background-color: rgba(0, 0, 0, 0); font-size: 16px; line-height: 1.5;"><br></span></div><div><span style="background-color: rgba(0, 0, 0, 0); font-size: 16px; line-height: 1.5;">YuLiu</span></div>
<div><br></div><hr style="width: 210px; height: 1px;" color="#b5c4df" size="1" align="left">
<div><span><div style="MARGIN: 10px; FONT-FAMILY: verdana; FONT-SIZE: 10pt"><div>liuyu11@ict.ac.cn</div></div></span></div>
<div></div></div>
</td>
</tr>
</tbody></table>
</body></html>