这篇教程C++ vector_size函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中vector_size函数的典型用法代码示例。如果您正苦于以下问题:C++ vector_size函数的具体用法?C++ vector_size怎么用?C++ vector_size使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了vector_size函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: _attribute_sort_items_void _attribute_sort_items_(container **X, enum attr_sort_enum sort, char sort_reverse){ if (*X == NULL) return; int i, j; container *N = NULL; /* printf("sort: "); switch (sort) { case sort_none: printf("sort_none"); break; case sort_hits: printf("sort_hits"); break; case sort_alpha: printf("sort_alpha"); break; } if (sort_reverse) printf(" (reverse)"); printf("/n"); for (i=0; i<vector_size(*X); i++) { struct _attr_tree_ *item = vector_get(*X, i).ptr; printf(" %.8x name:%s hits:%i/n", (int)X, item->name, item->hits); } */ if (sort == sort_hits) N = multimap_container( int_container(), ptr_container() ); else if (sort == sort_alpha) N = multimap_container( string_container(), ptr_container() ); for (i=0; i<vector_size(*X); i++) { struct _attr_tree_ *item = vector_get(*X, i).ptr; if (item->children != NULL) _attribute_sort_items_(&(item->children), item->sort, item->sort_reverse); if (sort == sort_hits) multimap_insert(N, item->hits, item); else if (sort == sort_alpha) { if (item->name!=NULL) multimap_insert(N, item->name, item); else if (item->value!=NULL) multimap_insert(N, item->name, item); else if (item->name!=NULL) multimap_insert(N, item->name, item); else multimap_insert(N, item->name, item); } } if (!sort_reverse && sort != sort_hits && sort != sort_alpha) return; container *Y = vector_container( ptr_container() ); iterator it; if ((sort == sort_hits && sort_reverse) || (sort == sort_alpha && !sort_reverse)) { it = multimap_begin(N); for (; it.valid; it=multimap_next(it)) vector_pushback(Y, map_val(it).ptr); } else { if (sort != sort_hits && sort != sort_alpha) { for (i=vector_size(*X)-1; i>=0; i--) vector_pushback(Y, vector_get(*X, i).ptr); } else { it = multimap_end(N); for (; it.valid; it=multimap_previous(it)) vector_pushback(Y, map_val(it).ptr); } } if (N != NULL) destroy(N); destroy(*X); *X = Y; /* for (i=0; i<vector_size(*X); i++) { struct _attr_tree_ *item = vector_get(*X, i).ptr; printf(" %.8x name:%s hits:%i/n", (int)X, item->name, item->hits); } */ return;}
开发者ID:c4125442,项目名称:enterprise-search,代码行数:85,
示例2: __attribute__/* PR target/70510 *//* { dg-do assemble { target avx512bw } } *//* { dg-require-effective-target masm_intel } *//* { dg-options "-Og -mavx512bw -masm=intel" } */typedef int V __attribute__ ((vector_size (64)));Vfoo (V u, V v){ v[0] |= v[u[0]]; u /= ((V)v)[0]; return u;}
开发者ID:0day-ci,项目名称:gcc,代码行数:14,
示例3: abortextern void abort (void);typedef short __v2hi __attribute ((vector_size(4)));typedef __v2hi fract2x16;typedef short fract16;int main (){ fract2x16 a, b, t; fract16 t1, t2; a = __builtin_bfin_compose_2x16 (0x5fff, 0xffff); b = __builtin_bfin_compose_2x16 (0x1001, 0x0001); t = __builtin_bfin_multr_fr2x16 (a, b); t1 = __builtin_bfin_extract_hi (t); t2 = __builtin_bfin_extract_lo (t); if (t1 != 0xc01 || t2 != 0x0) abort (); return 0;}
开发者ID:0day-ci,项目名称:gcc,代码行数:22,
示例4: __attribute__/* { dg-do compile } *//* { dg-options "-O -msve-vector-bits=256" } */#include <stdint.h>typedef int64_t vnx2di __attribute__((vector_size (32)));typedef int32_t vnx4si __attribute__((vector_size (32)));typedef int16_t vnx8hi __attribute__((vector_size (32)));typedef int8_t vnx16qi __attribute__((vector_size (32)));typedef double vnx2df __attribute__((vector_size (32)));typedef float vnx4sf __attribute__((vector_size (32)));typedef _Float16 vnx8hf __attribute__((vector_size (32)));#define VEC_PERM_CONST_OVERRUN(TYPE, MASK) /TYPE vec_perm_overrun_##TYPE (TYPE values1, TYPE values2) /{ / return __builtin_shuffle (values1, values2, MASK); /}VEC_PERM_CONST_OVERRUN (vnx2di, ((vnx2di) { 4 + (8 * 1), 3 + (8 * 1), 6 + (8 * 2), 1 + (8 * 3) }));VEC_PERM_CONST_OVERRUN (vnx4si, ((vnx4si) { 3 + (16 * 3), 9 + (16 * 4), 11 + (16 * 5), 12 + (16 * 3), 2 + (16 * 2), 4 + (16 * 1), 4 + (16 * 2), 2 + (16 * 1) }));VEC_PERM_CONST_OVERRUN (vnx8hi, ((vnx8hi) { 8 + (32 * 3), 27 + (32 * 1), 5 + (32 * 3), 4 + (32 * 3), 21 + (32 * 1), 12 + (32 * 3), 13 + (32 * 3), 0 + (32 * 1), 22 + (32 * 2), 1 + (32 * 2), 8 + (32 * 2), 9 + (32 * 1),
开发者ID:MaxKellermann,项目名称:gcc,代码行数:31,
示例5: __attribute__// { dg-do run { target c++11 } }using global_vector_type __attribute__((vector_size(16))) = float;template <class T> struct A{ using type = T;};template < typename Val > struct S{ using vector_type __attribute__((vector_size(16))) = typename A<Val>::type; typedef Val vector_type2 __attribute__((vector_size(16))); int pr_size() { return sizeof(vector_type); } int pr_size2() { return sizeof(vector_type2); }};int main(){ if (sizeof (S<float>::vector_type) != sizeof (global_vector_type)) return 1; if (sizeof (S<float>::vector_type2) != sizeof (global_vector_type)) return 2; S<float> x; if (x.pr_size() != sizeof (global_vector_type))
开发者ID:pjump,项目名称:gcc,代码行数:31,
示例6: cesk_diff_buffer_appendint cesk_diff_buffer_append(cesk_diff_buffer_t* buffer, int type, uint32_t addr, const void* value){ if(NULL == buffer) { LOG_ERROR("invalid argument"); return -1; } if(CESK_DIFF_DEALLOC == type) { if(NULL != value) LOG_WARNING("invalid value field, suppose to be NULL"); value = NULL; } else if(CESK_DIFF_REUSE != type && NULL == value) { LOG_ERROR("invalid value field, suppose to be non-NULL"); return -1; } _cesk_diff_node_t node = { .type = type, .addr = addr, .value = (void*)value, .time = vector_size(buffer->buffer) }; if(buffer->reverse) node.time = -node.time; /* so we reverse the time order */ if(CESK_DIFF_STORE == type || CESK_DIFF_ALLOC == type) cesk_value_incref((cesk_value_t*)value); else if(CESK_DIFF_REG == type) node.value = cesk_set_fork((cesk_set_t*)value); LOG_DEBUG("append a new record to the buffer %s, timestamp = %d", _cesk_diff_record_to_string(type, addr, value, NULL, 0), node.time); return vector_pushback(buffer->buffer, &node);}const void* cesk_diff_buffer_append_peek(cesk_diff_buffer_t* buffer, int type, uint32_t addr, const void* value){ if(cesk_diff_buffer_append(buffer, type, addr, value) < 0) { LOG_ERROR("can not append the record to buffer"); return NULL; } else { uint32_t sz = vector_size(buffer->buffer); _cesk_diff_node_t* node = (_cesk_diff_node_t*)vector_get(buffer->buffer, sz - 1); if(NULL == node) { LOG_ERROR("can not get the last appended node"); return NULL; } else { return node->value; } }}/** * @brief the compare function used to sort the diff buffer items by pair <type, addr> * @todo use faster sorting algorihtm **/static int _cesk_diff_buffer_cmp(const void* left, const void* right){ const _cesk_diff_node_t* lnode = (const _cesk_diff_node_t*)left; const _cesk_diff_node_t* rnode = (const _cesk_diff_node_t*)right; if(lnode->type != rnode->type) return lnode->type - rnode->type; if(lnode->addr != rnode->addr) //return lnode->addr - rnode->addr; { if(lnode->addr < rnode->addr) return -1; else if(lnode->addr == rnode->addr) return 0; return 1; } return lnode->time - rnode->time;}/** * @brief check if the address is used by the store section, set the buffer array to tick value if * the address is in use * @param data the data record array * @param N how many records in the data array * @param buf the result buffer * @param tick the tick * @return < 0 indicates an error occurred **/static inline int _cesk_diff_gc_check_store_rec_inuse(const cesk_diff_rec_t* data, size_t N, uint32_t* buf, uint32_t tick){ size_t i; for(i = 0; i < N; i ++) { const cesk_value_t* value = data[i].arg.value; if(NULL == value) { LOG_WARNING("ignore invalid value"); continue; } /* if this is a set */ if(CESK_TYPE_SET == value->type) { const cesk_set_t* set = value->pointer.set; cesk_set_iter_t iter; if(NULL == cesk_set_iter(set, &iter)) { LOG_WARNING("can not acquire the set iterator"); continue; } uint32_t addr; while(CESK_STORE_ADDR_NULL != (addr = cesk_set_iter_next(&iter)))//.........这里部分代码省略.........
开发者ID:38,项目名称:adam,代码行数:101,
示例7: __attribute__/* { dg-do assemble { target aarch64_asm_sve_ok } } *//* { dg-options "-O3 -msve-vector-bits=256 --save-temps" } */typedef _Float16 vnx8hf __attribute__((vector_size(32)));typedef float vnx4sf __attribute__((vector_size(32)));typedef double vnx2df __attribute__((vector_size(32)));#define DO_OP(TYPE) /void vdiv_##TYPE (TYPE *x, TYPE y) /{ / register TYPE dst asm("z0"); / register TYPE src asm("z2"); / dst = *x; / src = y; / asm volatile ("" :: "w" (dst), "w" (src)); / dst = dst / src; / asm volatile ("" :: "w" (dst)); / *x = dst; /} /void vdivr_##TYPE (TYPE *x, TYPE y) /{ / register TYPE dst asm("z0"); / register TYPE src asm("z2"); / dst = *x; / src = y; / asm volatile ("" :: "w" (dst), "w" (src)); / dst = src / dst; / asm volatile ("" :: "w" (dst)); / *x = dst; /}
开发者ID:MaxKellermann,项目名称:gcc,代码行数:30,
示例8: __attribute__// RUN: %clang_cc1 %s -fsyntax-only -verify//typedef __attribute__(( ext_vector_type(4) )) float float4;typedef float float4 __attribute__((vector_size(16)));float4 foo = (float4){ 1.0, 2.0, 3.0, 4.0 };float4 foo2 = (float4){ 1.0, 2.0, 3.0, 4.0 , 5.0 }; // expected-warning{{excess elements in vector initializer}}float4 array[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0};int array_sizecheck[(sizeof(array) / sizeof(float4)) == 3 ? 1 : -1];float4 array2[2] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 }; // expected-warning {{excess elements in array initializer}}float4 array3[2] = { {1.0, 2.0, 3.0}, 5.0, 6.0, 7.0, 8.0, 9.0 }; // expected-warning {{excess elements in array initializer}}// PR5650__attribute__((vector_size(16))) float f1(void) { __attribute__((vector_size(16))) float vec = {0.0f, 0.0f, 0.0f}; return(vec);}__attribute__((vector_size(16))) float f2( __attribute__((vector_size(16))) float a1) { return(a1);}
开发者ID:HenderOrlando,项目名称:clamav-bytecode-compiler,代码行数:28,
示例9: testVectorComponentAccessvoid testVectorComponentAccess() { typedef float v4sf __attribute__ ((vector_size (16))); static v4sf q; float* r = &q[0]; // expected-error {{address of vector element requested}}}
开发者ID:ACSOP,项目名称:android_external_clang,代码行数:5,
示例10: abort/* { dg-final { scan-assembler "rddsp" } } *//* { dg-final { scan-assembler "lbux?" } } *//* { dg-final { scan-assembler "lhx?" } } *//* { dg-final { scan-assembler "lwx?" } } *//* { dg-final { scan-assembler "bposge32" } } *//* { dg-final { scan-assembler "madd" } } *//* { dg-final { scan-assembler "maddu" } } *//* { dg-final { scan-assembler "msub" } } *//* { dg-final { scan-assembler "msubu" } } *//* { dg-final { scan-assembler "mult" } } *//* { dg-final { scan-assembler "multu" } } */extern void abort (void);extern void exit (int);typedef signed char v4i8 __attribute__ ((vector_size(4)));typedef short v2q15 __attribute__ ((vector_size(4)));typedef int q31;typedef int i32;typedef unsigned int ui32;typedef long long a64;NOMIPS16 void test_MIPS_DSP (void);char array[100];int little_endian;int main (){ int i;
开发者ID:rgmabs19357,项目名称:gcc,代码行数:31,
示例11: __attribute__/* PR rtl-optimization/18614 *//* { dg-do compile } *//* { dg-options "-O2 -msse2" } *//* { dg-require-effective-target sse2 } */typedef double v2df __attribute__ ((vector_size (16)));v2df foo (void){ v2df yd = { 1.0, 4.0 }; v2df xd; xd = __builtin_ia32_cvtps2pd (__builtin_ia32_rsqrtps (__builtin_ia32_cvtpd2ps (yd))); return xd;}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.toolchain,代码行数:16,
示例12: attribute_generate_xmlchar* attribute_generate_xml(container *attributes, int attrib_count, attr_conf *showattrp, struct fte_data *getfiletypep, struct adf_data *attrdescrp, query_array *qa, int outformat){ int i, j; /*** *** ***/ container *A = _attribute_dissect_query_(qa, attrib_count-1); int *container_id = malloc(sizeof(int)); *container_id = 0; struct _attr_ret_ ret = _attribute_build_tree_(attributes, showattrp, A, container_id); int default_filter = 0; _attribute_build_items_(ret.C, A, qa, default_filter, attrib_count-1, getfiletypep, attrdescrp); _attribute_sort_items_(&ret.C, showattrp->sort, showattrp->flags & sort_reverse); buffer *bout = buffer_init(-1); for (i=0; i<vector_size(A); i++) { struct _attr_query_element_ *vquery = (struct _attr_query_element_*)vector_get(A,i).ptr; if (vquery->selected) { qa->query[vquery->query_pos].hide = 1; } else default_filter|= (1<<vquery->filter_id); } // Hide dato from "all"-query: for (i=0; i<qa->n; i++) if (qa->query[i].operand == QUERY_DATE) qa->query[i].hide = 1; if (outformat==_OUT_FOMRAT_SD_JSON) { JsonNode *root = json_mkobject(); _attribute_print_and_delete_tree_json_(ret.C, 4, showattrp->max_items, root); char *tmps = json_stringify(root, "/t"); bprintf(bout, tmps); free(tmps); } else { bprintf(bout, "<navigation query=/""); bsprint_query_with_remove(bout, NULL, qa, 1); bprintf(bout, "/">/n"); _attribute_print_and_delete_tree_xml_(bout, ret.C, 4, showattrp->max_items); } free(container_id); destroy(ret.C); for (i=0; i<vector_size(A); i++) { struct _attr_query_element_ *vquery = vector_get(A,i).ptr; for (j=0; j<10; j++) if (vquery->w[j]!=NULL) free(vquery->w[j]); free(vquery); } destroy(A); char *out = buffer_exit(bout); #ifdef DEBUG printf("%s/n", out); #endif return out; /*** *** ***/}
开发者ID:c4125442,项目名称:enterprise-search,代码行数:69,
示例13: _attribute_print_and_delete_tree_json_void _attribute_print_and_delete_tree_json_(container *X, int indent, int max_items, JsonNode *root){ if (X==NULL) return; int i, j; JsonNode *jsonitems = NULL; int isgroup = 0; jsonitems = json_mkarray(); for (i=0; i<vector_size(X); i++) { JsonNode *jsonitem = json_mkobject(); struct _attr_tree_ *item = vector_get(X, i).ptr; if ((item->container_id == 0 && (item->hits == 0 || indent==-1)) || (item->hits==0 && !item->show_empty)) { if (item->children!=NULL) { _attribute_print_and_delete_tree_json_(item->children, -1, item->max_items, jsonitem); } if (item->free_value) free(item->value); if (item->free_name) free(item->name); if (item->querystr != NULL) free(item->querystr); destroy(item->children); destroy(item->query_param); free(item); continue; } if (!(max_items > 0 && i>=max_items)) { char buf[1024]; if (item->children!=NULL) { isgroup = 1; } else { isgroup = 0; } //if (item->key!=NULL) json_append_member(jsonitem, "key", json_mkstring(item->key) ); //if (item->value!=NULL) json_append_member(jsonitem, "value", json_mkstring(item->value) ); if (item->name!=NULL) json_append_member(jsonitem, "name", json_mkstring(item->name) ); if (item->icon!=NULL) json_append_member(jsonitem, "icon", json_mkstring(item->icon) ); if (item->querystr!=NULL) json_append_member(jsonitem, "query", json_mkstring(item->querystr) ); if (item->container_id == 0) json_append_member(jsonitem, "hits", json_mknumber(item->hits) ); if (item->children!=NULL) { _attribute_print_and_delete_tree_json_(item->children, indent+4, item->max_items, jsonitem); } } if (item->free_value) free(item->value); if (item->free_name) free(item->name); if (item->querystr != NULL) free(item->querystr); destroy(item->children); destroy(item->query_param); free(item); json_append_element(jsonitems, jsonitem ); } if (isgroup==1) json_append_member(root, "group", jsonitems ); else json_append_member(root, "items", jsonitems );}
开发者ID:c4125442,项目名称:enterprise-search,代码行数:76,
示例14: _attribute_print_and_delete_tree_xml_void _attribute_print_and_delete_tree_xml_(buffer *bout, container *X, int indent, int max_items){ if (X==NULL) return; int i, j; for (i=0; i<vector_size(X); i++) { struct _attr_tree_ *item = vector_get(X, i).ptr; if ((item->container_id == 0 && (item->hits == 0 || indent==-1)) || (item->hits==0 && !item->show_empty)) { if (item->children!=NULL) { _attribute_print_and_delete_tree_xml_(bout, item->children, -1, item->max_items); } if (item->free_value) free(item->value); if (item->free_name) free(item->name); if (item->querystr != NULL) free(item->querystr); destroy(item->children); destroy(item->query_param); free(item); continue; } if (max_items > 0 && i>=max_items) { if (i==max_items) { for (j=0; j<indent; j++) bprintf(bout, " "); bprintf(bout, "<item name=/".../" />/n"); } } else { char buf[1024]; for (j=0; j<indent; j++) bprintf(bout, " "); if (item->children!=NULL) bprintf(bout, "<group"); else bprintf(bout, "<item"); if (item->key!=NULL) bprintf(bout, " key=/"%s/"", xml_escape_uri(item->key, buf, sizeof(buf))); if (item->value!=NULL) bprintf(bout, " value=/"%s/"", xml_escape_uri(item->value, buf, sizeof(buf))); if (item->name!=NULL) bprintf(bout, " name=/"%s/"", xml_escape_attr(item->name, buf, sizeof(buf))); if (item->icon!=NULL) bprintf(bout, " icon=/"%s/"", xml_escape_uri(item->icon, buf, sizeof(buf))); if (item->version!=NULL) bprintf(bout, " version=/"%s/"", xml_escape_attr(item->version, buf, sizeof(buf))); if (item->querystr!=NULL) bprintf(bout, " query=/"%s/"", xml_escape_uri(item->querystr, buf, sizeof(buf))); if (item->selected >= 0) bprintf(bout, " selected=/"true/""); bprintf(bout, " expanded=/"%s/"", item->selected_descendant || item->expanded ? "true":"false"); if (item->container_id == 0) bprintf(bout, " hits=/"%i/"", item->hits); if (item->sort==sort_alpha) { if (item->sort_reverse) bprintf(bout, " sort=/"alpha_reversed/""); else bprintf(bout, " sort=/"alpha/""); } if (item->children!=NULL) { bprintf(bout, ">/n"); _attribute_print_and_delete_tree_xml_(bout, item->children, indent+4, item->max_items); for (j=0; j<indent; j++) bprintf(bout, " "); bprintf(bout, "</group>/n"); } else bprintf(bout, " />/n"); } if (item->free_value) free(item->value); if (item->free_name) free(item->name); if (item->querystr != NULL) free(item->querystr); destroy(item->children); destroy(item->query_param); free(item); }}
开发者ID:c4125442,项目名称:enterprise-search,代码行数:79,
示例15: __attribute__/* { dg-options "-mips64 -O2 -mpaired-single -mhard-float -mfp64" } */ /* { dg-final { scan-assembler "cvt.ps.s" } } */ /* { dg-final { scan-assembler "mov.ps" } } */ /* { dg-final { scan-assembler "ldc1" } } */ /* { dg-final { scan-assembler "sdc1" } } */ /* { dg-final { scan-assembler "add.ps" } } */ /* { dg-final { scan-assembler "sub.ps" } } */ /* { dg-final { scan-assembler "neg.ps" } } */ /* { dg-final { scan-assembler "mul.ps" } } */ /* { dg-final { scan-assembler "madd.ps" } } */ /* { dg-final { scan-assembler "msub.ps" } } */ /* { dg-final { scan-assembler "nmadd.ps" } } */ /* { dg-final { scan-assembler "nmsub.ps" } } */ /* { dg-final { scan-assembler "mov(n|z).ps" } } */ typedef float v2sf __attribute__ ((vector_size(8)));v2sf A = {100, 200};/* Init from floats */v2sf init (float a, float b){ return (v2sf) {a, b};}/* Move between registers */v2sf move (v2sf a){ return a;}
开发者ID:BackupTheBerlios,项目名称:iphone-binutils-svn,代码行数:30,
示例16: mainint main(int argc, char **argv, char *env[]) { vector vec; typedef float V __attribute__((vector_size(16))); V a; auto arr = x; // expected-error {{use of undeclared identifier 'x'}} int i;#pragma omp target teams distribute depend // expected-error {{expected '(' after 'depend'}} for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend ( // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after dependency type - ignoring}} for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend () // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend (argc // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend (source : argc) // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend (source) // expected-error {{expected expression}} expected-warning {{missing ':' after dependency type - ignoring}} for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend (in : argc)) // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute' are ignored}} for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend (out: ) // expected-error {{expected expression}} for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend (inout : foobool(argc)), depend (in, argc) // expected-error {{expected addressable lvalue expression, array element or array section}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected expression}} for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend (out :S1) // expected-error {{'S1' does not refer to a value}} for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend(in : argv[1][1] = '2') for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend (in : vec[1]) // expected-error {{expected addressable lvalue expression, array element or array section}} for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend (in : argv[0]) for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend (in : ) // expected-error {{expected expression}} for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend (in : main) for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend(in : a[0]) // expected-error{{expected addressable lvalue expression, array element or array section}} for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend (in : vec[1:2]) // expected-error {{ value is not an array or pointer}} for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend (in : argv[ // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}} for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend (in : argv[: // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}} for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend (in : argv[:] // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}} expected-error {{expected ')'}} expected-note {{to match this '('}} for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend (in : argv[argc: // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}} for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend (in : argv[argc:argc] // expected-error {{expected ')'}} expected-note {{to match this '('}} for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend (in : argv[0:-1]) // expected-error {{section length is evaluated to a negative value -1}} for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend (in : argv[-1:0]) for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend (in : argv[:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}} for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend (in : argv[3:4:1]) // expected-error {{expected ']'}} expected-note {{to match this '['}} for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend(in:a[0:1]) // expected-error {{subscripted value is not an array or pointer}} for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend(in:argv[argv[:2]:1]) // expected-error {{OpenMP array section is not allowed here}} for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend(in:argv[0:][:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}} for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend(in:env[0:][:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is an array of unknown bound}} for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend(in : argv[ : argc][1 : argc - 1]) for (i = 0; i < argc; ++i) foo();#pragma omp target teams distribute depend(in : arr[0]) for (i = 0; i < argc; ++i) foo(); return 0;}
开发者ID:LegalizeAdulthood,项目名称:clang,代码行数:74,
示例17: __attribute// RUN: %clang_cc1 -triple wasm32-unknown-unknown -target-feature +unimplemented-simd128 -target-feature +nontrapping-fptoint -target-feature +exception-handling -target-feature +bulk-memory -fno-lax-vector-conversions -O3 -emit-llvm -o - %s | FileCheck %s -check-prefixes WEBASSEMBLY,WEBASSEMBLY32// RUN: %clang_cc1 -triple wasm64-unknown-unknown -target-feature +unimplemented-simd128 -target-feature +nontrapping-fptoint -target-feature +exception-handling -target-feature +bulk-memory -fno-lax-vector-conversions -O3 -emit-llvm -o - %s | FileCheck %s -check-prefixes WEBASSEMBLY,WEBASSEMBLY64// RUN: not %clang_cc1 -triple wasm64-unknown-unknown -target-feature +nontrapping-fptoint -target-feature +exception-handling -target-feature +bulk-memory -fno-lax-vector-conversions -O3 -emit-llvm -o - %s 2>&1 | FileCheck %s -check-prefixes MISSING-SIMD// SIMD convenience typestypedef char i8x16 __attribute((vector_size(16)));typedef short i16x8 __attribute((vector_size(16)));typedef int i32x4 __attribute((vector_size(16)));typedef long long i64x2 __attribute((vector_size(16)));typedef unsigned char u8x16 __attribute((vector_size(16)));typedef unsigned short u16x8 __attribute((vector_size(16)));typedef unsigned int u32x4 __attribute((vector_size(16)));typedef unsigned long long u64x2 __attribute((vector_size(16)));typedef float f32x4 __attribute((vector_size(16)));typedef double f64x2 __attribute((vector_size(16)));__SIZE_TYPE__ memory_size(void) { return __builtin_wasm_memory_size(0); // WEBASSEMBLY32: call {{i.*}} @llvm.wasm.memory.size.i32(i32 0) // WEBASSEMBLY64: call {{i.*}} @llvm.wasm.memory.size.i64(i32 0)}__SIZE_TYPE__ memory_grow(__SIZE_TYPE__ delta) { return __builtin_wasm_memory_grow(0, delta); // WEBASSEMBLY32: call i32 @llvm.wasm.memory.grow.i32(i32 0, i32 %{{.*}}) // WEBASSEMBLY64: call i64 @llvm.wasm.memory.grow.i64(i32 0, i64 %{{.*}})}void memory_init(void *dest, int offset, int size) { __builtin_wasm_memory_init(3, 0, dest, offset, size); // WEBASSEMBLY32: call void @llvm.wasm.memory.init(i32 3, i32 0, i8* %{{.*}}, i32 %{{.*}}, i32 %{{.*}})
开发者ID:llvm-project,项目名称:clang,代码行数:31,
示例18: __attribute__typedef float V8SF __attribute__ ((vector_size (32)));void bar (V8SF);voidfoo (float x){ bar ((V8SF) { x, x, x, x, x, x, x, x });}
开发者ID:ImmanuelHaffner,项目名称:JACCo-old,代码行数:7,
示例19: __attribute__/* { dg-do compile } *//* { dg-options "--param ggc-min-expand=0 --param ggc-min-heapsize=0" } *//* { dg-additional-options "-fno-common" { target hppa*-*-hpux* } } */__attribute__ ((vector_size (64))) unsigned char v1, v2, v3;voidvadd (void){ v1 = v2 + v3;}voidtest_add (void){ vadd ();}voidvsub (void){ v1 = v2 - v3;}
开发者ID:pjump,项目名称:gcc,代码行数:19,
示例20: __attribute__ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==========================================================================*/#ifndef CAM_INLINED#define CAM_INLINED/* Histogram computation * C code */#include <stdlib.h>#include "camellia.h"#include "camellia_internals.h"#ifdef CAM_VECTORIZEtypedef unsigned long v4si __attribute__ ((vector_size(16)));union i4vector{ v4si v; unsigned long i[4];};#endif#ifdef CAM_GENERATE_FULL_CODE// 8 and 16 bits pixel size code generation#undef CAM_PIXEL#define CAM_PIXEL unsigned char#define camIntegralImage camIntegralImage8#include "cam_integralimage.c"
开发者ID:dylanvee,项目名称:camellia-lucid,代码行数:31,
示例21: STATIC_ASSERT#define STATIC_ASSERT(condition) / int some_array##__LINE__[(condition) ? 1 : -1]; #ifdef __GNUC__typedef int __attribute__ ((vector_size (16))) a, b;typedef int c, d __attribute__ ((vector_size (16)));typedef int e __attribute__ ((vector_size (16))), f;STATIC_ASSERT(sizeof(a)==16 && sizeof(b)==16);STATIC_ASSERT(sizeof(c)==sizeof(int) && sizeof(d)==16);STATIC_ASSERT(sizeof(e)==16 && sizeof(f)==sizeof(int));#endifint main(){}
开发者ID:AnnaTrost,项目名称:cbmc,代码行数:18,
示例22: __attribute__/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power6" } } *//* { dg-options "-O2 -mcpu=power6 -maltivec" } *//* { dg-final { scan-assembler-not "/[ /t/]and " } } *//* { dg-final { scan-assembler-not "/[ /t/]or " } } *//* { dg-final { scan-assembler-not "/[ /t/]xor " } } *//* { dg-final { scan-assembler-not "/[ /t/]nor " } } *//* { dg-final { scan-assembler-not "/[ /t/]andc " } } *//* { dg-final { scan-assembler-not "/[ /t/]eqv " } } *//* { dg-final { scan-assembler-not "/[ /t/]orc " } } *//* { dg-final { scan-assembler-not "/[ /t/]nand " } } *//* { dg-final { scan-assembler "/[ /t/]vand " } } *//* { dg-final { scan-assembler "/[ /t/]vandc " } } *//* { dg-final { scan-assembler "/[ /t/]vor " } } *//* { dg-final { scan-assembler "/[ /t/]vxor " } } *//* { dg-final { scan-assembler "/[ /t/]vnor " } } *//* { dg-final { scan-assembler-not "/[ /t/]xxland " } } *//* { dg-final { scan-assembler-not "/[ /t/]xxlor " } } *//* { dg-final { scan-assembler-not "/[ /t/]xxlxor " } } *//* { dg-final { scan-assembler-not "/[ /t/]xxlnor " } } *//* { dg-final { scan-assembler-not "/[ /t/]xxlandc " } } *//* { dg-final { scan-assembler-not "/[ /t/]xxleqv " } } *//* { dg-final { scan-assembler-not "/[ /t/]xxlorc " } } *//* { dg-final { scan-assembler-not "/[ /t/]xxlnand " } } */#ifndef TYPEtypedef int v4si __attribute__ ((vector_size (16)));#define TYPE v4si#endif#include "bool2.h"
开发者ID:MaxKellermann,项目名称:gcc,代码行数:30,
示例23: test15// <rdar://problem/8336581>void test15(const char *s) { __builtin_printf("string is %s/n", s);}// PR7885int test16() { return __builtin_constant_p() + // expected-error{{too few arguments}} __builtin_constant_p(1, 2); // expected-error {{too many arguments}}}const int test17_n = 0;const char test17_c[] = {1, 2, 3, 0};const char test17_d[] = {1, 2, 3, 4};typedef int __attribute__((vector_size(16))) IntVector;struct Aggregate { int n; char c; };enum Enum { EnumValue1, EnumValue2 };typedef __typeof(sizeof(int)) size_t;size_t strlen(const char *);void test17() {#define ASSERT(...) { int arr[(__VA_ARGS__) ? 1 : -1]; }#define T(...) ASSERT(__builtin_constant_p(__VA_ARGS__))#define F(...) ASSERT(!__builtin_constant_p(__VA_ARGS__)) // __builtin_constant_p returns 1 if the argument folds to: // - an arithmetic constant with value which is known at compile time T(test17_n); T(&test17_c[3] - test17_c);
开发者ID:Nanosim-LIG,项目名称:SPIR,代码行数:30,
示例24: __attribute__/* { dg-do assemble { target aarch64_asm_sve_ok } } *//* { dg-options "-O -msve-vector-bits=256 --save-temps" } */#include <stdint.h>typedef int8_t vnx16qi __attribute__((vector_size(32)));typedef int16_t vnx8hi __attribute__((vector_size(32)));typedef int32_t vnx4si __attribute__((vector_size(32)));typedef int64_t vnx2di __attribute__((vector_size(32)));typedef uint8_t v32qu __attribute__((vector_size(32)));typedef uint16_t v16hu __attribute__((vector_size(32)));typedef uint32_t v8su __attribute__((vector_size(32)));typedef uint64_t v4du __attribute__((vector_size(32)));#define DEF_VCOND_VAR(TYPE, COND, SUFFIX) /TYPE vcond_##TYPE##_##SUFFIX (TYPE x, TYPE y, TYPE a, TYPE b) /{ / TYPE r; / r = a COND b ? x : y; / return r; /}#define DEF_VCOND_IMM(TYPE, COND, IMM, SUFFIX) /TYPE vcond_imm_##TYPE##_##SUFFIX (TYPE x, TYPE y, TYPE a) /{ / TYPE r; / r = a COND IMM ? x : y; / return r; /}
开发者ID:MaxKellermann,项目名称:gcc,代码行数:30,
示例25: DAMAGES LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/#include "blis.h"#if PPAPI_RELEASE >= 36 typedef float v4sf __attribute__ ((vector_size(16))); inline v4sf v4sf_splat(float x) { return (v4sf) { x, x, x, x }; } inline v4sf v4sf_load(const float* a) { return *((const v4sf*)a); } inline v4sf v4sf_cload(const scomplex* a) { return *((const v4sf*)a); } inline void v4sf_store(float* a, v4sf x) { *((v4sf*)a) = x;
开发者ID:figual,项目名称:blis,代码行数:31,
示例26: __attribute__// RUN: %clang_cc1 %s -verify -fsyntax-only -Wvector-conversionstypedef unsigned int v2u __attribute__ ((vector_size (8)));typedef signed int v2s __attribute__ ((vector_size (8)));typedef signed int v1s __attribute__ ((vector_size (4)));typedef float v2f __attribute__ ((vector_size(8)));typedef signed short v4ss __attribute__ ((vector_size (8)));void test1() { v2s v1; v2u v2; v1s v3; v2f v4; v4ss v5; v1 = v2; // expected-warning {{incompatible vector types assigning to 'v2s' from 'v2u'}} v1 = v3; // expected-error {{assigning to 'v2s' from incompatible type 'v1s'}} v1 = v4; // expected-warning {{incompatible vector types assigning to 'v2s' from 'v2f'}} v1 = v5; // expected-warning {{incompatible vector types assigning to 'v2s' from 'v4ss'}} v2 = v1; // expected-warning {{incompatible vector types assigning to 'v2u' from 'v2s'}} v2 = v3; // expected-error {{assigning to 'v2u' from incompatible type 'v1s'}} v2 = v4; // expected-warning {{incompatible vector types assigning to 'v2u' from 'v2f'}} v2 = v5; // expected-warning {{incompatible vector types assigning to 'v2u' from 'v4ss'}} v3 = v1; // expected-error {{assigning to 'v1s' from incompatible type 'v2s'}} v3 = v2; // expected-error {{assigning to 'v1s' from incompatible type 'v2u'}} v3 = v4; // expected-error {{assigning to 'v1s' from incompatible type 'v2f'}} v3 = v5; // expected-error {{assigning to 'v1s' from incompatible type 'v4ss'}} v4 = v1; // expected-warning {{incompatible vector types assigning to 'v2f' from 'v2s'}} v4 = v2; // expected-warning {{incompatible vector types assigning to 'v2f' from 'v2u'}}
开发者ID:lgerbarg,项目名称:clang,代码行数:31,
示例27: voidtypedef int FooType;int *p;int *f(int *p, char *x, FooType z, int arr[5], void (*fn)(int)) { fn(*p); const FooType w = z; return p + z + arr[3];}typedef double OtherType;typedef int ArrayType[5];int __attribute__((vector_size(16))) x;typedef int __attribute__((vector_size(16))) int4_t;int f2(int incompletearray[]);// RUN: c-index-test -test-print-type %s | FileCheck %s// CHECK: FunctionDecl=f:3:6 (Definition) [type=int *(int *, char *, FooType, int *, void (*)(int))] [typekind=FunctionProto] [canonicaltype=int *(int *, char *, int, int *, void (*)(int))] [canonicaltypekind=FunctionProto] [resulttype=int *] [resulttypekind=Pointer] [args= [int *] [Pointer] [char *] [Pointer] [FooType] [Typedef] [int [5]] [ConstantArray] [void (*)(int)] [Pointer]] [isPOD=0]// CHECK: ParmDecl=p:3:13 (Definition) [type=int *] [typekind=Pointer] [isPOD=1]// CHECK: ParmDecl=x:3:22 (Definition) [type=char *] [typekind=Pointer] [isPOD=1]// CHECK: ParmDecl=z:3:33 (Definition) [type=FooType] [typekind=Typedef] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1]// CHECK: TypeRef=FooType:1:13 [type=FooType] [typekind=Typedef] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1]// CHECK: ParmDecl=arr:3:40 (Definition) [type=int [5]] [typekind=ConstantArray] [isPOD=1]// CHECK: IntegerLiteral= [type=int] [typekind=Int] [isPOD=1]// CHECK: ParmDecl=fn:3:55 (Definition) [type=void (*)(int)] [typekind=Pointer] [canonicaltype=void (*)(int)] [canonicaltypekind=Pointer] [isPOD=1]// CHECK: ParmDecl=:3:62 (Definition) [type=int] [typekind=Int] [isPOD=1]// CHECK: CompoundStmt= [type=] [typekind=Invalid] [isPOD=0]// CHECK: CallExpr=fn:3:55 [type=void] [typekind=Void] [args= [int] [Int]] [isPOD=0]// CHECK: DeclRefExpr=fn:3:55 [type=void (*)(int)] [typekind=Pointer] [canonicaltype=void (*)(int)] [canonicaltypekind=Pointer] [isPOD=1]// CHECK: UnaryOperator= [type=int] [typekind=Int] [isPOD=1]// CHECK: DeclRefExpr=p:3:13 [type=int *] [typekind=Pointer] [isPOD=1]// CHECK: DeclStmt= [type=] [typekind=Invalid] [isPOD=0]// CHECK: VarDecl=w:5:17 (Definition) [type=const FooType] [typekind=Typedef] const [canonicaltype=const int] [canonicaltypekind=Int] [isPOD=1]
开发者ID:Chxnew,项目名称:minix,代码行数:31,
示例28: __attribute__/* { dg-do compile } *//* { dg-require-effective-target vect_int } */typedef unsigned char uint8_t;typedef uint8_t footype __attribute__((vector_size(4)));void test(uint8_t *ptr, uint8_t *mask){ footype mv; __builtin_memcpy(&mv, mask, sizeof(mv)); for (unsigned i = 0; i < 16; i += 4) { footype temp; __builtin_memcpy(&temp, &ptr[i], sizeof(temp)); temp ^= mv; __builtin_memcpy(&ptr[i], &temp, sizeof(temp)); }}/* { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" { xfail sparc*-*-* } } } */
开发者ID:WojciechMigda,项目名称:gcc,代码行数:21,
示例29: animation_get_sprite_countint animation_get_sprite_count(animation *ani) { return vector_size(&ani->sprites);}
开发者ID:acasaccia,项目名称:openomf,代码行数:3,
示例30: _attribute_build_items_int _attribute_build_items_(container *X, container *A, query_array *qa, int default_filter, int group_filter_id, struct fte_data *getfiletypep, struct adf_data *attrdescrp){ if (X==NULL) return 0; int i, j; int total_hits = 0; for (i=0; i<vector_size(X); i++) { struct _attr_tree_ *item = vector_get(X, i).ptr; int filter = default_filter; // Container? Recalculate qa: if (item->container_id > 0) { // NB! Overlappende selecteds i forskjellige groups kan feile. //printf("Recalculating qa for container %i/n", item->container_id); filter = 0; for (j=0; j<vector_size(A); j++) { struct _attr_query_element_ *vquery = (struct _attr_query_element_*)vector_get(A,j).ptr; if (!(vquery->selected > 0 && vquery->selected != item->container_id)) { //printf(" qarg: %i/n", vquery->query_pos); qa->query[vquery->query_pos].hide = 1; filter|= (1<<vquery->filter_id); } //else if (vquery->selected == 0) filter|= (1<<vquery->filter_id); } } /* if (item->selected>=0) { filter|= (1<<item->selected); // Skulle bli samme om filtrert eller ikke? // m C++ vector_slot函数代码示例 C++ vector_set函数代码示例
|