79 |
(BV.neq_rr, simpleOp(Op.NEQ(DstTy.realTy))), |
(BV.neq_rr, simpleOp(Op.NEQ(DstTy.realTy))), |
80 |
(BV.add_ii, simpleOp(Op.Add DstTy.IntTy)), |
(BV.add_ii, simpleOp(Op.Add DstTy.IntTy)), |
81 |
(BV.add_tt, tensorOp Op.Add), |
(BV.add_tt, tensorOp Op.Add), |
82 |
|
(BV.add_ff, fn (y, _, [f, g]) => assign(y, Op.AddField, [f, g])), |
83 |
(BV.sub_ii, simpleOp(Op.Sub DstTy.IntTy)), |
(BV.sub_ii, simpleOp(Op.Sub DstTy.IntTy)), |
84 |
(BV.sub_tt, tensorOp Op.Sub), |
(BV.sub_tt, tensorOp Op.Sub), |
85 |
|
(BV.sub_ff, fn (y, _, [f, g]) => assign(y, Op.SubField, [f, g])), |
86 |
(BV.mul_ii, simpleOp(Op.Mul DstTy.IntTy)), |
(BV.mul_ii, simpleOp(Op.Mul DstTy.IntTy)), |
87 |
(BV.mul_rr, simpleOp(Op.Mul(DstTy.realTy))), |
(BV.mul_rr, simpleOp(Op.Mul(DstTy.realTy))), |
88 |
(BV.mul_rt, tensorOp Op.Scale), |
(BV.mul_rt, tensorOp Op.Scale), |
89 |
(BV.mul_tr, fn (y, sv, [t, r]) => tensorOp Op.Scale (y, sv, [r, t])), |
(BV.mul_tr, fn (y, sv, [t, r]) => tensorOp Op.Scale (y, sv, [r, t])), |
90 |
|
(BV.mul_rf, fn (y, _, [s, f]) => assign(y, Op.ScaleField, [s, f])), |
91 |
|
(BV.mul_fr, fn (y, _, [f, s]) => assign(y, Op.ScaleField, [s, f])), |
92 |
(BV.div_ii, simpleOp(Op.Div DstTy.IntTy)), |
(BV.div_ii, simpleOp(Op.Div DstTy.IntTy)), |
93 |
(BV.div_rr, simpleOp(Op.Div DstTy.realTy)), |
(BV.div_rr, simpleOp(Op.Div DstTy.realTy)), |
94 |
(BV.div_tr, fn (y, [sv], [x, s]) => let |
(BV.div_tr, fn (y, [sv], [x, s]) => let |
95 |
val one = IL.Var.new("one", DstTy.realTy) |
val one = IL.Var.new("one", DstTy.realTy) |
96 |
val s' = IL.Var.new("s", DstTy.realTy) |
val s' = IL.Var.new("sInv", DstTy.realTy) |
97 |
in [ |
in [ |
98 |
(one, IL.LIT(Literal.Float(FloatLit.one))), |
(one, IL.LIT(Literal.Float(FloatLit.one))), |
99 |
(s', IL.OP(Op.Div DstTy.realTy, [one, s])), |
(s', IL.OP(Op.Div DstTy.realTy, [one, s])), |
100 |
(y, IL.OP(Op.Scale(shapeVarToTensor sv), [s', x])) |
(y, IL.OP(Op.Scale(shapeVarToTensor sv), [s', x])) |
101 |
] end), |
] end), |
102 |
|
(BV.div_fr, fn (y, _, [f, s]) => let |
103 |
|
val one = IL.Var.new("one", DstTy.realTy) |
104 |
|
val s' = IL.Var.new("sInv", DstTy.realTy) |
105 |
|
in [ |
106 |
|
(one, IL.LIT(Literal.Float(FloatLit.one))), |
107 |
|
(s', IL.OP(Op.Div DstTy.realTy, [one, s])), |
108 |
|
(y, IL.OP(Op.ScaleField, [s', f])) |
109 |
|
] end), |
110 |
(BV.exp_ri, simpleOp(Op.Power)), |
(BV.exp_ri, simpleOp(Op.Power)), |
111 |
(BV.exp_rr, basisFn ILBasis.pow), |
(BV.exp_rr, basisFn ILBasis.pow), |
112 |
(BV.neg_i, simpleOp(Op.Neg DstTy.IntTy)), |
(BV.neg_i, simpleOp(Op.Neg DstTy.IntTy)), |