@@ -475,6 +475,7 @@ function add_compute!(
475
475
return add_anon_func! (ls, var, fexpr, ex, position, mpref, elementbytes)
476
476
# instr = instruction(first(ex.args))::Symbol
477
477
instr = instruction! (ls, first (ex. args)):: Instruction
478
+
478
479
args = @view (ex. args[2 : end ])
479
480
if (instr. instr === :pow_fast || instr. instr === :(^ )) && length (args) == 2
480
481
arg1 = args[1 ]
@@ -495,6 +496,8 @@ function add_compute!(
495
496
arg2num = Int (static (ex. args[3 ])):: Int
496
497
return add_pow! (ls, var, args[1 ], arg2num, elementbytes, position)
497
498
end
499
+ elseif instr. instr === :oftype && length (args) == 2
500
+ return get_arg! (ls, args[2 ], elementbytes, position)
498
501
end
499
502
vparents = Operation[]
500
503
deps = Symbol[]
@@ -757,6 +760,34 @@ function add_compute_ifelse!(
757
760
)
758
761
pushop! (ls, op, LHS)
759
762
end
763
+ function get_arg! (
764
+ ls:: LoopSet ,
765
+ @nospecialize (x),
766
+ elementbytes:: Int ,
767
+ position:: Int
768
+ ):: Operation
769
+ if x isa Expr
770
+ add_operation! (
771
+ ls,
772
+ Symbol (" ###xpow###$(length (operations (ls))) ###" ),
773
+ x,
774
+ elementbytes,
775
+ position
776
+ ):: Operation
777
+ elseif x isa Symbol
778
+ if x ∈ ls. loopsymbols
779
+ add_loopvalue! (ls, x, elementbytes)
780
+ else
781
+ xo = get (ls. opdict, x, nothing )
782
+ xo === nothing && return add_constant! (ls, x, elementbytes):: Operation
783
+ return xo
784
+ end
785
+ elseif x isa Number
786
+ return add_constant! (ls, x^ p, elementbytes, var):: Operation
787
+ else
788
+ throw (" objects of type $x not supported as arg" )
789
+ end
790
+ end
760
791
761
792
# adds x ^ (p::Real)
762
793
function add_pow! (
0 commit comments