Class: BOAST::FMS
- Extended by:
- Functor
- Includes:
- Arithmetic, Inspectable, Intrinsics, PrivateStateAccessor
- Defined in:
- lib/BOAST/Language/Operators.rb
Constant Summary
Constants included from Intrinsics
Intrinsics::CONVERSIONS, Intrinsics::INTRINSICS
Constants inherited from Operator
Instance Attribute Summary collapse
-
#operand1 ⇒ Object
readonly
Returns the value of attribute operand1.
-
#operand2 ⇒ Object
readonly
Returns the value of attribute operand2.
-
#operand3 ⇒ Object
readonly
Returns the value of attribute operand3.
-
#return_type ⇒ Object
readonly
Returns the value of attribute return_type.
Instance Method Summary collapse
-
#initialize(a, b, c) ⇒ FMS
constructor
A new instance of FMS.
- #pr ⇒ Object
- #to_s ⇒ Object
- #to_var ⇒ Object
- #type ⇒ Object
Methods included from Functor
Methods included from PrivateStateAccessor
#address_size, #address_size=, #annotate, #annotate=, #annotate?, #annotate_indepth_list, #annotate_indepth_list=, #annotate_level, #annotate_level=, #annotate_list, #annotate_list=, #architecture, #architecture=, #array_start, #array_start=, #chain_code, #chain_code=, #chain_code?, #debug, #debug=, #debug?, #debug_source, #debug_source=, #debug_source?, #decl_module, #decl_module=, #decl_module?, #default_align, #default_align=, #default_int_signed, #default_int_signed=, #default_int_signed?, #default_int_size, #default_int_size=, #default_real_size, #default_real_size=, #disable_openmp, #disable_openmp=, #disable_openmp?, #ffi, #ffi=, #ffi?, #fortran_line_length, #fortran_line_length=, #get_address_size, #get_annotate, #get_annotate_indepth_list, #get_annotate_level, #get_annotate_list, #get_architecture, #get_array_start, #get_chain_code, #get_debug, #get_debug_source, #get_decl_module, #get_default_align, #get_default_int_signed, #get_default_int_size, #get_default_real_size, #get_disable_openmp, #get_ffi, #get_fortran_line_length, #get_indent_increment, #get_indent_level, #get_keep_temp, #get_lang, #get_model, #get_optimizer_log, #get_optimizer_log_file, #get_output, #get_replace_constants, #get_use_vla, #get_verbose, #indent_increment, #indent_increment=, #indent_level, #indent_level=, #keep_temp, #keep_temp=, #keep_temp?, #lang, #lang=, #model, #model=, #optimizer_log, #optimizer_log=, #optimizer_log?, #optimizer_log_file, #optimizer_log_file=, #output, #output=, #replace_constants, #replace_constants=, #replace_constants?, #set_address_size, #set_annotate, #set_annotate_indepth_list, #set_annotate_level, #set_annotate_list, #set_architecture, #set_array_start, #set_chain_code, #set_debug, #set_debug_source, #set_decl_module, #set_default_align, #set_default_int_signed, #set_default_int_size, #set_default_real_size, #set_disable_openmp, #set_ffi, #set_fortran_line_length, #set_indent_increment, #set_indent_level, #set_keep_temp, #set_lang, #set_model, #set_optimizer_log, #set_optimizer_log_file, #set_output, #set_replace_constants, #set_use_vla, #set_verbose, #use_vla, #use_vla=, #use_vla?, #verbose, #verbose=, #verbose?
Methods included from Inspectable
Methods included from Arithmetic
#!, #!=, #*, #**, #+, #+@, #-, #-@, #/, #<, #<=, #==, #===, #>, #>=, #and, #cast, #components, #dereference, #or, #reference
Methods included from Intrinsics
check_coverage, get_conversion_path, get_vector_decl, get_vector_decl_ARM, get_vector_decl_X86, get_vector_name, intrinsics, intrinsics_by_vector_name, type_name_ARM, type_name_X86, vector_type_name
Methods inherited from Operator
Constructor Details
#initialize(a, b, c) ⇒ FMS
707 708 709 710 711 712 713 |
# File 'lib/BOAST/Language/Operators.rb', line 707 def initialize(a,b,c) @operand1 = a @operand2 = b @operand3 = c @return_type = nil @return_type = @operand3.to_var unless @return_type end |
Instance Attribute Details
#operand1 ⇒ Object (readonly)
Returns the value of attribute operand1.
702 703 704 |
# File 'lib/BOAST/Language/Operators.rb', line 702 def operand1 @operand1 end |
#operand2 ⇒ Object (readonly)
Returns the value of attribute operand2.
703 704 705 |
# File 'lib/BOAST/Language/Operators.rb', line 703 def operand2 @operand2 end |
#operand3 ⇒ Object (readonly)
Returns the value of attribute operand3.
704 705 706 |
# File 'lib/BOAST/Language/Operators.rb', line 704 def operand3 @operand3 end |
#return_type ⇒ Object (readonly)
Returns the value of attribute return_type.
705 706 707 |
# File 'lib/BOAST/Language/Operators.rb', line 705 def return_type @return_type end |
Instance Method Details
#pr ⇒ Object
755 756 757 758 759 760 761 762 |
# File 'lib/BOAST/Language/Operators.rb', line 755 def pr s="" s += indent s += to_s s += ";" if [C, CL, CUDA].include?( lang ) output.puts s return self end |
#to_s ⇒ Object
751 752 753 |
# File 'lib/BOAST/Language/Operators.rb', line 751 def to_s return to_var.to_s end |
#to_var ⇒ Object
725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 |
# File 'lib/BOAST/Language/Operators.rb', line 725 def to_var instruction = nil begin instruction = intrinsics(:FNMADD,@return_type.type) rescue end return (@operand3 - @operand1 * @operand2).to_var unless lang != FORTRAN and @return_type and ( instruction or ( [CL, CUDA].include?(lang) ) ) op1 = convert_operand(@operand1.to_var) op2 = convert_operand(@operand2.to_var) op3 = convert_operand(@operand3.to_var) if [CL, CUDA].include?(lang) op1 = convert_operand((-@operand1).to_var) ret_name = "fma( #{op1}, #{op2}, #{op3} )" else case architecture when X86 ret_name = "#{instruction}( #{op1}, #{op2}, #{op3} )" when ARM ret_name = "#{instruction}( #{op3}, #{op1}, #{op2} )" else return (@operand3 - @operand1 * @operand2).to_var end end return @return_type.copy( ret_name, DISCARD_OPTIONS) end |
#type ⇒ Object
721 722 723 |
# File 'lib/BOAST/Language/Operators.rb', line 721 def type return @return_type.type end |