d: Merge upstream dmd, druntime 2bbf64907c, phobos b64bfbf91
[official-gcc.git] / libgcc / gen-fixed.sh
blob774996110706da973de9026b7c2f7091fedfe62c
1 #!/bin/sh
3 # Worker script for libgcc/Makefile.in
4 # Generate lists of fixed-point labels, funcs, modes, from, to.
5 # Usage:
6 # gen-fixed.sh arith labels
7 # gen-fixed.sh arith funcs
8 # gen-fixed.sh arith modes
9 # gen-fixed.sh conv labels
10 # gen-fixed.sh conv funcs
11 # gen-fixed.sh conv from
12 # gen-fixed.sh conv to
14 fixed_sfract_modes="QQ HQ SQ DQ TQ HA SA DA TA"
15 fixed_ufract_modes="UQQ UHQ USQ UDQ UTQ UHA USA UDA UTA"
16 fixed_fract_modes="$fixed_sfract_modes $fixed_ufract_modes"
18 fixed_signed_modes="QI HI SI DI TI SF DF"
19 fixed_unsigned_modes="UQI UHI USI UDI UTI"
21 fixed_func_names="_add _sub _neg _mul _mulhelper _divhelper _ashl _ashlhelper _cmp _saturate1 _saturate2"
22 fixed_sfunc_names="_ssadd _sssub _ssneg _ssmul _ssdiv _div _ssashl _ashr"
23 fixed_ufunc_names="_usadd _ussub _usneg _usmul _usdiv _udiv _usashl _lshr"
25 # emit the function information
26 # $1 = output type selector
27 # $2 = base function name
28 # $3 = from mode
29 # $4 = to mode
30 emit ()
32 if [ "$3" != "$4" ]; then
33 case "$1" in
34 labels)
35 echo $2 ;;
36 from | modes)
37 echo $3 ;;
38 to)
39 echo $4 ;;
40 funcs)
41 echo $2$3$4 ;;
42 esac
46 case "$1" in
47 arith)
48 for n in $fixed_func_names; do
49 for m in $fixed_fract_modes; do
50 emit $2 $n $m
51 done
52 done
54 for n in $fixed_sfunc_names; do
55 for m in $fixed_sfract_modes; do
56 emit $2 $n $m
57 done
58 done
60 for n in $fixed_ufunc_names; do
61 for m in $fixed_ufract_modes; do
62 emit $2 $n $m
63 done
64 done
67 conv)
68 for f in $fixed_fract_modes; do
69 for t in $fixed_fract_modes $fixed_signed_modes; do
70 emit $2 _fract $f $t
71 done
72 done
74 for f in $fixed_signed_modes; do
75 for t in $fixed_fract_modes; do
76 emit $2 _fract $f $t
77 done
78 done
80 for f in $fixed_fract_modes $fixed_signed_modes; do
81 for t in $fixed_fract_modes; do
82 emit $2 _satfract $f $t
83 done
84 done
86 for f in $fixed_fract_modes; do
87 for t in $fixed_unsigned_modes; do
88 emit $2 _fractuns $f $t
89 done
90 done
92 for f in $fixed_unsigned_modes; do
93 for t in $fixed_fract_modes; do
94 emit $2 _fractuns $f $t
95 done
96 done
98 for f in $fixed_unsigned_modes; do
99 for t in $fixed_fract_modes; do
100 emit $2 _satfractuns $f $t
101 done
102 done
105 esac