示例#1
0
        void NeonVectorBackend::visit(const Nodecl::VectorAdd& n)
        {
            walk(n.get_lhs());
            walk(n.get_rhs());

            TL::Type t = n.get_type();
            ERROR_CONDITION(!t.is_vector(), "Invalid type", 0);
            TL::Type element = t.vector_element();
            ERROR_CONDITION(!element.is_float(), "Not implemented: %s", print_declarator(element.get_internal_type()));

            TL::Symbol builtin_fun = TL::Scope::get_global_scope().get_symbol_from_name("vaddq_f32");
            ERROR_CONDITION(!builtin_fun.is_valid(), "Symbol not found", 0);

            n.replace(
                    Nodecl::FunctionCall::make(
                        builtin_fun.make_nodecl(/* set_ref_type */ true),
                        Nodecl::List::make(
                            n.get_lhs(),
                            n.get_rhs()),
                        /* alternate-name */ Nodecl::NodeclBase::null(),
                        /* function-form */ Nodecl::NodeclBase::null(),
                        n.get_type(),
                        n.get_locus()
                        )
                    );
        }
示例#2
0
        TL::Type get_array_of_vector(TL::Type t)
        {
            ERROR_CONDITION(!t.is_vector(), "Invalid type", 0);

            return t.vector_element().get_array_to(
                    const_value_to_nodecl(
                        const_value_get_signed_int(t.vector_num_elements())
                        ),
                    TL::Scope::get_global_scope());
        }