summaryrefslogtreecommitdiffstats
path: root/tests/split-register-types
diff options
context:
space:
mode:
Diffstat (limited to 'tests/split-register-types')
-rw-r--r--tests/split-register-types70
1 files changed, 70 insertions, 0 deletions
diff --git a/tests/split-register-types b/tests/split-register-types
new file mode 100644
index 0000000..3b3070b
--- /dev/null
+++ b/tests/split-register-types
@@ -0,0 +1,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