beta-0.89.2
[luatex.git] / source / libs / gmp / gmp-src / mpn / x86 / t-zdisp.sh
blob61efdd6c4fffddea3b5020a1e5263c9929a3f383
1 #! /bin/sh
3 # Copyright 2000 Free Software Foundation, Inc.
5 # This file is part of the GNU MP Library.
7 # The GNU MP Library is free software; you can redistribute it and/or modify
8 # it under the terms of either:
10 # * the GNU Lesser General Public License as published by the Free
11 # Software Foundation; either version 3 of the License, or (at your
12 # option) any later version.
14 # or
16 # * the GNU General Public License as published by the Free Software
17 # Foundation; either version 2 of the License, or (at your option) any
18 # later version.
20 # or both in parallel, as here.
22 # The GNU MP Library is distributed in the hope that it will be useful, but
23 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 # for more details.
27 # You should have received copies of the GNU General Public License and the
28 # GNU Lesser General Public License along with the GNU MP Library. If not,
29 # see https://www.gnu.org/licenses/.
32 # Usage: cd $(builddir)/mpn
33 # $(srcdir)/x86/t-zdisp.sh
35 # Run the Zdisp() macro instructions through the assembler to check
36 # the encodings used. Mismatches are printed, no output means all ok.
38 # This program is only meant for use during development. It can be
39 # run in the mpn build directory of any x86 configuration.
41 # For this test the assembler needs to generate byte sized 0
42 # displacements when given something like 0(%eax). Recent versions of
43 # gas are suitable (eg. 2.9.x or 2.10.x).
45 set -e
47 cat >tmp-zdisptest.asm <<\EOF
49 include(`../config.m4')
51 dnl Redefine Zdisp_match to output its pattern and encoding.
52 define(`Zdisp_match',
53 `define(`Zdisp_found',1)dnl
54 ifelse(`$2',0,` $1 $2$3, $4')`'dnl
55 ifelse(`$3',0,` $1 $2, $3$4')`'dnl
57 .byte $5
59 .text
60 Zdisp()
61 EOF
63 m4 tmp-zdisptest.asm >tmp-zdisptest.s
64 as -o tmp-zdisptest.o tmp-zdisptest.s
66 # Demand duplicates from the instruction patterns and byte encodings.
67 objdump -d tmp-zdisptest.o | awk '
68 /^ *[a-z0-9]+:/ {
69 sub(/^ *[a-z0-9]+:/,"")
70 print
71 }' | sort | uniq -u