Method: BOAST::Intrinsics.intrinsics_by_vector_name

Defined in:
lib/BOAST/Language/Intrinsics.rb

.intrinsics_by_vector_name(intr_symbol, type, type2 = nil) ⇒ Object

Raises:



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/BOAST/Language/Intrinsics.rb', line 66

def intrinsics_by_vector_name(intr_symbol, type, type2=nil)
  if type2 then
    instruction = INTRINSICS[get_architecture][intr_symbol][type][type2]
  else
    instruction = INTRINSICS[get_architecture][intr_symbol][type]
  end
  raise IntrinsicsError, "Unsupported operation #{intr_symbol} for #{type}#{type2 ? " and #{type2}" : ""} on #{get_architecture_name}!" unless instruction
  supported = false
  INSTRUCTIONS[get_architecture][instruction.to_s].each { |cpuid|
    if cpuid.kind_of?( Array ) then
      supported = true if (cpuid - MODELS[get_model.to_s]).empty?
    else
      supported = true if MODELS[get_model.to_s].include?( cpuid )
    end
  }
#      supported = (INSTRUCTIONS[instruction.to_s] & MODELS[get_model.to_s]).size > 0
  unless supported then
    required = ""
    INSTRUCTIONS[get_architecture][instruction.to_s].each { |cpuid|
      required << " or " if required != ""
      if cpuid.kind_of?( Array ) then
        required << "( #{cpuid.join(" and ")} )"
      else
        required << "#{cpuid}"
      end
    }
    raise IntrinsicsError, "Unsupported operation #{intr_symbol} for #{type}#{type2 ? " and #{type2}" : ""} on #{get_model}! (requires #{required})"
  end
  return instruction
end