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