4 math_dialect : $ => choice(
5 // operation ::= `math.absf` $operand (`fastmath` ``
7 // attr-dict `:` type($result)
8 // operation ::= `math.atan` $operand (`fastmath` ``
10 // attr-dict `:` type($result)
11 // operation ::= `math.cbrt` $operand (`fastmath` ``
13 // attr-dict `:` type($result)
14 // operation ::= `math.ceil` $operand (`fastmath` ``
16 // attr-dict `:` type($result)
17 // operation ::= `math.cos` $operand (`fastmath` ``
19 // attr-dict `:` type($result)
20 // operation ::= `math.erf` $operand (`fastmath` ``
22 // attr-dict `:` type($result)
23 // operation ::= `math.exp` $operand (`fastmath` ``
25 // attr-dict `:` type($result)
26 // operation ::= `math.exp2` $operand (`fastmath` ``
28 // attr-dict `:` type($result)
29 // operation ::= `math.expm1` $operand (`fastmath` ``
31 // attr-dict `:` type($result)
32 // operation ::= `math.floor` $operand (`fastmath` ``
34 // attr-dict `:` type($result)
35 // operation ::= `math.log` $operand (`fastmath` ``
37 // attr-dict `:` type($result)
38 // operation ::= `math.log10` $operand (`fastmath` ``
40 // attr-dict `:` type($result)
41 // operation ::= `math.log1p` $operand (`fastmath` ``
43 // attr-dict `:` type($result)
44 // operation ::= `math.log2` $operand (`fastmath` ``
46 // attr-dict `:` type($result)
47 // operation ::= `math.round` $operand (`fastmath` ``
49 // attr-dict `:` type($result)
50 // operation ::= `math.roundeven` $operand (`fastmath` ``
52 // attr-dict `:` type($result)
53 // operation ::= `math.rsqrt` $operand (`fastmath` ``
55 // attr-dict `:` type($result)
56 // operation ::= `math.sin` $operand (`fastmath` ``
58 // attr-dict `:` type($result)
59 // operation ::= `math.sqrt` $operand (`fastmath` ``
61 // attr-dict `:` type($result)
62 // operation ::= `math.tan` $operand (`fastmath` ``
64 // attr-dict `:` type($result)
65 // operation ::= `math.tanh` $operand (`fastmath` ``
67 // attr-dict `:` type($result)
68 // operation ::= `math.trunc` $operand (`fastmath` ``
70 // attr-dict `:` type($result)
71 seq(choice('math.absf', 'math.atan', 'math.cbrt',
72 'math.ceil', 'math.cos', 'math.erf', 'math.exp',
73 'math.exp2', 'math.expm1', 'math.floor',
74 'math.log', 'math.log10', 'math.log1p',
75 'math.log2', 'math.round', 'math.roundeven',
76 'math.rsqrt', 'math.sin', 'math.sqrt', 'math.tan',
77 'math.tanh', 'math.trunc'),
78 field('operand', $.value_use),
79 field('fastmath', optional($.fastmath_attr)),
80 field('attributes', optional($.attribute)),
81 field('return', $._type_annotation)),
83 // operation ::= `math.absi` $operand attr-dict `:`
84 // type($result) operation ::= `math.ctlz` $operand attr-dict
85 // `:` type($result) operation ::= `math.cttz` $operand
86 // attr-dict `:` type($result) operation ::= `math.ctpop`
87 // $operand attr-dict `:` type($result)
88 seq(choice('math.absi', 'math.ctlz', 'math.cttz',
90 field('operand', $.value_use),
91 field('attributes', optional($.attribute)),
92 field('return', $._type_annotation)),
94 // operation ::= `math.atan2` $lhs `,` $rhs (`fastmath` ``
96 // attr-dict `:` type($result)
97 // operation ::= `math.copysign` $lhs `,` $rhs (`fastmath` ``
99 // attr-dict `:` type($result)
100 // operation ::= `math.fpowi` $lhs `,` $rhs (`fastmath` ``
102 // attr-dict `:` type($lhs) `,` type($rhs)
103 // operation ::= `math.powf` $lhs `,` $rhs (`fastmath` ``
105 // attr-dict `:` type($result)
106 seq(choice('math.atan2', 'math.copysign', 'math.fpowi',
108 field('lhs', $.value_use), ',',
109 field('rhs', $.value_use),
110 field('fastmath', optional($.fastmath_attr)),
111 field('attributes', optional($.attribute)),
112 field('return', $._type_annotation)),
114 // operation ::= `math.ipowi` $lhs `,` $rhs attr-dict `:`
116 seq('math.ipowi', field('lhs', $.value_use), ',',
117 field('rhs', $.value_use),
118 field('attributes', optional($.attribute)),
119 field('return', $._type_annotation)),
121 // operation ::= `math.fma` $a `,` $b `,` $c (`fastmath` ``
123 // attr-dict `:` type($result)
124 seq('math.fma', field('a', $.value_use), ',',
125 field('b', $.value_use), ',', field('c', $.value_use),
126 field('fastmath', optional($.fastmath_attr)),
127 field('attributes', optional($.attribute)),
128 field('return', $._type_annotation)))