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) ⇒ ConstExpr
Extracted element.
-
#initialize(size_or_values, &block) {|index| ... } ⇒ ConstantVector
constructor
Create a new constant vector value.
-
#insert_element(element, index) ⇒ ConstExpr
New vector representation with inserted value.
-
#shuffle(other, mask) ⇒ ConstantVector
New vector formed by shuffling the two vectors together using the mask.
Methods inherited from Constant
#bitcast_to, #get_element_ptr, #get_element_ptr_in_bounds
Methods included from AbstractClass
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.
488 489 490 491 492 493 494 495 496 497 |
# File 'lib/rltk/cg/value.rb', line 488 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) ⇒ ConstExpr
Returns Extracted element.
502 503 504 |
# File 'lib/rltk/cg/value.rb', line 502 def extract_element(index) ConstExpr.new(Bindings.const_extract_element(@ptr, index)) end |
#insert_element(element, index) ⇒ ConstExpr
Returns New vector representation with inserted value.
510 511 512 |
# File 'lib/rltk/cg/value.rb', line 510 def insert_element(element, index) ConstExpr.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.
518 519 520 |
# File 'lib/rltk/cg/value.rb', line 518 def shuffle(other, mask) ConstantVector.new(Bindings.const_shuffle_vector(@ptr, other, mask)) end |