class BOAST::MaskLoad
Attributes
mask[R]
return_type[R]
source[R]
Public Class Methods
new(source, mask, return_type)
click to toggle source
# File lib/BOAST/Language/Operators.rb, line 637 def initialize(source, mask, return_type) @source = source @mask = mask @return_type = return_type.to_var end
Public Instance Methods
pr()
click to toggle source
# File lib/BOAST/Language/Operators.rb, line 678 def pr s="" s << indent s << to_s s << ";" if [C, CL, CUDA].include?( lang ) output.puts s return self end
to_s()
click to toggle source
# File lib/BOAST/Language/Operators.rb, line 674 def to_s return to_var.to_s end
to_var()
click to toggle source
# File lib/BOAST/Language/Operators.rb, line 654 def to_var raise OperatorError, "Cannot load unknown type!" unless @return_type type = @return_type.type raise LanguageError, "Unsupported language!" unless lang == C raise OperatorError, "Mask size is wrong: #{@mask.length} for #{type.vector_length}!" if @mask.length != type.vector_length return Load( @source, @return_type ).to_var unless @mask.include?(0) return Set( 0, @return_type ).to_var if @mask.uniq.size == 1 and @mask.uniq.first == 0 instruction = intrinsics(:MASKLOAD, type) s = "" src = "#{@source}" if src[0] != "*" then src = "&" + src else src = src[1..-1] end p_type = type.copy(:vector_length => 1) s << "#{instruction}( (#{p_type.decl} * ) #{src}, #{get_mask} )" return @return_type.copy( s, DISCARD_OPTIONS) end
type()
click to toggle source
# File lib/BOAST/Language/Operators.rb, line 650 def type return @return_type.type end
Private Instance Methods
get_mask()
click to toggle source
# File lib/BOAST/Language/Operators.rb, line 643 def get_mask type = @return_type.type return Set(@mask.collect { |m| ( m and m != 0 ) ? -1 : 0 }, Int("mask", :size => type.size, :vector_length => type.vector_length ) ) end