summaryrefslogblamecommitdiffstats
path: root/tests/split-register-types
blob: 454d836ae63795be2ca351ff129ba1c68bae3b28 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15














                                                                                        
                                                                                                                          





















































                                                                                                             
# -*- 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]\{1,\}_[A-Z]\{1,\}_\([0-9]\{1,\}\)$/\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