convert_floating_point_to_mmx_integer.py revision 7087:fb8d5786ff30
17584SAli.Saidi@arm.com# Copyright (c) 2007 The Hewlett-Packard Development Company
27584SAli.Saidi@arm.com# All rights reserved.
37584SAli.Saidi@arm.com#
47584SAli.Saidi@arm.com# The license below extends only to copyright in the software and shall
57584SAli.Saidi@arm.com# not be construed as granting a license to any other intellectual
67584SAli.Saidi@arm.com# property including but not limited to intellectual property relating
77584SAli.Saidi@arm.com# to a hardware implementation of the functionality of the software
87584SAli.Saidi@arm.com# licensed hereunder.  You may use the software subject to the license
97584SAli.Saidi@arm.com# terms below provided that you ensure that this notice is replicated
107584SAli.Saidi@arm.com# unmodified and in its entirety in all distributions of the software,
117584SAli.Saidi@arm.com# modified or unmodified, in source code or in binary form.
127584SAli.Saidi@arm.com#
137584SAli.Saidi@arm.com# Redistribution and use in source and binary forms, with or without
147584SAli.Saidi@arm.com# modification, are permitted provided that the following conditions are
157584SAli.Saidi@arm.com# met: redistributions of source code must retain the above copyright
167584SAli.Saidi@arm.com# notice, this list of conditions and the following disclaimer;
177584SAli.Saidi@arm.com# redistributions in binary form must reproduce the above copyright
187584SAli.Saidi@arm.com# notice, this list of conditions and the following disclaimer in the
197584SAli.Saidi@arm.com# documentation and/or other materials provided with the distribution;
207584SAli.Saidi@arm.com# neither the name of the copyright holders nor the names of its
217584SAli.Saidi@arm.com# contributors may be used to endorse or promote products derived from
227584SAli.Saidi@arm.com# this software without specific prior written permission.
237584SAli.Saidi@arm.com#
247584SAli.Saidi@arm.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
257584SAli.Saidi@arm.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
267584SAli.Saidi@arm.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
277584SAli.Saidi@arm.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
287584SAli.Saidi@arm.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
297584SAli.Saidi@arm.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
307584SAli.Saidi@arm.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
317584SAli.Saidi@arm.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
327584SAli.Saidi@arm.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
337584SAli.Saidi@arm.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
347584SAli.Saidi@arm.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
357584SAli.Saidi@arm.com#
367584SAli.Saidi@arm.com# Authors: Gabe Black
377584SAli.Saidi@arm.com
387584SAli.Saidi@arm.commicrocode = '''
397584SAli.Saidi@arm.comdef macroop CVTPS2PI_MMX_XMM {
407584SAli.Saidi@arm.com    cvtf2i mmx, xmmlm, size=4, ext=4
417584SAli.Saidi@arm.com};
427584SAli.Saidi@arm.com
437584SAli.Saidi@arm.comdef macroop CVTPS2PI_MMX_M {
447584SAli.Saidi@arm.com    ldfp ufp1, seg, sib, disp, dataSize=8
457584SAli.Saidi@arm.com    cvtf2i mmx, ufp1, size=4, ext=4
467584SAli.Saidi@arm.com};
477584SAli.Saidi@arm.com
487584SAli.Saidi@arm.comdef macroop CVTPS2PI_MMX_P {
497584SAli.Saidi@arm.com    rdip t7
507584SAli.Saidi@arm.com    ldfp ufp1, seg, riprel, disp, dataSize=8
517584SAli.Saidi@arm.com    cvtf2i mmx, ufp1, size=4, ext=4
527584SAli.Saidi@arm.com};
537587SAli.Saidi@arm.com
547587SAli.Saidi@arm.comdef macroop CVTPD2PI_MMX_XMM {
557587SAli.Saidi@arm.com    cvtf2i mmx, xmmlm, srcSize=8, destSize=4, ext=4
567587SAli.Saidi@arm.com    cvtf2i mmx, xmmhm, srcSize=8, destSize=4, ext=(4 | 2)
577587SAli.Saidi@arm.com};
587587SAli.Saidi@arm.com
597587SAli.Saidi@arm.comdef macroop CVTPD2PI_MMX_M {
607584SAli.Saidi@arm.com    ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8
617587SAli.Saidi@arm.com    ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8
627584SAli.Saidi@arm.com    cvtf2i mmx, ufp1, srcSize=8, destSize=4, ext=4
637587SAli.Saidi@arm.com    cvtf2i mmx, ufp2, srcSize=8, destSize=4, ext=(4 | 2)
647584SAli.Saidi@arm.com};
657584SAli.Saidi@arm.com
667584SAli.Saidi@arm.comdef macroop CVTPD2PI_MMX_P {
677584SAli.Saidi@arm.com    rdip t7
687584SAli.Saidi@arm.com    ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8
697587SAli.Saidi@arm.com    ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8
707584SAli.Saidi@arm.com    cvtf2i mmx, ufp1, srcSize=8, destSize=4, ext=4
717587SAli.Saidi@arm.com    cvtf2i mmx, ufp2, srcSize=8, destSize=4, ext=(4 | 2)
727587SAli.Saidi@arm.com};
737584SAli.Saidi@arm.com
747587SAli.Saidi@arm.comdef macroop CVTTPS2PI_MMX_XMM {
757584SAli.Saidi@arm.com    cvtf2i mmx, xmmlm, size=4, ext=0
767584SAli.Saidi@arm.com};
777584SAli.Saidi@arm.com
787587SAli.Saidi@arm.comdef macroop CVTTPS2PI_MMX_M {
79    ldfp ufp1, seg, sib, disp, dataSize=8
80    cvtf2i mmx, ufp1, size=4, ext=0
81};
82
83def macroop CVTTPS2PI_MMX_P {
84    rdip t7
85    ldfp ufp1, seg, riprel, disp, dataSize=8
86    cvtf2i mmx, ufp1, size=4, ext=0
87};
88
89def macroop CVTTPD2PI_MMX_XMM {
90    cvtf2i mmx, xmmlm, srcSize=8, destSize=4, ext=0
91    cvtf2i mmx, xmmhm, srcSize=8, destSize=4, ext=2
92};
93
94def macroop CVTTPD2PI_MMX_M {
95    ldfp ufp1, seg, sib, "DISPLACEMENT", dataSize=8
96    ldfp ufp2, seg, sib, "DISPLACEMENT + 8", dataSize=8
97    cvtf2i mmx, ufp1, srcSize=8, destSize=4, ext=0
98    cvtf2i mmx, ufp2, srcSize=8, destSize=4, ext=2
99};
100
101def macroop CVTTPD2PI_MMX_P {
102    rdip t7
103    ldfp ufp1, seg, riprel, "DISPLACEMENT", dataSize=8
104    ldfp ufp2, seg, riprel, "DISPLACEMENT + 8", dataSize=8
105    cvtf2i mmx, ufp1, srcSize=8, destSize=4, ext=0
106    cvtf2i mmx, ufp2, srcSize=8, destSize=4, ext=2
107};
108'''
109