240 function gen_perf_scalar_footer {
241 cat $TEMPLATE_FOLDER/Perf-Scalar-footer.template >> $1
242 }
243 unit_output="unit_tests.template"
244 perf_output="perf_tests.template"
245 perf_scalar_output="perf_scalar_tests.template"
246 gen_unit_header $unit_output
247 gen_perf_header $perf_output
248 gen_perf_scalar_header $perf_scalar_output
249
250 # ALU binary ops.
251 gen_binary_alu_op "add" "a + b" $unit_output $perf_output $perf_scalar_output
252 gen_binary_alu_op "sub" "a - b" $unit_output $perf_output $perf_scalar_output
253 gen_binary_alu_op "div" "a \/ b" $unit_output $perf_output $perf_scalar_output "FP"
254 gen_binary_alu_op "mul" "a \* b" $unit_output $perf_output $perf_scalar_output
255 gen_binary_alu_op "and" "a \& b" $unit_output $perf_output $perf_scalar_output "BITWISE"
256 gen_binary_alu_op "or" "a | b" $unit_output $perf_output $perf_scalar_output "BITWISE"
257 gen_binary_alu_op "xor" "a ^ b" $unit_output $perf_output $perf_scalar_output "BITWISE"
258
259 # Shifts
260 gen_binary_alu_op "shiftR" "(a >>> b)" $unit_output $perf_output $perf_scalar_output "intOrLong"
261 gen_binary_alu_op "shiftL" "(a << b)" $unit_output $perf_output $perf_scalar_output "intOrLong"
262 gen_binary_alu_op "aShiftR" "(a >> b)" $unit_output $perf_output $perf_scalar_output "intOrLong"
263 gen_shift_cst_op "aShiftR" "(a >> b)" $unit_output $perf_output $perf_scalar_output "intOrLong"
264 gen_shift_cst_op "shiftR" "(a >>> b)" $unit_output $perf_output $perf_scalar_output "intOrLong"
265 gen_shift_cst_op "shiftL" "(a << b)" $unit_output $perf_output $perf_scalar_output "intOrLong"
266 gen_shift_cst_op "aShiftR" "(a >> (b \& 7))" $unit_output $perf_output $perf_scalar_output "byte"
267 gen_shift_cst_op "shiftL" "(a << (b \& 7))" $unit_output $perf_output $perf_scalar_output "byte"
268 gen_shift_cst_op "shiftR" "((a \& 0xFF) >>> (b \& 7))" $unit_output $perf_output $perf_scalar_output "byte"
269 gen_shift_cst_op "aShiftR" "(a >> (b \& 15))" $unit_output $perf_output $perf_scalar_output "short"
270 gen_shift_cst_op "shiftL" "(a << (b \& 15))" $unit_output $perf_output $perf_scalar_output "short"
271 gen_shift_cst_op "shiftR" "((a \& 0xFFFF) >>> (b \& 15))" $unit_output $perf_output $perf_scalar_output "short"
272
273 # Masked reductions.
274 gen_binary_op "max" "Math.max(a, b)" $unit_output $perf_output $perf_scalar_output
275 gen_binary_op "min" "Math.min(a, b)" $unit_output $perf_output $perf_scalar_output
276
277 # Reductions.
278 gen_reduction_op "andAll" "\&" $unit_output $perf_output $perf_scalar_output "BITWISE" "-1"
279 gen_reduction_op "orAll" "|" $unit_output $perf_output $perf_scalar_output "BITWISE" "0"
280 gen_reduction_op "xorAll" "^" $unit_output $perf_output $perf_scalar_output "BITWISE" "0"
281 gen_reduction_op "addAll" "+" $unit_output $perf_output $perf_scalar_output "" "0"
282 gen_reduction_op "mulAll" "*" $unit_output $perf_output $perf_scalar_output "" "1"
283 gen_reduction_op_min "minAll" "" $unit_output $perf_output $perf_scalar_output "" "\$Wideboxtype\$.\$MaxValue\$"
284 gen_reduction_op_max "maxAll" "" $unit_output $perf_output $perf_scalar_output "" "\$Wideboxtype\$.\$MinValue\$"
285
286
287 # Boolean reductions.
288 gen_bool_reduction_op "anyTrue" "|" $unit_output $perf_output $perf_scalar_output "BITWISE" "false"
289 gen_bool_reduction_op "allTrue" "\&" $unit_output $perf_output $perf_scalar_output "BITWISE" "true"
290
291 #Insert
292 gen_with_op "with" "" $unit_output $perf_output $perf_scalar_output "" ""
293
294 # Compares
295 gen_op_tmpl $compare_template "lessThan" "<" $unit_output $perf_output $perf_scalar_output
296 gen_op_tmpl $compare_template "greaterThan" ">" $unit_output $perf_output $perf_scalar_output
297 gen_op_tmpl $compare_template "equal" "==" $unit_output $perf_output $perf_scalar_output
298 gen_op_tmpl $compare_template "notEqual" "!=" $unit_output $perf_output $perf_scalar_output
299 gen_op_tmpl $compare_template "lessThanEq" "<=" $unit_output $perf_output $perf_scalar_output
300 gen_op_tmpl $compare_template "greaterThanEq" ">=" $unit_output $perf_output $perf_scalar_output
301
302 # Blend.
303 gen_op_tmpl $blend "blend" "" $unit_output $perf_output $perf_scalar_output
304
|
240 function gen_perf_scalar_footer {
241 cat $TEMPLATE_FOLDER/Perf-Scalar-footer.template >> $1
242 }
243 unit_output="unit_tests.template"
244 perf_output="perf_tests.template"
245 perf_scalar_output="perf_scalar_tests.template"
246 gen_unit_header $unit_output
247 gen_perf_header $perf_output
248 gen_perf_scalar_header $perf_scalar_output
249
250 # ALU binary ops.
251 gen_binary_alu_op "add" "a + b" $unit_output $perf_output $perf_scalar_output
252 gen_binary_alu_op "sub" "a - b" $unit_output $perf_output $perf_scalar_output
253 gen_binary_alu_op "div" "a \/ b" $unit_output $perf_output $perf_scalar_output "FP"
254 gen_binary_alu_op "mul" "a \* b" $unit_output $perf_output $perf_scalar_output
255 gen_binary_alu_op "and" "a \& b" $unit_output $perf_output $perf_scalar_output "BITWISE"
256 gen_binary_alu_op "or" "a | b" $unit_output $perf_output $perf_scalar_output "BITWISE"
257 gen_binary_alu_op "xor" "a ^ b" $unit_output $perf_output $perf_scalar_output "BITWISE"
258
259 # Shifts
260 gen_binary_alu_op "shiftLeft" "(a << b)" $unit_output $perf_output $perf_scalar_output "intOrLong"
261 gen_binary_alu_op "shiftLeft" "(a << (b \& 0x7))" $unit_output $perf_output $perf_scalar_output "byte"
262 gen_binary_alu_op "shiftLeft" "(a << (b \& 0xF))" $unit_output $perf_output $perf_scalar_output "short"
263 gen_binary_alu_op "shiftRight" "(a >>> b)" $unit_output $perf_output $perf_scalar_output "intOrLong"
264 gen_binary_alu_op "shiftRight" "(a >>> (b \& 0x7))" $unit_output $perf_output $perf_scalar_output "byte"
265 gen_binary_alu_op "shiftRight" "(a >>> (b \& 0xF))" $unit_output $perf_output $perf_scalar_output "short"
266 gen_binary_alu_op "shiftArithmeticRight" "(a >> b)" $unit_output $perf_output $perf_scalar_output "intOrLong"
267 gen_binary_alu_op "shiftArithmeticRight" "(a >> (b \& 0x7))" $unit_output $perf_output $perf_scalar_output "byte"
268 gen_binary_alu_op "shiftArithmeticRight" "(a >> (b \& 0xF))" $unit_output $perf_output $perf_scalar_output "short"
269 gen_shift_cst_op "shiftLeft" "(a << b)" $unit_output $perf_output $perf_scalar_output "intOrLong"
270 gen_shift_cst_op "shiftLeft" "(a << (b \& 7))" $unit_output $perf_output $perf_scalar_output "byte"
271 gen_shift_cst_op "shiftLeft" "(a << (b \& 15))" $unit_output $perf_output $perf_scalar_output "short"
272 gen_shift_cst_op "shiftRight" "(a >>> b)" $unit_output $perf_output $perf_scalar_output "intOrLong"
273 gen_shift_cst_op "shiftRight" "((a \& 0xFF) >>> (b \& 7))" $unit_output $perf_output $perf_scalar_output "byte"
274 gen_shift_cst_op "shiftRight" "((a \& 0xFFFF) >>> (b \& 15))" $unit_output $perf_output $perf_scalar_output "short"
275 gen_shift_cst_op "shiftArithmeticRight" "(a >> b)" $unit_output $perf_output $perf_scalar_output "intOrLong"
276 gen_shift_cst_op "shiftArithmeticRight" "(a >> (b \& 7))" $unit_output $perf_output $perf_scalar_output "byte"
277 gen_shift_cst_op "shiftArithmeticRight" "(a >> (b \& 15))" $unit_output $perf_output $perf_scalar_output "short"
278
279 # Masked reductions.
280 gen_binary_op "max" "Math.max(a, b)" $unit_output $perf_output $perf_scalar_output
281 gen_binary_op "min" "Math.min(a, b)" $unit_output $perf_output $perf_scalar_output
282
283 # Reductions.
284 gen_reduction_op "andLanes" "\&" $unit_output $perf_output $perf_scalar_output "BITWISE" "-1"
285 gen_reduction_op "orLanes" "|" $unit_output $perf_output $perf_scalar_output "BITWISE" "0"
286 gen_reduction_op "xorLanes" "^" $unit_output $perf_output $perf_scalar_output "BITWISE" "0"
287 gen_reduction_op "addLanes" "+" $unit_output $perf_output $perf_scalar_output "" "0"
288 gen_reduction_op "mulLanes" "*" $unit_output $perf_output $perf_scalar_output "" "1"
289 gen_reduction_op_min "minLanes" "" $unit_output $perf_output $perf_scalar_output "" "\$Wideboxtype\$.\$MaxValue\$"
290 gen_reduction_op_max "maxLanes" "" $unit_output $perf_output $perf_scalar_output "" "\$Wideboxtype\$.\$MinValue\$"
291
292
293 # Boolean reductions.
294 gen_bool_reduction_op "anyTrue" "|" $unit_output $perf_output $perf_scalar_output "BITWISE" "false"
295 gen_bool_reduction_op "allTrue" "\&" $unit_output $perf_output $perf_scalar_output "BITWISE" "true"
296
297 #Insert
298 gen_with_op "with" "" $unit_output $perf_output $perf_scalar_output "" ""
299
300 # Compares
301 gen_op_tmpl $compare_template "lessThan" "<" $unit_output $perf_output $perf_scalar_output
302 gen_op_tmpl $compare_template "greaterThan" ">" $unit_output $perf_output $perf_scalar_output
303 gen_op_tmpl $compare_template "equal" "==" $unit_output $perf_output $perf_scalar_output
304 gen_op_tmpl $compare_template "notEqual" "!=" $unit_output $perf_output $perf_scalar_output
305 gen_op_tmpl $compare_template "lessThanEq" "<=" $unit_output $perf_output $perf_scalar_output
306 gen_op_tmpl $compare_template "greaterThanEq" ">=" $unit_output $perf_output $perf_scalar_output
307
308 # Blend.
309 gen_op_tmpl $blend "blend" "" $unit_output $perf_output $perf_scalar_output
310
|