OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgcc/] [gen-fixed.sh] - Blame information for rev 784

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 734 jeremybenn
#!/bin/sh
2
 
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
13
 
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"
17
 
18
fixed_signed_modes="QI HI SI DI TI SF DF"
19
fixed_unsigned_modes="UQI UHI USI UDI UTI"
20
 
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"
24
 
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 ()
31
{
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
43
    fi
44
}
45
 
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
53
 
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
59
 
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
65
    ;;
66
 
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
73
 
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
79
 
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
85
 
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
91
 
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
97
 
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
103
    ;;
104
 
105
esac

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.