1module Accelerator.SM86.NumericSemantics
2
3family SM86MultiFunction : Type 0
4-- SASS MUFU.COS: cosine of the source, radians.
5constructor SM86Cosine
6-- SASS MUFU.SIN: sine of the source, radians.
7constructor SM86Sine
8-- SASS MUFU.EX2: two raised to the source.
9constructor SM86ExponentialBase2
10-- SASS MUFU.LG2: the base-2 logarithm of the source.
11constructor SM86LogarithmBase2
12-- SASS MUFU.RCP: one divided by the source.
13constructor SM86Reciprocal
14-- SASS MUFU.RSQ: one divided by the square root of the source.
15constructor SM86ReciprocalSquareRoot
16-- SASS MUFU.SQRT: the square root of the source.
17constructor SM86SquareRoot
18-- SASS MUFU.TANH: the hyperbolic tangent of the source.
19constructor SM86HyperbolicTangent
20
21end-family
22
23family SM86FloatExtremum : Type 0
24-- SASS FMNMX with PT: the smaller of the two operands.
25constructor SM86FloatMinimum
26-- SASS FMNMX with !PT: the larger of the two operands.
27constructor SM86FloatMaximum
28
29end-family
30
31family SM86NumericOperation : Type 0
32constructor SM86NumericMultiFunction
33field unrestricted sm86NumericMultiFunction : (family SM86MultiFunction)
34constructor SM86NumericFloatExtremum
35field unrestricted sm86NumericFloatExtremum : (family SM86FloatExtremum)
36constructor SM86NumericFloatNegate
37
38end-family
39
40def sm86MultiFunctionOpcode =
41 (bytes 8 3)
42
43def sm86FloatExtremumOpcode =
44 (bytes 9 2)
45
46def sm86FloatNegateOpcode =
47 (bytes 33 2)
48
49def sm86MultiFunctionSelector =
50 (lambda unrestricted function : (family SM86MultiFunction) .
51 (eliminate
52 SM86MultiFunction
53 (lambda unrestricted value : (family SM86MultiFunction) . Byte)
54 function
55 (branch SM86Cosine . (byte 0))
56 (branch SM86Sine . (byte 4))
57 (branch SM86ExponentialBase2 . (byte 8))
58 (branch SM86LogarithmBase2 . (byte 12))
59 (branch SM86Reciprocal . (byte 16))
60 (branch SM86ReciprocalSquareRoot . (byte 20))
61 (branch SM86SquareRoot . (byte 32))
62 (branch SM86HyperbolicTangent . (byte 36))))
63
64def sm86FloatExtremumDescriptor =
65 (lambda unrestricted extremum : (family SM86FloatExtremum) .
66 (eliminate
67 SM86FloatExtremum
68 (lambda unrestricted value : (family SM86FloatExtremum) . Bytes)
69 extremum
70 (branch SM86FloatMinimum . (bytes 0 0 128 3))
71 (branch SM86FloatMaximum . (bytes 0 0 128 7))))
72
73def sm86NumericOperationOpcode =
74 (lambda unrestricted operation : (family SM86NumericOperation) .
75 (eliminate
76 SM86NumericOperation
77 (lambda unrestricted value : (family SM86NumericOperation) . Bytes)
78 operation
79 (branch SM86NumericMultiFunction function . sm86MultiFunctionOpcode)
80 (branch SM86NumericFloatExtremum extremum . sm86FloatExtremumOpcode)
81 (branch SM86NumericFloatNegate . sm86FloatNegateOpcode)))
82
83def sm86NumericOperationDescriptor =
84 (lambda unrestricted operation : (family SM86NumericOperation) .
85 (eliminate
86 SM86NumericOperation
87 (lambda unrestricted value : (family SM86NumericOperation) . Bytes)
88 operation
89 (branch
90 SM86NumericMultiFunction
91 function
92 .
93 (bytes-cons (sm86MultiFunctionSelector function) b""))
94 (branch SM86NumericFloatExtremum extremum . (sm86FloatExtremumDescriptor extremum))
95 (branch SM86NumericFloatNegate . (bytes 255 0 0 128 1))))The compiler supplied declaration spans and resolved links from this source snapshot. This page does not assert that this file belongs to a checked closure.