summaryrefslogtreecommitdiffstats
path: root/tests/split-register-types
blob: 3b3070b2d4c5bc435939193f1d91519f9a343f15 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# -*- sh -*-
# See LICENSE file for copyright and license details.

upper_half=$(getnum SECTION UPPER_HALF)
lower_half=$(getnum SECTION LOWER_HALF)
for os in $(getnamelist OS); do
	osn=$(getnum OS $os)
	for arch in $(getnamelist ARCH); do
		archn=$(getnum ARCH $arch)
		if ! issupported $os $arch; then
			continue
		fi

		for stype in INT64_HIGH_32 INT64_LOW_32 INT64_FRONT_32 INT64_BACK_32; do
			utype=U$stype
			rtype="$(printf '%s\n' "$stype" | sed 's/^\(INT\)[0-9]\+_[A-Z]\+_\([0-9]\+\)$/\1\2/')"
			test ! "$rtype" = "$stype"
			rtypen=$(lookupnum "$types" $rtype)
			stypen=$(lookupnum "$types" $stype)
			utypen=$(lookupnum "$types" $utype)
			test -n "$rtypen"
			test -n "$stypen"
			test -n "$utypen"

			get-datatype-description.tu $osn $archn $rtypen $os $arch $rtype \
			| grep -v "^section = " > $a
			get-datatype-description.tu $osn $archn $stypen $os $arch $stype \
			| grep -v "^section = " > $b
			diff -u $a $b

			get-datatype-description.tu $osn $archn $stypen $os $arch $stype \
			| sed -e 's/^\(is_signed =\) .$/\1 0/' -e 's/^\(is_unsigned =\) .$/\1 1/' > $a
			get-datatype-description.tu $osn $archn $utypen $os $arch $utype > $b
			diff -u $a $b
		done

		type=INT64_HIGH_32
		get-datatype-description.tu $osn $archn $(lookupnum "$types" $type) $os $arch $type \
		| grep "^section = ${upper_half}"\$ >/dev/null

		type=INT64_LOW_32
		get-datatype-description.tu $osn $archn $(lookupnum "$types" $type) $os $arch $type \
		| grep "^section = ${lower_half}"\$ >/dev/null

		endian=$(getendian $arch)
		if test $endian = Little; then

			type=INT64_FRONT_32
			get-datatype-description.tu $osn $archn $(lookupnum "$types" $type) $os $arch $type \
			| grep "^section = ${lower_half}"\$ >/dev/null

			type=INT64_BACK_32
			get-datatype-description.tu $osn $archn $(lookupnum "$types" $type) $os $arch $type \
			| grep "^section = ${upper_half}"\$ >/dev/null

		elif test $endian = Big; then

			type=INT64_FRONT_32
			get-datatype-description.tu $osn $archn $(lookupnum "$types" $type) $os $arch $type \
			| grep "^section = ${upper_half}"\$ >/dev/null

			type=INT64_BACK_32
			get-datatype-description.tu $osn $archn $(lookupnum "$types" $type) $os $arch $type \
			| grep "^section = ${lower_half}"\$ >/dev/null

		else
			false # that's all we have for now
		fi
	done
done