Пример #1
0
bool casting_needs_reinterpr_or_pack(TL::Type& casted_type, TL::Type& cast_type) 
{
    if (casted_type.is_float())
    {
        if (cast_type.is_float())
            return false;
        else
            return true;
    }
    else if (casted_type.is_double())
    {
        if (cast_type.is_double())
            return false;
        else
            return true;
    }
    else if (casted_type.is_signed_int()
            || casted_type.is_unsigned_int())
    {
        if (cast_type.is_signed_int()
                || cast_type.is_unsigned_int())
            return false;
        else
            return true;
    }
    else if (casted_type.is_signed_short_int()
            || casted_type.is_unsigned_short_int())
    {
        if (cast_type.is_signed_short_int()
                || cast_type.is_unsigned_short_int())
            return false;
        else
            return true;
    }
    else if (casted_type.is_signed_char()
            || casted_type.is_unsigned_char()
            || casted_type.is_char())
    {
        if (cast_type.is_signed_char()
                || cast_type.is_unsigned_char()
                || cast_type.is_char())
            return false;
        else
            return true;
    }
    else
    {
        fatal_error("error: casting_needs_reinterpr_or_pack does not support this casting in HLT SIMD.\n");
    }
}
Пример #2
0
    void KNCModuleVisitor::visit(const Nodecl::VectorMinus& node) 
    { 
        TL::Type type = node.get_type().basic_type();

        // Intrinsic name
        file << "_mm512_sub";
        
        // Postfix
        if (type.is_float()) 
        { 
            file << "_ps"; 
        } 
        else if (type.is_double()) 
        { 
            file << "_pd"; 
        } 
        else if (type.is_signed_int() ||
            type.is_unsigned_int()) 
        { 
            file << "_epi32"; 
        } 
        else if (type.is_signed_short_int() ||
            type.is_unsigned_short_int()) 
        { 
            file << "_epi16"; 
        } 
        else if (type.is_char() || 
            type.is_signed_char() ||
            type.is_unsigned_char()) 
        { 
            file << "_epi8"; 
        } 
        else
        {
            running_error("KNC Codegen: Node %s at %s has an unsupported type.", 
                    ast_print_node_type(node.get_kind()),
                    node.get_locus_str().c_str());
        }      

        file << "("; 
        walk(node.get_lhs());
        file << ", ";
        walk(node.get_rhs());
        file << ")"; 
    }                                                 
Пример #3
0
        bool VectorizerVectorReduction::is_supported_reduction(bool is_builtin,
                const std::string& reduction_name,
                const TL::Type& reduction_type)
        {
            if(is_builtin)
            {
                if(_environment._device.compare("smp") == 0)
                {
                    if(reduction_name.compare("+") == 0)
                    {
                        if(reduction_type.is_signed_int())
                        {
                            return true;
                        }
                    }
                }
                else if(_environment._device.compare("knc") == 0)
                {
                    if((reduction_name.compare("+") == 0) ||
                            (reduction_name.compare("-") == 0))
                    {
                        if(reduction_type.is_signed_int())
                        {
                            return true;
                        }
                        else if(reduction_type.is_float())
                        {
                            return true;
                        }
                        else if (reduction_type.is_double())
                        {
                            return true;
                        }
                    }
                }
            }

            return false;
        }