Class: RLTK::CG::ConstantVector
- Defined in:
- lib/rltk/cg/value.rb
Overview
A constant vector value used for SIMD instructions.
Instance Attribute Summary
Attributes included from BindingClass
Instance Method Summary collapse
-
#extract_element(index) ⇒ ConstantExpr
Extracted element.
-
#initialize(size_or_values, &block) {|index| ... } ⇒ ConstantVector
constructor
Create a new constant vector value.
-
#insert_element(element, index) ⇒ ConstantExpr
New vector representation with inserted value.
-
#shuffle(other, mask) ⇒ ConstantVector
New vector formed by shuffling the two vectors together using the mask.
- #size ⇒ Object (also: #length)
Methods inherited from Constant
#addr_space_cast, #bitcast_to, #get_element_ptr, #get_element_ptr_in_bounds
Methods inherited from User
Methods inherited from Value
#==, #attributes, #bitcast, #constant?, #dump, #hash, #name, #name=, #null?, #print, #trunc, #trunc_or_bitcast, #type, #undefined?, #zextend, #zextend_or_bitcast
Methods included from BindingClass
Constructor Details
#initialize(size_or_values, &block) {|index| ... } ⇒ ConstantVector
Create a new constant vector value.
490 491 492 493 494 495 496 497 498 499 |
# File 'lib/rltk/cg/value.rb', line 490 def initialize(size_or_values, &block) @ptr = if size_or_values.is_a?(FFI::Pointer) size_or_values else vals_ptr = make_ptr_to_elements(size_or_values, &block) Bindings.const_vector(vals_ptr, vals_ptr.size / vals_ptr.type_size) end end |
Instance Method Details
#extract_element(index) ⇒ ConstantExpr
Returns Extracted element.
504 505 506 |
# File 'lib/rltk/cg/value.rb', line 504 def extract_element(index) ConstantExpr.new(Bindings.const_extract_element(@ptr, index)) end |
#insert_element(element, index) ⇒ ConstantExpr
Returns New vector representation with inserted value.
512 513 514 |
# File 'lib/rltk/cg/value.rb', line 512 def insert_element(element, index) ConstantExpr.new(Bindings.const_insert_element(@ptr, element, index)) end |
#shuffle(other, mask) ⇒ ConstantVector
Returns New vector formed by shuffling the two vectors together using the mask.
520 521 522 |
# File 'lib/rltk/cg/value.rb', line 520 def shuffle(other, mask) ConstantVector.new(Bindings.const_shuffle_vector(@ptr, other, mask)) end |
#size ⇒ Object Also known as: length
524 525 526 |
# File 'lib/rltk/cg/value.rb', line 524 def size self.type.size end |