Lines Matching defs:dst

129 def conditional_guard(src, dst):
139 if dst in int64_types:
141 elif dst in float64_types:
143 elif dst in float16_types:
241 def generate_default_conversion(src, dst, mode):
242 close_conditional = conditional_guard(src, dst)
247 f"""_CLC_DEF _CLC_OVERLOAD {dst} convert_{dst}{mode}({src} x) {{
248 return ({dst})x;
254 f"""_CLC_DEF _CLC_OVERLOAD {dst}{size} convert_{dst}{size}{mode}({src}{size} x) {{
255 return __builtin_convertvector(x, {dst}{size});
267 for dst in types:
268 generate_default_conversion(src, dst, "")
271 for dst in int_types:
277 generate_default_conversion(src, dst, mode)
291 def generate_saturated_conversion(src, dst, size):
293 close_conditional = conditional_guard(src, dst)
298 DST=dst, SRC=src, N=size
306 if dst in unsigned_types:
308 DST=dst, BOOL=bool_type[dst], N=size
312 bool_prefix = "convert_{BOOL}{N}".format(BOOL=bool_type[dst], N=size)
316 if src == dst:
331 DST=dst,
333 DST_MIN=limit_min[dst],
334 DST_MAX=limit_max[dst],
347 DST=dst,
349 DST_MIN=limit_min[dst],
350 DST_MAX=limit_max[dst],
358 # Integer to integer convesion with sizeof(src) == sizeof(dst)
359 if sizeof_type[src] == sizeof_type[dst]:
363 SRC=src, DST_MAX=limit_max[dst]
369 # Integer to integer conversion where sizeof(src) > sizeof(dst)
370 elif sizeof_type[src] > sizeof_type[dst]:
374 SRC=src, DST_MAX=limit_max[dst]
380 SRC=src, DST_MIN=limit_min[dst], DST_MAX=limit_max[dst]
384 # Integer to integer conversion where sizeof(src) < sizeof(dst)
385 elif src not in unsigned_types and dst in unsigned_types:
388 print(" return convert_{DST}{N}(x);".format(DST=dst, N=size))
397 for dst in int_types:
399 generate_saturated_conversion(src, dst, size)
402 def generate_saturated_conversion_with_rounding(src, dst, size, mode):
404 close_conditional = conditional_guard(src, dst)
414 DST=dst, SRC=src, N=size, M=mode
424 for dst in int_types:
427 generate_saturated_conversion_with_rounding(src, dst, size, mode)
444 def generate_float_conversion(src, dst, size, mode, sat):
446 close_conditional = conditional_guard(src, dst)
451 SRC=src, DST=dst, N=size, M=mode, S=sat
456 if dst in int_types:
463 print(" return convert_{DST}{N}{S}(x);".format(DST=dst, N=size, S=sat))
465 print(" return convert_{DST}{N}(x);".format(DST=dst, N=size))
467 print(" {DST}{N} r = convert_{DST}{N}(x);".format(DST=dst, N=size))
490 BOOL=bool_type[dst], N=size
496 BOOL=bool_type[dst], N=size, SRC=src, SRC_MAX=limit_max[src]
501 DST=dst, N=size, BOOL=bool_type[dst], SRC=src
507 DST=dst, N=size, BOOL=bool_type[dst]
510 if dst == "half" and src in int_types and sizeof_type[src] >= 2:
511 dst_max = limit_max[dst]
517 DST=dst, N=size, DST_MIN=limit_min[dst], DST_MAX=dst_max
525 DST=dst, N=size, BOOL=bool_type[dst]
528 if dst == "half" and src in int_types and sizeof_type[src] >= 2:
531 DST=dst, N=size, DST_MIN=limit_min[dst]
540 BOOL=bool_type[dst], N=size
546 BOOL=bool_type[dst], N=size, SRC=src, SRC_MAX=limit_max[src]
551 DST=dst, N=size, BOOL=bool_type[dst], SRC=src
557 DST=dst, N=size, BOOL=bool_type[dst]
560 if dst == "half" and src in int_types and sizeof_type[src] >= 2:
561 dst_max = limit_max[dst]
567 DST=dst, N=size, DST_MAX=dst_max
580 for dst in int_types:
584 generate_float_conversion(src, dst, size, mode, sat)
588 for dst in float_types:
595 generate_float_conversion(src, dst, size, mode, "")