public void Visit(BinaryOp ins) { Vector4f a = ctx.ReadValue (ins.Source1); Vector4f b = ctx.ReadValue (ins.Source2); Vector4f res = new Vector4f (); switch (ins.Operation) { case BinOpKind.Add: res = a + b; break; case BinOpKind.Sub: res = a - b; break; case BinOpKind.Mul: res = a * b; break; case BinOpKind.Max: res = a.Max (b); break; case BinOpKind.Dp3: //res = dp3 res = a * b; res = res + res.Shuffle (ShuffleSel.XFromY) + res.Shuffle (ShuffleSel.XFromZ); res = res.Shuffle (ShuffleSel.ExpandX); break; case BinOpKind.Dp4: //res = dp4 res = a * b; res = res + res.Shuffle (ShuffleSel.XFromY | ShuffleSel.ZFromW); //[x + y, _, w + z, _ res = res + res.Shuffle (ShuffleSel.XFromZ); //[x + y + w + z, ??] res = res.Shuffle (ShuffleSel.ExpandX); break; case BinOpKind.Min: res = a.Min (b); break; case BinOpKind.Slt: res = a.CompareLessThan (b) & new Vector4f (1); break; case BinOpKind.Sge: /*SSE doesn't have >=, so we use < and invert the operands*/ res = b.CompareLessThan (a) & new Vector4f (1); break; default: throw new Exception ("Cant handle " + ins.Operation); } if (Tracing.Enabled) Console.WriteLine ("{0} {1} {2} => {3}/{4} == {5}", ins.Source1, ins.Operation, ins.Source2, a, b, res); ctx.StoreValue (ins.Dest, res); }
public void Visit(BinaryOp ins) { Vector4f a = ctx.ReadValue (ins.Source1); Vector4f b = ctx.ReadValue (ins.Source2); Vector4f res = new Vector4f (); switch (ins.Operation) { case BinOpKind.Add: res = a + b; break; case BinOpKind.Mul: res = a * b; break; } if (Tracing.Enabled) Console.WriteLine ("{0} {1} {2} => {3}/{4} == {5}", ins.Source1, ins.Operation, ins.Source2, a, b, res); ctx.StoreValue (ins.Dest, res); }
public void Visit(BinaryOp ins) { }
public void Visit(BinaryOp ins) { VisitSrcReg (ins.Source1); VisitSrcReg (ins.Source2); VisitDestReg (ins.Dest); }
public void Visit(BinaryOp ins) { ctx.LoadValue (ins.Source1); ctx.LoadValue (ins.Source2); ctx.EmitBinary (ins.Operation); ctx.StoreValue (ins.Dest); }