|
Packit |
5c3484 |
#! /bin/sh
|
|
Packit |
5c3484 |
#
|
|
Packit |
5c3484 |
# Copyright 2000 Free Software Foundation, Inc.
|
|
Packit |
5c3484 |
#
|
|
Packit |
5c3484 |
# This file is part of the GNU MP Library.
|
|
Packit |
5c3484 |
#
|
|
Packit |
5c3484 |
# The GNU MP Library is free software; you can redistribute it and/or modify
|
|
Packit |
5c3484 |
# it under the terms of either:
|
|
Packit |
5c3484 |
#
|
|
Packit |
5c3484 |
# * the GNU Lesser General Public License as published by the Free
|
|
Packit |
5c3484 |
# Software Foundation; either version 3 of the License, or (at your
|
|
Packit |
5c3484 |
# option) any later version.
|
|
Packit |
5c3484 |
#
|
|
Packit |
5c3484 |
# or
|
|
Packit |
5c3484 |
#
|
|
Packit |
5c3484 |
# * the GNU General Public License as published by the Free Software
|
|
Packit |
5c3484 |
# Foundation; either version 2 of the License, or (at your option) any
|
|
Packit |
5c3484 |
# later version.
|
|
Packit |
5c3484 |
#
|
|
Packit |
5c3484 |
# or both in parallel, as here.
|
|
Packit |
5c3484 |
#
|
|
Packit |
5c3484 |
# The GNU MP Library is distributed in the hope that it will be useful, but
|
|
Packit |
5c3484 |
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
Packit |
5c3484 |
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
Packit |
5c3484 |
# for more details.
|
|
Packit |
5c3484 |
#
|
|
Packit |
5c3484 |
# You should have received copies of the GNU General Public License and the
|
|
Packit |
5c3484 |
# GNU Lesser General Public License along with the GNU MP Library. If not,
|
|
Packit |
5c3484 |
# see https://www.gnu.org/licenses/.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
# Usage: cd $(builddir)/mpn
|
|
Packit |
5c3484 |
# $(srcdir)/x86/t-zdisp.sh
|
|
Packit |
5c3484 |
#
|
|
Packit |
5c3484 |
# Run the Zdisp() macro instructions through the assembler to check
|
|
Packit |
5c3484 |
# the encodings used. Mismatches are printed, no output means all ok.
|
|
Packit |
5c3484 |
#
|
|
Packit |
5c3484 |
# This program is only meant for use during development. It can be
|
|
Packit |
5c3484 |
# run in the mpn build directory of any x86 configuration.
|
|
Packit |
5c3484 |
#
|
|
Packit |
5c3484 |
# For this test the assembler needs to generate byte sized 0
|
|
Packit |
5c3484 |
# displacements when given something like 0(%eax). Recent versions of
|
|
Packit |
5c3484 |
# gas are suitable (eg. 2.9.x or 2.10.x).
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
set -e
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
cat >tmp-zdisptest.asm <<\EOF
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
include(`../config.m4')
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
dnl Redefine Zdisp_match to output its pattern and encoding.
|
|
Packit |
5c3484 |
define(`Zdisp_match',
|
|
Packit |
5c3484 |
`define(`Zdisp_found',1)dnl
|
|
Packit |
5c3484 |
ifelse(`$2',0,` $1 $2$3, $4')`'dnl
|
|
Packit |
5c3484 |
ifelse(`$3',0,` $1 $2, $3$4')`'dnl
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
.byte $5
|
|
Packit |
5c3484 |
')
|
|
Packit |
5c3484 |
.text
|
|
Packit |
5c3484 |
Zdisp()
|
|
Packit |
5c3484 |
EOF
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
m4 tmp-zdisptest.asm >tmp-zdisptest.s
|
|
Packit |
5c3484 |
as -o tmp-zdisptest.o tmp-zdisptest.s
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
# Demand duplicates from the instruction patterns and byte encodings.
|
|
Packit |
5c3484 |
objdump -d tmp-zdisptest.o | awk '
|
|
Packit |
5c3484 |
/^ *[a-z0-9]+:/ {
|
|
Packit |
5c3484 |
sub(/^ *[a-z0-9]+:/,"")
|
|
Packit |
5c3484 |
print
|
|
Packit |
5c3484 |
}' | sort | uniq -u
|