carray 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +2 -1
- data/CHANGELOG.md +325 -3
- data/{NEWS.md → CHANGELOG.v1.md} +1 -1
- data/README.md +32 -32
- data/carray.gemspec +12 -8
- data/ext/ca_axis_group.c +55 -19
- data/ext/ca_binop_dispatch.c +5 -6
- data/ext/ca_binop_dispatch.h +0 -7
- data/ext/ca_categorical_iterator.c +13 -13
- data/ext/ca_for_each_element.h +6 -8
- data/ext/ca_group_iter.c +1 -1
- data/ext/ca_kernel_iterator.c +69 -23
- data/ext/ca_kernel_iterator.h +3 -10
- data/ext/ca_obj_bincmp.c +57 -27
- data/ext/ca_obj_binop.c +86 -30
- data/ext/ca_obj_const_string.c +3 -1
- data/ext/ca_obj_face.c +80 -0
- data/ext/ca_obj_face.h +33 -1
- data/ext/ca_obj_fake.c +11 -0
- data/ext/ca_obj_fixlen_string.c +3 -1
- data/ext/ca_obj_grid.c +11 -3
- data/ext/ca_obj_meld.c +13 -8
- data/ext/ca_obj_moncmp.c +33 -14
- data/ext/ca_obj_monop.c +19 -7
- data/ext/ca_obj_object.c +99 -4
- data/ext/ca_obj_record.c +3 -1
- data/ext/ca_obj_refer.c +30 -6
- data/ext/ca_obj_roll.c +13 -5
- data/ext/ca_obj_select_axis.c +16 -6
- data/ext/ca_obj_shift.c +3 -3
- data/ext/ca_obj_stride.c +106 -23
- data/ext/ca_obj_string.c +3 -1
- data/ext/ca_obj_tile.c +13 -5
- data/ext/ca_obj_time.c +3 -1
- data/ext/ca_obj_timedelta.c +3 -1
- data/ext/ca_obj_transpose.c +1 -1
- data/ext/ca_obj_triop.c +62 -23
- data/ext/ca_obj_window.c +86 -17
- data/ext/ca_op_cmplx64.h +123 -0
- data/ext/ca_op_ipower.c +0 -3
- data/ext/ca_sort_kernels.h +5 -5
- data/ext/ca_sweep_engine.c +78 -35
- data/ext/ca_sweep_engine.h +13 -4
- data/ext/ca_transform_common.c +7 -0
- data/ext/carray.h +127 -130
- data/ext/carray_access.c +56 -34
- data/ext/carray_bincount.c +8 -8
- data/ext/carray_broadcast.c +99 -6
- data/ext/carray_build_flags.h +3 -0
- data/ext/carray_call_cfunc.c +1491 -0
- data/ext/carray_call_cfunc.h +153 -0
- data/ext/carray_cast.c +69 -31
- data/ext/carray_conversion.c +22 -22
- data/ext/carray_copy.c +12 -2
- data/ext/carray_core.c +57 -10
- data/ext/carray_count.c +1 -1
- data/ext/carray_element.c +7 -7
- data/ext/carray_factorize.c +28 -28
- data/ext/carray_hold.c +1 -1
- data/ext/carray_index_classifier.c +7 -21
- data/ext/carray_internal.h +19 -3
- data/ext/carray_kernels_bincmp.c +1 -0
- data/ext/carray_kernels_binop.c +320 -298
- data/ext/carray_kernels_init.c +1095 -0
- data/ext/carray_kernels_map.c +1 -0
- data/ext/carray_kernels_moncmp.c +1 -0
- data/ext/carray_kernels_monop.c +412 -411
- data/ext/carray_kernels_reduce_aggregate.c +88 -87
- data/ext/carray_kernels_reduce_boolean.c +1 -0
- data/ext/carray_kernels_reduce_cumulative.c +54 -53
- data/ext/carray_kernels_reduce_extreme.c +51 -50
- data/ext/carray_kernels_reduce_variance.c +1 -0
- data/ext/carray_kernels_scan.c +1 -0
- data/ext/carray_kernels_search.c +93 -92
- data/ext/carray_kernels_sort.c +1 -0
- data/ext/carray_kernels_triop.c +1 -0
- data/ext/carray_lazy.c +175 -5
- data/ext/carray_mask.c +6 -5
- data/ext/carray_median_percentile.c +1 -1
- data/ext/carray_memory_view.c +46 -21
- data/ext/carray_operator.c +46 -49
- data/ext/carray_partition.c +4 -4
- data/ext/carray_random.c +7 -7
- data/ext/carray_scatter.c +1 -1
- data/ext/carray_sort.c +3 -3
- data/ext/carray_sort_kernel.c +10 -10
- data/ext/carray_test.c +1 -1
- data/ext/extconf.rb +18 -0
- data/ext/mk_call_cfunc.rb +243 -52
- data/ext/mkkernel.rb +354 -100
- data/ext/ruby_carray.c +18 -16
- data/ext/version.h +4 -4
- data/lib/carray/autoload_carray.rb +19 -0
- data/lib/carray/autoload_method_extension.rb +2 -1
- data/lib/carray/axis_group.rb +7 -7
- data/lib/carray/basics.rb +59 -59
- data/lib/carray/bincount_nd.rb +12 -12
- data/lib/carray/block_iterator.rb +24 -14
- data/lib/carray/categorical.rb +4 -4
- data/lib/carray/categorical_iterator.rb +98 -76
- data/lib/carray/conditional.rb +14 -14
- data/lib/carray/construct.rb +21 -0
- data/lib/carray/core_extensions.rb +62 -5
- data/lib/carray/data_type_extension.rb +18 -1
- data/lib/carray/frame/concat.rb +3 -3
- data/lib/carray/frame/convert.rb +1 -1
- data/lib/carray/frame/frame.rb +4 -11
- data/lib/carray/frame/io.rb +159 -2
- data/lib/carray/frame/sort.rb +1 -1
- data/lib/carray/frame/verbs.rb +18 -1
- data/lib/carray/fuse_source.rb +123 -0
- data/lib/carray/fusion.rb +218 -0
- data/lib/carray/histogram.rb +16 -16
- data/lib/carray/inspect.rb +1 -7
- data/lib/carray/iterator.rb +4 -3
- data/lib/carray/lazy.rb +125 -73
- data/lib/carray/meld_reduce.rb +2 -2
- data/lib/carray/methods/align_addr.rb +1 -1
- data/lib/carray/methods/composition.rb +1 -1
- data/lib/carray/methods/is_in.rb +12 -12
- data/lib/carray/methods/locate_addr.rb +6 -1
- data/lib/carray/methods/mask_duplicates.rb +1 -1
- data/lib/carray/methods/meshgrid.rb +4 -5
- data/lib/carray/methods/mode.rb +2 -2
- data/lib/carray/methods/nunique.rb +1 -1
- data/lib/carray/methods/snap.rb +7 -2
- data/lib/carray/methods/unique.rb +3 -3
- data/lib/carray/methods/value_counts.rb +2 -2
- data/lib/carray/runtime.rb +0 -19
- data/lib/carray/slab_iterator.rb +20 -7
- data/lib/carray/string_operation_extension.rb +5 -5
- data/lib/carray/time.rb +890 -491
- data/lib/carray/window_iterator.rb +285 -13
- data/lib/carray.rb +5 -5
- data/yard-stubs/ca_obj_array.rb +385 -0
- data/yard-stubs/ca_obj_bitarray.rb +38 -0
- data/yard-stubs/ca_obj_bitfield.rb +43 -0
- data/yard-stubs/ca_obj_block.rb +73 -0
- data/yard-stubs/ca_obj_byte_swap.rb +56 -0
- data/yard-stubs/ca_obj_fake.rb +31 -0
- data/yard-stubs/ca_obj_farray.rb +32 -0
- data/yard-stubs/ca_obj_field.rb +45 -0
- data/yard-stubs/ca_obj_grid.rb +35 -0
- data/yard-stubs/ca_obj_refer.rb +72 -0
- data/yard-stubs/ca_obj_roll.rb +45 -0
- data/yard-stubs/ca_obj_shift.rb +43 -0
- data/yard-stubs/ca_obj_stride.rb +181 -0
- data/yard-stubs/ca_obj_tile.rb +29 -0
- data/yard-stubs/ca_obj_transpose.rb +40 -0
- data/yard-stubs/ca_obj_window.rb +49 -0
- data/yard-stubs/carray_access.rb +131 -0
- data/yard-stubs/carray_attribute.rb +246 -0
- data/yard-stubs/carray_broadcast.rb +37 -0
- data/yard-stubs/carray_cast.rb +489 -0
- data/yard-stubs/carray_class.rb +65 -0
- data/yard-stubs/carray_conversion.rb +76 -0
- data/yard-stubs/carray_copy.rb +79 -0
- data/yard-stubs/carray_core.rb +114 -0
- data/yard-stubs/carray_count.rb +79 -0
- data/yard-stubs/carray_element.rb +108 -0
- data/yard-stubs/carray_generate.rb +66 -0
- data/yard-stubs/carray_lazy.rb +23 -0
- data/yard-stubs/carray_loop.rb +140 -0
- data/yard-stubs/carray_mask.rb +259 -0
- data/yard-stubs/carray_math.rb +132 -0
- data/yard-stubs/carray_mathfunc.rb +45 -0
- data/yard-stubs/carray_median_percentile.rb +89 -0
- data/yard-stubs/carray_memory_view.rb +163 -0
- data/yard-stubs/carray_order.rb +312 -0
- data/yard-stubs/carray_random.rb +89 -0
- data/yard-stubs/carray_scatter.rb +106 -0
- data/yard-stubs/carray_slab.rb +57 -0
- data/yard-stubs/carray_sort.rb +163 -0
- data/yard-stubs/carray_test.rb +85 -0
- data/yard-stubs/carray_undef.rb +64 -0
- data/yard-stubs/carray_utils.rb +97 -0
- data/yard-stubs/ruby_carray.rb +193 -0
- metadata +59 -10
- data/ext/ca_obj_unbound_repeat.c +0 -496
data/ext/carray_kernels_init.c
CHANGED
|
@@ -16,6 +16,1099 @@ void Init_carray_kernels_triop (void);
|
|
|
16
16
|
void Init_carray_kernels_moncmp (void);
|
|
17
17
|
void Init_carray_kernels_bincmp (void);
|
|
18
18
|
|
|
19
|
+
|
|
20
|
+
/* The text of every kernel body, for a caller that compiles the same
|
|
21
|
+
operation elsewhere. Placeholders are left in place. */
|
|
22
|
+
|
|
23
|
+
typedef struct {
|
|
24
|
+
const char *kind;
|
|
25
|
+
const char *name;
|
|
26
|
+
const char *data_type;
|
|
27
|
+
const char *body;
|
|
28
|
+
} ca_kernel_body_t;
|
|
29
|
+
|
|
30
|
+
static const ca_kernel_body_t ca_kernel_bodies[] = {
|
|
31
|
+
{ "monop", "zero", "int8",
|
|
32
|
+
"(#2) = 0;" },
|
|
33
|
+
{ "monop", "zero", "uint8",
|
|
34
|
+
"(#2) = 0;" },
|
|
35
|
+
{ "monop", "zero", "int16",
|
|
36
|
+
"(#2) = 0;" },
|
|
37
|
+
{ "monop", "zero", "uint16",
|
|
38
|
+
"(#2) = 0;" },
|
|
39
|
+
{ "monop", "zero", "int32",
|
|
40
|
+
"(#2) = 0;" },
|
|
41
|
+
{ "monop", "zero", "uint32",
|
|
42
|
+
"(#2) = 0;" },
|
|
43
|
+
{ "monop", "zero", "int64",
|
|
44
|
+
"(#2) = 0;" },
|
|
45
|
+
{ "monop", "zero", "uint64",
|
|
46
|
+
"(#2) = 0;" },
|
|
47
|
+
{ "monop", "zero", "float32",
|
|
48
|
+
"(#2) = 0;" },
|
|
49
|
+
{ "monop", "zero", "float64",
|
|
50
|
+
"(#2) = 0;" },
|
|
51
|
+
{ "monop", "zero", "boolean",
|
|
52
|
+
"(#2) = 0;" },
|
|
53
|
+
{ "monop", "zero", "cmplx64",
|
|
54
|
+
"(#2) = 0.0;" },
|
|
55
|
+
{ "monop", "zero", "cmplx128",
|
|
56
|
+
"(#2) = 0.0;" },
|
|
57
|
+
{ "monop", "one", "int8",
|
|
58
|
+
"(#2) = 1;" },
|
|
59
|
+
{ "monop", "one", "uint8",
|
|
60
|
+
"(#2) = 1;" },
|
|
61
|
+
{ "monop", "one", "int16",
|
|
62
|
+
"(#2) = 1;" },
|
|
63
|
+
{ "monop", "one", "uint16",
|
|
64
|
+
"(#2) = 1;" },
|
|
65
|
+
{ "monop", "one", "int32",
|
|
66
|
+
"(#2) = 1;" },
|
|
67
|
+
{ "monop", "one", "uint32",
|
|
68
|
+
"(#2) = 1;" },
|
|
69
|
+
{ "monop", "one", "int64",
|
|
70
|
+
"(#2) = 1;" },
|
|
71
|
+
{ "monop", "one", "uint64",
|
|
72
|
+
"(#2) = 1;" },
|
|
73
|
+
{ "monop", "one", "float32",
|
|
74
|
+
"(#2) = 1;" },
|
|
75
|
+
{ "monop", "one", "float64",
|
|
76
|
+
"(#2) = 1;" },
|
|
77
|
+
{ "monop", "one", "boolean",
|
|
78
|
+
"(#2) = 1;" },
|
|
79
|
+
{ "monop", "one", "cmplx64",
|
|
80
|
+
"(#2) = 1.0;" },
|
|
81
|
+
{ "monop", "one", "cmplx128",
|
|
82
|
+
"(#2) = 1.0;" },
|
|
83
|
+
{ "monop", "frac", "int8",
|
|
84
|
+
"(#2) = 0;" },
|
|
85
|
+
{ "monop", "frac", "uint8",
|
|
86
|
+
"(#2) = 0;" },
|
|
87
|
+
{ "monop", "frac", "int16",
|
|
88
|
+
"(#2) = 0;" },
|
|
89
|
+
{ "monop", "frac", "uint16",
|
|
90
|
+
"(#2) = 0;" },
|
|
91
|
+
{ "monop", "frac", "int32",
|
|
92
|
+
"(#2) = 0;" },
|
|
93
|
+
{ "monop", "frac", "uint32",
|
|
94
|
+
"(#2) = 0;" },
|
|
95
|
+
{ "monop", "frac", "int64",
|
|
96
|
+
"(#2) = 0;" },
|
|
97
|
+
{ "monop", "frac", "uint64",
|
|
98
|
+
"(#2) = 0;" },
|
|
99
|
+
{ "monop", "frac", "float32",
|
|
100
|
+
"(#2) = ((#1)>0.0) ? (#1)-floor(#1) : ((#1)<0.0) ? (#1)-ceil(#1) : (#1);" },
|
|
101
|
+
{ "monop", "frac", "float64",
|
|
102
|
+
"(#2) = ((#1)>0.0) ? (#1)-floor(#1) : ((#1)<0.0) ? (#1)-ceil(#1) : (#1);" },
|
|
103
|
+
{ "monop", "neg", "int8",
|
|
104
|
+
"(#2) = -(#1);" },
|
|
105
|
+
{ "monop", "neg", "uint8",
|
|
106
|
+
"(#2) = -(#1);" },
|
|
107
|
+
{ "monop", "neg", "int16",
|
|
108
|
+
"(#2) = -(#1);" },
|
|
109
|
+
{ "monop", "neg", "uint16",
|
|
110
|
+
"(#2) = -(#1);" },
|
|
111
|
+
{ "monop", "neg", "int32",
|
|
112
|
+
"(#2) = -(#1);" },
|
|
113
|
+
{ "monop", "neg", "uint32",
|
|
114
|
+
"(#2) = -(#1);" },
|
|
115
|
+
{ "monop", "neg", "int64",
|
|
116
|
+
"(#2) = -(#1);" },
|
|
117
|
+
{ "monop", "neg", "uint64",
|
|
118
|
+
"(#2) = -(#1);" },
|
|
119
|
+
{ "monop", "neg", "float32",
|
|
120
|
+
"(#2) = -(#1);" },
|
|
121
|
+
{ "monop", "neg", "float64",
|
|
122
|
+
"(#2) = -(#1);" },
|
|
123
|
+
{ "monop", "neg", "cmplx64",
|
|
124
|
+
"(#2) = -(#1);" },
|
|
125
|
+
{ "monop", "neg", "cmplx128",
|
|
126
|
+
"(#2) = -(#1);" },
|
|
127
|
+
{ "monop", "bit_neg", "int8",
|
|
128
|
+
"(#2) = ~(#1);" },
|
|
129
|
+
{ "monop", "bit_neg", "uint8",
|
|
130
|
+
"(#2) = ~(#1);" },
|
|
131
|
+
{ "monop", "bit_neg", "int16",
|
|
132
|
+
"(#2) = ~(#1);" },
|
|
133
|
+
{ "monop", "bit_neg", "uint16",
|
|
134
|
+
"(#2) = ~(#1);" },
|
|
135
|
+
{ "monop", "bit_neg", "int32",
|
|
136
|
+
"(#2) = ~(#1);" },
|
|
137
|
+
{ "monop", "bit_neg", "uint32",
|
|
138
|
+
"(#2) = ~(#1);" },
|
|
139
|
+
{ "monop", "bit_neg", "int64",
|
|
140
|
+
"(#2) = ~(#1);" },
|
|
141
|
+
{ "monop", "bit_neg", "uint64",
|
|
142
|
+
"(#2) = ~(#1);" },
|
|
143
|
+
{ "monop", "bit_neg", "boolean",
|
|
144
|
+
"(#2) = (#1) ? 0 : 1;" },
|
|
145
|
+
{ "monop", "abs_i", "int8",
|
|
146
|
+
"(#2) = abs(#1);" },
|
|
147
|
+
{ "monop", "abs_i", "uint8",
|
|
148
|
+
"(#2) = (#1);" },
|
|
149
|
+
{ "monop", "abs_i", "int16",
|
|
150
|
+
"(#2) = abs(#1);" },
|
|
151
|
+
{ "monop", "abs_i", "uint16",
|
|
152
|
+
"(#2) = (#1);" },
|
|
153
|
+
{ "monop", "abs_i", "int32",
|
|
154
|
+
"(#2) = abs(#1);" },
|
|
155
|
+
{ "monop", "abs_i", "uint32",
|
|
156
|
+
"(#2) = (#1);" },
|
|
157
|
+
{ "monop", "abs_i", "int64",
|
|
158
|
+
"(#2) = llabs(#1);" },
|
|
159
|
+
{ "monop", "abs_i", "uint64",
|
|
160
|
+
"(#2) = (#1);" },
|
|
161
|
+
{ "monop", "abs_i", "float32",
|
|
162
|
+
"(#2) = fabs((float64_t)#1);" },
|
|
163
|
+
{ "monop", "abs_i", "float64",
|
|
164
|
+
"(#2) = fabs((float64_t)#1);" },
|
|
165
|
+
{ "monop", "abs_i", "cmplx64",
|
|
166
|
+
"(#2) = cabsf(#1);" },
|
|
167
|
+
{ "monop", "abs_i", "cmplx128",
|
|
168
|
+
"(#2) = cabs(#1);" },
|
|
169
|
+
{ "monop", "abs", "int8",
|
|
170
|
+
"(#2) = abs(#1);" },
|
|
171
|
+
{ "monop", "abs", "uint8",
|
|
172
|
+
"(#2) = (#1);" },
|
|
173
|
+
{ "monop", "abs", "int16",
|
|
174
|
+
"(#2) = abs(#1);" },
|
|
175
|
+
{ "monop", "abs", "uint16",
|
|
176
|
+
"(#2) = (#1);" },
|
|
177
|
+
{ "monop", "abs", "int32",
|
|
178
|
+
"(#2) = abs(#1);" },
|
|
179
|
+
{ "monop", "abs", "uint32",
|
|
180
|
+
"(#2) = (#1);" },
|
|
181
|
+
{ "monop", "abs", "int64",
|
|
182
|
+
"(#2) = llabs(#1);" },
|
|
183
|
+
{ "monop", "abs", "uint64",
|
|
184
|
+
"(#2) = (#1);" },
|
|
185
|
+
{ "monop", "abs", "float32",
|
|
186
|
+
"(#2) = fabs(#1);" },
|
|
187
|
+
{ "monop", "abs", "float64",
|
|
188
|
+
"(#2) = fabs(#1);" },
|
|
189
|
+
{ "monop", "abs", "cmplx64",
|
|
190
|
+
"(#2) = cabsf(#1);" },
|
|
191
|
+
{ "monop", "abs", "cmplx128",
|
|
192
|
+
"(#2) = cabs(#1);" },
|
|
193
|
+
{ "monop", "abs2", "int8",
|
|
194
|
+
"(#2) = (#1) * (#1);" },
|
|
195
|
+
{ "monop", "abs2", "uint8",
|
|
196
|
+
"(#2) = (#1) * (#1);" },
|
|
197
|
+
{ "monop", "abs2", "int16",
|
|
198
|
+
"(#2) = (#1) * (#1);" },
|
|
199
|
+
{ "monop", "abs2", "uint16",
|
|
200
|
+
"(#2) = (#1) * (#1);" },
|
|
201
|
+
{ "monop", "abs2", "int32",
|
|
202
|
+
"(#2) = (#1) * (#1);" },
|
|
203
|
+
{ "monop", "abs2", "uint32",
|
|
204
|
+
"(#2) = (#1) * (#1);" },
|
|
205
|
+
{ "monop", "abs2", "int64",
|
|
206
|
+
"(#2) = (#1) * (#1);" },
|
|
207
|
+
{ "monop", "abs2", "uint64",
|
|
208
|
+
"(#2) = (#1) * (#1);" },
|
|
209
|
+
{ "monop", "abs2", "float32",
|
|
210
|
+
"(#2) = (#1) * (#1);" },
|
|
211
|
+
{ "monop", "abs2", "float64",
|
|
212
|
+
"(#2) = (#1) * (#1);" },
|
|
213
|
+
{ "monop", "abs2", "cmplx64",
|
|
214
|
+
"{ float _r = crealf(#1); float _i = cimagf(#1); (#2) = _r * _r + _i * _i; }" },
|
|
215
|
+
{ "monop", "abs2", "cmplx128",
|
|
216
|
+
"{ double _r = creal(#1); double _i = cimag(#1); (#2) = _r * _r + _i * _i; }" },
|
|
217
|
+
{ "monop", "conj", "int8",
|
|
218
|
+
"(#2) = (#1);" },
|
|
219
|
+
{ "monop", "conj", "uint8",
|
|
220
|
+
"(#2) = (#1);" },
|
|
221
|
+
{ "monop", "conj", "int16",
|
|
222
|
+
"(#2) = (#1);" },
|
|
223
|
+
{ "monop", "conj", "uint16",
|
|
224
|
+
"(#2) = (#1);" },
|
|
225
|
+
{ "monop", "conj", "int32",
|
|
226
|
+
"(#2) = (#1);" },
|
|
227
|
+
{ "monop", "conj", "uint32",
|
|
228
|
+
"(#2) = (#1);" },
|
|
229
|
+
{ "monop", "conj", "int64",
|
|
230
|
+
"(#2) = (#1);" },
|
|
231
|
+
{ "monop", "conj", "uint64",
|
|
232
|
+
"(#2) = (#1);" },
|
|
233
|
+
{ "monop", "conj", "float32",
|
|
234
|
+
"(#2) = (#1);" },
|
|
235
|
+
{ "monop", "conj", "float64",
|
|
236
|
+
"(#2) = (#1);" },
|
|
237
|
+
{ "monop", "conj", "cmplx64",
|
|
238
|
+
"(#2) = conjf(#1);" },
|
|
239
|
+
{ "monop", "conj", "cmplx128",
|
|
240
|
+
"(#2) = conj(#1);" },
|
|
241
|
+
{ "monop", "sign", "int8",
|
|
242
|
+
"(#2) = ((#1) > 0) - ((#1) < 0);" },
|
|
243
|
+
{ "monop", "sign", "uint8",
|
|
244
|
+
"(#2) = ((#1) > 0) ? 1 : 0;" },
|
|
245
|
+
{ "monop", "sign", "int16",
|
|
246
|
+
"(#2) = ((#1) > 0) - ((#1) < 0);" },
|
|
247
|
+
{ "monop", "sign", "uint16",
|
|
248
|
+
"(#2) = ((#1) > 0) ? 1 : 0;" },
|
|
249
|
+
{ "monop", "sign", "int32",
|
|
250
|
+
"(#2) = ((#1) > 0) - ((#1) < 0);" },
|
|
251
|
+
{ "monop", "sign", "uint32",
|
|
252
|
+
"(#2) = ((#1) > 0) ? 1 : 0;" },
|
|
253
|
+
{ "monop", "sign", "int64",
|
|
254
|
+
"(#2) = ((#1) > 0) - ((#1) < 0);" },
|
|
255
|
+
{ "monop", "sign", "uint64",
|
|
256
|
+
"(#2) = ((#1) > 0) ? 1 : 0;" },
|
|
257
|
+
{ "monop", "sign", "float32",
|
|
258
|
+
"(#2) = isnan(#1) ? (#1) : (((#1) > 0) - ((#1) < 0));" },
|
|
259
|
+
{ "monop", "sign", "float64",
|
|
260
|
+
"(#2) = isnan(#1) ? (#1) : (((#1) > 0) - ((#1) < 0));" },
|
|
261
|
+
{ "monop", "sign", "boolean",
|
|
262
|
+
"(#2) = (#1) ? 1 : 0;" },
|
|
263
|
+
{ "monop", "sign", "cmplx64",
|
|
264
|
+
"{ float _m = cabsf(#1); (#2) = (_m == 0) ? 0 : ((#1) / _m); }" },
|
|
265
|
+
{ "monop", "sign", "cmplx128",
|
|
266
|
+
"{ double _m = cabs(#1); (#2) = (_m == 0) ? 0 : ((#1) / _m); }" },
|
|
267
|
+
{ "monop", "arg", "int8",
|
|
268
|
+
"(#2) = carg((cmplx128_t)(#1));" },
|
|
269
|
+
{ "monop", "arg", "uint8",
|
|
270
|
+
"(#2) = carg((cmplx128_t)(#1));" },
|
|
271
|
+
{ "monop", "arg", "int16",
|
|
272
|
+
"(#2) = carg((cmplx128_t)(#1));" },
|
|
273
|
+
{ "monop", "arg", "uint16",
|
|
274
|
+
"(#2) = carg((cmplx128_t)(#1));" },
|
|
275
|
+
{ "monop", "arg", "int32",
|
|
276
|
+
"(#2) = carg((cmplx128_t)(#1));" },
|
|
277
|
+
{ "monop", "arg", "uint32",
|
|
278
|
+
"(#2) = carg((cmplx128_t)(#1));" },
|
|
279
|
+
{ "monop", "arg", "int64",
|
|
280
|
+
"(#2) = carg((cmplx128_t)(#1));" },
|
|
281
|
+
{ "monop", "arg", "uint64",
|
|
282
|
+
"(#2) = carg((cmplx128_t)(#1));" },
|
|
283
|
+
{ "monop", "arg", "float32",
|
|
284
|
+
"(#2) = carg((cmplx128_t)(#1));" },
|
|
285
|
+
{ "monop", "arg", "float64",
|
|
286
|
+
"(#2) = carg((cmplx128_t)(#1));" },
|
|
287
|
+
{ "monop", "arg", "cmplx64",
|
|
288
|
+
"(#2) = cargf(#1);" },
|
|
289
|
+
{ "monop", "arg", "cmplx128",
|
|
290
|
+
"(#2) = carg(#1);" },
|
|
291
|
+
{ "monop", "imag_i", "int8",
|
|
292
|
+
"(#2) = 0;" },
|
|
293
|
+
{ "monop", "imag_i", "uint8",
|
|
294
|
+
"(#2) = 0;" },
|
|
295
|
+
{ "monop", "imag_i", "int16",
|
|
296
|
+
"(#2) = 0;" },
|
|
297
|
+
{ "monop", "imag_i", "uint16",
|
|
298
|
+
"(#2) = 0;" },
|
|
299
|
+
{ "monop", "imag_i", "int32",
|
|
300
|
+
"(#2) = 0;" },
|
|
301
|
+
{ "monop", "imag_i", "uint32",
|
|
302
|
+
"(#2) = 0;" },
|
|
303
|
+
{ "monop", "imag_i", "int64",
|
|
304
|
+
"(#2) = 0;" },
|
|
305
|
+
{ "monop", "imag_i", "uint64",
|
|
306
|
+
"(#2) = 0;" },
|
|
307
|
+
{ "monop", "imag_i", "float32",
|
|
308
|
+
"(#2) = 0;" },
|
|
309
|
+
{ "monop", "imag_i", "float64",
|
|
310
|
+
"(#2) = 0;" },
|
|
311
|
+
{ "monop", "imag_i", "cmplx64",
|
|
312
|
+
"(#2) = cimagf(#1);" },
|
|
313
|
+
{ "monop", "imag_i", "cmplx128",
|
|
314
|
+
"(#2) = cimag(#1);" },
|
|
315
|
+
{ "monop", "arg_i", "float32",
|
|
316
|
+
"(#2) = cargf((cmplx64_t)(#1));" },
|
|
317
|
+
{ "monop", "arg_i", "float64",
|
|
318
|
+
"(#2) = carg((cmplx128_t)(#1));" },
|
|
319
|
+
{ "monop", "arg_i", "cmplx64",
|
|
320
|
+
"(#2) = cargf(#1);" },
|
|
321
|
+
{ "monop", "arg_i", "cmplx128",
|
|
322
|
+
"(#2) = carg(#1);" },
|
|
323
|
+
{ "monop", "not", "boolean",
|
|
324
|
+
"(#2) = (#1) ? 0 : 1;" },
|
|
325
|
+
{ "monop", "rad", "float32",
|
|
326
|
+
"(#2) = (0.0174532925199433*(#1));" },
|
|
327
|
+
{ "monop", "rad", "float64",
|
|
328
|
+
"(#2) = (0.0174532925199433*(#1));" },
|
|
329
|
+
{ "monop", "deg", "float32",
|
|
330
|
+
"(#2) = (57.2957795130823*(#1));" },
|
|
331
|
+
{ "monop", "deg", "float64",
|
|
332
|
+
"(#2) = (57.2957795130823*(#1));" },
|
|
333
|
+
{ "monop", "ceil", "int8",
|
|
334
|
+
"(#2) = (#1);" },
|
|
335
|
+
{ "monop", "ceil", "uint8",
|
|
336
|
+
"(#2) = (#1);" },
|
|
337
|
+
{ "monop", "ceil", "int16",
|
|
338
|
+
"(#2) = (#1);" },
|
|
339
|
+
{ "monop", "ceil", "uint16",
|
|
340
|
+
"(#2) = (#1);" },
|
|
341
|
+
{ "monop", "ceil", "int32",
|
|
342
|
+
"(#2) = (#1);" },
|
|
343
|
+
{ "monop", "ceil", "uint32",
|
|
344
|
+
"(#2) = (#1);" },
|
|
345
|
+
{ "monop", "ceil", "int64",
|
|
346
|
+
"(#2) = (#1);" },
|
|
347
|
+
{ "monop", "ceil", "uint64",
|
|
348
|
+
"(#2) = (#1);" },
|
|
349
|
+
{ "monop", "ceil", "float32",
|
|
350
|
+
"(#2) = ceil(#1);" },
|
|
351
|
+
{ "monop", "ceil", "float64",
|
|
352
|
+
"(#2) = ceil(#1);" },
|
|
353
|
+
{ "monop", "floor", "int8",
|
|
354
|
+
"(#2) = (#1);" },
|
|
355
|
+
{ "monop", "floor", "uint8",
|
|
356
|
+
"(#2) = (#1);" },
|
|
357
|
+
{ "monop", "floor", "int16",
|
|
358
|
+
"(#2) = (#1);" },
|
|
359
|
+
{ "monop", "floor", "uint16",
|
|
360
|
+
"(#2) = (#1);" },
|
|
361
|
+
{ "monop", "floor", "int32",
|
|
362
|
+
"(#2) = (#1);" },
|
|
363
|
+
{ "monop", "floor", "uint32",
|
|
364
|
+
"(#2) = (#1);" },
|
|
365
|
+
{ "monop", "floor", "int64",
|
|
366
|
+
"(#2) = (#1);" },
|
|
367
|
+
{ "monop", "floor", "uint64",
|
|
368
|
+
"(#2) = (#1);" },
|
|
369
|
+
{ "monop", "floor", "float32",
|
|
370
|
+
"(#2) = floor(#1);" },
|
|
371
|
+
{ "monop", "floor", "float64",
|
|
372
|
+
"(#2) = floor(#1);" },
|
|
373
|
+
{ "monop", "round", "int8",
|
|
374
|
+
"(#2) = (#1);" },
|
|
375
|
+
{ "monop", "round", "uint8",
|
|
376
|
+
"(#2) = (#1);" },
|
|
377
|
+
{ "monop", "round", "int16",
|
|
378
|
+
"(#2) = (#1);" },
|
|
379
|
+
{ "monop", "round", "uint16",
|
|
380
|
+
"(#2) = (#1);" },
|
|
381
|
+
{ "monop", "round", "int32",
|
|
382
|
+
"(#2) = (#1);" },
|
|
383
|
+
{ "monop", "round", "uint32",
|
|
384
|
+
"(#2) = (#1);" },
|
|
385
|
+
{ "monop", "round", "int64",
|
|
386
|
+
"(#2) = (#1);" },
|
|
387
|
+
{ "monop", "round", "uint64",
|
|
388
|
+
"(#2) = (#1);" },
|
|
389
|
+
{ "monop", "round", "float32",
|
|
390
|
+
"(#2) = ((#1)>0.0) ? floor((#1)+0.5) : ((#1)<0.0) ? ceil((#1)-0.5) : (#1);" },
|
|
391
|
+
{ "monop", "round", "float64",
|
|
392
|
+
"(#2) = ((#1)>0.0) ? floor((#1)+0.5) : ((#1)<0.0) ? ceil((#1)-0.5) : (#1);" },
|
|
393
|
+
{ "monop", "rcp", "int8",
|
|
394
|
+
"if ((#1)==0) {ca_zerodiv();}; (#2) = 1/(#1);" },
|
|
395
|
+
{ "monop", "rcp", "uint8",
|
|
396
|
+
"if ((#1)==0) {ca_zerodiv();}; (#2) = 1/(#1);" },
|
|
397
|
+
{ "monop", "rcp", "int16",
|
|
398
|
+
"if ((#1)==0) {ca_zerodiv();}; (#2) = 1/(#1);" },
|
|
399
|
+
{ "monop", "rcp", "uint16",
|
|
400
|
+
"if ((#1)==0) {ca_zerodiv();}; (#2) = 1/(#1);" },
|
|
401
|
+
{ "monop", "rcp", "int32",
|
|
402
|
+
"if ((#1)==0) {ca_zerodiv();}; (#2) = 1/(#1);" },
|
|
403
|
+
{ "monop", "rcp", "uint32",
|
|
404
|
+
"if ((#1)==0) {ca_zerodiv();}; (#2) = 1/(#1);" },
|
|
405
|
+
{ "monop", "rcp", "int64",
|
|
406
|
+
"if ((#1)==0) {ca_zerodiv();}; (#2) = 1/(#1);" },
|
|
407
|
+
{ "monop", "rcp", "uint64",
|
|
408
|
+
"if ((#1)==0) {ca_zerodiv();}; (#2) = 1/(#1);" },
|
|
409
|
+
{ "monop", "rcp", "float32",
|
|
410
|
+
"(#2) = 1/(#1);" },
|
|
411
|
+
{ "monop", "rcp", "float64",
|
|
412
|
+
"(#2) = 1/(#1);" },
|
|
413
|
+
{ "monop", "rcp", "cmplx64",
|
|
414
|
+
"(#2) = op_crcp_cmplx64(#1);" },
|
|
415
|
+
{ "monop", "rcp", "cmplx128",
|
|
416
|
+
"(#2) = 1/(#1);" },
|
|
417
|
+
{ "monop", "sqrt", "float32",
|
|
418
|
+
"(#2) = sqrtf(#1);" },
|
|
419
|
+
{ "monop", "sqrt", "float64",
|
|
420
|
+
"(#2) = sqrt(#1);" },
|
|
421
|
+
{ "monop", "sqrt", "cmplx64",
|
|
422
|
+
"(#2) = csqrtf(#1);" },
|
|
423
|
+
{ "monop", "sqrt", "cmplx128",
|
|
424
|
+
"(#2) = csqrt(#1);" },
|
|
425
|
+
{ "monop", "exp", "float32",
|
|
426
|
+
"(#2) = expf(#1);" },
|
|
427
|
+
{ "monop", "exp", "float64",
|
|
428
|
+
"(#2) = exp(#1);" },
|
|
429
|
+
{ "monop", "exp", "cmplx64",
|
|
430
|
+
"(#2) = cexpf(#1);" },
|
|
431
|
+
{ "monop", "exp", "cmplx128",
|
|
432
|
+
"(#2) = cexp(#1);" },
|
|
433
|
+
{ "monop", "sin", "float32",
|
|
434
|
+
"(#2) = sinf(#1);" },
|
|
435
|
+
{ "monop", "sin", "float64",
|
|
436
|
+
"(#2) = sin(#1);" },
|
|
437
|
+
{ "monop", "sin", "cmplx64",
|
|
438
|
+
"(#2) = csinf(#1);" },
|
|
439
|
+
{ "monop", "sin", "cmplx128",
|
|
440
|
+
"(#2) = csin(#1);" },
|
|
441
|
+
{ "monop", "cos", "float32",
|
|
442
|
+
"(#2) = cosf(#1);" },
|
|
443
|
+
{ "monop", "cos", "float64",
|
|
444
|
+
"(#2) = cos(#1);" },
|
|
445
|
+
{ "monop", "cos", "cmplx64",
|
|
446
|
+
"(#2) = ccosf(#1);" },
|
|
447
|
+
{ "monop", "cos", "cmplx128",
|
|
448
|
+
"(#2) = ccos(#1);" },
|
|
449
|
+
{ "monop", "tan", "float32",
|
|
450
|
+
"(#2) = tanf(#1);" },
|
|
451
|
+
{ "monop", "tan", "float64",
|
|
452
|
+
"(#2) = tan(#1);" },
|
|
453
|
+
{ "monop", "tan", "cmplx64",
|
|
454
|
+
"(#2) = ctanf(#1);" },
|
|
455
|
+
{ "monop", "tan", "cmplx128",
|
|
456
|
+
"(#2) = ctan(#1);" },
|
|
457
|
+
{ "monop", "asin", "float32",
|
|
458
|
+
"(#2) = asinf(#1);" },
|
|
459
|
+
{ "monop", "asin", "float64",
|
|
460
|
+
"(#2) = asin(#1);" },
|
|
461
|
+
{ "monop", "asin", "cmplx64",
|
|
462
|
+
"(#2) = casinf(#1);" },
|
|
463
|
+
{ "monop", "asin", "cmplx128",
|
|
464
|
+
"(#2) = casin(#1);" },
|
|
465
|
+
{ "monop", "acos", "float32",
|
|
466
|
+
"(#2) = acosf(#1);" },
|
|
467
|
+
{ "monop", "acos", "float64",
|
|
468
|
+
"(#2) = acos(#1);" },
|
|
469
|
+
{ "monop", "acos", "cmplx64",
|
|
470
|
+
"(#2) = cacosf(#1);" },
|
|
471
|
+
{ "monop", "acos", "cmplx128",
|
|
472
|
+
"(#2) = cacos(#1);" },
|
|
473
|
+
{ "monop", "atan", "float32",
|
|
474
|
+
"(#2) = atanf(#1);" },
|
|
475
|
+
{ "monop", "atan", "float64",
|
|
476
|
+
"(#2) = atan(#1);" },
|
|
477
|
+
{ "monop", "atan", "cmplx64",
|
|
478
|
+
"(#2) = catanf(#1);" },
|
|
479
|
+
{ "monop", "atan", "cmplx128",
|
|
480
|
+
"(#2) = catan(#1);" },
|
|
481
|
+
{ "monop", "log", "float32",
|
|
482
|
+
"(#2) = logf(#1);" },
|
|
483
|
+
{ "monop", "log", "float64",
|
|
484
|
+
"(#2) = log(#1);" },
|
|
485
|
+
{ "monop", "log", "cmplx64",
|
|
486
|
+
"(#2) = clog(#1);" },
|
|
487
|
+
{ "monop", "log", "cmplx128",
|
|
488
|
+
"(#2) = clog(#1);" },
|
|
489
|
+
{ "monop", "exp2", "float32",
|
|
490
|
+
"(#2) = exp2f(#1);" },
|
|
491
|
+
{ "monop", "exp2", "float64",
|
|
492
|
+
"(#2) = exp2(#1);" },
|
|
493
|
+
{ "monop", "exp2", "cmplx64",
|
|
494
|
+
"(#2) = cpow(2, (#1));" },
|
|
495
|
+
{ "monop", "exp2", "cmplx128",
|
|
496
|
+
"(#2) = cpow(2, (#1));" },
|
|
497
|
+
{ "monop", "log10", "float32",
|
|
498
|
+
"(#2) = log10f(#1);" },
|
|
499
|
+
{ "monop", "log10", "float64",
|
|
500
|
+
"(#2) = log10(#1);" },
|
|
501
|
+
{ "monop", "log2", "float32",
|
|
502
|
+
"(#2) = log2f(#1);" },
|
|
503
|
+
{ "monop", "log2", "float64",
|
|
504
|
+
"(#2) = log2(#1);" },
|
|
505
|
+
{ "monop", "logb", "float32",
|
|
506
|
+
"(#2) = logbf(#1);" },
|
|
507
|
+
{ "monop", "logb", "float64",
|
|
508
|
+
"(#2) = logb(#1);" },
|
|
509
|
+
{ "monop", "exp10", "float32",
|
|
510
|
+
"(#2) = powf(10, (#1));" },
|
|
511
|
+
{ "monop", "exp10", "float64",
|
|
512
|
+
"(#2) = pow(10, (#1));" },
|
|
513
|
+
{ "monop", "exp10", "cmplx64",
|
|
514
|
+
"(#2) = cpow(10, (#1));" },
|
|
515
|
+
{ "monop", "exp10", "cmplx128",
|
|
516
|
+
"(#2) = cpow(10, (#1));" },
|
|
517
|
+
{ "monop", "sinh", "float32",
|
|
518
|
+
"(#2) = sinhf(#1);" },
|
|
519
|
+
{ "monop", "sinh", "float64",
|
|
520
|
+
"(#2) = sinh(#1);" },
|
|
521
|
+
{ "monop", "sinh", "cmplx64",
|
|
522
|
+
"(#2) = csinhf(#1);" },
|
|
523
|
+
{ "monop", "sinh", "cmplx128",
|
|
524
|
+
"(#2) = csinh(#1);" },
|
|
525
|
+
{ "monop", "cosh", "float32",
|
|
526
|
+
"(#2) = coshf(#1);" },
|
|
527
|
+
{ "monop", "cosh", "float64",
|
|
528
|
+
"(#2) = cosh(#1);" },
|
|
529
|
+
{ "monop", "cosh", "cmplx64",
|
|
530
|
+
"(#2) = ccoshf(#1);" },
|
|
531
|
+
{ "monop", "cosh", "cmplx128",
|
|
532
|
+
"(#2) = ccosh(#1);" },
|
|
533
|
+
{ "monop", "tanh", "float32",
|
|
534
|
+
"(#2) = tanhf(#1);" },
|
|
535
|
+
{ "monop", "tanh", "float64",
|
|
536
|
+
"(#2) = tanh(#1);" },
|
|
537
|
+
{ "monop", "tanh", "cmplx64",
|
|
538
|
+
"(#2) = ctanhf(#1);" },
|
|
539
|
+
{ "monop", "tanh", "cmplx128",
|
|
540
|
+
"(#2) = ctanh(#1);" },
|
|
541
|
+
{ "monop", "asinh", "float32",
|
|
542
|
+
"(#2) = asinhf(#1);" },
|
|
543
|
+
{ "monop", "asinh", "float64",
|
|
544
|
+
"(#2) = asinh(#1);" },
|
|
545
|
+
{ "monop", "asinh", "cmplx64",
|
|
546
|
+
"(#2) = casinhf(#1);" },
|
|
547
|
+
{ "monop", "asinh", "cmplx128",
|
|
548
|
+
"(#2) = casinh(#1);" },
|
|
549
|
+
{ "monop", "acosh", "float32",
|
|
550
|
+
"(#2) = acoshf(#1);" },
|
|
551
|
+
{ "monop", "acosh", "float64",
|
|
552
|
+
"(#2) = acosh(#1);" },
|
|
553
|
+
{ "monop", "acosh", "cmplx64",
|
|
554
|
+
"(#2) = cacoshf(#1);" },
|
|
555
|
+
{ "monop", "acosh", "cmplx128",
|
|
556
|
+
"(#2) = cacosh(#1);" },
|
|
557
|
+
{ "monop", "atanh", "float32",
|
|
558
|
+
"(#2) = atanhf(#1);" },
|
|
559
|
+
{ "monop", "atanh", "float64",
|
|
560
|
+
"(#2) = atanh(#1);" },
|
|
561
|
+
{ "monop", "atanh", "cmplx64",
|
|
562
|
+
"(#2) = catanhf(#1);" },
|
|
563
|
+
{ "monop", "atanh", "cmplx128",
|
|
564
|
+
"(#2) = catanh(#1);" },
|
|
565
|
+
{ "monop", "expm1", "float32",
|
|
566
|
+
"(#2) = expm1f(#1);" },
|
|
567
|
+
{ "monop", "expm1", "float64",
|
|
568
|
+
"(#2) = expm1(#1);" },
|
|
569
|
+
{ "monop", "log1p", "float32",
|
|
570
|
+
"(#2) = log1pf(#1);" },
|
|
571
|
+
{ "monop", "log1p", "float64",
|
|
572
|
+
"(#2) = log1p(#1);" },
|
|
573
|
+
{ "monop", "rsqrt", "float32",
|
|
574
|
+
"(#2) = ((float)1.0) / sqrtf(#1);" },
|
|
575
|
+
{ "monop", "rsqrt", "float64",
|
|
576
|
+
"(#2) = ((double)1.0) / sqrt(#1);" },
|
|
577
|
+
{ "monop", "rsqrt", "cmplx64",
|
|
578
|
+
"(#2) = ((float)1.0) / csqrtf(#1);" },
|
|
579
|
+
{ "monop", "rsqrt", "cmplx128",
|
|
580
|
+
"(#2) = ((double)1.0) / csqrt(#1);" },
|
|
581
|
+
{ "monop", "trunc", "int8",
|
|
582
|
+
"(#2) = (#1);" },
|
|
583
|
+
{ "monop", "trunc", "uint8",
|
|
584
|
+
"(#2) = (#1);" },
|
|
585
|
+
{ "monop", "trunc", "int16",
|
|
586
|
+
"(#2) = (#1);" },
|
|
587
|
+
{ "monop", "trunc", "uint16",
|
|
588
|
+
"(#2) = (#1);" },
|
|
589
|
+
{ "monop", "trunc", "int32",
|
|
590
|
+
"(#2) = (#1);" },
|
|
591
|
+
{ "monop", "trunc", "uint32",
|
|
592
|
+
"(#2) = (#1);" },
|
|
593
|
+
{ "monop", "trunc", "int64",
|
|
594
|
+
"(#2) = (#1);" },
|
|
595
|
+
{ "monop", "trunc", "uint64",
|
|
596
|
+
"(#2) = (#1);" },
|
|
597
|
+
{ "monop", "trunc", "float32",
|
|
598
|
+
"(#2) = trunc(#1);" },
|
|
599
|
+
{ "monop", "trunc", "float64",
|
|
600
|
+
"(#2) = trunc(#1);" },
|
|
601
|
+
{ "monop", "square", "int8",
|
|
602
|
+
"(#2) = (#1) * (#1);" },
|
|
603
|
+
{ "monop", "square", "uint8",
|
|
604
|
+
"(#2) = (#1) * (#1);" },
|
|
605
|
+
{ "monop", "square", "int16",
|
|
606
|
+
"(#2) = (#1) * (#1);" },
|
|
607
|
+
{ "monop", "square", "uint16",
|
|
608
|
+
"(#2) = (#1) * (#1);" },
|
|
609
|
+
{ "monop", "square", "int32",
|
|
610
|
+
"(#2) = (#1) * (#1);" },
|
|
611
|
+
{ "monop", "square", "uint32",
|
|
612
|
+
"(#2) = (#1) * (#1);" },
|
|
613
|
+
{ "monop", "square", "int64",
|
|
614
|
+
"(#2) = (#1) * (#1);" },
|
|
615
|
+
{ "monop", "square", "uint64",
|
|
616
|
+
"(#2) = (#1) * (#1);" },
|
|
617
|
+
{ "monop", "square", "float32",
|
|
618
|
+
"(#2) = (#1) * (#1);" },
|
|
619
|
+
{ "monop", "square", "float64",
|
|
620
|
+
"(#2) = (#1) * (#1);" },
|
|
621
|
+
{ "monop", "square", "cmplx64",
|
|
622
|
+
"(#2) = (#1) * (#1);" },
|
|
623
|
+
{ "monop", "square", "cmplx128",
|
|
624
|
+
"(#2) = (#1) * (#1);" },
|
|
625
|
+
{ "monop", "deg_360", "float32",
|
|
626
|
+
"{\n double _a = (double)(#1);\n double _fa = _a / 360.0;\n (#2) = (_a >= 0)\n ? (_fa - floor(_fa)) * 360.0\n : (_fa - ceil(_fa) + 1.0) * 360.0;\n}\n" },
|
|
627
|
+
{ "monop", "deg_360", "float64",
|
|
628
|
+
"{\n double _a = (double)(#1);\n double _fa = _a / 360.0;\n (#2) = (_a >= 0)\n ? (_fa - floor(_fa)) * 360.0\n : (_fa - ceil(_fa) + 1.0) * 360.0;\n}\n" },
|
|
629
|
+
{ "monop", "deg_180", "float32",
|
|
630
|
+
"{\n double _a = (double)(#1);\n double _fa = (_a + 180.0) / 360.0;\n double _b = (_a >= 0)\n ? (_fa - floor(_fa)) * 360.0 - 180.0\n : (_fa - ceil(_fa)) * 360.0 - 180.0;\n if (_b <= -180.0) _b += 360.0;\n (#2) = _b;\n}\n" },
|
|
631
|
+
{ "monop", "deg_180", "float64",
|
|
632
|
+
"{\n double _a = (double)(#1);\n double _fa = (_a + 180.0) / 360.0;\n double _b = (_a >= 0)\n ? (_fa - floor(_fa)) * 360.0 - 180.0\n : (_fa - ceil(_fa)) * 360.0 - 180.0;\n if (_b <= -180.0) _b += 360.0;\n (#2) = _b;\n}\n" },
|
|
633
|
+
{ "monop", "rad_2pi", "float32",
|
|
634
|
+
"{\n double _two_pi = 2.0 * M_PI;\n double _a = (double)(#1);\n double _fa = _a / _two_pi;\n (#2) = (_a >= 0)\n ? (_fa - floor(_fa)) * _two_pi\n : (_fa - ceil(_fa) + 1.0) * _two_pi;\n}\n" },
|
|
635
|
+
{ "monop", "rad_2pi", "float64",
|
|
636
|
+
"{\n double _two_pi = 2.0 * M_PI;\n double _a = (double)(#1);\n double _fa = _a / _two_pi;\n (#2) = (_a >= 0)\n ? (_fa - floor(_fa)) * _two_pi\n : (_fa - ceil(_fa) + 1.0) * _two_pi;\n}\n" },
|
|
637
|
+
{ "monop", "rad_pi", "float32",
|
|
638
|
+
"{\n double _two_pi = 2.0 * M_PI;\n double _a = (double)(#1);\n double _fa = (_a + M_PI) / _two_pi;\n double _b = (_a >= 0)\n ? (_fa - floor(_fa)) * _two_pi - M_PI\n : (_fa - ceil(_fa)) * _two_pi - M_PI;\n if (_b <= -M_PI) _b += _two_pi;\n (#2) = _b;\n}\n" },
|
|
639
|
+
{ "monop", "rad_pi", "float64",
|
|
640
|
+
"{\n double _two_pi = 2.0 * M_PI;\n double _a = (double)(#1);\n double _fa = (_a + M_PI) / _two_pi;\n double _b = (_a >= 0)\n ? (_fa - floor(_fa)) * _two_pi - M_PI\n : (_fa - ceil(_fa)) * _two_pi - M_PI;\n if (_b <= -M_PI) _b += _two_pi;\n (#2) = _b;\n}\n" },
|
|
641
|
+
{ "binop", "pmax", "int8",
|
|
642
|
+
"(#3) = (#1) > (#2) ? (#1) : (#2);" },
|
|
643
|
+
{ "binop", "pmax", "uint8",
|
|
644
|
+
"(#3) = (#1) > (#2) ? (#1) : (#2);" },
|
|
645
|
+
{ "binop", "pmax", "int16",
|
|
646
|
+
"(#3) = (#1) > (#2) ? (#1) : (#2);" },
|
|
647
|
+
{ "binop", "pmax", "uint16",
|
|
648
|
+
"(#3) = (#1) > (#2) ? (#1) : (#2);" },
|
|
649
|
+
{ "binop", "pmax", "int32",
|
|
650
|
+
"(#3) = (#1) > (#2) ? (#1) : (#2);" },
|
|
651
|
+
{ "binop", "pmax", "uint32",
|
|
652
|
+
"(#3) = (#1) > (#2) ? (#1) : (#2);" },
|
|
653
|
+
{ "binop", "pmax", "int64",
|
|
654
|
+
"(#3) = (#1) > (#2) ? (#1) : (#2);" },
|
|
655
|
+
{ "binop", "pmax", "uint64",
|
|
656
|
+
"(#3) = (#1) > (#2) ? (#1) : (#2);" },
|
|
657
|
+
{ "binop", "pmax", "float32",
|
|
658
|
+
"(#3) = fmax(#1, #2);" },
|
|
659
|
+
{ "binop", "pmax", "float64",
|
|
660
|
+
"(#3) = fmax(#1, #2);" },
|
|
661
|
+
{ "binop", "pmin", "int8",
|
|
662
|
+
"(#3) = (#1) < (#2) ? (#1) : (#2);" },
|
|
663
|
+
{ "binop", "pmin", "uint8",
|
|
664
|
+
"(#3) = (#1) < (#2) ? (#1) : (#2);" },
|
|
665
|
+
{ "binop", "pmin", "int16",
|
|
666
|
+
"(#3) = (#1) < (#2) ? (#1) : (#2);" },
|
|
667
|
+
{ "binop", "pmin", "uint16",
|
|
668
|
+
"(#3) = (#1) < (#2) ? (#1) : (#2);" },
|
|
669
|
+
{ "binop", "pmin", "int32",
|
|
670
|
+
"(#3) = (#1) < (#2) ? (#1) : (#2);" },
|
|
671
|
+
{ "binop", "pmin", "uint32",
|
|
672
|
+
"(#3) = (#1) < (#2) ? (#1) : (#2);" },
|
|
673
|
+
{ "binop", "pmin", "int64",
|
|
674
|
+
"(#3) = (#1) < (#2) ? (#1) : (#2);" },
|
|
675
|
+
{ "binop", "pmin", "uint64",
|
|
676
|
+
"(#3) = (#1) < (#2) ? (#1) : (#2);" },
|
|
677
|
+
{ "binop", "pmin", "float32",
|
|
678
|
+
"(#3) = fmin(#1, #2);" },
|
|
679
|
+
{ "binop", "pmin", "float64",
|
|
680
|
+
"(#3) = fmin(#1, #2);" },
|
|
681
|
+
{ "binop", "maximum", "int8",
|
|
682
|
+
"(#3) = (#1) > (#2) ? (#1) : (#2);" },
|
|
683
|
+
{ "binop", "maximum", "uint8",
|
|
684
|
+
"(#3) = (#1) > (#2) ? (#1) : (#2);" },
|
|
685
|
+
{ "binop", "maximum", "int16",
|
|
686
|
+
"(#3) = (#1) > (#2) ? (#1) : (#2);" },
|
|
687
|
+
{ "binop", "maximum", "uint16",
|
|
688
|
+
"(#3) = (#1) > (#2) ? (#1) : (#2);" },
|
|
689
|
+
{ "binop", "maximum", "int32",
|
|
690
|
+
"(#3) = (#1) > (#2) ? (#1) : (#2);" },
|
|
691
|
+
{ "binop", "maximum", "uint32",
|
|
692
|
+
"(#3) = (#1) > (#2) ? (#1) : (#2);" },
|
|
693
|
+
{ "binop", "maximum", "int64",
|
|
694
|
+
"(#3) = (#1) > (#2) ? (#1) : (#2);" },
|
|
695
|
+
{ "binop", "maximum", "uint64",
|
|
696
|
+
"(#3) = (#1) > (#2) ? (#1) : (#2);" },
|
|
697
|
+
{ "binop", "maximum", "float32",
|
|
698
|
+
"(#3) = isnan(#1) ? (#1) : (isnan(#2) ? (#2) : ((#1) > (#2) ? (#1) : (#2)));" },
|
|
699
|
+
{ "binop", "maximum", "float64",
|
|
700
|
+
"(#3) = isnan(#1) ? (#1) : (isnan(#2) ? (#2) : ((#1) > (#2) ? (#1) : (#2)));" },
|
|
701
|
+
{ "binop", "minimum", "int8",
|
|
702
|
+
"(#3) = (#1) < (#2) ? (#1) : (#2);" },
|
|
703
|
+
{ "binop", "minimum", "uint8",
|
|
704
|
+
"(#3) = (#1) < (#2) ? (#1) : (#2);" },
|
|
705
|
+
{ "binop", "minimum", "int16",
|
|
706
|
+
"(#3) = (#1) < (#2) ? (#1) : (#2);" },
|
|
707
|
+
{ "binop", "minimum", "uint16",
|
|
708
|
+
"(#3) = (#1) < (#2) ? (#1) : (#2);" },
|
|
709
|
+
{ "binop", "minimum", "int32",
|
|
710
|
+
"(#3) = (#1) < (#2) ? (#1) : (#2);" },
|
|
711
|
+
{ "binop", "minimum", "uint32",
|
|
712
|
+
"(#3) = (#1) < (#2) ? (#1) : (#2);" },
|
|
713
|
+
{ "binop", "minimum", "int64",
|
|
714
|
+
"(#3) = (#1) < (#2) ? (#1) : (#2);" },
|
|
715
|
+
{ "binop", "minimum", "uint64",
|
|
716
|
+
"(#3) = (#1) < (#2) ? (#1) : (#2);" },
|
|
717
|
+
{ "binop", "minimum", "float32",
|
|
718
|
+
"(#3) = isnan(#1) ? (#1) : (isnan(#2) ? (#2) : ((#1) < (#2) ? (#1) : (#2)));" },
|
|
719
|
+
{ "binop", "minimum", "float64",
|
|
720
|
+
"(#3) = isnan(#1) ? (#1) : (isnan(#2) ? (#2) : ((#1) < (#2) ? (#1) : (#2)));" },
|
|
721
|
+
{ "binop", "add", "int8",
|
|
722
|
+
"(#3) = (#1) + (#2);" },
|
|
723
|
+
{ "binop", "add", "uint8",
|
|
724
|
+
"(#3) = (#1) + (#2);" },
|
|
725
|
+
{ "binop", "add", "int16",
|
|
726
|
+
"(#3) = (#1) + (#2);" },
|
|
727
|
+
{ "binop", "add", "uint16",
|
|
728
|
+
"(#3) = (#1) + (#2);" },
|
|
729
|
+
{ "binop", "add", "int32",
|
|
730
|
+
"(#3) = (#1) + (#2);" },
|
|
731
|
+
{ "binop", "add", "uint32",
|
|
732
|
+
"(#3) = (#1) + (#2);" },
|
|
733
|
+
{ "binop", "add", "int64",
|
|
734
|
+
"(#3) = (#1) + (#2);" },
|
|
735
|
+
{ "binop", "add", "uint64",
|
|
736
|
+
"(#3) = (#1) + (#2);" },
|
|
737
|
+
{ "binop", "add", "float32",
|
|
738
|
+
"(#3) = (#1) + (#2);" },
|
|
739
|
+
{ "binop", "add", "float64",
|
|
740
|
+
"(#3) = (#1) + (#2);" },
|
|
741
|
+
{ "binop", "add", "cmplx64",
|
|
742
|
+
"(#3) = (#1) + (#2);" },
|
|
743
|
+
{ "binop", "add", "cmplx128",
|
|
744
|
+
"(#3) = (#1) + (#2);" },
|
|
745
|
+
{ "binop", "sub", "int8",
|
|
746
|
+
"(#3) = (#1) - (#2);" },
|
|
747
|
+
{ "binop", "sub", "uint8",
|
|
748
|
+
"(#3) = (#1) - (#2);" },
|
|
749
|
+
{ "binop", "sub", "int16",
|
|
750
|
+
"(#3) = (#1) - (#2);" },
|
|
751
|
+
{ "binop", "sub", "uint16",
|
|
752
|
+
"(#3) = (#1) - (#2);" },
|
|
753
|
+
{ "binop", "sub", "int32",
|
|
754
|
+
"(#3) = (#1) - (#2);" },
|
|
755
|
+
{ "binop", "sub", "uint32",
|
|
756
|
+
"(#3) = (#1) - (#2);" },
|
|
757
|
+
{ "binop", "sub", "int64",
|
|
758
|
+
"(#3) = (#1) - (#2);" },
|
|
759
|
+
{ "binop", "sub", "uint64",
|
|
760
|
+
"(#3) = (#1) - (#2);" },
|
|
761
|
+
{ "binop", "sub", "float32",
|
|
762
|
+
"(#3) = (#1) - (#2);" },
|
|
763
|
+
{ "binop", "sub", "float64",
|
|
764
|
+
"(#3) = (#1) - (#2);" },
|
|
765
|
+
{ "binop", "sub", "cmplx64",
|
|
766
|
+
"(#3) = (#1) - (#2);" },
|
|
767
|
+
{ "binop", "sub", "cmplx128",
|
|
768
|
+
"(#3) = (#1) - (#2);" },
|
|
769
|
+
{ "binop", "mul", "int8",
|
|
770
|
+
"(#3) = (#1) * (#2);" },
|
|
771
|
+
{ "binop", "mul", "uint8",
|
|
772
|
+
"(#3) = (#1) * (#2);" },
|
|
773
|
+
{ "binop", "mul", "int16",
|
|
774
|
+
"(#3) = (#1) * (#2);" },
|
|
775
|
+
{ "binop", "mul", "uint16",
|
|
776
|
+
"(#3) = (#1) * (#2);" },
|
|
777
|
+
{ "binop", "mul", "int32",
|
|
778
|
+
"(#3) = (#1) * (#2);" },
|
|
779
|
+
{ "binop", "mul", "uint32",
|
|
780
|
+
"(#3) = (#1) * (#2);" },
|
|
781
|
+
{ "binop", "mul", "int64",
|
|
782
|
+
"(#3) = (#1) * (#2);" },
|
|
783
|
+
{ "binop", "mul", "uint64",
|
|
784
|
+
"(#3) = (#1) * (#2);" },
|
|
785
|
+
{ "binop", "mul", "float32",
|
|
786
|
+
"(#3) = (#1) * (#2);" },
|
|
787
|
+
{ "binop", "mul", "float64",
|
|
788
|
+
"(#3) = (#1) * (#2);" },
|
|
789
|
+
{ "binop", "mul", "cmplx64",
|
|
790
|
+
"(#3) = op_cmul_cmplx64((#1), (#2));" },
|
|
791
|
+
{ "binop", "mul", "cmplx128",
|
|
792
|
+
"(#3) = (#1) * (#2);" },
|
|
793
|
+
{ "binop", "div", "int8",
|
|
794
|
+
"\n if ((#2)==0) {ca_zerodiv();};\n {\n <type> _q = (#1) / (#2);\n if ( (#1) % (#2) != 0 && (((#1) < 0) != ((#2) < 0)) ) { _q -= 1; }\n (#3) = _q;\n }\n " },
|
|
795
|
+
{ "binop", "div", "uint8",
|
|
796
|
+
"if ((#2)==0) {ca_zerodiv();}; (#3) = (#1) / (#2);" },
|
|
797
|
+
{ "binop", "div", "int16",
|
|
798
|
+
"\n if ((#2)==0) {ca_zerodiv();};\n {\n <type> _q = (#1) / (#2);\n if ( (#1) % (#2) != 0 && (((#1) < 0) != ((#2) < 0)) ) { _q -= 1; }\n (#3) = _q;\n }\n " },
|
|
799
|
+
{ "binop", "div", "uint16",
|
|
800
|
+
"if ((#2)==0) {ca_zerodiv();}; (#3) = (#1) / (#2);" },
|
|
801
|
+
{ "binop", "div", "int32",
|
|
802
|
+
"\n if ((#2)==0) {ca_zerodiv();};\n {\n <type> _q = (#1) / (#2);\n if ( (#1) % (#2) != 0 && (((#1) < 0) != ((#2) < 0)) ) { _q -= 1; }\n (#3) = _q;\n }\n " },
|
|
803
|
+
{ "binop", "div", "uint32",
|
|
804
|
+
"if ((#2)==0) {ca_zerodiv();}; (#3) = (#1) / (#2);" },
|
|
805
|
+
{ "binop", "div", "int64",
|
|
806
|
+
"\n if ((#2)==0) {ca_zerodiv();};\n {\n <type> _q = (#1) / (#2);\n if ( (#1) % (#2) != 0 && (((#1) < 0) != ((#2) < 0)) ) { _q -= 1; }\n (#3) = _q;\n }\n " },
|
|
807
|
+
{ "binop", "div", "uint64",
|
|
808
|
+
"if ((#2)==0) {ca_zerodiv();}; (#3) = (#1) / (#2);" },
|
|
809
|
+
{ "binop", "div", "float32",
|
|
810
|
+
"(#3) = (#1) / (#2);" },
|
|
811
|
+
{ "binop", "div", "float64",
|
|
812
|
+
"(#3) = (#1) / (#2);" },
|
|
813
|
+
{ "binop", "div", "cmplx64",
|
|
814
|
+
"(#3) = op_cdiv_cmplx64((#1), (#2));" },
|
|
815
|
+
{ "binop", "div", "cmplx128",
|
|
816
|
+
"(#3) = (#1) / (#2);" },
|
|
817
|
+
{ "binop", "rcp_mul", "int8",
|
|
818
|
+
"if ((#1)==0) {ca_zerodiv();}; (#3) = (#2) / (#1);" },
|
|
819
|
+
{ "binop", "rcp_mul", "uint8",
|
|
820
|
+
"if ((#1)==0) {ca_zerodiv();}; (#3) = (#2) / (#1);" },
|
|
821
|
+
{ "binop", "rcp_mul", "int16",
|
|
822
|
+
"if ((#1)==0) {ca_zerodiv();}; (#3) = (#2) / (#1);" },
|
|
823
|
+
{ "binop", "rcp_mul", "uint16",
|
|
824
|
+
"if ((#1)==0) {ca_zerodiv();}; (#3) = (#2) / (#1);" },
|
|
825
|
+
{ "binop", "rcp_mul", "int32",
|
|
826
|
+
"if ((#1)==0) {ca_zerodiv();}; (#3) = (#2) / (#1);" },
|
|
827
|
+
{ "binop", "rcp_mul", "uint32",
|
|
828
|
+
"if ((#1)==0) {ca_zerodiv();}; (#3) = (#2) / (#1);" },
|
|
829
|
+
{ "binop", "rcp_mul", "int64",
|
|
830
|
+
"if ((#1)==0) {ca_zerodiv();}; (#3) = (#2) / (#1);" },
|
|
831
|
+
{ "binop", "rcp_mul", "uint64",
|
|
832
|
+
"if ((#1)==0) {ca_zerodiv();}; (#3) = (#2) / (#1);" },
|
|
833
|
+
{ "binop", "rcp_mul", "float32",
|
|
834
|
+
"(#3) = (#2) / (#1);" },
|
|
835
|
+
{ "binop", "rcp_mul", "float64",
|
|
836
|
+
"(#3) = (#2) / (#1);" },
|
|
837
|
+
{ "binop", "rcp_mul", "cmplx64",
|
|
838
|
+
"(#3) = op_cdiv_cmplx64((#2), (#1));" },
|
|
839
|
+
{ "binop", "rcp_mul", "cmplx128",
|
|
840
|
+
"(#3) = (#2) / (#1);" },
|
|
841
|
+
{ "binop", "mod", "int8",
|
|
842
|
+
"\n if ((#2)==0) {ca_zerodiv();};\n {\n <type> _r = (#1) % (#2);\n if ( _r != 0 && ((_r < 0) != ((#2) < 0)) ) { _r += (#2); }\n (#3) = _r;\n }\n " },
|
|
843
|
+
{ "binop", "mod", "uint8",
|
|
844
|
+
"if ((#2)==0) {ca_zerodiv();}; (#3) = (#1) % (#2);" },
|
|
845
|
+
{ "binop", "mod", "int16",
|
|
846
|
+
"\n if ((#2)==0) {ca_zerodiv();};\n {\n <type> _r = (#1) % (#2);\n if ( _r != 0 && ((_r < 0) != ((#2) < 0)) ) { _r += (#2); }\n (#3) = _r;\n }\n " },
|
|
847
|
+
{ "binop", "mod", "uint16",
|
|
848
|
+
"if ((#2)==0) {ca_zerodiv();}; (#3) = (#1) % (#2);" },
|
|
849
|
+
{ "binop", "mod", "int32",
|
|
850
|
+
"\n if ((#2)==0) {ca_zerodiv();};\n {\n <type> _r = (#1) % (#2);\n if ( _r != 0 && ((_r < 0) != ((#2) < 0)) ) { _r += (#2); }\n (#3) = _r;\n }\n " },
|
|
851
|
+
{ "binop", "mod", "uint32",
|
|
852
|
+
"if ((#2)==0) {ca_zerodiv();}; (#3) = (#1) % (#2);" },
|
|
853
|
+
{ "binop", "mod", "int64",
|
|
854
|
+
"\n if ((#2)==0) {ca_zerodiv();};\n {\n <type> _r = (#1) % (#2);\n if ( _r != 0 && ((_r < 0) != ((#2) < 0)) ) { _r += (#2); }\n (#3) = _r;\n }\n " },
|
|
855
|
+
{ "binop", "mod", "uint64",
|
|
856
|
+
"if ((#2)==0) {ca_zerodiv();}; (#3) = (#1) % (#2);" },
|
|
857
|
+
{ "binop", "mod", "float32",
|
|
858
|
+
"\n {\n <type> _r = fmod((#1), (#2));\n if ( _r != 0 ) {\n if ( (_r < 0) != ((#2) < 0) ) { _r += (#2); }\n }\n else { _r = copysign((<type>) 0, (#2)); }\n (#3) = _r;\n }\n " },
|
|
859
|
+
{ "binop", "mod", "float64",
|
|
860
|
+
"\n {\n <type> _r = fmod((#1), (#2));\n if ( _r != 0 ) {\n if ( (_r < 0) != ((#2) < 0) ) { _r += (#2); }\n }\n else { _r = copysign((<type>) 0, (#2)); }\n (#3) = _r;\n }\n " },
|
|
861
|
+
{ "binop", "fmod", "int8",
|
|
862
|
+
"if ((#2)==0) {ca_zerodiv();}; (#3) = (#1) % (#2);" },
|
|
863
|
+
{ "binop", "fmod", "uint8",
|
|
864
|
+
"if ((#2)==0) {ca_zerodiv();}; (#3) = (#1) % (#2);" },
|
|
865
|
+
{ "binop", "fmod", "int16",
|
|
866
|
+
"if ((#2)==0) {ca_zerodiv();}; (#3) = (#1) % (#2);" },
|
|
867
|
+
{ "binop", "fmod", "uint16",
|
|
868
|
+
"if ((#2)==0) {ca_zerodiv();}; (#3) = (#1) % (#2);" },
|
|
869
|
+
{ "binop", "fmod", "int32",
|
|
870
|
+
"if ((#2)==0) {ca_zerodiv();}; (#3) = (#1) % (#2);" },
|
|
871
|
+
{ "binop", "fmod", "uint32",
|
|
872
|
+
"if ((#2)==0) {ca_zerodiv();}; (#3) = (#1) % (#2);" },
|
|
873
|
+
{ "binop", "fmod", "int64",
|
|
874
|
+
"if ((#2)==0) {ca_zerodiv();}; (#3) = (#1) % (#2);" },
|
|
875
|
+
{ "binop", "fmod", "uint64",
|
|
876
|
+
"if ((#2)==0) {ca_zerodiv();}; (#3) = (#1) % (#2);" },
|
|
877
|
+
{ "binop", "fmod", "float32",
|
|
878
|
+
"(#3) = fmodf((#1), (#2));" },
|
|
879
|
+
{ "binop", "fmod", "float64",
|
|
880
|
+
"(#3) = fmod((#1), (#2));" },
|
|
881
|
+
{ "binop", "bit_and_i", "int8",
|
|
882
|
+
"(#3) = (#1) & (#2);" },
|
|
883
|
+
{ "binop", "bit_and_i", "uint8",
|
|
884
|
+
"(#3) = (#1) & (#2);" },
|
|
885
|
+
{ "binop", "bit_and_i", "int16",
|
|
886
|
+
"(#3) = (#1) & (#2);" },
|
|
887
|
+
{ "binop", "bit_and_i", "uint16",
|
|
888
|
+
"(#3) = (#1) & (#2);" },
|
|
889
|
+
{ "binop", "bit_and_i", "int32",
|
|
890
|
+
"(#3) = (#1) & (#2);" },
|
|
891
|
+
{ "binop", "bit_and_i", "uint32",
|
|
892
|
+
"(#3) = (#1) & (#2);" },
|
|
893
|
+
{ "binop", "bit_and_i", "int64",
|
|
894
|
+
"(#3) = (#1) & (#2);" },
|
|
895
|
+
{ "binop", "bit_and_i", "uint64",
|
|
896
|
+
"(#3) = (#1) & (#2);" },
|
|
897
|
+
{ "binop", "bit_and_i", "boolean",
|
|
898
|
+
"(#3) = (#1) & (#2);" },
|
|
899
|
+
{ "binop", "bit_or_i", "int8",
|
|
900
|
+
"(#3) = (#1) | (#2);" },
|
|
901
|
+
{ "binop", "bit_or_i", "uint8",
|
|
902
|
+
"(#3) = (#1) | (#2);" },
|
|
903
|
+
{ "binop", "bit_or_i", "int16",
|
|
904
|
+
"(#3) = (#1) | (#2);" },
|
|
905
|
+
{ "binop", "bit_or_i", "uint16",
|
|
906
|
+
"(#3) = (#1) | (#2);" },
|
|
907
|
+
{ "binop", "bit_or_i", "int32",
|
|
908
|
+
"(#3) = (#1) | (#2);" },
|
|
909
|
+
{ "binop", "bit_or_i", "uint32",
|
|
910
|
+
"(#3) = (#1) | (#2);" },
|
|
911
|
+
{ "binop", "bit_or_i", "int64",
|
|
912
|
+
"(#3) = (#1) | (#2);" },
|
|
913
|
+
{ "binop", "bit_or_i", "uint64",
|
|
914
|
+
"(#3) = (#1) | (#2);" },
|
|
915
|
+
{ "binop", "bit_or_i", "boolean",
|
|
916
|
+
"(#3) = (#1) | (#2);" },
|
|
917
|
+
{ "binop", "bit_xor_i", "int8",
|
|
918
|
+
"(#3) = (#1) ^ (#2);" },
|
|
919
|
+
{ "binop", "bit_xor_i", "uint8",
|
|
920
|
+
"(#3) = (#1) ^ (#2);" },
|
|
921
|
+
{ "binop", "bit_xor_i", "int16",
|
|
922
|
+
"(#3) = (#1) ^ (#2);" },
|
|
923
|
+
{ "binop", "bit_xor_i", "uint16",
|
|
924
|
+
"(#3) = (#1) ^ (#2);" },
|
|
925
|
+
{ "binop", "bit_xor_i", "int32",
|
|
926
|
+
"(#3) = (#1) ^ (#2);" },
|
|
927
|
+
{ "binop", "bit_xor_i", "uint32",
|
|
928
|
+
"(#3) = (#1) ^ (#2);" },
|
|
929
|
+
{ "binop", "bit_xor_i", "int64",
|
|
930
|
+
"(#3) = (#1) ^ (#2);" },
|
|
931
|
+
{ "binop", "bit_xor_i", "uint64",
|
|
932
|
+
"(#3) = (#1) ^ (#2);" },
|
|
933
|
+
{ "binop", "bit_xor_i", "boolean",
|
|
934
|
+
"(#3) = ((#1) != (#2)) ? 1 : 0;" },
|
|
935
|
+
{ "binop", "bit_lshift", "int8",
|
|
936
|
+
"(#3) = (#1) << (#2);" },
|
|
937
|
+
{ "binop", "bit_lshift", "uint8",
|
|
938
|
+
"(#3) = (#1) << (#2);" },
|
|
939
|
+
{ "binop", "bit_lshift", "int16",
|
|
940
|
+
"(#3) = (#1) << (#2);" },
|
|
941
|
+
{ "binop", "bit_lshift", "uint16",
|
|
942
|
+
"(#3) = (#1) << (#2);" },
|
|
943
|
+
{ "binop", "bit_lshift", "int32",
|
|
944
|
+
"(#3) = (#1) << (#2);" },
|
|
945
|
+
{ "binop", "bit_lshift", "uint32",
|
|
946
|
+
"(#3) = (#1) << (#2);" },
|
|
947
|
+
{ "binop", "bit_lshift", "int64",
|
|
948
|
+
"(#3) = (#1) << (#2);" },
|
|
949
|
+
{ "binop", "bit_lshift", "uint64",
|
|
950
|
+
"(#3) = (#1) << (#2);" },
|
|
951
|
+
{ "binop", "bit_rshift", "int8",
|
|
952
|
+
"(#3) = (#1) >> (#2);" },
|
|
953
|
+
{ "binop", "bit_rshift", "uint8",
|
|
954
|
+
"(#3) = (#1) >> (#2);" },
|
|
955
|
+
{ "binop", "bit_rshift", "int16",
|
|
956
|
+
"(#3) = (#1) >> (#2);" },
|
|
957
|
+
{ "binop", "bit_rshift", "uint16",
|
|
958
|
+
"(#3) = (#1) >> (#2);" },
|
|
959
|
+
{ "binop", "bit_rshift", "int32",
|
|
960
|
+
"(#3) = (#1) >> (#2);" },
|
|
961
|
+
{ "binop", "bit_rshift", "uint32",
|
|
962
|
+
"(#3) = (#1) >> (#2);" },
|
|
963
|
+
{ "binop", "bit_rshift", "int64",
|
|
964
|
+
"(#3) = (#1) >> (#2);" },
|
|
965
|
+
{ "binop", "bit_rshift", "uint64",
|
|
966
|
+
"(#3) = (#1) >> (#2);" },
|
|
967
|
+
{ "binop", "and", "boolean",
|
|
968
|
+
"(#3) = (#1) && (#2);" },
|
|
969
|
+
{ "binop", "or", "boolean",
|
|
970
|
+
"(#3) = (#1) || (#2);" },
|
|
971
|
+
{ "binop", "xor", "boolean",
|
|
972
|
+
"(#3) = (((#1)==0) == ((#2)==0)) ? 0 : 1;" },
|
|
973
|
+
{ "triop", "fma", "int8",
|
|
974
|
+
"(#4) = (#1) * (#2) + (#3);" },
|
|
975
|
+
{ "triop", "fma", "uint8",
|
|
976
|
+
"(#4) = (#1) * (#2) + (#3);" },
|
|
977
|
+
{ "triop", "fma", "int16",
|
|
978
|
+
"(#4) = (#1) * (#2) + (#3);" },
|
|
979
|
+
{ "triop", "fma", "uint16",
|
|
980
|
+
"(#4) = (#1) * (#2) + (#3);" },
|
|
981
|
+
{ "triop", "fma", "int32",
|
|
982
|
+
"(#4) = (#1) * (#2) + (#3);" },
|
|
983
|
+
{ "triop", "fma", "uint32",
|
|
984
|
+
"(#4) = (#1) * (#2) + (#3);" },
|
|
985
|
+
{ "triop", "fma", "int64",
|
|
986
|
+
"(#4) = (#1) * (#2) + (#3);" },
|
|
987
|
+
{ "triop", "fma", "uint64",
|
|
988
|
+
"(#4) = (#1) * (#2) + (#3);" },
|
|
989
|
+
{ "triop", "fma", "float32",
|
|
990
|
+
"(#4) = fma((#1), (#2), (#3));" },
|
|
991
|
+
{ "triop", "fma", "float64",
|
|
992
|
+
"(#4) = fma((#1), (#2), (#3));" },
|
|
993
|
+
{ "triop", "fma", "cmplx64",
|
|
994
|
+
"(#4) = (#1) * (#2) + (#3);" },
|
|
995
|
+
{ "triop", "fma", "cmplx128",
|
|
996
|
+
"(#4) = (#1) * (#2) + (#3);" },
|
|
997
|
+
{ "triop", "fms", "int8",
|
|
998
|
+
"(#4) = (#1) * (#2) - (#3);" },
|
|
999
|
+
{ "triop", "fms", "uint8",
|
|
1000
|
+
"(#4) = (#1) * (#2) - (#3);" },
|
|
1001
|
+
{ "triop", "fms", "int16",
|
|
1002
|
+
"(#4) = (#1) * (#2) - (#3);" },
|
|
1003
|
+
{ "triop", "fms", "uint16",
|
|
1004
|
+
"(#4) = (#1) * (#2) - (#3);" },
|
|
1005
|
+
{ "triop", "fms", "int32",
|
|
1006
|
+
"(#4) = (#1) * (#2) - (#3);" },
|
|
1007
|
+
{ "triop", "fms", "uint32",
|
|
1008
|
+
"(#4) = (#1) * (#2) - (#3);" },
|
|
1009
|
+
{ "triop", "fms", "int64",
|
|
1010
|
+
"(#4) = (#1) * (#2) - (#3);" },
|
|
1011
|
+
{ "triop", "fms", "uint64",
|
|
1012
|
+
"(#4) = (#1) * (#2) - (#3);" },
|
|
1013
|
+
{ "triop", "fms", "float32",
|
|
1014
|
+
"(#4) = fma((#1), (#2), -(#3));" },
|
|
1015
|
+
{ "triop", "fms", "float64",
|
|
1016
|
+
"(#4) = fma((#1), (#2), -(#3));" },
|
|
1017
|
+
{ "triop", "fms", "cmplx64",
|
|
1018
|
+
"(#4) = (#1) * (#2) - (#3);" },
|
|
1019
|
+
{ "triop", "fms", "cmplx128",
|
|
1020
|
+
"(#4) = (#1) * (#2) - (#3);" },
|
|
1021
|
+
{ "triop", "clip", "int8",
|
|
1022
|
+
"(#4) = ((#1) < (#2)) ? (#2) : (((#1) > (#3)) ? (#3) : (#1));" },
|
|
1023
|
+
{ "triop", "clip", "uint8",
|
|
1024
|
+
"(#4) = ((#1) < (#2)) ? (#2) : (((#1) > (#3)) ? (#3) : (#1));" },
|
|
1025
|
+
{ "triop", "clip", "int16",
|
|
1026
|
+
"(#4) = ((#1) < (#2)) ? (#2) : (((#1) > (#3)) ? (#3) : (#1));" },
|
|
1027
|
+
{ "triop", "clip", "uint16",
|
|
1028
|
+
"(#4) = ((#1) < (#2)) ? (#2) : (((#1) > (#3)) ? (#3) : (#1));" },
|
|
1029
|
+
{ "triop", "clip", "int32",
|
|
1030
|
+
"(#4) = ((#1) < (#2)) ? (#2) : (((#1) > (#3)) ? (#3) : (#1));" },
|
|
1031
|
+
{ "triop", "clip", "uint32",
|
|
1032
|
+
"(#4) = ((#1) < (#2)) ? (#2) : (((#1) > (#3)) ? (#3) : (#1));" },
|
|
1033
|
+
{ "triop", "clip", "int64",
|
|
1034
|
+
"(#4) = ((#1) < (#2)) ? (#2) : (((#1) > (#3)) ? (#3) : (#1));" },
|
|
1035
|
+
{ "triop", "clip", "uint64",
|
|
1036
|
+
"(#4) = ((#1) < (#2)) ? (#2) : (((#1) > (#3)) ? (#3) : (#1));" },
|
|
1037
|
+
{ "triop", "clip", "float32",
|
|
1038
|
+
"(#4) = isnan(#1) ? (#1) : fmin(fmax((#1), (#2)), (#3));" },
|
|
1039
|
+
{ "triop", "clip", "float64",
|
|
1040
|
+
"(#4) = isnan(#1) ? (#1) : fmin(fmax((#1), (#2)), (#3));" },
|
|
1041
|
+
{ "binop", "power", "int8",
|
|
1042
|
+
"(#3) = op_powi_<type>((#1), (#2));" },
|
|
1043
|
+
{ "binop", "power", "uint8",
|
|
1044
|
+
"(#3) = op_powi_<type>((#1), (#2));" },
|
|
1045
|
+
{ "binop", "power", "int16",
|
|
1046
|
+
"(#3) = op_powi_<type>((#1), (#2));" },
|
|
1047
|
+
{ "binop", "power", "uint16",
|
|
1048
|
+
"(#3) = op_powi_<type>((#1), (#2));" },
|
|
1049
|
+
{ "binop", "power", "int32",
|
|
1050
|
+
"(#3) = op_powi_<type>((#1), (#2));" },
|
|
1051
|
+
{ "binop", "power", "uint32",
|
|
1052
|
+
"(#3) = op_powi_<type>((#1), (#2));" },
|
|
1053
|
+
{ "binop", "power", "int64",
|
|
1054
|
+
"(#3) = op_powi_<type>((#1), (#2));" },
|
|
1055
|
+
{ "binop", "power", "uint64",
|
|
1056
|
+
"(#3) = op_powi_<type>((#1), (#2));" },
|
|
1057
|
+
{ "binop", "power", "float32",
|
|
1058
|
+
"(#3) = powf((#1), (#2));" },
|
|
1059
|
+
{ "binop", "power", "float64",
|
|
1060
|
+
"(#3) = pow((#1), (#2));" },
|
|
1061
|
+
{ "binop", "power", "cmplx64",
|
|
1062
|
+
"(#3) = cpow((#1), (#2));" },
|
|
1063
|
+
{ "binop", "power", "cmplx128",
|
|
1064
|
+
"(#3) = cpow((#1), (#2));" },
|
|
1065
|
+
{ "binop", "copysign", "float32",
|
|
1066
|
+
"(#3) = copysignf((#1), (#2));" },
|
|
1067
|
+
{ "binop", "copysign", "float64",
|
|
1068
|
+
"(#3) = copysign((#1), (#2));" },
|
|
1069
|
+
{ "binop", "nextafter", "float32",
|
|
1070
|
+
"(#3) = nextafterf((#1), (#2));" },
|
|
1071
|
+
{ "binop", "nextafter", "float64",
|
|
1072
|
+
"(#3) = nextafter((#1), (#2));" },
|
|
1073
|
+
{ "binop", "atan2", "float32",
|
|
1074
|
+
"(#3) = atan2f((#1), (#2));" },
|
|
1075
|
+
{ "binop", "atan2", "float64",
|
|
1076
|
+
"(#3) = atan2((#1), (#2));" },
|
|
1077
|
+
{ "binop", "hypot", "float32",
|
|
1078
|
+
"(#3) = hypotf((#1), (#2));" },
|
|
1079
|
+
{ "binop", "hypot", "float64",
|
|
1080
|
+
"(#3) = hypot((#1), (#2));" },
|
|
1081
|
+
{ "binop", "logaddexp", "float32",
|
|
1082
|
+
"(#3) = fmaxf((#1), (#2)) + log1pf(expf(-fabsf((#1) - (#2))));" },
|
|
1083
|
+
{ "binop", "logaddexp", "float64",
|
|
1084
|
+
"(#3) = fmax((#1), (#2)) + log1p(exp(-fabs((#1) - (#2))));" },
|
|
1085
|
+
};
|
|
1086
|
+
|
|
1087
|
+
static const int ca_kernel_bodies_count = 527;
|
|
1088
|
+
|
|
1089
|
+
/* CArray.__kernel_body__(kind, name, data_type) -> String, or nil where
|
|
1090
|
+
this operation has no body at that data type. */
|
|
1091
|
+
static VALUE
|
|
1092
|
+
rb_ca_s_kernel_body (VALUE klass, VALUE rkind, VALUE rname, VALUE rtype)
|
|
1093
|
+
{
|
|
1094
|
+
VALUE kind = rb_obj_as_string(rkind);
|
|
1095
|
+
VALUE name = rb_obj_as_string(rname);
|
|
1096
|
+
VALUE type = rb_obj_as_string(rtype);
|
|
1097
|
+
const char *k = StringValueCStr(kind);
|
|
1098
|
+
const char *n = StringValueCStr(name);
|
|
1099
|
+
const char *t = StringValueCStr(type);
|
|
1100
|
+
int i;
|
|
1101
|
+
for ( i = 0; i < ca_kernel_bodies_count; i++ ) {
|
|
1102
|
+
const ca_kernel_body_t *e = &ca_kernel_bodies[i];
|
|
1103
|
+
if ( strcmp(e->kind, k) == 0 &&
|
|
1104
|
+
strcmp(e->name, n) == 0 &&
|
|
1105
|
+
strcmp(e->data_type, t) == 0 ) {
|
|
1106
|
+
return rb_str_new_cstr(e->body);
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
return Qnil;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
19
1112
|
void
|
|
20
1113
|
Init_carray_kernels (void)
|
|
21
1114
|
{
|
|
@@ -33,4 +1126,6 @@ Init_carray_kernels (void)
|
|
|
33
1126
|
Init_carray_kernels_triop();
|
|
34
1127
|
Init_carray_kernels_moncmp();
|
|
35
1128
|
Init_carray_kernels_bincmp();
|
|
1129
|
+
rb_define_singleton_method(rb_cCArray, "__kernel_body__",
|
|
1130
|
+
rb_ca_s_kernel_body, 3);
|
|
36
1131
|
}
|