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_kernel_source, #debug_kernel_source=, #debug_kernel_source?, #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=, #default_type, #default_type=, #disable_openmp, #disable_openmp=, #disable_openmp?, #executable, #executable=, #executable?, #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_kernel_source, #get_debug_source, #get_decl_module, #get_default_align, #get_default_int_signed, #get_default_int_size, #get_default_real_size, #get_default_type, #get_disable_openmp, #get_executable, #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_synchro, #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_kernel_source, #set_debug_source, #set_decl_module, #set_default_align, #set_default_int_signed, #set_default_int_size, #set_default_real_size, #set_default_type, #set_disable_openmp, #set_executable, #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_synchro, #set_use_vla, #set_verbose, #synchro, #synchro=, #use_vla, #use_vla=, #use_vla?, #verbose, #verbose=, #verbose?
Methods included from Inspectable
Methods included from Arithmetic
#!, #!=, #*, #**, #+, #+@, #-, #-@, #/, #<, #<=, #==, #===, #>, #>=, #and, #cast, #coerce, #components, #dereference, #or, #reference
Methods included from Intrinsics
check_coverage, generate_conversions, 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
Returns a new instance of FMS.
902 903 904 905 906 907 |
# File 'lib/BOAST/Language/Operators.rb', line 902 def initialize(a,b,c) @operand1 = a @operand2 = b @operand3 = c @return_type = @operand3.to_var end |
Instance Attribute Details
#operand1 ⇒ Object (readonly)
Returns the value of attribute operand1.
897 898 899 |
# File 'lib/BOAST/Language/Operators.rb', line 897 def operand1 @operand1 end |
#operand2 ⇒ Object (readonly)
Returns the value of attribute operand2.
898 899 900 |
# File 'lib/BOAST/Language/Operators.rb', line 898 def operand2 @operand2 end |
#operand3 ⇒ Object (readonly)
Returns the value of attribute operand3.
899 900 901 |
# File 'lib/BOAST/Language/Operators.rb', line 899 def operand3 @operand3 end |
#return_type ⇒ Object (readonly)
Returns the value of attribute return_type.
900 901 902 |
# File 'lib/BOAST/Language/Operators.rb', line 900 def return_type @return_type end |
Instance Method Details
#pr ⇒ Object
949 950 951 952 953 954 955 956 |
# File 'lib/BOAST/Language/Operators.rb', line 949 def pr s="" s << indent s << to_s s << ";" if [C, CL, CUDA].include?( lang ) output.puts s return self end |
#to_s ⇒ Object
945 946 947 |
# File 'lib/BOAST/Language/Operators.rb', line 945 def to_s return to_var.to_s end |
#to_var ⇒ Object
919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 |
# File 'lib/BOAST/Language/Operators.rb', line 919 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
915 916 917 |
# File 'lib/BOAST/Language/Operators.rb', line 915 def type return @return_type.type end |