neon.isa revision 13978
17639Sgblack@eecs.umich.edu// -*- mode:c++ -*- 27639Sgblack@eecs.umich.edu 313978Sciro.santilli@arm.com// Copyright (c) 2010-2011, 2015, 2019 ARM Limited 47639Sgblack@eecs.umich.edu// All rights reserved 57639Sgblack@eecs.umich.edu// 67639Sgblack@eecs.umich.edu// The license below extends only to copyright in the software and shall 77639Sgblack@eecs.umich.edu// not be construed as granting a license to any other intellectual 87639Sgblack@eecs.umich.edu// property including but not limited to intellectual property relating 97639Sgblack@eecs.umich.edu// to a hardware implementation of the functionality of the software 107639Sgblack@eecs.umich.edu// licensed hereunder. You may use the software subject to the license 117639Sgblack@eecs.umich.edu// terms below provided that you ensure that this notice is replicated 127639Sgblack@eecs.umich.edu// unmodified and in its entirety in all distributions of the software, 137639Sgblack@eecs.umich.edu// modified or unmodified, in source code or in binary form. 147639Sgblack@eecs.umich.edu// 157639Sgblack@eecs.umich.edu// Redistribution and use in source and binary forms, with or without 167639Sgblack@eecs.umich.edu// modification, are permitted provided that the following conditions are 177639Sgblack@eecs.umich.edu// met: redistributions of source code must retain the above copyright 187639Sgblack@eecs.umich.edu// notice, this list of conditions and the following disclaimer; 197639Sgblack@eecs.umich.edu// redistributions in binary form must reproduce the above copyright 207639Sgblack@eecs.umich.edu// notice, this list of conditions and the following disclaimer in the 217639Sgblack@eecs.umich.edu// documentation and/or other materials provided with the distribution; 227639Sgblack@eecs.umich.edu// neither the name of the copyright holders nor the names of its 237639Sgblack@eecs.umich.edu// contributors may be used to endorse or promote products derived from 247639Sgblack@eecs.umich.edu// this software without specific prior written permission. 257639Sgblack@eecs.umich.edu// 267639Sgblack@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 277639Sgblack@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 287639Sgblack@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 297639Sgblack@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 307639Sgblack@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 317639Sgblack@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 327639Sgblack@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 337639Sgblack@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 347639Sgblack@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 357639Sgblack@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 367639Sgblack@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 377639Sgblack@eecs.umich.edu// 387639Sgblack@eecs.umich.edu// Authors: Gabe Black 397639Sgblack@eecs.umich.edu 407639Sgblack@eecs.umich.eduoutput header {{ 417639Sgblack@eecs.umich.edu template <template <typename T> class Base> 427639Sgblack@eecs.umich.edu StaticInstPtr 437639Sgblack@eecs.umich.edu decodeNeonUThreeUReg(unsigned size, 447639Sgblack@eecs.umich.edu ExtMachInst machInst, IntRegIndex dest, 457639Sgblack@eecs.umich.edu IntRegIndex op1, IntRegIndex op2) 467639Sgblack@eecs.umich.edu { 477639Sgblack@eecs.umich.edu switch (size) { 487639Sgblack@eecs.umich.edu case 0: 497639Sgblack@eecs.umich.edu return new Base<uint8_t>(machInst, dest, op1, op2); 507639Sgblack@eecs.umich.edu case 1: 517639Sgblack@eecs.umich.edu return new Base<uint16_t>(machInst, dest, op1, op2); 527639Sgblack@eecs.umich.edu case 2: 537639Sgblack@eecs.umich.edu return new Base<uint32_t>(machInst, dest, op1, op2); 547639Sgblack@eecs.umich.edu case 3: 557639Sgblack@eecs.umich.edu return new Base<uint64_t>(machInst, dest, op1, op2); 567639Sgblack@eecs.umich.edu default: 577639Sgblack@eecs.umich.edu return new Unknown(machInst); 587639Sgblack@eecs.umich.edu } 597639Sgblack@eecs.umich.edu } 607639Sgblack@eecs.umich.edu 617639Sgblack@eecs.umich.edu template <template <typename T> class Base> 627639Sgblack@eecs.umich.edu StaticInstPtr 637639Sgblack@eecs.umich.edu decodeNeonSThreeUReg(unsigned size, 647639Sgblack@eecs.umich.edu ExtMachInst machInst, IntRegIndex dest, 657639Sgblack@eecs.umich.edu IntRegIndex op1, IntRegIndex op2) 667639Sgblack@eecs.umich.edu { 677639Sgblack@eecs.umich.edu switch (size) { 687639Sgblack@eecs.umich.edu case 0: 697639Sgblack@eecs.umich.edu return new Base<int8_t>(machInst, dest, op1, op2); 707639Sgblack@eecs.umich.edu case 1: 717639Sgblack@eecs.umich.edu return new Base<int16_t>(machInst, dest, op1, op2); 727639Sgblack@eecs.umich.edu case 2: 737639Sgblack@eecs.umich.edu return new Base<int32_t>(machInst, dest, op1, op2); 747639Sgblack@eecs.umich.edu case 3: 757639Sgblack@eecs.umich.edu return new Base<int64_t>(machInst, dest, op1, op2); 767639Sgblack@eecs.umich.edu default: 777639Sgblack@eecs.umich.edu return new Unknown(machInst); 787639Sgblack@eecs.umich.edu } 797639Sgblack@eecs.umich.edu } 807639Sgblack@eecs.umich.edu 817639Sgblack@eecs.umich.edu template <template <typename T> class Base> 827639Sgblack@eecs.umich.edu StaticInstPtr 837639Sgblack@eecs.umich.edu decodeNeonUSThreeUReg(bool notSigned, unsigned size, 847639Sgblack@eecs.umich.edu ExtMachInst machInst, IntRegIndex dest, 857639Sgblack@eecs.umich.edu IntRegIndex op1, IntRegIndex op2) 867639Sgblack@eecs.umich.edu { 877639Sgblack@eecs.umich.edu if (notSigned) { 887639Sgblack@eecs.umich.edu return decodeNeonUThreeUReg<Base>(size, machInst, dest, op1, op2); 897639Sgblack@eecs.umich.edu } else { 907639Sgblack@eecs.umich.edu return decodeNeonSThreeUReg<Base>(size, machInst, dest, op1, op2); 917639Sgblack@eecs.umich.edu } 927639Sgblack@eecs.umich.edu } 937639Sgblack@eecs.umich.edu 947639Sgblack@eecs.umich.edu template <template <typename T> class Base> 957639Sgblack@eecs.umich.edu StaticInstPtr 967639Sgblack@eecs.umich.edu decodeNeonUThreeUSReg(unsigned size, 9710037SARM gem5 Developers ExtMachInst machInst, IntRegIndex dest, 9810037SARM gem5 Developers IntRegIndex op1, IntRegIndex op2) 997639Sgblack@eecs.umich.edu { 1007639Sgblack@eecs.umich.edu switch (size) { 1017639Sgblack@eecs.umich.edu case 0: 1027639Sgblack@eecs.umich.edu return new Base<uint8_t>(machInst, dest, op1, op2); 1037639Sgblack@eecs.umich.edu case 1: 1047639Sgblack@eecs.umich.edu return new Base<uint16_t>(machInst, dest, op1, op2); 1057639Sgblack@eecs.umich.edu case 2: 1067639Sgblack@eecs.umich.edu return new Base<uint32_t>(machInst, dest, op1, op2); 1077639Sgblack@eecs.umich.edu default: 1087639Sgblack@eecs.umich.edu return new Unknown(machInst); 1097639Sgblack@eecs.umich.edu } 1107639Sgblack@eecs.umich.edu } 1117639Sgblack@eecs.umich.edu 1127639Sgblack@eecs.umich.edu template <template <typename T> class Base> 1137639Sgblack@eecs.umich.edu StaticInstPtr 1147639Sgblack@eecs.umich.edu decodeNeonSThreeUSReg(unsigned size, 11510037SARM gem5 Developers ExtMachInst machInst, IntRegIndex dest, 11610037SARM gem5 Developers IntRegIndex op1, IntRegIndex op2) 1177639Sgblack@eecs.umich.edu { 1187639Sgblack@eecs.umich.edu switch (size) { 1197639Sgblack@eecs.umich.edu case 0: 1207639Sgblack@eecs.umich.edu return new Base<int8_t>(machInst, dest, op1, op2); 1217639Sgblack@eecs.umich.edu case 1: 1227639Sgblack@eecs.umich.edu return new Base<int16_t>(machInst, dest, op1, op2); 1237639Sgblack@eecs.umich.edu case 2: 1247639Sgblack@eecs.umich.edu return new Base<int32_t>(machInst, dest, op1, op2); 1257639Sgblack@eecs.umich.edu default: 1267639Sgblack@eecs.umich.edu return new Unknown(machInst); 1277639Sgblack@eecs.umich.edu } 1287639Sgblack@eecs.umich.edu } 1297639Sgblack@eecs.umich.edu 1307639Sgblack@eecs.umich.edu template <template <typename T> class Base> 1317639Sgblack@eecs.umich.edu StaticInstPtr 13210037SARM gem5 Developers decodeNeonSThreeHAndWReg(unsigned size, ExtMachInst machInst, 13310037SARM gem5 Developers IntRegIndex dest, IntRegIndex op1, 13410037SARM gem5 Developers IntRegIndex op2) 13510037SARM gem5 Developers { 13610037SARM gem5 Developers switch (size) { 13710037SARM gem5 Developers case 1: 13810037SARM gem5 Developers return new Base<int16_t>(machInst, dest, op1, op2); 13910037SARM gem5 Developers case 2: 14010037SARM gem5 Developers return new Base<int32_t>(machInst, dest, op1, op2); 14110037SARM gem5 Developers default: 14210037SARM gem5 Developers return new Unknown(machInst); 14310037SARM gem5 Developers } 14410037SARM gem5 Developers } 14510037SARM gem5 Developers 14610037SARM gem5 Developers template <template <typename T> class Base> 14710037SARM gem5 Developers StaticInstPtr 14810037SARM gem5 Developers decodeNeonSThreeImmHAndWReg(unsigned size, ExtMachInst machInst, 14910037SARM gem5 Developers IntRegIndex dest, IntRegIndex op1, 15010037SARM gem5 Developers IntRegIndex op2, uint64_t imm) 15110037SARM gem5 Developers { 15210037SARM gem5 Developers switch (size) { 15310037SARM gem5 Developers case 1: 15410037SARM gem5 Developers return new Base<int16_t>(machInst, dest, op1, op2, imm); 15510037SARM gem5 Developers case 2: 15610037SARM gem5 Developers return new Base<int32_t>(machInst, dest, op1, op2, imm); 15710037SARM gem5 Developers default: 15810037SARM gem5 Developers return new Unknown(machInst); 15910037SARM gem5 Developers } 16010037SARM gem5 Developers } 16110037SARM gem5 Developers 16210037SARM gem5 Developers template <template <typename T> class Base> 16310037SARM gem5 Developers StaticInstPtr 1647639Sgblack@eecs.umich.edu decodeNeonUSThreeUSReg(bool notSigned, unsigned size, 1657639Sgblack@eecs.umich.edu ExtMachInst machInst, IntRegIndex dest, 1667639Sgblack@eecs.umich.edu IntRegIndex op1, IntRegIndex op2) 1677639Sgblack@eecs.umich.edu { 1687639Sgblack@eecs.umich.edu if (notSigned) { 1697639Sgblack@eecs.umich.edu return decodeNeonUThreeUSReg<Base>( 1707639Sgblack@eecs.umich.edu size, machInst, dest, op1, op2); 1717639Sgblack@eecs.umich.edu } else { 1727639Sgblack@eecs.umich.edu return decodeNeonSThreeUSReg<Base>( 1737639Sgblack@eecs.umich.edu size, machInst, dest, op1, op2); 1747639Sgblack@eecs.umich.edu } 1757639Sgblack@eecs.umich.edu } 1767639Sgblack@eecs.umich.edu 1777639Sgblack@eecs.umich.edu template <template <typename T> class BaseD, 1787639Sgblack@eecs.umich.edu template <typename T> class BaseQ> 1797639Sgblack@eecs.umich.edu StaticInstPtr 1807639Sgblack@eecs.umich.edu decodeNeonUThreeSReg(bool q, unsigned size, 1817639Sgblack@eecs.umich.edu ExtMachInst machInst, IntRegIndex dest, 1827639Sgblack@eecs.umich.edu IntRegIndex op1, IntRegIndex op2) 1837639Sgblack@eecs.umich.edu { 1847639Sgblack@eecs.umich.edu if (q) { 1857639Sgblack@eecs.umich.edu return decodeNeonUThreeUSReg<BaseQ>( 1867639Sgblack@eecs.umich.edu size, machInst, dest, op1, op2); 1877639Sgblack@eecs.umich.edu } else { 1887639Sgblack@eecs.umich.edu return decodeNeonUThreeUSReg<BaseD>( 1897639Sgblack@eecs.umich.edu size, machInst, dest, op1, op2); 1907639Sgblack@eecs.umich.edu } 1917639Sgblack@eecs.umich.edu } 1927639Sgblack@eecs.umich.edu 1937639Sgblack@eecs.umich.edu template <template <typename T> class BaseD, 1947639Sgblack@eecs.umich.edu template <typename T> class BaseQ> 1957639Sgblack@eecs.umich.edu StaticInstPtr 1967639Sgblack@eecs.umich.edu decodeNeonSThreeSReg(bool q, unsigned size, 1977639Sgblack@eecs.umich.edu ExtMachInst machInst, IntRegIndex dest, 1987639Sgblack@eecs.umich.edu IntRegIndex op1, IntRegIndex op2) 1997639Sgblack@eecs.umich.edu { 2007639Sgblack@eecs.umich.edu if (q) { 2017639Sgblack@eecs.umich.edu return decodeNeonSThreeUSReg<BaseQ>( 2027639Sgblack@eecs.umich.edu size, machInst, dest, op1, op2); 2037639Sgblack@eecs.umich.edu } else { 2047639Sgblack@eecs.umich.edu return decodeNeonSThreeUSReg<BaseD>( 2057639Sgblack@eecs.umich.edu size, machInst, dest, op1, op2); 2067639Sgblack@eecs.umich.edu } 2077639Sgblack@eecs.umich.edu } 2087639Sgblack@eecs.umich.edu 2097639Sgblack@eecs.umich.edu template <template <typename T> class BaseD, 2107639Sgblack@eecs.umich.edu template <typename T> class BaseQ> 2117639Sgblack@eecs.umich.edu StaticInstPtr 21210037SARM gem5 Developers decodeNeonSThreeXReg(bool q, unsigned size, 21310037SARM gem5 Developers ExtMachInst machInst, IntRegIndex dest, 21410037SARM gem5 Developers IntRegIndex op1, IntRegIndex op2) 21510037SARM gem5 Developers { 21610037SARM gem5 Developers if (q) { 21710037SARM gem5 Developers return decodeNeonSThreeUReg<BaseQ>( 21810037SARM gem5 Developers size, machInst, dest, op1, op2); 21910037SARM gem5 Developers } else { 22010037SARM gem5 Developers return decodeNeonSThreeUSReg<BaseD>( 22110037SARM gem5 Developers size, machInst, dest, op1, op2); 22210037SARM gem5 Developers } 22310037SARM gem5 Developers } 22410037SARM gem5 Developers 22510037SARM gem5 Developers template <template <typename T> class BaseD, 22610037SARM gem5 Developers template <typename T> class BaseQ> 22710037SARM gem5 Developers StaticInstPtr 22810037SARM gem5 Developers decodeNeonUThreeXReg(bool q, unsigned size, 22910037SARM gem5 Developers ExtMachInst machInst, IntRegIndex dest, 23010037SARM gem5 Developers IntRegIndex op1, IntRegIndex op2) 23110037SARM gem5 Developers { 23210037SARM gem5 Developers if (q) { 23310037SARM gem5 Developers return decodeNeonUThreeUReg<BaseQ>( 23410037SARM gem5 Developers size, machInst, dest, op1, op2); 23510037SARM gem5 Developers } else { 23610037SARM gem5 Developers return decodeNeonUThreeUSReg<BaseD>( 23710037SARM gem5 Developers size, machInst, dest, op1, op2); 23810037SARM gem5 Developers } 23910037SARM gem5 Developers } 24010037SARM gem5 Developers 24110037SARM gem5 Developers template <template <typename T> class BaseD, 24210037SARM gem5 Developers template <typename T> class BaseQ> 24310037SARM gem5 Developers StaticInstPtr 2447639Sgblack@eecs.umich.edu decodeNeonUSThreeSReg(bool q, bool notSigned, unsigned size, 2457639Sgblack@eecs.umich.edu ExtMachInst machInst, IntRegIndex dest, 2467639Sgblack@eecs.umich.edu IntRegIndex op1, IntRegIndex op2) 2477639Sgblack@eecs.umich.edu { 2487639Sgblack@eecs.umich.edu if (notSigned) { 2497639Sgblack@eecs.umich.edu return decodeNeonUThreeSReg<BaseD, BaseQ>( 2507639Sgblack@eecs.umich.edu q, size, machInst, dest, op1, op2); 2517639Sgblack@eecs.umich.edu } else { 2527639Sgblack@eecs.umich.edu return decodeNeonSThreeSReg<BaseD, BaseQ>( 2537639Sgblack@eecs.umich.edu q, size, machInst, dest, op1, op2); 2547639Sgblack@eecs.umich.edu } 2557639Sgblack@eecs.umich.edu } 2567639Sgblack@eecs.umich.edu 2577639Sgblack@eecs.umich.edu template <template <typename T> class BaseD, 2587639Sgblack@eecs.umich.edu template <typename T> class BaseQ> 2597639Sgblack@eecs.umich.edu StaticInstPtr 2607639Sgblack@eecs.umich.edu decodeNeonUThreeReg(bool q, unsigned size, 2617639Sgblack@eecs.umich.edu ExtMachInst machInst, IntRegIndex dest, 2627639Sgblack@eecs.umich.edu IntRegIndex op1, IntRegIndex op2) 2637639Sgblack@eecs.umich.edu { 2647639Sgblack@eecs.umich.edu if (q) { 2657639Sgblack@eecs.umich.edu return decodeNeonUThreeUReg<BaseQ>( 2667639Sgblack@eecs.umich.edu size, machInst, dest, op1, op2); 2677639Sgblack@eecs.umich.edu } else { 2687639Sgblack@eecs.umich.edu return decodeNeonUThreeUReg<BaseD>( 2697639Sgblack@eecs.umich.edu size, machInst, dest, op1, op2); 2707639Sgblack@eecs.umich.edu } 2717639Sgblack@eecs.umich.edu } 2727639Sgblack@eecs.umich.edu 2737639Sgblack@eecs.umich.edu template <template <typename T> class BaseD, 2747639Sgblack@eecs.umich.edu template <typename T> class BaseQ> 2757639Sgblack@eecs.umich.edu StaticInstPtr 2767639Sgblack@eecs.umich.edu decodeNeonSThreeReg(bool q, unsigned size, 2777639Sgblack@eecs.umich.edu ExtMachInst machInst, IntRegIndex dest, 2787639Sgblack@eecs.umich.edu IntRegIndex op1, IntRegIndex op2) 2797639Sgblack@eecs.umich.edu { 2807639Sgblack@eecs.umich.edu if (q) { 2817639Sgblack@eecs.umich.edu return decodeNeonSThreeUReg<BaseQ>( 2827639Sgblack@eecs.umich.edu size, machInst, dest, op1, op2); 2837639Sgblack@eecs.umich.edu } else { 2847639Sgblack@eecs.umich.edu return decodeNeonSThreeUReg<BaseD>( 2857639Sgblack@eecs.umich.edu size, machInst, dest, op1, op2); 2867639Sgblack@eecs.umich.edu } 2877639Sgblack@eecs.umich.edu } 2887639Sgblack@eecs.umich.edu 2897639Sgblack@eecs.umich.edu template <template <typename T> class BaseD, 2907639Sgblack@eecs.umich.edu template <typename T> class BaseQ> 2917639Sgblack@eecs.umich.edu StaticInstPtr 2927639Sgblack@eecs.umich.edu decodeNeonUSThreeReg(bool q, bool notSigned, unsigned size, 2937639Sgblack@eecs.umich.edu ExtMachInst machInst, IntRegIndex dest, 2947639Sgblack@eecs.umich.edu IntRegIndex op1, IntRegIndex op2) 2957639Sgblack@eecs.umich.edu { 2967639Sgblack@eecs.umich.edu if (notSigned) { 2977639Sgblack@eecs.umich.edu return decodeNeonUThreeReg<BaseD, BaseQ>( 2987639Sgblack@eecs.umich.edu q, size, machInst, dest, op1, op2); 2997639Sgblack@eecs.umich.edu } else { 3007639Sgblack@eecs.umich.edu return decodeNeonSThreeReg<BaseD, BaseQ>( 3017639Sgblack@eecs.umich.edu q, size, machInst, dest, op1, op2); 3027639Sgblack@eecs.umich.edu } 3037639Sgblack@eecs.umich.edu } 3047639Sgblack@eecs.umich.edu 3057639Sgblack@eecs.umich.edu template <template <typename T> class BaseD, 3067639Sgblack@eecs.umich.edu template <typename T> class BaseQ> 3077639Sgblack@eecs.umich.edu StaticInstPtr 30810037SARM gem5 Developers decodeNeonUThreeFpReg(bool q, unsigned size, ExtMachInst machInst, 30910037SARM gem5 Developers IntRegIndex dest, IntRegIndex op1, IntRegIndex op2) 31010037SARM gem5 Developers { 31110037SARM gem5 Developers if (q) { 31210037SARM gem5 Developers if (size) 31310037SARM gem5 Developers return new BaseQ<uint64_t>(machInst, dest, op1, op2); 31410037SARM gem5 Developers else 31510037SARM gem5 Developers return new BaseQ<uint32_t>(machInst, dest, op1, op2); 31610037SARM gem5 Developers } else { 31710037SARM gem5 Developers if (size) 31810037SARM gem5 Developers return new Unknown(machInst); 31910037SARM gem5 Developers else 32010037SARM gem5 Developers return new BaseD<uint32_t>(machInst, dest, op1, op2); 32110037SARM gem5 Developers } 32210037SARM gem5 Developers } 32310037SARM gem5 Developers 32410037SARM gem5 Developers template <template <typename T> class Base> 32510037SARM gem5 Developers StaticInstPtr 32610037SARM gem5 Developers decodeNeonUThreeScFpReg(bool size, ExtMachInst machInst, 32710037SARM gem5 Developers IntRegIndex dest, IntRegIndex op1, IntRegIndex op2) 32810037SARM gem5 Developers { 32910037SARM gem5 Developers if (size) 33010037SARM gem5 Developers return new Base<uint64_t>(machInst, dest, op1, op2); 33110037SARM gem5 Developers else 33210037SARM gem5 Developers return new Base<uint32_t>(machInst, dest, op1, op2); 33310037SARM gem5 Developers } 33410037SARM gem5 Developers 33510037SARM gem5 Developers template <template <typename T> class Base> 33610037SARM gem5 Developers StaticInstPtr 33710037SARM gem5 Developers decodeNeonUThreeImmScFpReg(bool size, ExtMachInst machInst, 33810037SARM gem5 Developers IntRegIndex dest, IntRegIndex op1, 33910037SARM gem5 Developers IntRegIndex op2, uint64_t imm) 34010037SARM gem5 Developers { 34110037SARM gem5 Developers if (size) 34210037SARM gem5 Developers return new Base<uint64_t>(machInst, dest, op1, op2, imm); 34310037SARM gem5 Developers else 34410037SARM gem5 Developers return new Base<uint32_t>(machInst, dest, op1, op2, imm); 34510037SARM gem5 Developers } 34610037SARM gem5 Developers 34710037SARM gem5 Developers template <template <typename T> class BaseD, 34810037SARM gem5 Developers template <typename T> class BaseQ> 34910037SARM gem5 Developers StaticInstPtr 35010037SARM gem5 Developers decodeNeonUThreeImmHAndWReg(bool q, unsigned size, ExtMachInst machInst, 35110037SARM gem5 Developers IntRegIndex dest, IntRegIndex op1, 35210037SARM gem5 Developers IntRegIndex op2, uint64_t imm) 35310037SARM gem5 Developers { 35410037SARM gem5 Developers if (q) { 35510037SARM gem5 Developers switch (size) { 35610037SARM gem5 Developers case 1: 35710037SARM gem5 Developers return new BaseQ<uint16_t>(machInst, dest, op1, op2, imm); 35810037SARM gem5 Developers case 2: 35910037SARM gem5 Developers return new BaseQ<uint32_t>(machInst, dest, op1, op2, imm); 36010037SARM gem5 Developers default: 36110037SARM gem5 Developers return new Unknown(machInst); 36210037SARM gem5 Developers } 36310037SARM gem5 Developers } else { 36410037SARM gem5 Developers switch (size) { 36510037SARM gem5 Developers case 1: 36610037SARM gem5 Developers return new BaseD<uint16_t>(machInst, dest, op1, op2, imm); 36710037SARM gem5 Developers case 2: 36810037SARM gem5 Developers return new BaseD<uint32_t>(machInst, dest, op1, op2, imm); 36910037SARM gem5 Developers default: 37010037SARM gem5 Developers return new Unknown(machInst); 37110037SARM gem5 Developers } 37210037SARM gem5 Developers } 37310037SARM gem5 Developers } 37410037SARM gem5 Developers 37510037SARM gem5 Developers template <template <typename T> class BaseD, 37610037SARM gem5 Developers template <typename T> class BaseQ> 37710037SARM gem5 Developers StaticInstPtr 37810037SARM gem5 Developers decodeNeonSThreeImmHAndWReg(bool q, unsigned size, ExtMachInst machInst, 37910037SARM gem5 Developers IntRegIndex dest, IntRegIndex op1, 38010037SARM gem5 Developers IntRegIndex op2, uint64_t imm) 38110037SARM gem5 Developers { 38210037SARM gem5 Developers if (q) { 38310037SARM gem5 Developers switch (size) { 38410037SARM gem5 Developers case 1: 38510037SARM gem5 Developers return new BaseQ<int16_t>(machInst, dest, op1, op2, imm); 38610037SARM gem5 Developers case 2: 38710037SARM gem5 Developers return new BaseQ<int32_t>(machInst, dest, op1, op2, imm); 38810037SARM gem5 Developers default: 38910037SARM gem5 Developers return new Unknown(machInst); 39010037SARM gem5 Developers } 39110037SARM gem5 Developers } else { 39210037SARM gem5 Developers switch (size) { 39310037SARM gem5 Developers case 1: 39410037SARM gem5 Developers return new BaseD<int16_t>(machInst, dest, op1, op2, imm); 39510037SARM gem5 Developers case 2: 39610037SARM gem5 Developers return new BaseD<int32_t>(machInst, dest, op1, op2, imm); 39710037SARM gem5 Developers default: 39810037SARM gem5 Developers return new Unknown(machInst); 39910037SARM gem5 Developers } 40010037SARM gem5 Developers } 40110037SARM gem5 Developers } 40210037SARM gem5 Developers 40310037SARM gem5 Developers template <template <typename T> class BaseD, 40410037SARM gem5 Developers template <typename T> class BaseQ> 40510037SARM gem5 Developers StaticInstPtr 40610037SARM gem5 Developers decodeNeonUThreeImmFpReg(bool q, unsigned size, ExtMachInst machInst, 40710037SARM gem5 Developers IntRegIndex dest, IntRegIndex op1, 40810037SARM gem5 Developers IntRegIndex op2, uint64_t imm) 40910037SARM gem5 Developers { 41010037SARM gem5 Developers if (q) { 41110037SARM gem5 Developers if (size) 41210037SARM gem5 Developers return new BaseQ<uint64_t>(machInst, dest, op1, op2, imm); 41310037SARM gem5 Developers else 41410037SARM gem5 Developers return new BaseQ<uint32_t>(machInst, dest, op1, op2, imm); 41510037SARM gem5 Developers } else { 41610037SARM gem5 Developers if (size) 41710037SARM gem5 Developers return new Unknown(machInst); 41810037SARM gem5 Developers else 41910037SARM gem5 Developers return new BaseD<uint32_t>(machInst, dest, op1, op2, imm); 42010037SARM gem5 Developers } 42110037SARM gem5 Developers } 42210037SARM gem5 Developers 42310037SARM gem5 Developers template <template <typename T> class BaseD, 42410037SARM gem5 Developers template <typename T> class BaseQ> 42510037SARM gem5 Developers StaticInstPtr 4267639Sgblack@eecs.umich.edu decodeNeonUTwoShiftReg(bool q, unsigned size, 4277639Sgblack@eecs.umich.edu ExtMachInst machInst, IntRegIndex dest, 4287639Sgblack@eecs.umich.edu IntRegIndex op1, uint64_t imm) 4297639Sgblack@eecs.umich.edu { 4307639Sgblack@eecs.umich.edu if (q) { 4317639Sgblack@eecs.umich.edu switch (size) { 4327639Sgblack@eecs.umich.edu case 0: 4337639Sgblack@eecs.umich.edu return new BaseQ<uint8_t>(machInst, dest, op1, imm); 4347639Sgblack@eecs.umich.edu case 1: 4357639Sgblack@eecs.umich.edu return new BaseQ<uint16_t>(machInst, dest, op1, imm); 4367639Sgblack@eecs.umich.edu case 2: 4377639Sgblack@eecs.umich.edu return new BaseQ<uint32_t>(machInst, dest, op1, imm); 4387639Sgblack@eecs.umich.edu case 3: 4397639Sgblack@eecs.umich.edu return new BaseQ<uint64_t>(machInst, dest, op1, imm); 4407639Sgblack@eecs.umich.edu default: 4417639Sgblack@eecs.umich.edu return new Unknown(machInst); 4427639Sgblack@eecs.umich.edu } 4437639Sgblack@eecs.umich.edu } else { 4447639Sgblack@eecs.umich.edu switch (size) { 4457639Sgblack@eecs.umich.edu case 0: 4467639Sgblack@eecs.umich.edu return new BaseD<uint8_t>(machInst, dest, op1, imm); 4477639Sgblack@eecs.umich.edu case 1: 4487639Sgblack@eecs.umich.edu return new BaseD<uint16_t>(machInst, dest, op1, imm); 4497639Sgblack@eecs.umich.edu case 2: 4507639Sgblack@eecs.umich.edu return new BaseD<uint32_t>(machInst, dest, op1, imm); 4517639Sgblack@eecs.umich.edu case 3: 4527639Sgblack@eecs.umich.edu return new BaseD<uint64_t>(machInst, dest, op1, imm); 4537639Sgblack@eecs.umich.edu default: 4547639Sgblack@eecs.umich.edu return new Unknown(machInst); 4557639Sgblack@eecs.umich.edu } 4567639Sgblack@eecs.umich.edu } 4577639Sgblack@eecs.umich.edu } 4587639Sgblack@eecs.umich.edu 4597639Sgblack@eecs.umich.edu template <template <typename T> class BaseD, 4607639Sgblack@eecs.umich.edu template <typename T> class BaseQ> 4617639Sgblack@eecs.umich.edu StaticInstPtr 4627639Sgblack@eecs.umich.edu decodeNeonSTwoShiftReg(bool q, unsigned size, 4637639Sgblack@eecs.umich.edu ExtMachInst machInst, IntRegIndex dest, 4647639Sgblack@eecs.umich.edu IntRegIndex op1, uint64_t imm) 4657639Sgblack@eecs.umich.edu { 4667639Sgblack@eecs.umich.edu if (q) { 4677639Sgblack@eecs.umich.edu switch (size) { 4687639Sgblack@eecs.umich.edu case 0: 4697639Sgblack@eecs.umich.edu return new BaseQ<int8_t>(machInst, dest, op1, imm); 4707639Sgblack@eecs.umich.edu case 1: 4717639Sgblack@eecs.umich.edu return new BaseQ<int16_t>(machInst, dest, op1, imm); 4727639Sgblack@eecs.umich.edu case 2: 4737639Sgblack@eecs.umich.edu return new BaseQ<int32_t>(machInst, dest, op1, imm); 4747639Sgblack@eecs.umich.edu case 3: 4757639Sgblack@eecs.umich.edu return new BaseQ<int64_t>(machInst, dest, op1, imm); 4767639Sgblack@eecs.umich.edu default: 4777639Sgblack@eecs.umich.edu return new Unknown(machInst); 4787639Sgblack@eecs.umich.edu } 4797639Sgblack@eecs.umich.edu } else { 4807639Sgblack@eecs.umich.edu switch (size) { 4817639Sgblack@eecs.umich.edu case 0: 4827639Sgblack@eecs.umich.edu return new BaseD<int8_t>(machInst, dest, op1, imm); 4837639Sgblack@eecs.umich.edu case 1: 4847639Sgblack@eecs.umich.edu return new BaseD<int16_t>(machInst, dest, op1, imm); 4857639Sgblack@eecs.umich.edu case 2: 4867639Sgblack@eecs.umich.edu return new BaseD<int32_t>(machInst, dest, op1, imm); 4877639Sgblack@eecs.umich.edu case 3: 4887639Sgblack@eecs.umich.edu return new BaseD<int64_t>(machInst, dest, op1, imm); 4897639Sgblack@eecs.umich.edu default: 4907639Sgblack@eecs.umich.edu return new Unknown(machInst); 4917639Sgblack@eecs.umich.edu } 4927639Sgblack@eecs.umich.edu } 4937639Sgblack@eecs.umich.edu } 4947639Sgblack@eecs.umich.edu 4957639Sgblack@eecs.umich.edu 4967639Sgblack@eecs.umich.edu template <template <typename T> class BaseD, 4977639Sgblack@eecs.umich.edu template <typename T> class BaseQ> 4987639Sgblack@eecs.umich.edu StaticInstPtr 4997639Sgblack@eecs.umich.edu decodeNeonUSTwoShiftReg(bool q, bool notSigned, unsigned size, 5007639Sgblack@eecs.umich.edu ExtMachInst machInst, IntRegIndex dest, 5017639Sgblack@eecs.umich.edu IntRegIndex op1, uint64_t imm) 5027639Sgblack@eecs.umich.edu { 5037639Sgblack@eecs.umich.edu if (notSigned) { 5047639Sgblack@eecs.umich.edu return decodeNeonUTwoShiftReg<BaseD, BaseQ>( 5057639Sgblack@eecs.umich.edu q, size, machInst, dest, op1, imm); 5067639Sgblack@eecs.umich.edu } else { 5077639Sgblack@eecs.umich.edu return decodeNeonSTwoShiftReg<BaseD, BaseQ>( 5087639Sgblack@eecs.umich.edu q, size, machInst, dest, op1, imm); 5097639Sgblack@eecs.umich.edu } 5107639Sgblack@eecs.umich.edu } 5117639Sgblack@eecs.umich.edu 5127639Sgblack@eecs.umich.edu template <template <typename T> class Base> 5137639Sgblack@eecs.umich.edu StaticInstPtr 5147639Sgblack@eecs.umich.edu decodeNeonUTwoShiftUSReg(unsigned size, 5157639Sgblack@eecs.umich.edu ExtMachInst machInst, IntRegIndex dest, 5167639Sgblack@eecs.umich.edu IntRegIndex op1, uint64_t imm) 5177639Sgblack@eecs.umich.edu { 5187639Sgblack@eecs.umich.edu switch (size) { 5197639Sgblack@eecs.umich.edu case 0: 5207639Sgblack@eecs.umich.edu return new Base<uint8_t>(machInst, dest, op1, imm); 5217639Sgblack@eecs.umich.edu case 1: 5227639Sgblack@eecs.umich.edu return new Base<uint16_t>(machInst, dest, op1, imm); 5237639Sgblack@eecs.umich.edu case 2: 5247639Sgblack@eecs.umich.edu return new Base<uint32_t>(machInst, dest, op1, imm); 5257639Sgblack@eecs.umich.edu default: 5267639Sgblack@eecs.umich.edu return new Unknown(machInst); 5277639Sgblack@eecs.umich.edu } 5287639Sgblack@eecs.umich.edu } 5297639Sgblack@eecs.umich.edu 53010037SARM gem5 Developers template <template <typename T> class Base> 53110037SARM gem5 Developers StaticInstPtr 53210037SARM gem5 Developers decodeNeonUTwoShiftUReg(unsigned size, 53310037SARM gem5 Developers ExtMachInst machInst, IntRegIndex dest, 53410037SARM gem5 Developers IntRegIndex op1, uint64_t imm) 53510037SARM gem5 Developers { 53610037SARM gem5 Developers switch (size) { 53710037SARM gem5 Developers case 0: 53810037SARM gem5 Developers return new Base<uint8_t>(machInst, dest, op1, imm); 53910037SARM gem5 Developers case 1: 54010037SARM gem5 Developers return new Base<uint16_t>(machInst, dest, op1, imm); 54110037SARM gem5 Developers case 2: 54210037SARM gem5 Developers return new Base<uint32_t>(machInst, dest, op1, imm); 54310037SARM gem5 Developers case 3: 54410037SARM gem5 Developers return new Base<uint64_t>(machInst, dest, op1, imm); 54510037SARM gem5 Developers default: 54610037SARM gem5 Developers return new Unknown(machInst); 54710037SARM gem5 Developers } 54810037SARM gem5 Developers } 54910037SARM gem5 Developers 55010037SARM gem5 Developers template <template <typename T> class Base> 55110037SARM gem5 Developers StaticInstPtr 55210037SARM gem5 Developers decodeNeonSTwoShiftUReg(unsigned size, 55310037SARM gem5 Developers ExtMachInst machInst, IntRegIndex dest, 55410037SARM gem5 Developers IntRegIndex op1, uint64_t imm) 55510037SARM gem5 Developers { 55610037SARM gem5 Developers switch (size) { 55710037SARM gem5 Developers case 0: 55810037SARM gem5 Developers return new Base<int8_t>(machInst, dest, op1, imm); 55910037SARM gem5 Developers case 1: 56010037SARM gem5 Developers return new Base<int16_t>(machInst, dest, op1, imm); 56110037SARM gem5 Developers case 2: 56210037SARM gem5 Developers return new Base<int32_t>(machInst, dest, op1, imm); 56310037SARM gem5 Developers case 3: 56410037SARM gem5 Developers return new Base<int64_t>(machInst, dest, op1, imm); 56510037SARM gem5 Developers default: 56610037SARM gem5 Developers return new Unknown(machInst); 56710037SARM gem5 Developers } 56810037SARM gem5 Developers } 56910037SARM gem5 Developers 5707639Sgblack@eecs.umich.edu template <template <typename T> class BaseD, 5717639Sgblack@eecs.umich.edu template <typename T> class BaseQ> 5727639Sgblack@eecs.umich.edu StaticInstPtr 5737639Sgblack@eecs.umich.edu decodeNeonUTwoShiftSReg(bool q, unsigned size, 5747639Sgblack@eecs.umich.edu ExtMachInst machInst, IntRegIndex dest, 5757639Sgblack@eecs.umich.edu IntRegIndex op1, uint64_t imm) 5767639Sgblack@eecs.umich.edu { 5777639Sgblack@eecs.umich.edu if (q) { 5787639Sgblack@eecs.umich.edu return decodeNeonUTwoShiftUSReg<BaseQ>( 5797639Sgblack@eecs.umich.edu size, machInst, dest, op1, imm); 5807639Sgblack@eecs.umich.edu } else { 5817639Sgblack@eecs.umich.edu return decodeNeonUTwoShiftUSReg<BaseD>( 5827639Sgblack@eecs.umich.edu size, machInst, dest, op1, imm); 5837639Sgblack@eecs.umich.edu } 5847639Sgblack@eecs.umich.edu } 5857639Sgblack@eecs.umich.edu 5867639Sgblack@eecs.umich.edu template <template <typename T> class Base> 5877639Sgblack@eecs.umich.edu StaticInstPtr 5887639Sgblack@eecs.umich.edu decodeNeonSTwoShiftUSReg(unsigned size, 5897639Sgblack@eecs.umich.edu ExtMachInst machInst, IntRegIndex dest, 5907639Sgblack@eecs.umich.edu IntRegIndex op1, uint64_t imm) 5917639Sgblack@eecs.umich.edu { 5927639Sgblack@eecs.umich.edu switch (size) { 5937639Sgblack@eecs.umich.edu case 0: 5947639Sgblack@eecs.umich.edu return new Base<int8_t>(machInst, dest, op1, imm); 5957639Sgblack@eecs.umich.edu case 1: 5967639Sgblack@eecs.umich.edu return new Base<int16_t>(machInst, dest, op1, imm); 5977639Sgblack@eecs.umich.edu case 2: 5987639Sgblack@eecs.umich.edu return new Base<int32_t>(machInst, dest, op1, imm); 5997639Sgblack@eecs.umich.edu default: 6007639Sgblack@eecs.umich.edu return new Unknown(machInst); 6017639Sgblack@eecs.umich.edu } 6027639Sgblack@eecs.umich.edu } 6037639Sgblack@eecs.umich.edu 6047639Sgblack@eecs.umich.edu template <template <typename T> class BaseD, 6057639Sgblack@eecs.umich.edu template <typename T> class BaseQ> 6067639Sgblack@eecs.umich.edu StaticInstPtr 6077639Sgblack@eecs.umich.edu decodeNeonSTwoShiftSReg(bool q, unsigned size, 6087639Sgblack@eecs.umich.edu ExtMachInst machInst, IntRegIndex dest, 6097639Sgblack@eecs.umich.edu IntRegIndex op1, uint64_t imm) 6107639Sgblack@eecs.umich.edu { 6117639Sgblack@eecs.umich.edu if (q) { 6127639Sgblack@eecs.umich.edu return decodeNeonSTwoShiftUSReg<BaseQ>( 6137639Sgblack@eecs.umich.edu size, machInst, dest, op1, imm); 6147639Sgblack@eecs.umich.edu } else { 6157639Sgblack@eecs.umich.edu return decodeNeonSTwoShiftUSReg<BaseD>( 6167639Sgblack@eecs.umich.edu size, machInst, dest, op1, imm); 6177639Sgblack@eecs.umich.edu } 6187639Sgblack@eecs.umich.edu } 6197639Sgblack@eecs.umich.edu 6207639Sgblack@eecs.umich.edu template <template <typename T> class BaseD, 6217639Sgblack@eecs.umich.edu template <typename T> class BaseQ> 6227639Sgblack@eecs.umich.edu StaticInstPtr 6237639Sgblack@eecs.umich.edu decodeNeonUSTwoShiftSReg(bool q, bool notSigned, unsigned size, 6247639Sgblack@eecs.umich.edu ExtMachInst machInst, IntRegIndex dest, 6257639Sgblack@eecs.umich.edu IntRegIndex op1, uint64_t imm) 6267639Sgblack@eecs.umich.edu { 6277639Sgblack@eecs.umich.edu if (notSigned) { 6287639Sgblack@eecs.umich.edu return decodeNeonUTwoShiftSReg<BaseD, BaseQ>( 6297639Sgblack@eecs.umich.edu q, size, machInst, dest, op1, imm); 6307639Sgblack@eecs.umich.edu } else { 6317639Sgblack@eecs.umich.edu return decodeNeonSTwoShiftSReg<BaseD, BaseQ>( 6327639Sgblack@eecs.umich.edu q, size, machInst, dest, op1, imm); 6337639Sgblack@eecs.umich.edu } 6347639Sgblack@eecs.umich.edu } 6357639Sgblack@eecs.umich.edu 63610037SARM gem5 Developers template <template <typename T> class BaseD, 63710037SARM gem5 Developers template <typename T> class BaseQ> 63810037SARM gem5 Developers StaticInstPtr 63910037SARM gem5 Developers decodeNeonUTwoShiftXReg(bool q, unsigned size, ExtMachInst machInst, 64010037SARM gem5 Developers IntRegIndex dest, IntRegIndex op1, uint64_t imm) 64110037SARM gem5 Developers { 64210037SARM gem5 Developers if (q) { 64310037SARM gem5 Developers return decodeNeonUTwoShiftUReg<BaseQ>( 64410037SARM gem5 Developers size, machInst, dest, op1, imm); 64510037SARM gem5 Developers } else { 64610037SARM gem5 Developers return decodeNeonUTwoShiftUSReg<BaseD>( 64710037SARM gem5 Developers size, machInst, dest, op1, imm); 64810037SARM gem5 Developers } 64910037SARM gem5 Developers } 65010037SARM gem5 Developers 65110037SARM gem5 Developers template <template <typename T> class BaseD, 65210037SARM gem5 Developers template <typename T> class BaseQ> 65310037SARM gem5 Developers StaticInstPtr 65410037SARM gem5 Developers decodeNeonSTwoShiftXReg(bool q, unsigned size, ExtMachInst machInst, 65510037SARM gem5 Developers IntRegIndex dest, IntRegIndex op1, uint64_t imm) 65610037SARM gem5 Developers { 65710037SARM gem5 Developers if (q) { 65810037SARM gem5 Developers return decodeNeonSTwoShiftUReg<BaseQ>( 65910037SARM gem5 Developers size, machInst, dest, op1, imm); 66010037SARM gem5 Developers } else { 66110037SARM gem5 Developers return decodeNeonSTwoShiftUSReg<BaseD>( 66210037SARM gem5 Developers size, machInst, dest, op1, imm); 66310037SARM gem5 Developers } 66410037SARM gem5 Developers } 66510037SARM gem5 Developers 66610037SARM gem5 Developers template <template <typename T> class Base> 66710037SARM gem5 Developers StaticInstPtr 66810037SARM gem5 Developers decodeNeonUTwoShiftUFpReg(unsigned size, ExtMachInst machInst, 66910037SARM gem5 Developers IntRegIndex dest, IntRegIndex op1, uint64_t imm) 67010037SARM gem5 Developers { 67110037SARM gem5 Developers if (size) 67210037SARM gem5 Developers return new Base<uint64_t>(machInst, dest, op1, imm); 67310037SARM gem5 Developers else 67410037SARM gem5 Developers return new Base<uint32_t>(machInst, dest, op1, imm); 67510037SARM gem5 Developers } 67610037SARM gem5 Developers 67710037SARM gem5 Developers template <template <typename T> class BaseD, 67810037SARM gem5 Developers template <typename T> class BaseQ> 67910037SARM gem5 Developers StaticInstPtr 68010037SARM gem5 Developers decodeNeonUTwoShiftFpReg(bool q, unsigned size, ExtMachInst machInst, 68110037SARM gem5 Developers IntRegIndex dest, IntRegIndex op1, uint64_t imm) 68210037SARM gem5 Developers { 68310037SARM gem5 Developers if (q) { 68410037SARM gem5 Developers if (size) 68510037SARM gem5 Developers return new BaseQ<uint64_t>(machInst, dest, op1, imm); 68610037SARM gem5 Developers else 68710037SARM gem5 Developers return new BaseQ<uint32_t>(machInst, dest, op1, imm); 68810037SARM gem5 Developers } else { 68910037SARM gem5 Developers if (size) 69010037SARM gem5 Developers return new Unknown(machInst); 69110037SARM gem5 Developers else 69210037SARM gem5 Developers return new BaseD<uint32_t>(machInst, dest, op1, imm); 69310037SARM gem5 Developers } 69410037SARM gem5 Developers } 69510037SARM gem5 Developers 6967639Sgblack@eecs.umich.edu template <template <typename T> class Base> 6977639Sgblack@eecs.umich.edu StaticInstPtr 6987639Sgblack@eecs.umich.edu decodeNeonUTwoMiscUSReg(unsigned size, 6997639Sgblack@eecs.umich.edu ExtMachInst machInst, IntRegIndex dest, 7007639Sgblack@eecs.umich.edu IntRegIndex op1) 7017639Sgblack@eecs.umich.edu { 7027639Sgblack@eecs.umich.edu switch (size) { 7037639Sgblack@eecs.umich.edu case 0: 7047639Sgblack@eecs.umich.edu return new Base<uint8_t>(machInst, dest, op1); 7057639Sgblack@eecs.umich.edu case 1: 7067639Sgblack@eecs.umich.edu return new Base<uint16_t>(machInst, dest, op1); 7077639Sgblack@eecs.umich.edu case 2: 7087639Sgblack@eecs.umich.edu return new Base<uint32_t>(machInst, dest, op1); 7097639Sgblack@eecs.umich.edu default: 7107639Sgblack@eecs.umich.edu return new Unknown(machInst); 7117639Sgblack@eecs.umich.edu } 7127639Sgblack@eecs.umich.edu } 7137639Sgblack@eecs.umich.edu 7147639Sgblack@eecs.umich.edu template <template <typename T> class Base> 7157639Sgblack@eecs.umich.edu StaticInstPtr 7167639Sgblack@eecs.umich.edu decodeNeonSTwoMiscUSReg(unsigned size, 7177639Sgblack@eecs.umich.edu ExtMachInst machInst, IntRegIndex dest, 7187639Sgblack@eecs.umich.edu IntRegIndex op1) 7197639Sgblack@eecs.umich.edu { 7207639Sgblack@eecs.umich.edu switch (size) { 7217639Sgblack@eecs.umich.edu case 0: 7227639Sgblack@eecs.umich.edu return new Base<int8_t>(machInst, dest, op1); 7237639Sgblack@eecs.umich.edu case 1: 7247639Sgblack@eecs.umich.edu return new Base<int16_t>(machInst, dest, op1); 7257639Sgblack@eecs.umich.edu case 2: 7267639Sgblack@eecs.umich.edu return new Base<int32_t>(machInst, dest, op1); 7277639Sgblack@eecs.umich.edu default: 7287639Sgblack@eecs.umich.edu return new Unknown(machInst); 7297639Sgblack@eecs.umich.edu } 7307639Sgblack@eecs.umich.edu } 7317639Sgblack@eecs.umich.edu 7327639Sgblack@eecs.umich.edu template <template <typename T> class BaseD, 7337639Sgblack@eecs.umich.edu template <typename T> class BaseQ> 7347639Sgblack@eecs.umich.edu StaticInstPtr 7357639Sgblack@eecs.umich.edu decodeNeonUTwoMiscSReg(bool q, unsigned size, 73610037SARM gem5 Developers ExtMachInst machInst, IntRegIndex dest, 73710037SARM gem5 Developers IntRegIndex op1) 7387639Sgblack@eecs.umich.edu { 7397639Sgblack@eecs.umich.edu if (q) { 7407639Sgblack@eecs.umich.edu return decodeNeonUTwoMiscUSReg<BaseQ>(size, machInst, dest, op1); 7417639Sgblack@eecs.umich.edu } else { 7427639Sgblack@eecs.umich.edu return decodeNeonUTwoMiscUSReg<BaseD>(size, machInst, dest, op1); 7437639Sgblack@eecs.umich.edu } 7447639Sgblack@eecs.umich.edu } 7457639Sgblack@eecs.umich.edu 7467639Sgblack@eecs.umich.edu template <template <typename T> class BaseD, 7477639Sgblack@eecs.umich.edu template <typename T> class BaseQ> 7487639Sgblack@eecs.umich.edu StaticInstPtr 7497639Sgblack@eecs.umich.edu decodeNeonSTwoMiscSReg(bool q, unsigned size, 75010037SARM gem5 Developers ExtMachInst machInst, IntRegIndex dest, 75110037SARM gem5 Developers IntRegIndex op1) 7527639Sgblack@eecs.umich.edu { 7537639Sgblack@eecs.umich.edu if (q) { 7547639Sgblack@eecs.umich.edu return decodeNeonSTwoMiscUSReg<BaseQ>(size, machInst, dest, op1); 7557639Sgblack@eecs.umich.edu } else { 7567639Sgblack@eecs.umich.edu return decodeNeonSTwoMiscUSReg<BaseD>(size, machInst, dest, op1); 7577639Sgblack@eecs.umich.edu } 7587639Sgblack@eecs.umich.edu } 7597639Sgblack@eecs.umich.edu 7607639Sgblack@eecs.umich.edu template <template <typename T> class Base> 7617639Sgblack@eecs.umich.edu StaticInstPtr 7627639Sgblack@eecs.umich.edu decodeNeonUTwoMiscUReg(unsigned size, 7637639Sgblack@eecs.umich.edu ExtMachInst machInst, IntRegIndex dest, 7647639Sgblack@eecs.umich.edu IntRegIndex op1) 7657639Sgblack@eecs.umich.edu { 7667639Sgblack@eecs.umich.edu switch (size) { 7677639Sgblack@eecs.umich.edu case 0: 7687639Sgblack@eecs.umich.edu return new Base<uint8_t>(machInst, dest, op1); 7697639Sgblack@eecs.umich.edu case 1: 7707639Sgblack@eecs.umich.edu return new Base<uint16_t>(machInst, dest, op1); 7717639Sgblack@eecs.umich.edu case 2: 7727639Sgblack@eecs.umich.edu return new Base<uint32_t>(machInst, dest, op1); 7737639Sgblack@eecs.umich.edu case 3: 7747639Sgblack@eecs.umich.edu return new Base<uint64_t>(machInst, dest, op1); 7757639Sgblack@eecs.umich.edu default: 7767639Sgblack@eecs.umich.edu return new Unknown(machInst); 7777639Sgblack@eecs.umich.edu } 7787639Sgblack@eecs.umich.edu } 7797639Sgblack@eecs.umich.edu 7807639Sgblack@eecs.umich.edu template <template <typename T> class Base> 7817639Sgblack@eecs.umich.edu StaticInstPtr 7827639Sgblack@eecs.umich.edu decodeNeonSTwoMiscUReg(unsigned size, 78310037SARM gem5 Developers ExtMachInst machInst, IntRegIndex dest, 78410037SARM gem5 Developers IntRegIndex op1) 7857639Sgblack@eecs.umich.edu { 7867639Sgblack@eecs.umich.edu switch (size) { 7877639Sgblack@eecs.umich.edu case 0: 7887639Sgblack@eecs.umich.edu return new Base<int8_t>(machInst, dest, op1); 7897639Sgblack@eecs.umich.edu case 1: 7907639Sgblack@eecs.umich.edu return new Base<int16_t>(machInst, dest, op1); 7917639Sgblack@eecs.umich.edu case 2: 7927639Sgblack@eecs.umich.edu return new Base<int32_t>(machInst, dest, op1); 7937639Sgblack@eecs.umich.edu case 3: 7947639Sgblack@eecs.umich.edu return new Base<int64_t>(machInst, dest, op1); 7957639Sgblack@eecs.umich.edu default: 7967639Sgblack@eecs.umich.edu return new Unknown(machInst); 7977639Sgblack@eecs.umich.edu } 7987639Sgblack@eecs.umich.edu } 7997639Sgblack@eecs.umich.edu 8007639Sgblack@eecs.umich.edu template <template <typename T> class BaseD, 8017639Sgblack@eecs.umich.edu template <typename T> class BaseQ> 8027639Sgblack@eecs.umich.edu StaticInstPtr 8037639Sgblack@eecs.umich.edu decodeNeonSTwoMiscReg(bool q, unsigned size, 8047639Sgblack@eecs.umich.edu ExtMachInst machInst, IntRegIndex dest, 8057639Sgblack@eecs.umich.edu IntRegIndex op1) 8067639Sgblack@eecs.umich.edu { 8077639Sgblack@eecs.umich.edu if (q) { 8087639Sgblack@eecs.umich.edu return decodeNeonSTwoMiscUReg<BaseQ>(size, machInst, dest, op1); 8097639Sgblack@eecs.umich.edu } else { 8107639Sgblack@eecs.umich.edu return decodeNeonSTwoMiscUReg<BaseD>(size, machInst, dest, op1); 8117639Sgblack@eecs.umich.edu } 8127639Sgblack@eecs.umich.edu } 8137639Sgblack@eecs.umich.edu 8147639Sgblack@eecs.umich.edu template <template <typename T> class BaseD, 8157639Sgblack@eecs.umich.edu template <typename T> class BaseQ> 8167639Sgblack@eecs.umich.edu StaticInstPtr 8177639Sgblack@eecs.umich.edu decodeNeonUTwoMiscReg(bool q, unsigned size, 8187639Sgblack@eecs.umich.edu ExtMachInst machInst, IntRegIndex dest, 8197639Sgblack@eecs.umich.edu IntRegIndex op1) 8207639Sgblack@eecs.umich.edu { 8217639Sgblack@eecs.umich.edu if (q) { 8227639Sgblack@eecs.umich.edu return decodeNeonUTwoMiscUReg<BaseQ>(size, machInst, dest, op1); 8237639Sgblack@eecs.umich.edu } else { 8247639Sgblack@eecs.umich.edu return decodeNeonUTwoMiscUReg<BaseD>(size, machInst, dest, op1); 8257639Sgblack@eecs.umich.edu } 8267639Sgblack@eecs.umich.edu } 8277639Sgblack@eecs.umich.edu 8287639Sgblack@eecs.umich.edu template <template <typename T> class BaseD, 8297639Sgblack@eecs.umich.edu template <typename T> class BaseQ> 8307639Sgblack@eecs.umich.edu StaticInstPtr 8317639Sgblack@eecs.umich.edu decodeNeonUSTwoMiscSReg(bool q, bool notSigned, unsigned size, 8327639Sgblack@eecs.umich.edu ExtMachInst machInst, IntRegIndex dest, 8337639Sgblack@eecs.umich.edu IntRegIndex op1) 8347639Sgblack@eecs.umich.edu { 8357639Sgblack@eecs.umich.edu if (notSigned) { 8367639Sgblack@eecs.umich.edu return decodeNeonUTwoShiftSReg<BaseD, BaseQ>( 8377639Sgblack@eecs.umich.edu q, size, machInst, dest, op1); 8387639Sgblack@eecs.umich.edu } else { 8397639Sgblack@eecs.umich.edu return decodeNeonSTwoShiftSReg<BaseD, BaseQ>( 8407639Sgblack@eecs.umich.edu q, size, machInst, dest, op1); 8417639Sgblack@eecs.umich.edu } 8427639Sgblack@eecs.umich.edu } 8437639Sgblack@eecs.umich.edu 84410037SARM gem5 Developers template <template <typename T> class BaseD, 84510037SARM gem5 Developers template <typename T> class BaseQ> 84610037SARM gem5 Developers StaticInstPtr 84710037SARM gem5 Developers decodeNeonUTwoMiscXReg(bool q, unsigned size, ExtMachInst machInst, 84810037SARM gem5 Developers IntRegIndex dest, IntRegIndex op1) 84910037SARM gem5 Developers { 85010037SARM gem5 Developers if (q) { 85110037SARM gem5 Developers return decodeNeonUTwoMiscUReg<BaseQ>(size, machInst, dest, op1); 85210037SARM gem5 Developers } else { 85310037SARM gem5 Developers return decodeNeonUTwoMiscUSReg<BaseD>(size, machInst, dest, op1); 85410037SARM gem5 Developers } 85510037SARM gem5 Developers } 85610037SARM gem5 Developers 85710037SARM gem5 Developers template <template <typename T> class BaseD, 85810037SARM gem5 Developers template <typename T> class BaseQ> 85910037SARM gem5 Developers StaticInstPtr 86010037SARM gem5 Developers decodeNeonSTwoMiscXReg(bool q, unsigned size, ExtMachInst machInst, 86110037SARM gem5 Developers IntRegIndex dest, IntRegIndex op1) 86210037SARM gem5 Developers { 86310037SARM gem5 Developers if (q) { 86410037SARM gem5 Developers return decodeNeonSTwoMiscUReg<BaseQ>(size, machInst, dest, op1); 86510037SARM gem5 Developers } else { 86610037SARM gem5 Developers return decodeNeonSTwoMiscUSReg<BaseD>(size, machInst, dest, op1); 86710037SARM gem5 Developers } 86810037SARM gem5 Developers } 86910037SARM gem5 Developers 87010037SARM gem5 Developers template <template <typename T> class BaseD, 87110037SARM gem5 Developers template <typename T> class BaseQ> 87210037SARM gem5 Developers StaticInstPtr 87310037SARM gem5 Developers decodeNeonUTwoMiscFpReg(bool q, unsigned size, ExtMachInst machInst, 87410037SARM gem5 Developers IntRegIndex dest, IntRegIndex op1) 87510037SARM gem5 Developers { 87610037SARM gem5 Developers if (q) { 87710037SARM gem5 Developers if (size) 87810037SARM gem5 Developers return new BaseQ<uint64_t>(machInst, dest, op1); 87910037SARM gem5 Developers else 88010037SARM gem5 Developers return new BaseQ<uint32_t>(machInst, dest, op1); 88110037SARM gem5 Developers } else { 88210037SARM gem5 Developers if (size) 88310037SARM gem5 Developers return new Unknown(machInst); 88410037SARM gem5 Developers else 88510037SARM gem5 Developers return new BaseD<uint32_t>(machInst, dest, op1); 88610037SARM gem5 Developers } 88710037SARM gem5 Developers } 88810037SARM gem5 Developers 88910037SARM gem5 Developers template <template <typename T> class BaseD, 89010037SARM gem5 Developers template <typename T> class BaseQ> 89110037SARM gem5 Developers StaticInstPtr 89210037SARM gem5 Developers decodeNeonUTwoMiscPwiseScFpReg(unsigned size, ExtMachInst machInst, 89310037SARM gem5 Developers IntRegIndex dest, IntRegIndex op1) 89410037SARM gem5 Developers { 89510037SARM gem5 Developers if (size) 89610037SARM gem5 Developers return new BaseQ<uint64_t>(machInst, dest, op1); 89710037SARM gem5 Developers else 89810037SARM gem5 Developers return new BaseD<uint32_t>(machInst, dest, op1); 89910037SARM gem5 Developers } 90010037SARM gem5 Developers 90110037SARM gem5 Developers template <template <typename T> class Base> 90210037SARM gem5 Developers StaticInstPtr 90310037SARM gem5 Developers decodeNeonUTwoMiscScFpReg(unsigned size, ExtMachInst machInst, 90410037SARM gem5 Developers IntRegIndex dest, IntRegIndex op1) 90510037SARM gem5 Developers { 90610037SARM gem5 Developers if (size) 90710037SARM gem5 Developers return new Base<uint64_t>(machInst, dest, op1); 90810037SARM gem5 Developers else 90910037SARM gem5 Developers return new Base<uint32_t>(machInst, dest, op1); 91010037SARM gem5 Developers } 91110037SARM gem5 Developers 91210037SARM gem5 Developers template <template <typename T> class BaseD, 91310037SARM gem5 Developers template <typename T> class BaseQ> 91410037SARM gem5 Developers StaticInstPtr 91510037SARM gem5 Developers decodeNeonUAcrossLanesReg(bool q, unsigned size, ExtMachInst machInst, 91610037SARM gem5 Developers IntRegIndex dest, IntRegIndex op1) 91710037SARM gem5 Developers { 91810037SARM gem5 Developers if (q) { 91910037SARM gem5 Developers switch (size) { 92010037SARM gem5 Developers case 0x0: 92110037SARM gem5 Developers return new BaseQ<uint8_t>(machInst, dest, op1); 92210037SARM gem5 Developers case 0x1: 92310037SARM gem5 Developers return new BaseQ<uint16_t>(machInst, dest, op1); 92410037SARM gem5 Developers case 0x2: 92510037SARM gem5 Developers return new BaseQ<uint32_t>(machInst, dest, op1); 92610037SARM gem5 Developers default: 92710037SARM gem5 Developers return new Unknown(machInst); 92810037SARM gem5 Developers } 92910037SARM gem5 Developers } else { 93010037SARM gem5 Developers switch (size) { 93110037SARM gem5 Developers case 0x0: 93210037SARM gem5 Developers return new BaseD<uint8_t>(machInst, dest, op1); 93310037SARM gem5 Developers case 0x1: 93410037SARM gem5 Developers return new BaseD<uint16_t>(machInst, dest, op1); 93510037SARM gem5 Developers default: 93610037SARM gem5 Developers return new Unknown(machInst); 93710037SARM gem5 Developers } 93810037SARM gem5 Developers } 93910037SARM gem5 Developers } 94010037SARM gem5 Developers 94110037SARM gem5 Developers template <template <typename T> class BaseD, 94210037SARM gem5 Developers template <typename T> class BaseQ, 94310037SARM gem5 Developers template <typename T> class BaseBQ> 94410037SARM gem5 Developers StaticInstPtr 94510037SARM gem5 Developers decodeNeonUAcrossLanesReg(bool q, unsigned size, ExtMachInst machInst, 94610037SARM gem5 Developers IntRegIndex dest, IntRegIndex op1) 94710037SARM gem5 Developers { 94810037SARM gem5 Developers if (q) { 94910037SARM gem5 Developers switch (size) { 95010037SARM gem5 Developers case 0x0: 95110037SARM gem5 Developers return new BaseQ<uint8_t>(machInst, dest, op1); 95210037SARM gem5 Developers case 0x1: 95310037SARM gem5 Developers return new BaseQ<uint16_t>(machInst, dest, op1); 95410037SARM gem5 Developers case 0x2: 95510037SARM gem5 Developers return new BaseBQ<uint32_t>(machInst, dest, op1); 95610037SARM gem5 Developers default: 95710037SARM gem5 Developers return new Unknown(machInst); 95810037SARM gem5 Developers } 95910037SARM gem5 Developers } else { 96010037SARM gem5 Developers switch (size) { 96110037SARM gem5 Developers case 0x0: 96210037SARM gem5 Developers return new BaseD<uint8_t>(machInst, dest, op1); 96310037SARM gem5 Developers case 0x1: 96410037SARM gem5 Developers return new BaseD<uint16_t>(machInst, dest, op1); 96510037SARM gem5 Developers default: 96610037SARM gem5 Developers return new Unknown(machInst); 96710037SARM gem5 Developers } 96810037SARM gem5 Developers } 96910037SARM gem5 Developers } 97010037SARM gem5 Developers 97110037SARM gem5 Developers template <template <typename T> class BaseD, 97210037SARM gem5 Developers template <typename T> class BaseQ> 97310037SARM gem5 Developers StaticInstPtr 97410037SARM gem5 Developers decodeNeonSAcrossLanesReg(bool q, unsigned size, ExtMachInst machInst, 97510037SARM gem5 Developers IntRegIndex dest, IntRegIndex op1) 97610037SARM gem5 Developers { 97710037SARM gem5 Developers if (q) { 97810037SARM gem5 Developers switch (size) { 97910037SARM gem5 Developers case 0x0: 98010037SARM gem5 Developers return new BaseQ<int8_t>(machInst, dest, op1); 98110037SARM gem5 Developers case 0x1: 98210037SARM gem5 Developers return new BaseQ<int16_t>(machInst, dest, op1); 98310037SARM gem5 Developers case 0x2: 98410037SARM gem5 Developers return new BaseQ<int32_t>(machInst, dest, op1); 98510037SARM gem5 Developers default: 98610037SARM gem5 Developers return new Unknown(machInst); 98710037SARM gem5 Developers } 98810037SARM gem5 Developers } else { 98910037SARM gem5 Developers switch (size) { 99010037SARM gem5 Developers case 0x0: 99110037SARM gem5 Developers return new BaseD<int8_t>(machInst, dest, op1); 99210037SARM gem5 Developers case 0x1: 99310037SARM gem5 Developers return new BaseD<int16_t>(machInst, dest, op1); 99410037SARM gem5 Developers default: 99510037SARM gem5 Developers return new Unknown(machInst); 99610037SARM gem5 Developers } 99710037SARM gem5 Developers } 99810037SARM gem5 Developers } 99910037SARM gem5 Developers 100010037SARM gem5 Developers template <template <typename T> class BaseD, 100110037SARM gem5 Developers template <typename T> class BaseQ, 100210037SARM gem5 Developers template <typename T> class BaseBQ> 100310037SARM gem5 Developers StaticInstPtr 100410037SARM gem5 Developers decodeNeonUAcrossLanesLongReg(bool q, unsigned size, ExtMachInst machInst, 100510037SARM gem5 Developers IntRegIndex dest, IntRegIndex op1) 100610037SARM gem5 Developers { 100710037SARM gem5 Developers if (q) { 100810037SARM gem5 Developers switch (size) { 100910037SARM gem5 Developers case 0x0: 101010037SARM gem5 Developers return new BaseQ<uint8_t>(machInst, dest, op1); 101110037SARM gem5 Developers case 0x1: 101210037SARM gem5 Developers return new BaseQ<uint16_t>(machInst, dest, op1); 101310037SARM gem5 Developers case 0x2: 101410037SARM gem5 Developers return new BaseBQ<uint32_t>(machInst, dest, op1); 101510037SARM gem5 Developers default: 101610037SARM gem5 Developers return new Unknown(machInst); 101710037SARM gem5 Developers } 101810037SARM gem5 Developers } else { 101910037SARM gem5 Developers switch (size) { 102010037SARM gem5 Developers case 0x0: 102110037SARM gem5 Developers return new BaseD<uint8_t>(machInst, dest, op1); 102210037SARM gem5 Developers case 0x1: 102310037SARM gem5 Developers return new BaseD<uint16_t>(machInst, dest, op1); 102410037SARM gem5 Developers default: 102510037SARM gem5 Developers return new Unknown(machInst); 102610037SARM gem5 Developers } 102710037SARM gem5 Developers } 102810037SARM gem5 Developers } 102910037SARM gem5 Developers 103010037SARM gem5 Developers template <template <typename T> class BaseD, 103110037SARM gem5 Developers template <typename T> class BaseQ, 103210037SARM gem5 Developers template <typename T> class BaseBQ> 103310037SARM gem5 Developers StaticInstPtr 103410037SARM gem5 Developers decodeNeonSAcrossLanesLongReg(bool q, unsigned size, ExtMachInst machInst, 103510037SARM gem5 Developers IntRegIndex dest, IntRegIndex op1) 103610037SARM gem5 Developers { 103710037SARM gem5 Developers if (q) { 103810037SARM gem5 Developers switch (size) { 103910037SARM gem5 Developers case 0x0: 104010037SARM gem5 Developers return new BaseQ<int8_t>(machInst, dest, op1); 104110037SARM gem5 Developers case 0x1: 104210037SARM gem5 Developers return new BaseQ<int16_t>(machInst, dest, op1); 104310037SARM gem5 Developers case 0x2: 104410037SARM gem5 Developers return new BaseBQ<int32_t>(machInst, dest, op1); 104510037SARM gem5 Developers default: 104610037SARM gem5 Developers return new Unknown(machInst); 104710037SARM gem5 Developers } 104810037SARM gem5 Developers } else { 104910037SARM gem5 Developers switch (size) { 105010037SARM gem5 Developers case 0x0: 105110037SARM gem5 Developers return new BaseD<int8_t>(machInst, dest, op1); 105210037SARM gem5 Developers case 0x1: 105310037SARM gem5 Developers return new BaseD<int16_t>(machInst, dest, op1); 105410037SARM gem5 Developers default: 105510037SARM gem5 Developers return new Unknown(machInst); 105610037SARM gem5 Developers } 105710037SARM gem5 Developers } 105810037SARM gem5 Developers } 10597639Sgblack@eecs.umich.edu}}; 10607639Sgblack@eecs.umich.edu 106110197SCurtis.Dunham@arm.comlet {{ 106210197SCurtis.Dunham@arm.com header_output = "" 106310197SCurtis.Dunham@arm.com exec_output = "" 106410197SCurtis.Dunham@arm.com 106510197SCurtis.Dunham@arm.com vcompares = ''' 10667639Sgblack@eecs.umich.edu static float 10677639Sgblack@eecs.umich.edu vcgtFunc(float op1, float op2) 10687639Sgblack@eecs.umich.edu { 10699517SAli.Saidi@ARM.com if (std::isnan(op1) || std::isnan(op2)) 10707639Sgblack@eecs.umich.edu return 2.0; 10717639Sgblack@eecs.umich.edu return (op1 > op2) ? 0.0 : 1.0; 10727639Sgblack@eecs.umich.edu } 10737639Sgblack@eecs.umich.edu 10747639Sgblack@eecs.umich.edu static float 10757639Sgblack@eecs.umich.edu vcgeFunc(float op1, float op2) 10767639Sgblack@eecs.umich.edu { 10779517SAli.Saidi@ARM.com if (std::isnan(op1) || std::isnan(op2)) 10787639Sgblack@eecs.umich.edu return 2.0; 10797639Sgblack@eecs.umich.edu return (op1 >= op2) ? 0.0 : 1.0; 10807639Sgblack@eecs.umich.edu } 10817639Sgblack@eecs.umich.edu 10827639Sgblack@eecs.umich.edu static float 10837639Sgblack@eecs.umich.edu vceqFunc(float op1, float op2) 10847639Sgblack@eecs.umich.edu { 10857639Sgblack@eecs.umich.edu if (isSnan(op1) || isSnan(op2)) 10867639Sgblack@eecs.umich.edu return 2.0; 10877639Sgblack@eecs.umich.edu return (op1 == op2) ? 0.0 : 1.0; 10887639Sgblack@eecs.umich.edu } 108910197SCurtis.Dunham@arm.com''' 109010197SCurtis.Dunham@arm.com vcomparesL = ''' 10917639Sgblack@eecs.umich.edu static float 10927639Sgblack@eecs.umich.edu vcleFunc(float op1, float op2) 10937639Sgblack@eecs.umich.edu { 10949517SAli.Saidi@ARM.com if (std::isnan(op1) || std::isnan(op2)) 10957639Sgblack@eecs.umich.edu return 2.0; 10967639Sgblack@eecs.umich.edu return (op1 <= op2) ? 0.0 : 1.0; 10977639Sgblack@eecs.umich.edu } 10987639Sgblack@eecs.umich.edu 10997639Sgblack@eecs.umich.edu static float 11007639Sgblack@eecs.umich.edu vcltFunc(float op1, float op2) 11017639Sgblack@eecs.umich.edu { 11029517SAli.Saidi@ARM.com if (std::isnan(op1) || std::isnan(op2)) 11037639Sgblack@eecs.umich.edu return 2.0; 11047639Sgblack@eecs.umich.edu return (op1 < op2) ? 0.0 : 1.0; 11057639Sgblack@eecs.umich.edu } 110610197SCurtis.Dunham@arm.com''' 110710197SCurtis.Dunham@arm.com vacomparesG = ''' 11087639Sgblack@eecs.umich.edu static float 11097639Sgblack@eecs.umich.edu vacgtFunc(float op1, float op2) 11107639Sgblack@eecs.umich.edu { 11119517SAli.Saidi@ARM.com if (std::isnan(op1) || std::isnan(op2)) 11127639Sgblack@eecs.umich.edu return 2.0; 11137639Sgblack@eecs.umich.edu return (fabsf(op1) > fabsf(op2)) ? 0.0 : 1.0; 11147639Sgblack@eecs.umich.edu } 11157639Sgblack@eecs.umich.edu 11167639Sgblack@eecs.umich.edu static float 11177639Sgblack@eecs.umich.edu vacgeFunc(float op1, float op2) 11187639Sgblack@eecs.umich.edu { 11199517SAli.Saidi@ARM.com if (std::isnan(op1) || std::isnan(op2)) 11207639Sgblack@eecs.umich.edu return 2.0; 11217639Sgblack@eecs.umich.edu return (fabsf(op1) >= fabsf(op2)) ? 0.0 : 1.0; 11227639Sgblack@eecs.umich.edu } 112310197SCurtis.Dunham@arm.com''' 11247639Sgblack@eecs.umich.edu 112510197SCurtis.Dunham@arm.com exec_output += vcompares + vacomparesG 11267639Sgblack@eecs.umich.edu 11277639Sgblack@eecs.umich.edu smallUnsignedTypes = ("uint8_t", "uint16_t", "uint32_t") 11287639Sgblack@eecs.umich.edu unsignedTypes = smallUnsignedTypes + ("uint64_t",) 11297639Sgblack@eecs.umich.edu smallSignedTypes = ("int8_t", "int16_t", "int32_t") 11307639Sgblack@eecs.umich.edu signedTypes = smallSignedTypes + ("int64_t",) 11317639Sgblack@eecs.umich.edu smallTypes = smallUnsignedTypes + smallSignedTypes 11327639Sgblack@eecs.umich.edu allTypes = unsignedTypes + signedTypes 11337639Sgblack@eecs.umich.edu 11347760SGiacomo.Gabrielli@arm.com def threeEqualRegInst(name, Name, opClass, types, rCount, op, 113513978Sciro.santilli@arm.com readDest=False, pairwise=False, 113613978Sciro.santilli@arm.com standardFpcsr=False): 11377639Sgblack@eecs.umich.edu global header_output, exec_output 11387640Sgblack@eecs.umich.edu eWalkCode = simdEnabledCheckCode + ''' 11397639Sgblack@eecs.umich.edu RegVect srcReg1, srcReg2, destReg; 11407639Sgblack@eecs.umich.edu ''' 11417639Sgblack@eecs.umich.edu for reg in range(rCount): 11427639Sgblack@eecs.umich.edu eWalkCode += ''' 11438588Sgblack@eecs.umich.edu srcReg1.regs[%(reg)d] = htog(FpOp1P%(reg)d_uw); 11448588Sgblack@eecs.umich.edu srcReg2.regs[%(reg)d] = htog(FpOp2P%(reg)d_uw); 11457639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 11467639Sgblack@eecs.umich.edu if readDest: 11477639Sgblack@eecs.umich.edu eWalkCode += ''' 11488588Sgblack@eecs.umich.edu destReg.regs[%(reg)d] = htog(FpDestP%(reg)d_uw); 11497639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 11507639Sgblack@eecs.umich.edu readDestCode = '' 115113978Sciro.santilli@arm.com if standardFpcsr: 115213978Sciro.santilli@arm.com eWalkCode += ''' 115313978Sciro.santilli@arm.com FPSCR fpscr = fpStandardFPSCRValue((FPSCR)FpscrExc); 115413978Sciro.santilli@arm.com ''' 11557639Sgblack@eecs.umich.edu if readDest: 11567639Sgblack@eecs.umich.edu readDestCode = 'destElem = gtoh(destReg.elements[i]);' 11577639Sgblack@eecs.umich.edu if pairwise: 11587639Sgblack@eecs.umich.edu eWalkCode += ''' 11597639Sgblack@eecs.umich.edu for (unsigned i = 0; i < eCount; i++) { 11607639Sgblack@eecs.umich.edu Element srcElem1 = gtoh(2 * i < eCount ? 11617639Sgblack@eecs.umich.edu srcReg1.elements[2 * i] : 11627639Sgblack@eecs.umich.edu srcReg2.elements[2 * i - eCount]); 11637639Sgblack@eecs.umich.edu Element srcElem2 = gtoh(2 * i < eCount ? 11647639Sgblack@eecs.umich.edu srcReg1.elements[2 * i + 1] : 11657639Sgblack@eecs.umich.edu srcReg2.elements[2 * i + 1 - eCount]); 11667639Sgblack@eecs.umich.edu Element destElem; 11677639Sgblack@eecs.umich.edu %(readDest)s 11687639Sgblack@eecs.umich.edu %(op)s 11697639Sgblack@eecs.umich.edu destReg.elements[i] = htog(destElem); 11707639Sgblack@eecs.umich.edu } 11717639Sgblack@eecs.umich.edu ''' % { "op" : op, "readDest" : readDestCode } 11727639Sgblack@eecs.umich.edu else: 11737639Sgblack@eecs.umich.edu eWalkCode += ''' 11747639Sgblack@eecs.umich.edu for (unsigned i = 0; i < eCount; i++) { 11757639Sgblack@eecs.umich.edu Element srcElem1 = gtoh(srcReg1.elements[i]); 11767639Sgblack@eecs.umich.edu Element srcElem2 = gtoh(srcReg2.elements[i]); 11777639Sgblack@eecs.umich.edu Element destElem; 11787639Sgblack@eecs.umich.edu %(readDest)s 11797639Sgblack@eecs.umich.edu %(op)s 11807639Sgblack@eecs.umich.edu destReg.elements[i] = htog(destElem); 11817639Sgblack@eecs.umich.edu } 11827639Sgblack@eecs.umich.edu ''' % { "op" : op, "readDest" : readDestCode } 118313978Sciro.santilli@arm.com if standardFpcsr: 118413978Sciro.santilli@arm.com eWalkCode += ''' 118513978Sciro.santilli@arm.com FpscrExc = fpscr; 118613978Sciro.santilli@arm.com ''' 11877639Sgblack@eecs.umich.edu for reg in range(rCount): 11887639Sgblack@eecs.umich.edu eWalkCode += ''' 11898588Sgblack@eecs.umich.edu FpDestP%(reg)d_uw = gtoh(destReg.regs[%(reg)d]); 11907639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 11917639Sgblack@eecs.umich.edu iop = InstObjParams(name, Name, 11927639Sgblack@eecs.umich.edu "RegRegRegOp", 11937639Sgblack@eecs.umich.edu { "code": eWalkCode, 11947639Sgblack@eecs.umich.edu "r_count": rCount, 11957760SGiacomo.Gabrielli@arm.com "predicate_test": predicateTest, 11967760SGiacomo.Gabrielli@arm.com "op_class": opClass }, []) 11977639Sgblack@eecs.umich.edu header_output += NeonRegRegRegOpDeclare.subst(iop) 11987639Sgblack@eecs.umich.edu exec_output += NeonEqualRegExecute.subst(iop) 11997639Sgblack@eecs.umich.edu for type in types: 12007639Sgblack@eecs.umich.edu substDict = { "targs" : type, 12017639Sgblack@eecs.umich.edu "class_name" : Name } 12027639Sgblack@eecs.umich.edu exec_output += NeonExecDeclare.subst(substDict) 12037639Sgblack@eecs.umich.edu 12047760SGiacomo.Gabrielli@arm.com def threeEqualRegInstFp(name, Name, opClass, types, rCount, op, 12057639Sgblack@eecs.umich.edu readDest=False, pairwise=False, toInt=False): 12067639Sgblack@eecs.umich.edu global header_output, exec_output 12077640Sgblack@eecs.umich.edu eWalkCode = simdEnabledCheckCode + ''' 120813544Sgabeblack@google.com typedef float FloatVect[rCount]; 12097639Sgblack@eecs.umich.edu FloatVect srcRegs1, srcRegs2; 12107639Sgblack@eecs.umich.edu ''' 12117639Sgblack@eecs.umich.edu if toInt: 12127639Sgblack@eecs.umich.edu eWalkCode += 'RegVect destRegs;\n' 12137639Sgblack@eecs.umich.edu else: 12147639Sgblack@eecs.umich.edu eWalkCode += 'FloatVect destRegs;\n' 12157639Sgblack@eecs.umich.edu for reg in range(rCount): 12167639Sgblack@eecs.umich.edu eWalkCode += ''' 12177639Sgblack@eecs.umich.edu srcRegs1[%(reg)d] = FpOp1P%(reg)d; 12187639Sgblack@eecs.umich.edu srcRegs2[%(reg)d] = FpOp2P%(reg)d; 12197639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 12207639Sgblack@eecs.umich.edu if readDest: 12217639Sgblack@eecs.umich.edu if toInt: 12227639Sgblack@eecs.umich.edu eWalkCode += ''' 12237639Sgblack@eecs.umich.edu destRegs.regs[%(reg)d] = FpDestP%(reg)d.bits; 12247639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 12257639Sgblack@eecs.umich.edu else: 12267639Sgblack@eecs.umich.edu eWalkCode += ''' 12277639Sgblack@eecs.umich.edu destRegs[%(reg)d] = FpDestP%(reg)d; 12287639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 12297639Sgblack@eecs.umich.edu readDestCode = '' 12307639Sgblack@eecs.umich.edu if readDest: 12317639Sgblack@eecs.umich.edu readDestCode = 'destReg = destRegs[r];' 123213544Sgabeblack@google.com destType = 'float' 12337639Sgblack@eecs.umich.edu writeDest = 'destRegs[r] = destReg;' 12347639Sgblack@eecs.umich.edu if toInt: 123513544Sgabeblack@google.com destType = 'uint32_t' 12367639Sgblack@eecs.umich.edu writeDest = 'destRegs.regs[r] = destReg;' 12377639Sgblack@eecs.umich.edu if pairwise: 12387639Sgblack@eecs.umich.edu eWalkCode += ''' 12397639Sgblack@eecs.umich.edu for (unsigned r = 0; r < rCount; r++) { 124013544Sgabeblack@google.com float srcReg1 = (2 * r < rCount) ? 12417639Sgblack@eecs.umich.edu srcRegs1[2 * r] : srcRegs2[2 * r - rCount]; 124213544Sgabeblack@google.com float srcReg2 = (2 * r < rCount) ? 12437639Sgblack@eecs.umich.edu srcRegs1[2 * r + 1] : srcRegs2[2 * r + 1 - rCount]; 12447639Sgblack@eecs.umich.edu %(destType)s destReg; 12457639Sgblack@eecs.umich.edu %(readDest)s 12467639Sgblack@eecs.umich.edu %(op)s 12477639Sgblack@eecs.umich.edu %(writeDest)s 12487639Sgblack@eecs.umich.edu } 12497639Sgblack@eecs.umich.edu ''' % { "op" : op, 12507639Sgblack@eecs.umich.edu "readDest" : readDestCode, 12517639Sgblack@eecs.umich.edu "destType" : destType, 12527639Sgblack@eecs.umich.edu "writeDest" : writeDest } 12537639Sgblack@eecs.umich.edu else: 12547639Sgblack@eecs.umich.edu eWalkCode += ''' 12557639Sgblack@eecs.umich.edu for (unsigned r = 0; r < rCount; r++) { 125613544Sgabeblack@google.com float srcReg1 = srcRegs1[r]; 125713544Sgabeblack@google.com float srcReg2 = srcRegs2[r]; 12587639Sgblack@eecs.umich.edu %(destType)s destReg; 12597639Sgblack@eecs.umich.edu %(readDest)s 12607639Sgblack@eecs.umich.edu %(op)s 12617639Sgblack@eecs.umich.edu %(writeDest)s 12627639Sgblack@eecs.umich.edu } 12637639Sgblack@eecs.umich.edu ''' % { "op" : op, 12647639Sgblack@eecs.umich.edu "readDest" : readDestCode, 12657639Sgblack@eecs.umich.edu "destType" : destType, 12667639Sgblack@eecs.umich.edu "writeDest" : writeDest } 12677639Sgblack@eecs.umich.edu for reg in range(rCount): 12687639Sgblack@eecs.umich.edu if toInt: 12697639Sgblack@eecs.umich.edu eWalkCode += ''' 12708588Sgblack@eecs.umich.edu FpDestP%(reg)d_uw = destRegs.regs[%(reg)d]; 12717639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 12727639Sgblack@eecs.umich.edu else: 12737639Sgblack@eecs.umich.edu eWalkCode += ''' 12747639Sgblack@eecs.umich.edu FpDestP%(reg)d = destRegs[%(reg)d]; 12757639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 12767639Sgblack@eecs.umich.edu iop = InstObjParams(name, Name, 12777639Sgblack@eecs.umich.edu "FpRegRegRegOp", 12787639Sgblack@eecs.umich.edu { "code": eWalkCode, 12797639Sgblack@eecs.umich.edu "r_count": rCount, 12807760SGiacomo.Gabrielli@arm.com "predicate_test": predicateTest, 12817760SGiacomo.Gabrielli@arm.com "op_class": opClass }, []) 12827639Sgblack@eecs.umich.edu header_output += NeonRegRegRegOpDeclare.subst(iop) 12837639Sgblack@eecs.umich.edu exec_output += NeonEqualRegExecute.subst(iop) 12847639Sgblack@eecs.umich.edu for type in types: 12857639Sgblack@eecs.umich.edu substDict = { "targs" : type, 12867639Sgblack@eecs.umich.edu "class_name" : Name } 12877639Sgblack@eecs.umich.edu exec_output += NeonExecDeclare.subst(substDict) 12887639Sgblack@eecs.umich.edu 12897760SGiacomo.Gabrielli@arm.com def threeUnequalRegInst(name, Name, opClass, types, op, 12907639Sgblack@eecs.umich.edu bigSrc1, bigSrc2, bigDest, readDest): 12917639Sgblack@eecs.umich.edu global header_output, exec_output 12927639Sgblack@eecs.umich.edu src1Cnt = src2Cnt = destCnt = 2 12937639Sgblack@eecs.umich.edu src1Prefix = src2Prefix = destPrefix = '' 12947639Sgblack@eecs.umich.edu if bigSrc1: 12957639Sgblack@eecs.umich.edu src1Cnt = 4 12967639Sgblack@eecs.umich.edu src1Prefix = 'Big' 12977639Sgblack@eecs.umich.edu if bigSrc2: 12987639Sgblack@eecs.umich.edu src2Cnt = 4 12997639Sgblack@eecs.umich.edu src2Prefix = 'Big' 13007639Sgblack@eecs.umich.edu if bigDest: 13017639Sgblack@eecs.umich.edu destCnt = 4 13027639Sgblack@eecs.umich.edu destPrefix = 'Big' 13037640Sgblack@eecs.umich.edu eWalkCode = simdEnabledCheckCode + ''' 13047639Sgblack@eecs.umich.edu %sRegVect srcReg1; 13057639Sgblack@eecs.umich.edu %sRegVect srcReg2; 13067639Sgblack@eecs.umich.edu %sRegVect destReg; 13077639Sgblack@eecs.umich.edu ''' % (src1Prefix, src2Prefix, destPrefix) 13087639Sgblack@eecs.umich.edu for reg in range(src1Cnt): 13097639Sgblack@eecs.umich.edu eWalkCode += ''' 13108588Sgblack@eecs.umich.edu srcReg1.regs[%(reg)d] = htog(FpOp1P%(reg)d_uw); 13117639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 13127639Sgblack@eecs.umich.edu for reg in range(src2Cnt): 13137639Sgblack@eecs.umich.edu eWalkCode += ''' 13148588Sgblack@eecs.umich.edu srcReg2.regs[%(reg)d] = htog(FpOp2P%(reg)d_uw); 13157639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 13167639Sgblack@eecs.umich.edu if readDest: 13177639Sgblack@eecs.umich.edu for reg in range(destCnt): 13187639Sgblack@eecs.umich.edu eWalkCode += ''' 13198588Sgblack@eecs.umich.edu destReg.regs[%(reg)d] = htog(FpDestP%(reg)d_uw); 13207639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 13217639Sgblack@eecs.umich.edu readDestCode = '' 13227639Sgblack@eecs.umich.edu if readDest: 13237639Sgblack@eecs.umich.edu readDestCode = 'destElem = gtoh(destReg.elements[i]);' 13247639Sgblack@eecs.umich.edu eWalkCode += ''' 13257639Sgblack@eecs.umich.edu for (unsigned i = 0; i < eCount; i++) { 13267639Sgblack@eecs.umich.edu %(src1Prefix)sElement srcElem1 = gtoh(srcReg1.elements[i]); 13277639Sgblack@eecs.umich.edu %(src1Prefix)sElement srcElem2 = gtoh(srcReg2.elements[i]); 13287639Sgblack@eecs.umich.edu %(destPrefix)sElement destElem; 13297639Sgblack@eecs.umich.edu %(readDest)s 13307639Sgblack@eecs.umich.edu %(op)s 13317639Sgblack@eecs.umich.edu destReg.elements[i] = htog(destElem); 13327639Sgblack@eecs.umich.edu } 13337639Sgblack@eecs.umich.edu ''' % { "op" : op, "readDest" : readDestCode, 13347639Sgblack@eecs.umich.edu "src1Prefix" : src1Prefix, "src2Prefix" : src2Prefix, 13357639Sgblack@eecs.umich.edu "destPrefix" : destPrefix } 13367639Sgblack@eecs.umich.edu for reg in range(destCnt): 13377639Sgblack@eecs.umich.edu eWalkCode += ''' 13388588Sgblack@eecs.umich.edu FpDestP%(reg)d_uw = gtoh(destReg.regs[%(reg)d]); 13397639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 13407639Sgblack@eecs.umich.edu iop = InstObjParams(name, Name, 13417639Sgblack@eecs.umich.edu "RegRegRegOp", 13427639Sgblack@eecs.umich.edu { "code": eWalkCode, 13437639Sgblack@eecs.umich.edu "r_count": 2, 13447760SGiacomo.Gabrielli@arm.com "predicate_test": predicateTest, 13457760SGiacomo.Gabrielli@arm.com "op_class": opClass }, []) 13467639Sgblack@eecs.umich.edu header_output += NeonRegRegRegOpDeclare.subst(iop) 13477639Sgblack@eecs.umich.edu exec_output += NeonUnequalRegExecute.subst(iop) 13487639Sgblack@eecs.umich.edu for type in types: 13497639Sgblack@eecs.umich.edu substDict = { "targs" : type, 13507639Sgblack@eecs.umich.edu "class_name" : Name } 13517639Sgblack@eecs.umich.edu exec_output += NeonExecDeclare.subst(substDict) 13527639Sgblack@eecs.umich.edu 13537760SGiacomo.Gabrielli@arm.com def threeRegNarrowInst(name, Name, opClass, types, op, readDest=False): 13547760SGiacomo.Gabrielli@arm.com threeUnequalRegInst(name, Name, opClass, types, op, 13557639Sgblack@eecs.umich.edu True, True, False, readDest) 13567639Sgblack@eecs.umich.edu 13577760SGiacomo.Gabrielli@arm.com def threeRegLongInst(name, Name, opClass, types, op, readDest=False): 13587760SGiacomo.Gabrielli@arm.com threeUnequalRegInst(name, Name, opClass, types, op, 13597639Sgblack@eecs.umich.edu False, False, True, readDest) 13607639Sgblack@eecs.umich.edu 13617760SGiacomo.Gabrielli@arm.com def threeRegWideInst(name, Name, opClass, types, op, readDest=False): 13627760SGiacomo.Gabrielli@arm.com threeUnequalRegInst(name, Name, opClass, types, op, 13637639Sgblack@eecs.umich.edu True, False, True, readDest) 13647639Sgblack@eecs.umich.edu 13657760SGiacomo.Gabrielli@arm.com def twoEqualRegInst(name, Name, opClass, types, rCount, op, readDest=False): 13667639Sgblack@eecs.umich.edu global header_output, exec_output 13677640Sgblack@eecs.umich.edu eWalkCode = simdEnabledCheckCode + ''' 13687639Sgblack@eecs.umich.edu RegVect srcReg1, srcReg2, destReg; 13697639Sgblack@eecs.umich.edu ''' 13707639Sgblack@eecs.umich.edu for reg in range(rCount): 13717639Sgblack@eecs.umich.edu eWalkCode += ''' 13728588Sgblack@eecs.umich.edu srcReg1.regs[%(reg)d] = htog(FpOp1P%(reg)d_uw); 13738588Sgblack@eecs.umich.edu srcReg2.regs[%(reg)d] = htog(FpOp2P%(reg)d_uw); 13747639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 13757639Sgblack@eecs.umich.edu if readDest: 13767639Sgblack@eecs.umich.edu eWalkCode += ''' 13778588Sgblack@eecs.umich.edu destReg.regs[%(reg)d] = htog(FpDestP%(reg)d_uw); 13787639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 13797639Sgblack@eecs.umich.edu readDestCode = '' 13807639Sgblack@eecs.umich.edu if readDest: 13817639Sgblack@eecs.umich.edu readDestCode = 'destElem = gtoh(destReg.elements[i]);' 13827639Sgblack@eecs.umich.edu eWalkCode += ''' 13837853SMatt.Horsnell@ARM.com if (imm < 0 && imm >= eCount) { 138410474Sandreas.hansson@arm.com fault = std::make_shared<UndefinedInstruction>(machInst, false, 138510474Sandreas.hansson@arm.com mnemonic); 13867853SMatt.Horsnell@ARM.com } else { 13877853SMatt.Horsnell@ARM.com for (unsigned i = 0; i < eCount; i++) { 13887853SMatt.Horsnell@ARM.com Element srcElem1 = gtoh(srcReg1.elements[i]); 13897853SMatt.Horsnell@ARM.com Element srcElem2 = gtoh(srcReg2.elements[imm]); 13907853SMatt.Horsnell@ARM.com Element destElem; 13917853SMatt.Horsnell@ARM.com %(readDest)s 13927853SMatt.Horsnell@ARM.com %(op)s 13937853SMatt.Horsnell@ARM.com destReg.elements[i] = htog(destElem); 13947853SMatt.Horsnell@ARM.com } 13957639Sgblack@eecs.umich.edu } 13967639Sgblack@eecs.umich.edu ''' % { "op" : op, "readDest" : readDestCode } 13977639Sgblack@eecs.umich.edu for reg in range(rCount): 13987639Sgblack@eecs.umich.edu eWalkCode += ''' 13998588Sgblack@eecs.umich.edu FpDestP%(reg)d_uw = gtoh(destReg.regs[%(reg)d]); 14007639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 14017639Sgblack@eecs.umich.edu iop = InstObjParams(name, Name, 14027639Sgblack@eecs.umich.edu "RegRegRegImmOp", 14037639Sgblack@eecs.umich.edu { "code": eWalkCode, 14047639Sgblack@eecs.umich.edu "r_count": rCount, 14057760SGiacomo.Gabrielli@arm.com "predicate_test": predicateTest, 14067760SGiacomo.Gabrielli@arm.com "op_class": opClass }, []) 14077639Sgblack@eecs.umich.edu header_output += NeonRegRegRegImmOpDeclare.subst(iop) 14087639Sgblack@eecs.umich.edu exec_output += NeonEqualRegExecute.subst(iop) 14097639Sgblack@eecs.umich.edu for type in types: 14107639Sgblack@eecs.umich.edu substDict = { "targs" : type, 14117639Sgblack@eecs.umich.edu "class_name" : Name } 14127639Sgblack@eecs.umich.edu exec_output += NeonExecDeclare.subst(substDict) 14137639Sgblack@eecs.umich.edu 14147760SGiacomo.Gabrielli@arm.com def twoRegLongInst(name, Name, opClass, types, op, readDest=False): 14157639Sgblack@eecs.umich.edu global header_output, exec_output 14167639Sgblack@eecs.umich.edu rCount = 2 14177640Sgblack@eecs.umich.edu eWalkCode = simdEnabledCheckCode + ''' 14187639Sgblack@eecs.umich.edu RegVect srcReg1, srcReg2; 14197639Sgblack@eecs.umich.edu BigRegVect destReg; 14207639Sgblack@eecs.umich.edu ''' 14217639Sgblack@eecs.umich.edu for reg in range(rCount): 14227639Sgblack@eecs.umich.edu eWalkCode += ''' 14238588Sgblack@eecs.umich.edu srcReg1.regs[%(reg)d] = htog(FpOp1P%(reg)d_uw); 14248588Sgblack@eecs.umich.edu srcReg2.regs[%(reg)d] = htog(FpOp2P%(reg)d_uw);; 14257639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 14267639Sgblack@eecs.umich.edu if readDest: 14277639Sgblack@eecs.umich.edu for reg in range(2 * rCount): 14287639Sgblack@eecs.umich.edu eWalkCode += ''' 14298588Sgblack@eecs.umich.edu destReg.regs[%(reg)d] = htog(FpDestP%(reg)d_uw); 14307639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 14317639Sgblack@eecs.umich.edu readDestCode = '' 14327639Sgblack@eecs.umich.edu if readDest: 14337639Sgblack@eecs.umich.edu readDestCode = 'destElem = gtoh(destReg.elements[i]);' 14347639Sgblack@eecs.umich.edu eWalkCode += ''' 14357853SMatt.Horsnell@ARM.com if (imm < 0 && imm >= eCount) { 143610474Sandreas.hansson@arm.com fault = std::make_shared<UndefinedInstruction>(machInst, false, 143710474Sandreas.hansson@arm.com mnemonic); 14387853SMatt.Horsnell@ARM.com } else { 14397853SMatt.Horsnell@ARM.com for (unsigned i = 0; i < eCount; i++) { 14407853SMatt.Horsnell@ARM.com Element srcElem1 = gtoh(srcReg1.elements[i]); 14417853SMatt.Horsnell@ARM.com Element srcElem2 = gtoh(srcReg2.elements[imm]); 14427853SMatt.Horsnell@ARM.com BigElement destElem; 14437853SMatt.Horsnell@ARM.com %(readDest)s 14447853SMatt.Horsnell@ARM.com %(op)s 14457853SMatt.Horsnell@ARM.com destReg.elements[i] = htog(destElem); 14467853SMatt.Horsnell@ARM.com } 14477639Sgblack@eecs.umich.edu } 14487639Sgblack@eecs.umich.edu ''' % { "op" : op, "readDest" : readDestCode } 14497639Sgblack@eecs.umich.edu for reg in range(2 * rCount): 14507639Sgblack@eecs.umich.edu eWalkCode += ''' 14518588Sgblack@eecs.umich.edu FpDestP%(reg)d_uw = gtoh(destReg.regs[%(reg)d]); 14527639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 14537639Sgblack@eecs.umich.edu iop = InstObjParams(name, Name, 14547639Sgblack@eecs.umich.edu "RegRegRegImmOp", 14557639Sgblack@eecs.umich.edu { "code": eWalkCode, 14567639Sgblack@eecs.umich.edu "r_count": rCount, 14577760SGiacomo.Gabrielli@arm.com "predicate_test": predicateTest, 14587760SGiacomo.Gabrielli@arm.com "op_class": opClass }, []) 14597639Sgblack@eecs.umich.edu header_output += NeonRegRegRegImmOpDeclare.subst(iop) 14607639Sgblack@eecs.umich.edu exec_output += NeonUnequalRegExecute.subst(iop) 14617639Sgblack@eecs.umich.edu for type in types: 14627639Sgblack@eecs.umich.edu substDict = { "targs" : type, 14637639Sgblack@eecs.umich.edu "class_name" : Name } 14647639Sgblack@eecs.umich.edu exec_output += NeonExecDeclare.subst(substDict) 14657639Sgblack@eecs.umich.edu 14667760SGiacomo.Gabrielli@arm.com def twoEqualRegInstFp(name, Name, opClass, types, rCount, op, readDest=False): 14677639Sgblack@eecs.umich.edu global header_output, exec_output 14687640Sgblack@eecs.umich.edu eWalkCode = simdEnabledCheckCode + ''' 146913544Sgabeblack@google.com typedef float FloatVect[rCount]; 14707639Sgblack@eecs.umich.edu FloatVect srcRegs1, srcRegs2, destRegs; 14717639Sgblack@eecs.umich.edu ''' 14727639Sgblack@eecs.umich.edu for reg in range(rCount): 14737639Sgblack@eecs.umich.edu eWalkCode += ''' 14747639Sgblack@eecs.umich.edu srcRegs1[%(reg)d] = FpOp1P%(reg)d; 14757639Sgblack@eecs.umich.edu srcRegs2[%(reg)d] = FpOp2P%(reg)d; 14767639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 14777639Sgblack@eecs.umich.edu if readDest: 14787639Sgblack@eecs.umich.edu eWalkCode += ''' 14797639Sgblack@eecs.umich.edu destRegs[%(reg)d] = FpDestP%(reg)d; 14807639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 14817639Sgblack@eecs.umich.edu readDestCode = '' 14827639Sgblack@eecs.umich.edu if readDest: 14837639Sgblack@eecs.umich.edu readDestCode = 'destReg = destRegs[i];' 14847639Sgblack@eecs.umich.edu eWalkCode += ''' 14857853SMatt.Horsnell@ARM.com if (imm < 0 && imm >= eCount) { 148610474Sandreas.hansson@arm.com fault = std::make_shared<UndefinedInstruction>(machInst, false, 148710474Sandreas.hansson@arm.com mnemonic); 14887853SMatt.Horsnell@ARM.com } else { 14897853SMatt.Horsnell@ARM.com for (unsigned i = 0; i < rCount; i++) { 149013544Sgabeblack@google.com float srcReg1 = srcRegs1[i]; 149113544Sgabeblack@google.com float srcReg2 = srcRegs2[imm]; 149213544Sgabeblack@google.com float destReg; 14937853SMatt.Horsnell@ARM.com %(readDest)s 14947853SMatt.Horsnell@ARM.com %(op)s 14957853SMatt.Horsnell@ARM.com destRegs[i] = destReg; 14967853SMatt.Horsnell@ARM.com } 14977639Sgblack@eecs.umich.edu } 14987639Sgblack@eecs.umich.edu ''' % { "op" : op, "readDest" : readDestCode } 14997639Sgblack@eecs.umich.edu for reg in range(rCount): 15007639Sgblack@eecs.umich.edu eWalkCode += ''' 15017639Sgblack@eecs.umich.edu FpDestP%(reg)d = destRegs[%(reg)d]; 15027639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 15037639Sgblack@eecs.umich.edu iop = InstObjParams(name, Name, 15047639Sgblack@eecs.umich.edu "FpRegRegRegImmOp", 15057639Sgblack@eecs.umich.edu { "code": eWalkCode, 15067639Sgblack@eecs.umich.edu "r_count": rCount, 15077760SGiacomo.Gabrielli@arm.com "predicate_test": predicateTest, 15087760SGiacomo.Gabrielli@arm.com "op_class": opClass }, []) 15097639Sgblack@eecs.umich.edu header_output += NeonRegRegRegImmOpDeclare.subst(iop) 15107639Sgblack@eecs.umich.edu exec_output += NeonEqualRegExecute.subst(iop) 15117639Sgblack@eecs.umich.edu for type in types: 15127639Sgblack@eecs.umich.edu substDict = { "targs" : type, 15137639Sgblack@eecs.umich.edu "class_name" : Name } 15147639Sgblack@eecs.umich.edu exec_output += NeonExecDeclare.subst(substDict) 15157639Sgblack@eecs.umich.edu 15167760SGiacomo.Gabrielli@arm.com def twoRegShiftInst(name, Name, opClass, types, rCount, op, 15177639Sgblack@eecs.umich.edu readDest=False, toInt=False, fromInt=False): 15187639Sgblack@eecs.umich.edu global header_output, exec_output 15197640Sgblack@eecs.umich.edu eWalkCode = simdEnabledCheckCode + ''' 15207639Sgblack@eecs.umich.edu RegVect srcRegs1, destRegs; 15217639Sgblack@eecs.umich.edu ''' 15227639Sgblack@eecs.umich.edu for reg in range(rCount): 15237639Sgblack@eecs.umich.edu eWalkCode += ''' 15248588Sgblack@eecs.umich.edu srcRegs1.regs[%(reg)d] = htog(FpOp1P%(reg)d_uw); 15257639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 15267639Sgblack@eecs.umich.edu if readDest: 15277639Sgblack@eecs.umich.edu eWalkCode += ''' 15288588Sgblack@eecs.umich.edu destRegs.regs[%(reg)d] = htog(FpDestP%(reg)d_uw); 15297639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 15307639Sgblack@eecs.umich.edu readDestCode = '' 15317639Sgblack@eecs.umich.edu if readDest: 15327639Sgblack@eecs.umich.edu readDestCode = 'destElem = gtoh(destRegs.elements[i]);' 15337639Sgblack@eecs.umich.edu if toInt: 15347639Sgblack@eecs.umich.edu readDestCode = 'destReg = gtoh(destRegs.regs[i]);' 15357639Sgblack@eecs.umich.edu readOpCode = 'Element srcElem1 = gtoh(srcRegs1.elements[i]);' 15367639Sgblack@eecs.umich.edu if fromInt: 153713544Sgabeblack@google.com readOpCode = 'uint32_t srcReg1 = gtoh(srcRegs1.regs[i]);' 15387639Sgblack@eecs.umich.edu declDest = 'Element destElem;' 15397639Sgblack@eecs.umich.edu writeDestCode = 'destRegs.elements[i] = htog(destElem);' 15407639Sgblack@eecs.umich.edu if toInt: 154113544Sgabeblack@google.com declDest = 'uint32_t destReg;' 15427639Sgblack@eecs.umich.edu writeDestCode = 'destRegs.regs[i] = htog(destReg);' 15437639Sgblack@eecs.umich.edu eWalkCode += ''' 15447639Sgblack@eecs.umich.edu for (unsigned i = 0; i < eCount; i++) { 15457639Sgblack@eecs.umich.edu %(readOp)s 15467639Sgblack@eecs.umich.edu %(declDest)s 15477639Sgblack@eecs.umich.edu %(readDest)s 15487639Sgblack@eecs.umich.edu %(op)s 15497639Sgblack@eecs.umich.edu %(writeDest)s 15507639Sgblack@eecs.umich.edu } 15517639Sgblack@eecs.umich.edu ''' % { "readOp" : readOpCode, 15527639Sgblack@eecs.umich.edu "declDest" : declDest, 15537639Sgblack@eecs.umich.edu "readDest" : readDestCode, 15547639Sgblack@eecs.umich.edu "op" : op, 15557639Sgblack@eecs.umich.edu "writeDest" : writeDestCode } 15567639Sgblack@eecs.umich.edu for reg in range(rCount): 15577639Sgblack@eecs.umich.edu eWalkCode += ''' 15588588Sgblack@eecs.umich.edu FpDestP%(reg)d_uw = gtoh(destRegs.regs[%(reg)d]); 15597639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 15607639Sgblack@eecs.umich.edu iop = InstObjParams(name, Name, 15617639Sgblack@eecs.umich.edu "RegRegImmOp", 15627639Sgblack@eecs.umich.edu { "code": eWalkCode, 15637639Sgblack@eecs.umich.edu "r_count": rCount, 15647760SGiacomo.Gabrielli@arm.com "predicate_test": predicateTest, 15657760SGiacomo.Gabrielli@arm.com "op_class": opClass }, []) 15667639Sgblack@eecs.umich.edu header_output += NeonRegRegImmOpDeclare.subst(iop) 15677639Sgblack@eecs.umich.edu exec_output += NeonEqualRegExecute.subst(iop) 15687639Sgblack@eecs.umich.edu for type in types: 15697639Sgblack@eecs.umich.edu substDict = { "targs" : type, 15707639Sgblack@eecs.umich.edu "class_name" : Name } 15717639Sgblack@eecs.umich.edu exec_output += NeonExecDeclare.subst(substDict) 15727639Sgblack@eecs.umich.edu 15737760SGiacomo.Gabrielli@arm.com def twoRegNarrowShiftInst(name, Name, opClass, types, op, readDest=False): 15747639Sgblack@eecs.umich.edu global header_output, exec_output 15757640Sgblack@eecs.umich.edu eWalkCode = simdEnabledCheckCode + ''' 15767639Sgblack@eecs.umich.edu BigRegVect srcReg1; 15777639Sgblack@eecs.umich.edu RegVect destReg; 15787639Sgblack@eecs.umich.edu ''' 15797639Sgblack@eecs.umich.edu for reg in range(4): 15807639Sgblack@eecs.umich.edu eWalkCode += ''' 15818588Sgblack@eecs.umich.edu srcReg1.regs[%(reg)d] = htog(FpOp1P%(reg)d_uw); 15827639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 15837639Sgblack@eecs.umich.edu if readDest: 15847639Sgblack@eecs.umich.edu for reg in range(2): 15857639Sgblack@eecs.umich.edu eWalkCode += ''' 15868588Sgblack@eecs.umich.edu destReg.regs[%(reg)d] = htog(FpDestP%(reg)d_uw); 15877639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 15887639Sgblack@eecs.umich.edu readDestCode = '' 15897639Sgblack@eecs.umich.edu if readDest: 15907639Sgblack@eecs.umich.edu readDestCode = 'destElem = gtoh(destReg.elements[i]);' 15917639Sgblack@eecs.umich.edu eWalkCode += ''' 15927639Sgblack@eecs.umich.edu for (unsigned i = 0; i < eCount; i++) { 15937639Sgblack@eecs.umich.edu BigElement srcElem1 = gtoh(srcReg1.elements[i]); 15947639Sgblack@eecs.umich.edu Element destElem; 15957639Sgblack@eecs.umich.edu %(readDest)s 15967639Sgblack@eecs.umich.edu %(op)s 15977639Sgblack@eecs.umich.edu destReg.elements[i] = htog(destElem); 15987639Sgblack@eecs.umich.edu } 15997639Sgblack@eecs.umich.edu ''' % { "op" : op, "readDest" : readDestCode } 16007639Sgblack@eecs.umich.edu for reg in range(2): 16017639Sgblack@eecs.umich.edu eWalkCode += ''' 16028588Sgblack@eecs.umich.edu FpDestP%(reg)d_uw = gtoh(destReg.regs[%(reg)d]); 16037639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 16047639Sgblack@eecs.umich.edu iop = InstObjParams(name, Name, 16057639Sgblack@eecs.umich.edu "RegRegImmOp", 16067639Sgblack@eecs.umich.edu { "code": eWalkCode, 16077639Sgblack@eecs.umich.edu "r_count": 2, 16087760SGiacomo.Gabrielli@arm.com "predicate_test": predicateTest, 16097760SGiacomo.Gabrielli@arm.com "op_class": opClass }, []) 16107639Sgblack@eecs.umich.edu header_output += NeonRegRegImmOpDeclare.subst(iop) 16117639Sgblack@eecs.umich.edu exec_output += NeonUnequalRegExecute.subst(iop) 16127639Sgblack@eecs.umich.edu for type in types: 16137639Sgblack@eecs.umich.edu substDict = { "targs" : type, 16147639Sgblack@eecs.umich.edu "class_name" : Name } 16157639Sgblack@eecs.umich.edu exec_output += NeonExecDeclare.subst(substDict) 16167639Sgblack@eecs.umich.edu 16177760SGiacomo.Gabrielli@arm.com def twoRegLongShiftInst(name, Name, opClass, types, op, readDest=False): 16187639Sgblack@eecs.umich.edu global header_output, exec_output 16197640Sgblack@eecs.umich.edu eWalkCode = simdEnabledCheckCode + ''' 16207639Sgblack@eecs.umich.edu RegVect srcReg1; 16217639Sgblack@eecs.umich.edu BigRegVect destReg; 16227639Sgblack@eecs.umich.edu ''' 16237639Sgblack@eecs.umich.edu for reg in range(2): 16247639Sgblack@eecs.umich.edu eWalkCode += ''' 16258588Sgblack@eecs.umich.edu srcReg1.regs[%(reg)d] = htog(FpOp1P%(reg)d_uw); 16267639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 16277639Sgblack@eecs.umich.edu if readDest: 16287639Sgblack@eecs.umich.edu for reg in range(4): 16297639Sgblack@eecs.umich.edu eWalkCode += ''' 16308588Sgblack@eecs.umich.edu destReg.regs[%(reg)d] = htog(FpDestP%(reg)d_uw); 16317639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 16327639Sgblack@eecs.umich.edu readDestCode = '' 16337639Sgblack@eecs.umich.edu if readDest: 16347639Sgblack@eecs.umich.edu readDestCode = 'destReg = gtoh(destReg.elements[i]);' 16357639Sgblack@eecs.umich.edu eWalkCode += ''' 16367639Sgblack@eecs.umich.edu for (unsigned i = 0; i < eCount; i++) { 16377639Sgblack@eecs.umich.edu Element srcElem1 = gtoh(srcReg1.elements[i]); 16387639Sgblack@eecs.umich.edu BigElement destElem; 16397639Sgblack@eecs.umich.edu %(readDest)s 16407639Sgblack@eecs.umich.edu %(op)s 16417639Sgblack@eecs.umich.edu destReg.elements[i] = htog(destElem); 16427639Sgblack@eecs.umich.edu } 16437639Sgblack@eecs.umich.edu ''' % { "op" : op, "readDest" : readDestCode } 16447639Sgblack@eecs.umich.edu for reg in range(4): 16457639Sgblack@eecs.umich.edu eWalkCode += ''' 16468588Sgblack@eecs.umich.edu FpDestP%(reg)d_uw = gtoh(destReg.regs[%(reg)d]); 16477639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 16487639Sgblack@eecs.umich.edu iop = InstObjParams(name, Name, 16497639Sgblack@eecs.umich.edu "RegRegImmOp", 16507639Sgblack@eecs.umich.edu { "code": eWalkCode, 16517639Sgblack@eecs.umich.edu "r_count": 2, 16527760SGiacomo.Gabrielli@arm.com "predicate_test": predicateTest, 16537760SGiacomo.Gabrielli@arm.com "op_class": opClass }, []) 16547639Sgblack@eecs.umich.edu header_output += NeonRegRegImmOpDeclare.subst(iop) 16557639Sgblack@eecs.umich.edu exec_output += NeonUnequalRegExecute.subst(iop) 16567639Sgblack@eecs.umich.edu for type in types: 16577639Sgblack@eecs.umich.edu substDict = { "targs" : type, 16587639Sgblack@eecs.umich.edu "class_name" : Name } 16597639Sgblack@eecs.umich.edu exec_output += NeonExecDeclare.subst(substDict) 16607639Sgblack@eecs.umich.edu 16617760SGiacomo.Gabrielli@arm.com def twoRegMiscInst(name, Name, opClass, types, rCount, op, readDest=False): 16627639Sgblack@eecs.umich.edu global header_output, exec_output 16637640Sgblack@eecs.umich.edu eWalkCode = simdEnabledCheckCode + ''' 16647639Sgblack@eecs.umich.edu RegVect srcReg1, destReg; 16657639Sgblack@eecs.umich.edu ''' 16667639Sgblack@eecs.umich.edu for reg in range(rCount): 16677639Sgblack@eecs.umich.edu eWalkCode += ''' 16688588Sgblack@eecs.umich.edu srcReg1.regs[%(reg)d] = htog(FpOp1P%(reg)d_uw); 16697639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 16707639Sgblack@eecs.umich.edu if readDest: 16717639Sgblack@eecs.umich.edu eWalkCode += ''' 16728588Sgblack@eecs.umich.edu destReg.regs[%(reg)d] = htog(FpDestP%(reg)d_uw); 16737639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 16747639Sgblack@eecs.umich.edu readDestCode = '' 16757639Sgblack@eecs.umich.edu if readDest: 16767639Sgblack@eecs.umich.edu readDestCode = 'destElem = gtoh(destReg.elements[i]);' 16777639Sgblack@eecs.umich.edu eWalkCode += ''' 16787639Sgblack@eecs.umich.edu for (unsigned i = 0; i < eCount; i++) { 16797639Sgblack@eecs.umich.edu unsigned j = i; 16807639Sgblack@eecs.umich.edu Element srcElem1 = gtoh(srcReg1.elements[i]); 16817639Sgblack@eecs.umich.edu Element destElem; 16827639Sgblack@eecs.umich.edu %(readDest)s 16837639Sgblack@eecs.umich.edu %(op)s 16847639Sgblack@eecs.umich.edu destReg.elements[j] = htog(destElem); 16857639Sgblack@eecs.umich.edu } 16867639Sgblack@eecs.umich.edu ''' % { "op" : op, "readDest" : readDestCode } 16877639Sgblack@eecs.umich.edu for reg in range(rCount): 16887639Sgblack@eecs.umich.edu eWalkCode += ''' 16898588Sgblack@eecs.umich.edu FpDestP%(reg)d_uw = gtoh(destReg.regs[%(reg)d]); 16907639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 16917639Sgblack@eecs.umich.edu iop = InstObjParams(name, Name, 16927639Sgblack@eecs.umich.edu "RegRegOp", 16937639Sgblack@eecs.umich.edu { "code": eWalkCode, 16947639Sgblack@eecs.umich.edu "r_count": rCount, 16957760SGiacomo.Gabrielli@arm.com "predicate_test": predicateTest, 16967760SGiacomo.Gabrielli@arm.com "op_class": opClass }, []) 16977639Sgblack@eecs.umich.edu header_output += NeonRegRegOpDeclare.subst(iop) 16987639Sgblack@eecs.umich.edu exec_output += NeonEqualRegExecute.subst(iop) 16997639Sgblack@eecs.umich.edu for type in types: 17007639Sgblack@eecs.umich.edu substDict = { "targs" : type, 17017639Sgblack@eecs.umich.edu "class_name" : Name } 17027639Sgblack@eecs.umich.edu exec_output += NeonExecDeclare.subst(substDict) 17037639Sgblack@eecs.umich.edu 17047760SGiacomo.Gabrielli@arm.com def twoRegMiscScInst(name, Name, opClass, types, rCount, op, readDest=False): 17057639Sgblack@eecs.umich.edu global header_output, exec_output 17067640Sgblack@eecs.umich.edu eWalkCode = simdEnabledCheckCode + ''' 17077639Sgblack@eecs.umich.edu RegVect srcReg1, destReg; 17087639Sgblack@eecs.umich.edu ''' 17097639Sgblack@eecs.umich.edu for reg in range(rCount): 17107639Sgblack@eecs.umich.edu eWalkCode += ''' 17118588Sgblack@eecs.umich.edu srcReg1.regs[%(reg)d] = htog(FpOp1P%(reg)d_uw); 17127639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 17137639Sgblack@eecs.umich.edu if readDest: 17147639Sgblack@eecs.umich.edu eWalkCode += ''' 17158588Sgblack@eecs.umich.edu destReg.regs[%(reg)d] = htog(FpDestP%(reg)d_uw); 17167639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 17177639Sgblack@eecs.umich.edu readDestCode = '' 17187639Sgblack@eecs.umich.edu if readDest: 17197639Sgblack@eecs.umich.edu readDestCode = 'destElem = gtoh(destReg.elements[i]);' 17207639Sgblack@eecs.umich.edu eWalkCode += ''' 17217639Sgblack@eecs.umich.edu for (unsigned i = 0; i < eCount; i++) { 17227639Sgblack@eecs.umich.edu Element srcElem1 = gtoh(srcReg1.elements[imm]); 17237639Sgblack@eecs.umich.edu Element destElem; 17247639Sgblack@eecs.umich.edu %(readDest)s 17257639Sgblack@eecs.umich.edu %(op)s 17267639Sgblack@eecs.umich.edu destReg.elements[i] = htog(destElem); 17277639Sgblack@eecs.umich.edu } 17287639Sgblack@eecs.umich.edu ''' % { "op" : op, "readDest" : readDestCode } 17297639Sgblack@eecs.umich.edu for reg in range(rCount): 17307639Sgblack@eecs.umich.edu eWalkCode += ''' 17318588Sgblack@eecs.umich.edu FpDestP%(reg)d_uw = gtoh(destReg.regs[%(reg)d]); 17327639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 17337639Sgblack@eecs.umich.edu iop = InstObjParams(name, Name, 17347639Sgblack@eecs.umich.edu "RegRegImmOp", 17357639Sgblack@eecs.umich.edu { "code": eWalkCode, 17367639Sgblack@eecs.umich.edu "r_count": rCount, 17377760SGiacomo.Gabrielli@arm.com "predicate_test": predicateTest, 17387760SGiacomo.Gabrielli@arm.com "op_class": opClass }, []) 17397639Sgblack@eecs.umich.edu header_output += NeonRegRegImmOpDeclare.subst(iop) 17407639Sgblack@eecs.umich.edu exec_output += NeonEqualRegExecute.subst(iop) 17417639Sgblack@eecs.umich.edu for type in types: 17427639Sgblack@eecs.umich.edu substDict = { "targs" : type, 17437639Sgblack@eecs.umich.edu "class_name" : Name } 17447639Sgblack@eecs.umich.edu exec_output += NeonExecDeclare.subst(substDict) 17457639Sgblack@eecs.umich.edu 17467760SGiacomo.Gabrielli@arm.com def twoRegMiscScramble(name, Name, opClass, types, rCount, op, readDest=False): 17477639Sgblack@eecs.umich.edu global header_output, exec_output 17487640Sgblack@eecs.umich.edu eWalkCode = simdEnabledCheckCode + ''' 17497639Sgblack@eecs.umich.edu RegVect srcReg1, destReg; 17507639Sgblack@eecs.umich.edu ''' 17517639Sgblack@eecs.umich.edu for reg in range(rCount): 17527639Sgblack@eecs.umich.edu eWalkCode += ''' 17538588Sgblack@eecs.umich.edu srcReg1.regs[%(reg)d] = htog(FpOp1P%(reg)d_uw); 17548588Sgblack@eecs.umich.edu destReg.regs[%(reg)d] = htog(FpDestP%(reg)d_uw); 17557639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 17567639Sgblack@eecs.umich.edu if readDest: 17577639Sgblack@eecs.umich.edu eWalkCode += ''' 17587639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 17597639Sgblack@eecs.umich.edu readDestCode = '' 17607639Sgblack@eecs.umich.edu if readDest: 17617639Sgblack@eecs.umich.edu readDestCode = 'destElem = gtoh(destReg.elements[i]);' 17627639Sgblack@eecs.umich.edu eWalkCode += op 17637639Sgblack@eecs.umich.edu for reg in range(rCount): 17647639Sgblack@eecs.umich.edu eWalkCode += ''' 17658588Sgblack@eecs.umich.edu FpDestP%(reg)d_uw = gtoh(destReg.regs[%(reg)d]); 17668588Sgblack@eecs.umich.edu FpOp1P%(reg)d_uw = gtoh(srcReg1.regs[%(reg)d]); 17677639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 17687639Sgblack@eecs.umich.edu iop = InstObjParams(name, Name, 17697639Sgblack@eecs.umich.edu "RegRegOp", 17707639Sgblack@eecs.umich.edu { "code": eWalkCode, 17717639Sgblack@eecs.umich.edu "r_count": rCount, 17727760SGiacomo.Gabrielli@arm.com "predicate_test": predicateTest, 17737760SGiacomo.Gabrielli@arm.com "op_class": opClass }, []) 17747639Sgblack@eecs.umich.edu header_output += NeonRegRegOpDeclare.subst(iop) 17757639Sgblack@eecs.umich.edu exec_output += NeonEqualRegExecute.subst(iop) 17767639Sgblack@eecs.umich.edu for type in types: 17777639Sgblack@eecs.umich.edu substDict = { "targs" : type, 17787639Sgblack@eecs.umich.edu "class_name" : Name } 17797639Sgblack@eecs.umich.edu exec_output += NeonExecDeclare.subst(substDict) 17807639Sgblack@eecs.umich.edu 17817760SGiacomo.Gabrielli@arm.com def twoRegMiscInstFp(name, Name, opClass, types, rCount, op, 17827639Sgblack@eecs.umich.edu readDest=False, toInt=False): 17837639Sgblack@eecs.umich.edu global header_output, exec_output 17847640Sgblack@eecs.umich.edu eWalkCode = simdEnabledCheckCode + ''' 178513544Sgabeblack@google.com typedef float FloatVect[rCount]; 17867639Sgblack@eecs.umich.edu FloatVect srcRegs1; 17877639Sgblack@eecs.umich.edu ''' 17887639Sgblack@eecs.umich.edu if toInt: 17897639Sgblack@eecs.umich.edu eWalkCode += 'RegVect destRegs;\n' 17907639Sgblack@eecs.umich.edu else: 17917639Sgblack@eecs.umich.edu eWalkCode += 'FloatVect destRegs;\n' 17927639Sgblack@eecs.umich.edu for reg in range(rCount): 17937639Sgblack@eecs.umich.edu eWalkCode += ''' 17947639Sgblack@eecs.umich.edu srcRegs1[%(reg)d] = FpOp1P%(reg)d; 17957639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 17967639Sgblack@eecs.umich.edu if readDest: 17977639Sgblack@eecs.umich.edu if toInt: 17987639Sgblack@eecs.umich.edu eWalkCode += ''' 17997639Sgblack@eecs.umich.edu destRegs.regs[%(reg)d] = FpDestP%(reg)d.bits; 18007639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 18017639Sgblack@eecs.umich.edu else: 18027639Sgblack@eecs.umich.edu eWalkCode += ''' 18037639Sgblack@eecs.umich.edu destRegs[%(reg)d] = FpDestP%(reg)d; 18047639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 18057639Sgblack@eecs.umich.edu readDestCode = '' 18067639Sgblack@eecs.umich.edu if readDest: 18077639Sgblack@eecs.umich.edu readDestCode = 'destReg = destRegs[i];' 180813544Sgabeblack@google.com destType = 'float' 18097639Sgblack@eecs.umich.edu writeDest = 'destRegs[r] = destReg;' 18107639Sgblack@eecs.umich.edu if toInt: 181113544Sgabeblack@google.com destType = 'uint32_t' 18127639Sgblack@eecs.umich.edu writeDest = 'destRegs.regs[r] = destReg;' 18137639Sgblack@eecs.umich.edu eWalkCode += ''' 18147639Sgblack@eecs.umich.edu for (unsigned r = 0; r < rCount; r++) { 181513544Sgabeblack@google.com float srcReg1 = srcRegs1[r]; 18167639Sgblack@eecs.umich.edu %(destType)s destReg; 18177639Sgblack@eecs.umich.edu %(readDest)s 18187639Sgblack@eecs.umich.edu %(op)s 18197639Sgblack@eecs.umich.edu %(writeDest)s 18207639Sgblack@eecs.umich.edu } 18217639Sgblack@eecs.umich.edu ''' % { "op" : op, 18227639Sgblack@eecs.umich.edu "readDest" : readDestCode, 18237639Sgblack@eecs.umich.edu "destType" : destType, 18247639Sgblack@eecs.umich.edu "writeDest" : writeDest } 18257639Sgblack@eecs.umich.edu for reg in range(rCount): 18267639Sgblack@eecs.umich.edu if toInt: 18277639Sgblack@eecs.umich.edu eWalkCode += ''' 18288588Sgblack@eecs.umich.edu FpDestP%(reg)d_uw = destRegs.regs[%(reg)d]; 18297639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 18307639Sgblack@eecs.umich.edu else: 18317639Sgblack@eecs.umich.edu eWalkCode += ''' 18327639Sgblack@eecs.umich.edu FpDestP%(reg)d = destRegs[%(reg)d]; 18337639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 18347639Sgblack@eecs.umich.edu iop = InstObjParams(name, Name, 18357639Sgblack@eecs.umich.edu "FpRegRegOp", 18367639Sgblack@eecs.umich.edu { "code": eWalkCode, 18377639Sgblack@eecs.umich.edu "r_count": rCount, 18387760SGiacomo.Gabrielli@arm.com "predicate_test": predicateTest, 18397760SGiacomo.Gabrielli@arm.com "op_class": opClass }, []) 18407639Sgblack@eecs.umich.edu header_output += NeonRegRegOpDeclare.subst(iop) 18417639Sgblack@eecs.umich.edu exec_output += NeonEqualRegExecute.subst(iop) 18427639Sgblack@eecs.umich.edu for type in types: 18437639Sgblack@eecs.umich.edu substDict = { "targs" : type, 18447639Sgblack@eecs.umich.edu "class_name" : Name } 18457639Sgblack@eecs.umich.edu exec_output += NeonExecDeclare.subst(substDict) 18467639Sgblack@eecs.umich.edu 18477760SGiacomo.Gabrielli@arm.com def twoRegCondenseInst(name, Name, opClass, types, rCount, op, readDest=False): 18487639Sgblack@eecs.umich.edu global header_output, exec_output 18497640Sgblack@eecs.umich.edu eWalkCode = simdEnabledCheckCode + ''' 18507639Sgblack@eecs.umich.edu RegVect srcRegs; 18517639Sgblack@eecs.umich.edu BigRegVect destReg; 18527639Sgblack@eecs.umich.edu ''' 18537639Sgblack@eecs.umich.edu for reg in range(rCount): 18547639Sgblack@eecs.umich.edu eWalkCode += ''' 18558588Sgblack@eecs.umich.edu srcRegs.regs[%(reg)d] = htog(FpOp1P%(reg)d_uw); 18567639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 18577639Sgblack@eecs.umich.edu if readDest: 18587639Sgblack@eecs.umich.edu eWalkCode += ''' 18598588Sgblack@eecs.umich.edu destReg.regs[%(reg)d] = htog(FpDestP%(reg)d_uw); 18607639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 18617639Sgblack@eecs.umich.edu readDestCode = '' 18627639Sgblack@eecs.umich.edu if readDest: 18637639Sgblack@eecs.umich.edu readDestCode = 'destElem = gtoh(destReg.elements[i]);' 18647639Sgblack@eecs.umich.edu eWalkCode += ''' 18657639Sgblack@eecs.umich.edu for (unsigned i = 0; i < eCount / 2; i++) { 18667639Sgblack@eecs.umich.edu Element srcElem1 = gtoh(srcRegs.elements[2 * i]); 18677639Sgblack@eecs.umich.edu Element srcElem2 = gtoh(srcRegs.elements[2 * i + 1]); 18687639Sgblack@eecs.umich.edu BigElement destElem; 18697639Sgblack@eecs.umich.edu %(readDest)s 18707639Sgblack@eecs.umich.edu %(op)s 18717639Sgblack@eecs.umich.edu destReg.elements[i] = htog(destElem); 18727639Sgblack@eecs.umich.edu } 18737639Sgblack@eecs.umich.edu ''' % { "op" : op, "readDest" : readDestCode } 18747639Sgblack@eecs.umich.edu for reg in range(rCount): 18757639Sgblack@eecs.umich.edu eWalkCode += ''' 18768588Sgblack@eecs.umich.edu FpDestP%(reg)d_uw = gtoh(destReg.regs[%(reg)d]); 18777639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 18787639Sgblack@eecs.umich.edu iop = InstObjParams(name, Name, 18797639Sgblack@eecs.umich.edu "RegRegOp", 18807639Sgblack@eecs.umich.edu { "code": eWalkCode, 18817639Sgblack@eecs.umich.edu "r_count": rCount, 18827760SGiacomo.Gabrielli@arm.com "predicate_test": predicateTest, 18837760SGiacomo.Gabrielli@arm.com "op_class": opClass }, []) 18847639Sgblack@eecs.umich.edu header_output += NeonRegRegOpDeclare.subst(iop) 18857639Sgblack@eecs.umich.edu exec_output += NeonUnequalRegExecute.subst(iop) 18867639Sgblack@eecs.umich.edu for type in types: 18877639Sgblack@eecs.umich.edu substDict = { "targs" : type, 18887639Sgblack@eecs.umich.edu "class_name" : Name } 18897639Sgblack@eecs.umich.edu exec_output += NeonExecDeclare.subst(substDict) 18907639Sgblack@eecs.umich.edu 18917760SGiacomo.Gabrielli@arm.com def twoRegNarrowMiscInst(name, Name, opClass, types, op, readDest=False): 18927639Sgblack@eecs.umich.edu global header_output, exec_output 18937640Sgblack@eecs.umich.edu eWalkCode = simdEnabledCheckCode + ''' 18947639Sgblack@eecs.umich.edu BigRegVect srcReg1; 18957639Sgblack@eecs.umich.edu RegVect destReg; 18967639Sgblack@eecs.umich.edu ''' 18977639Sgblack@eecs.umich.edu for reg in range(4): 18987639Sgblack@eecs.umich.edu eWalkCode += ''' 18998588Sgblack@eecs.umich.edu srcReg1.regs[%(reg)d] = htog(FpOp1P%(reg)d_uw); 19007639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 19017639Sgblack@eecs.umich.edu if readDest: 19027639Sgblack@eecs.umich.edu for reg in range(2): 19037639Sgblack@eecs.umich.edu eWalkCode += ''' 19048588Sgblack@eecs.umich.edu destReg.regs[%(reg)d] = htog(FpDestP%(reg)d_uw); 19057639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 19067639Sgblack@eecs.umich.edu readDestCode = '' 19077639Sgblack@eecs.umich.edu if readDest: 19087639Sgblack@eecs.umich.edu readDestCode = 'destElem = gtoh(destReg.elements[i]);' 19097639Sgblack@eecs.umich.edu eWalkCode += ''' 19107639Sgblack@eecs.umich.edu for (unsigned i = 0; i < eCount; i++) { 19117639Sgblack@eecs.umich.edu BigElement srcElem1 = gtoh(srcReg1.elements[i]); 19127639Sgblack@eecs.umich.edu Element destElem; 19137639Sgblack@eecs.umich.edu %(readDest)s 19147639Sgblack@eecs.umich.edu %(op)s 19157639Sgblack@eecs.umich.edu destReg.elements[i] = htog(destElem); 19167639Sgblack@eecs.umich.edu } 19177639Sgblack@eecs.umich.edu ''' % { "op" : op, "readDest" : readDestCode } 19187639Sgblack@eecs.umich.edu for reg in range(2): 19197639Sgblack@eecs.umich.edu eWalkCode += ''' 19208588Sgblack@eecs.umich.edu FpDestP%(reg)d_uw = gtoh(destReg.regs[%(reg)d]); 19217639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 19227639Sgblack@eecs.umich.edu iop = InstObjParams(name, Name, 19237639Sgblack@eecs.umich.edu "RegRegOp", 19247639Sgblack@eecs.umich.edu { "code": eWalkCode, 19257639Sgblack@eecs.umich.edu "r_count": 2, 19267760SGiacomo.Gabrielli@arm.com "predicate_test": predicateTest, 19277760SGiacomo.Gabrielli@arm.com "op_class": opClass }, []) 19287639Sgblack@eecs.umich.edu header_output += NeonRegRegOpDeclare.subst(iop) 19297639Sgblack@eecs.umich.edu exec_output += NeonUnequalRegExecute.subst(iop) 19307639Sgblack@eecs.umich.edu for type in types: 19317639Sgblack@eecs.umich.edu substDict = { "targs" : type, 19327639Sgblack@eecs.umich.edu "class_name" : Name } 19337639Sgblack@eecs.umich.edu exec_output += NeonExecDeclare.subst(substDict) 19347639Sgblack@eecs.umich.edu 19357760SGiacomo.Gabrielli@arm.com def oneRegImmInst(name, Name, opClass, types, rCount, op, readDest=False): 19367639Sgblack@eecs.umich.edu global header_output, exec_output 19377640Sgblack@eecs.umich.edu eWalkCode = simdEnabledCheckCode + ''' 19387639Sgblack@eecs.umich.edu RegVect destReg; 19397639Sgblack@eecs.umich.edu ''' 19407639Sgblack@eecs.umich.edu if readDest: 19417639Sgblack@eecs.umich.edu for reg in range(rCount): 19427639Sgblack@eecs.umich.edu eWalkCode += ''' 19438588Sgblack@eecs.umich.edu destReg.regs[%(reg)d] = htog(FpDestP%(reg)d_uw); 19447639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 19457639Sgblack@eecs.umich.edu readDestCode = '' 19467639Sgblack@eecs.umich.edu if readDest: 19477639Sgblack@eecs.umich.edu readDestCode = 'destElem = gtoh(destReg.elements[i]);' 19487639Sgblack@eecs.umich.edu eWalkCode += ''' 19497639Sgblack@eecs.umich.edu for (unsigned i = 0; i < eCount; i++) { 19507639Sgblack@eecs.umich.edu Element destElem; 19517639Sgblack@eecs.umich.edu %(readDest)s 19527639Sgblack@eecs.umich.edu %(op)s 19537639Sgblack@eecs.umich.edu destReg.elements[i] = htog(destElem); 19547639Sgblack@eecs.umich.edu } 19557639Sgblack@eecs.umich.edu ''' % { "op" : op, "readDest" : readDestCode } 19567639Sgblack@eecs.umich.edu for reg in range(rCount): 19577639Sgblack@eecs.umich.edu eWalkCode += ''' 19588588Sgblack@eecs.umich.edu FpDestP%(reg)d_uw = gtoh(destReg.regs[%(reg)d]); 19597639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 19607639Sgblack@eecs.umich.edu iop = InstObjParams(name, Name, 19617639Sgblack@eecs.umich.edu "RegImmOp", 19627639Sgblack@eecs.umich.edu { "code": eWalkCode, 19637639Sgblack@eecs.umich.edu "r_count": rCount, 19647760SGiacomo.Gabrielli@arm.com "predicate_test": predicateTest, 19657760SGiacomo.Gabrielli@arm.com "op_class": opClass }, []) 19667639Sgblack@eecs.umich.edu header_output += NeonRegImmOpDeclare.subst(iop) 19677639Sgblack@eecs.umich.edu exec_output += NeonEqualRegExecute.subst(iop) 19687639Sgblack@eecs.umich.edu for type in types: 19697639Sgblack@eecs.umich.edu substDict = { "targs" : type, 19707639Sgblack@eecs.umich.edu "class_name" : Name } 19717639Sgblack@eecs.umich.edu exec_output += NeonExecDeclare.subst(substDict) 19727639Sgblack@eecs.umich.edu 19737760SGiacomo.Gabrielli@arm.com def twoRegLongMiscInst(name, Name, opClass, types, op, readDest=False): 19747639Sgblack@eecs.umich.edu global header_output, exec_output 19757640Sgblack@eecs.umich.edu eWalkCode = simdEnabledCheckCode + ''' 19767639Sgblack@eecs.umich.edu RegVect srcReg1; 19777639Sgblack@eecs.umich.edu BigRegVect destReg; 19787639Sgblack@eecs.umich.edu ''' 19797639Sgblack@eecs.umich.edu for reg in range(2): 19807639Sgblack@eecs.umich.edu eWalkCode += ''' 19818588Sgblack@eecs.umich.edu srcReg1.regs[%(reg)d] = htog(FpOp1P%(reg)d_uw); 19827639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 19837639Sgblack@eecs.umich.edu if readDest: 19847639Sgblack@eecs.umich.edu for reg in range(4): 19857639Sgblack@eecs.umich.edu eWalkCode += ''' 19868588Sgblack@eecs.umich.edu destReg.regs[%(reg)d] = htog(FpDestP%(reg)d_uw); 19877639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 19887639Sgblack@eecs.umich.edu readDestCode = '' 19897639Sgblack@eecs.umich.edu if readDest: 19907639Sgblack@eecs.umich.edu readDestCode = 'destReg = gtoh(destReg.elements[i]);' 19917639Sgblack@eecs.umich.edu eWalkCode += ''' 19927639Sgblack@eecs.umich.edu for (unsigned i = 0; i < eCount; i++) { 19937639Sgblack@eecs.umich.edu Element srcElem1 = gtoh(srcReg1.elements[i]); 19947639Sgblack@eecs.umich.edu BigElement destElem; 19957639Sgblack@eecs.umich.edu %(readDest)s 19967639Sgblack@eecs.umich.edu %(op)s 19977639Sgblack@eecs.umich.edu destReg.elements[i] = htog(destElem); 19987639Sgblack@eecs.umich.edu } 19997639Sgblack@eecs.umich.edu ''' % { "op" : op, "readDest" : readDestCode } 20007639Sgblack@eecs.umich.edu for reg in range(4): 20017639Sgblack@eecs.umich.edu eWalkCode += ''' 20028588Sgblack@eecs.umich.edu FpDestP%(reg)d_uw = gtoh(destReg.regs[%(reg)d]); 20037639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 20047639Sgblack@eecs.umich.edu iop = InstObjParams(name, Name, 20057639Sgblack@eecs.umich.edu "RegRegOp", 20067639Sgblack@eecs.umich.edu { "code": eWalkCode, 20077639Sgblack@eecs.umich.edu "r_count": 2, 20087760SGiacomo.Gabrielli@arm.com "predicate_test": predicateTest, 20097760SGiacomo.Gabrielli@arm.com "op_class": opClass }, []) 20107639Sgblack@eecs.umich.edu header_output += NeonRegRegOpDeclare.subst(iop) 20117639Sgblack@eecs.umich.edu exec_output += NeonUnequalRegExecute.subst(iop) 20127639Sgblack@eecs.umich.edu for type in types: 20137639Sgblack@eecs.umich.edu substDict = { "targs" : type, 20147639Sgblack@eecs.umich.edu "class_name" : Name } 20157639Sgblack@eecs.umich.edu exec_output += NeonExecDeclare.subst(substDict) 20167639Sgblack@eecs.umich.edu 20177639Sgblack@eecs.umich.edu vhaddCode = ''' 20187639Sgblack@eecs.umich.edu Element carryBit = 20197639Sgblack@eecs.umich.edu (((unsigned)srcElem1 & 0x1) + 20207639Sgblack@eecs.umich.edu ((unsigned)srcElem2 & 0x1)) >> 1; 20217639Sgblack@eecs.umich.edu // Use division instead of a shift to ensure the sign extension works 20227639Sgblack@eecs.umich.edu // right. The compiler will figure out if it can be a shift. Mask the 20237639Sgblack@eecs.umich.edu // inputs so they get truncated correctly. 20247639Sgblack@eecs.umich.edu destElem = (((srcElem1 & ~(Element)1) / 2) + 20257639Sgblack@eecs.umich.edu ((srcElem2 & ~(Element)1) / 2)) + carryBit; 20267639Sgblack@eecs.umich.edu ''' 20277760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vhadd", "VhaddD", "SimdAddOp", allTypes, 2, vhaddCode) 20287760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vhadd", "VhaddQ", "SimdAddOp", allTypes, 4, vhaddCode) 20297639Sgblack@eecs.umich.edu 20307639Sgblack@eecs.umich.edu vrhaddCode = ''' 20317639Sgblack@eecs.umich.edu Element carryBit = 20327639Sgblack@eecs.umich.edu (((unsigned)srcElem1 & 0x1) + 20337639Sgblack@eecs.umich.edu ((unsigned)srcElem2 & 0x1) + 1) >> 1; 20347639Sgblack@eecs.umich.edu // Use division instead of a shift to ensure the sign extension works 20357639Sgblack@eecs.umich.edu // right. The compiler will figure out if it can be a shift. Mask the 20367639Sgblack@eecs.umich.edu // inputs so they get truncated correctly. 20377639Sgblack@eecs.umich.edu destElem = (((srcElem1 & ~(Element)1) / 2) + 20387639Sgblack@eecs.umich.edu ((srcElem2 & ~(Element)1) / 2)) + carryBit; 20397639Sgblack@eecs.umich.edu ''' 20407760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vrhadd", "VrhaddD", "SimdAddOp", allTypes, 2, vrhaddCode) 20417760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vrhadd", "VrhaddQ", "SimdAddOp", allTypes, 4, vrhaddCode) 20427639Sgblack@eecs.umich.edu 20437639Sgblack@eecs.umich.edu vhsubCode = ''' 20447639Sgblack@eecs.umich.edu Element barrowBit = 20457639Sgblack@eecs.umich.edu (((srcElem1 & 0x1) - (srcElem2 & 0x1)) >> 1) & 0x1; 20467639Sgblack@eecs.umich.edu // Use division instead of a shift to ensure the sign extension works 20477639Sgblack@eecs.umich.edu // right. The compiler will figure out if it can be a shift. Mask the 20487639Sgblack@eecs.umich.edu // inputs so they get truncated correctly. 20497639Sgblack@eecs.umich.edu destElem = (((srcElem1 & ~(Element)1) / 2) - 20507639Sgblack@eecs.umich.edu ((srcElem2 & ~(Element)1) / 2)) - barrowBit; 20517639Sgblack@eecs.umich.edu ''' 20527760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vhsub", "VhsubD", "SimdAddOp", allTypes, 2, vhsubCode) 20537760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vhsub", "VhsubQ", "SimdAddOp", allTypes, 4, vhsubCode) 20547639Sgblack@eecs.umich.edu 20557639Sgblack@eecs.umich.edu vandCode = ''' 20567639Sgblack@eecs.umich.edu destElem = srcElem1 & srcElem2; 20577639Sgblack@eecs.umich.edu ''' 20587760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vand", "VandD", "SimdAluOp", unsignedTypes, 2, vandCode) 20597760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vand", "VandQ", "SimdAluOp", unsignedTypes, 4, vandCode) 20607639Sgblack@eecs.umich.edu 20617639Sgblack@eecs.umich.edu vbicCode = ''' 20627639Sgblack@eecs.umich.edu destElem = srcElem1 & ~srcElem2; 20637639Sgblack@eecs.umich.edu ''' 20647760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vbic", "VbicD", "SimdAluOp", unsignedTypes, 2, vbicCode) 20657760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vbic", "VbicQ", "SimdAluOp", unsignedTypes, 4, vbicCode) 20667639Sgblack@eecs.umich.edu 20677639Sgblack@eecs.umich.edu vorrCode = ''' 20687639Sgblack@eecs.umich.edu destElem = srcElem1 | srcElem2; 20697639Sgblack@eecs.umich.edu ''' 20707760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vorr", "VorrD", "SimdAluOp", unsignedTypes, 2, vorrCode) 20717760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vorr", "VorrQ", "SimdAluOp", unsignedTypes, 4, vorrCode) 20727639Sgblack@eecs.umich.edu 20737760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vmov", "VmovD", "SimdMiscOp", unsignedTypes, 2, vorrCode) 20747760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vmov", "VmovQ", "SimdMiscOp", unsignedTypes, 4, vorrCode) 20757639Sgblack@eecs.umich.edu 20767639Sgblack@eecs.umich.edu vornCode = ''' 20777639Sgblack@eecs.umich.edu destElem = srcElem1 | ~srcElem2; 20787639Sgblack@eecs.umich.edu ''' 20797760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vorn", "VornD", "SimdAluOp", unsignedTypes, 2, vornCode) 20807760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vorn", "VornQ", "SimdAluOp", unsignedTypes, 4, vornCode) 20817639Sgblack@eecs.umich.edu 20827639Sgblack@eecs.umich.edu veorCode = ''' 20837639Sgblack@eecs.umich.edu destElem = srcElem1 ^ srcElem2; 20847639Sgblack@eecs.umich.edu ''' 20857760SGiacomo.Gabrielli@arm.com threeEqualRegInst("veor", "VeorD", "SimdAluOp", unsignedTypes, 2, veorCode) 20867760SGiacomo.Gabrielli@arm.com threeEqualRegInst("veor", "VeorQ", "SimdAluOp", unsignedTypes, 4, veorCode) 20877639Sgblack@eecs.umich.edu 20887639Sgblack@eecs.umich.edu vbifCode = ''' 20897639Sgblack@eecs.umich.edu destElem = (destElem & srcElem2) | (srcElem1 & ~srcElem2); 20907639Sgblack@eecs.umich.edu ''' 20917760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vbif", "VbifD", "SimdAluOp", unsignedTypes, 2, vbifCode, True) 20927760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vbif", "VbifQ", "SimdAluOp", unsignedTypes, 4, vbifCode, True) 20937639Sgblack@eecs.umich.edu vbitCode = ''' 20947639Sgblack@eecs.umich.edu destElem = (srcElem1 & srcElem2) | (destElem & ~srcElem2); 20957639Sgblack@eecs.umich.edu ''' 20967760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vbit", "VbitD", "SimdAluOp", unsignedTypes, 2, vbitCode, True) 20977760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vbit", "VbitQ", "SimdAluOp", unsignedTypes, 4, vbitCode, True) 20987639Sgblack@eecs.umich.edu vbslCode = ''' 20997639Sgblack@eecs.umich.edu destElem = (srcElem1 & destElem) | (srcElem2 & ~destElem); 21007639Sgblack@eecs.umich.edu ''' 21017760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vbsl", "VbslD", "SimdAluOp", unsignedTypes, 2, vbslCode, True) 21027760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vbsl", "VbslQ", "SimdAluOp", unsignedTypes, 4, vbslCode, True) 21037639Sgblack@eecs.umich.edu 21047639Sgblack@eecs.umich.edu vmaxCode = ''' 21057639Sgblack@eecs.umich.edu destElem = (srcElem1 > srcElem2) ? srcElem1 : srcElem2; 21067639Sgblack@eecs.umich.edu ''' 21077760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vmax", "VmaxD", "SimdCmpOp", allTypes, 2, vmaxCode) 21087760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vmax", "VmaxQ", "SimdCmpOp", allTypes, 4, vmaxCode) 21097639Sgblack@eecs.umich.edu 21107639Sgblack@eecs.umich.edu vminCode = ''' 21117639Sgblack@eecs.umich.edu destElem = (srcElem1 < srcElem2) ? srcElem1 : srcElem2; 21127639Sgblack@eecs.umich.edu ''' 21137760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vmin", "VminD", "SimdCmpOp", allTypes, 2, vminCode) 21147760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vmin", "VminQ", "SimdCmpOp", allTypes, 4, vminCode) 21157639Sgblack@eecs.umich.edu 21167639Sgblack@eecs.umich.edu vaddCode = ''' 21177639Sgblack@eecs.umich.edu destElem = srcElem1 + srcElem2; 21187639Sgblack@eecs.umich.edu ''' 21197760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vadd", "NVaddD", "SimdAddOp", unsignedTypes, 2, vaddCode) 21207760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vadd", "NVaddQ", "SimdAddOp", unsignedTypes, 4, vaddCode) 21217639Sgblack@eecs.umich.edu 21228607Sgblack@eecs.umich.edu threeEqualRegInst("vpadd", "NVpaddD", "SimdAddOp", smallUnsignedTypes, 21237639Sgblack@eecs.umich.edu 2, vaddCode, pairwise=True) 21247639Sgblack@eecs.umich.edu vaddlwCode = ''' 21257639Sgblack@eecs.umich.edu destElem = (BigElement)srcElem1 + (BigElement)srcElem2; 21267639Sgblack@eecs.umich.edu ''' 21277760SGiacomo.Gabrielli@arm.com threeRegLongInst("vaddl", "Vaddl", "SimdAddOp", smallTypes, vaddlwCode) 21287760SGiacomo.Gabrielli@arm.com threeRegWideInst("vaddw", "Vaddw", "SimdAddOp", smallTypes, vaddlwCode) 21297639Sgblack@eecs.umich.edu vaddhnCode = ''' 21307639Sgblack@eecs.umich.edu destElem = ((BigElement)srcElem1 + (BigElement)srcElem2) >> 21317639Sgblack@eecs.umich.edu (sizeof(Element) * 8); 21327639Sgblack@eecs.umich.edu ''' 21337760SGiacomo.Gabrielli@arm.com threeRegNarrowInst("vaddhn", "Vaddhn", "SimdAddOp", smallTypes, vaddhnCode) 21347639Sgblack@eecs.umich.edu vraddhnCode = ''' 21357639Sgblack@eecs.umich.edu destElem = ((BigElement)srcElem1 + (BigElement)srcElem2 + 21367639Sgblack@eecs.umich.edu ((BigElement)1 << (sizeof(Element) * 8 - 1))) >> 21377639Sgblack@eecs.umich.edu (sizeof(Element) * 8); 21387639Sgblack@eecs.umich.edu ''' 21397760SGiacomo.Gabrielli@arm.com threeRegNarrowInst("vraddhn", "Vraddhn", "SimdAddOp", smallTypes, vraddhnCode) 21407639Sgblack@eecs.umich.edu 21417639Sgblack@eecs.umich.edu vsubCode = ''' 21427639Sgblack@eecs.umich.edu destElem = srcElem1 - srcElem2; 21437639Sgblack@eecs.umich.edu ''' 21447760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vsub", "NVsubD", "SimdAddOp", unsignedTypes, 2, vsubCode) 21457760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vsub", "NVsubQ", "SimdAddOp", unsignedTypes, 4, vsubCode) 21467639Sgblack@eecs.umich.edu vsublwCode = ''' 21477639Sgblack@eecs.umich.edu destElem = (BigElement)srcElem1 - (BigElement)srcElem2; 21487639Sgblack@eecs.umich.edu ''' 21497760SGiacomo.Gabrielli@arm.com threeRegLongInst("vsubl", "Vsubl", "SimdAddOp", smallTypes, vsublwCode) 21507760SGiacomo.Gabrielli@arm.com threeRegWideInst("vsubw", "Vsubw", "SimdAddOp", smallTypes, vsublwCode) 21517639Sgblack@eecs.umich.edu 21527639Sgblack@eecs.umich.edu vqaddUCode = ''' 21537639Sgblack@eecs.umich.edu destElem = srcElem1 + srcElem2; 21547783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrQc; 21557639Sgblack@eecs.umich.edu if (destElem < srcElem1 || destElem < srcElem2) { 21567639Sgblack@eecs.umich.edu destElem = (Element)(-1); 21577639Sgblack@eecs.umich.edu fpscr.qc = 1; 21587639Sgblack@eecs.umich.edu } 21597783SGiacomo.Gabrielli@arm.com FpscrQc = fpscr; 21607639Sgblack@eecs.umich.edu ''' 21617760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vqadd", "VqaddUD", "SimdAddOp", unsignedTypes, 2, vqaddUCode) 21627760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vqadd", "VqaddUQ", "SimdAddOp", unsignedTypes, 4, vqaddUCode) 21637639Sgblack@eecs.umich.edu vsubhnCode = ''' 21647639Sgblack@eecs.umich.edu destElem = ((BigElement)srcElem1 - (BigElement)srcElem2) >> 21657639Sgblack@eecs.umich.edu (sizeof(Element) * 8); 21667639Sgblack@eecs.umich.edu ''' 21677760SGiacomo.Gabrielli@arm.com threeRegNarrowInst("vsubhn", "Vsubhn", "SimdAddOp", smallTypes, vsubhnCode) 21687639Sgblack@eecs.umich.edu vrsubhnCode = ''' 21697639Sgblack@eecs.umich.edu destElem = ((BigElement)srcElem1 - (BigElement)srcElem2 + 21707639Sgblack@eecs.umich.edu ((BigElement)1 << (sizeof(Element) * 8 - 1))) >> 21717639Sgblack@eecs.umich.edu (sizeof(Element) * 8); 21727639Sgblack@eecs.umich.edu ''' 21737760SGiacomo.Gabrielli@arm.com threeRegNarrowInst("vrsubhn", "Vrsubhn", "SimdAddOp", smallTypes, vrsubhnCode) 21747639Sgblack@eecs.umich.edu 21757639Sgblack@eecs.umich.edu vqaddSCode = ''' 21767639Sgblack@eecs.umich.edu destElem = srcElem1 + srcElem2; 21777783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrQc; 21787639Sgblack@eecs.umich.edu bool negDest = (destElem < 0); 21797639Sgblack@eecs.umich.edu bool negSrc1 = (srcElem1 < 0); 21807639Sgblack@eecs.umich.edu bool negSrc2 = (srcElem2 < 0); 21817639Sgblack@eecs.umich.edu if ((negDest != negSrc1) && (negSrc1 == negSrc2)) { 21827639Sgblack@eecs.umich.edu if (negDest) 218312038Srekai.gonzalezalberquilla@arm.com /* If (>=0) plus (>=0) yields (<0), saturate to +. */ 218412038Srekai.gonzalezalberquilla@arm.com destElem = std::numeric_limits<Element>::max(); 218512038Srekai.gonzalezalberquilla@arm.com else 218612038Srekai.gonzalezalberquilla@arm.com /* If (<0) plus (<0) yields (>=0), saturate to -. */ 218712038Srekai.gonzalezalberquilla@arm.com destElem = std::numeric_limits<Element>::min(); 21887639Sgblack@eecs.umich.edu fpscr.qc = 1; 21897639Sgblack@eecs.umich.edu } 21907783SGiacomo.Gabrielli@arm.com FpscrQc = fpscr; 21917639Sgblack@eecs.umich.edu ''' 21927760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vqadd", "VqaddSD", "SimdAddOp", signedTypes, 2, vqaddSCode) 21937760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vqadd", "VqaddSQ", "SimdAddOp", signedTypes, 4, vqaddSCode) 21947639Sgblack@eecs.umich.edu 21957639Sgblack@eecs.umich.edu vqsubUCode = ''' 21967639Sgblack@eecs.umich.edu destElem = srcElem1 - srcElem2; 21977783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrQc; 21987639Sgblack@eecs.umich.edu if (destElem > srcElem1) { 21997639Sgblack@eecs.umich.edu destElem = 0; 22007639Sgblack@eecs.umich.edu fpscr.qc = 1; 22017639Sgblack@eecs.umich.edu } 22027783SGiacomo.Gabrielli@arm.com FpscrQc = fpscr; 22037639Sgblack@eecs.umich.edu ''' 22047760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vqsub", "VqsubUD", "SimdAddOp", unsignedTypes, 2, vqsubUCode) 22057760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vqsub", "VqsubUQ", "SimdAddOp", unsignedTypes, 4, vqsubUCode) 22067639Sgblack@eecs.umich.edu 22077639Sgblack@eecs.umich.edu vqsubSCode = ''' 22087639Sgblack@eecs.umich.edu destElem = srcElem1 - srcElem2; 22097783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrQc; 22107639Sgblack@eecs.umich.edu bool negDest = (destElem < 0); 22117639Sgblack@eecs.umich.edu bool negSrc1 = (srcElem1 < 0); 22127639Sgblack@eecs.umich.edu bool posSrc2 = (srcElem2 >= 0); 22137639Sgblack@eecs.umich.edu if ((negDest != negSrc1) && (negSrc1 == posSrc2)) { 22147639Sgblack@eecs.umich.edu if (negDest) 221512038Srekai.gonzalezalberquilla@arm.com /* If (>=0) minus (<0) yields (<0), saturate to +. */ 221612038Srekai.gonzalezalberquilla@arm.com destElem = std::numeric_limits<Element>::max(); 221712038Srekai.gonzalezalberquilla@arm.com else 221812038Srekai.gonzalezalberquilla@arm.com /* If (<0) minus (>=0) yields (>=0), saturate to -. */ 221912038Srekai.gonzalezalberquilla@arm.com destElem = std::numeric_limits<Element>::min(); 22207639Sgblack@eecs.umich.edu fpscr.qc = 1; 22217639Sgblack@eecs.umich.edu } 22227783SGiacomo.Gabrielli@arm.com FpscrQc = fpscr; 22237639Sgblack@eecs.umich.edu ''' 22247760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vqsub", "VqsubSD", "SimdAddOp", signedTypes, 2, vqsubSCode) 22257760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vqsub", "VqsubSQ", "SimdAddOp", signedTypes, 4, vqsubSCode) 22267639Sgblack@eecs.umich.edu 22277639Sgblack@eecs.umich.edu vcgtCode = ''' 22287639Sgblack@eecs.umich.edu destElem = (srcElem1 > srcElem2) ? (Element)(-1) : 0; 22297639Sgblack@eecs.umich.edu ''' 22307760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vcgt", "VcgtD", "SimdCmpOp", allTypes, 2, vcgtCode) 22317760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vcgt", "VcgtQ", "SimdCmpOp", allTypes, 4, vcgtCode) 22327639Sgblack@eecs.umich.edu 22337639Sgblack@eecs.umich.edu vcgeCode = ''' 22347639Sgblack@eecs.umich.edu destElem = (srcElem1 >= srcElem2) ? (Element)(-1) : 0; 22357639Sgblack@eecs.umich.edu ''' 22367760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vcge", "VcgeD", "SimdCmpOp", allTypes, 2, vcgeCode) 22377760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vcge", "VcgeQ", "SimdCmpOp", allTypes, 4, vcgeCode) 22387639Sgblack@eecs.umich.edu 22397639Sgblack@eecs.umich.edu vceqCode = ''' 22407639Sgblack@eecs.umich.edu destElem = (srcElem1 == srcElem2) ? (Element)(-1) : 0; 22417639Sgblack@eecs.umich.edu ''' 22427760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vceq", "VceqD", "SimdCmpOp", unsignedTypes, 2, vceqCode) 22437760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vceq", "VceqQ", "SimdCmpOp", unsignedTypes, 4, vceqCode) 22447639Sgblack@eecs.umich.edu 22457639Sgblack@eecs.umich.edu vshlCode = ''' 22467639Sgblack@eecs.umich.edu int16_t shiftAmt = (int8_t)srcElem2; 22477639Sgblack@eecs.umich.edu if (shiftAmt < 0) { 22487639Sgblack@eecs.umich.edu shiftAmt = -shiftAmt; 22497639Sgblack@eecs.umich.edu if (shiftAmt >= sizeof(Element) * 8) { 22507639Sgblack@eecs.umich.edu shiftAmt = sizeof(Element) * 8 - 1; 22517639Sgblack@eecs.umich.edu destElem = 0; 22527639Sgblack@eecs.umich.edu } else { 22537639Sgblack@eecs.umich.edu destElem = (srcElem1 >> shiftAmt); 22547639Sgblack@eecs.umich.edu } 22557639Sgblack@eecs.umich.edu // Make sure the right shift sign extended when it should. 22567641Sgblack@eecs.umich.edu if (ltz(srcElem1) && !ltz(destElem)) { 22577639Sgblack@eecs.umich.edu destElem |= -((Element)1 << (sizeof(Element) * 8 - 22587639Sgblack@eecs.umich.edu 1 - shiftAmt)); 22597639Sgblack@eecs.umich.edu } 22607639Sgblack@eecs.umich.edu } else { 22617639Sgblack@eecs.umich.edu if (shiftAmt >= sizeof(Element) * 8) { 22627639Sgblack@eecs.umich.edu destElem = 0; 22637639Sgblack@eecs.umich.edu } else { 22647639Sgblack@eecs.umich.edu destElem = srcElem1 << shiftAmt; 22657639Sgblack@eecs.umich.edu } 22667639Sgblack@eecs.umich.edu } 22677639Sgblack@eecs.umich.edu ''' 22688206SWilliam.Wang@arm.com threeEqualRegInst("vshl", "VshlD", "SimdShiftOp", allTypes, 2, vshlCode) 22698206SWilliam.Wang@arm.com threeEqualRegInst("vshl", "VshlQ", "SimdShiftOp", allTypes, 4, vshlCode) 22707639Sgblack@eecs.umich.edu 22717639Sgblack@eecs.umich.edu vrshlCode = ''' 22727639Sgblack@eecs.umich.edu int16_t shiftAmt = (int8_t)srcElem2; 22737639Sgblack@eecs.umich.edu if (shiftAmt < 0) { 22747639Sgblack@eecs.umich.edu shiftAmt = -shiftAmt; 22757639Sgblack@eecs.umich.edu Element rBit = 0; 22767639Sgblack@eecs.umich.edu if (shiftAmt <= sizeof(Element) * 8) 22777639Sgblack@eecs.umich.edu rBit = bits(srcElem1, shiftAmt - 1); 22787641Sgblack@eecs.umich.edu if (shiftAmt > sizeof(Element) * 8 && ltz(srcElem1)) 22797639Sgblack@eecs.umich.edu rBit = 1; 22807639Sgblack@eecs.umich.edu if (shiftAmt >= sizeof(Element) * 8) { 22817639Sgblack@eecs.umich.edu shiftAmt = sizeof(Element) * 8 - 1; 22827639Sgblack@eecs.umich.edu destElem = 0; 22837639Sgblack@eecs.umich.edu } else { 22847639Sgblack@eecs.umich.edu destElem = (srcElem1 >> shiftAmt); 22857639Sgblack@eecs.umich.edu } 22867639Sgblack@eecs.umich.edu // Make sure the right shift sign extended when it should. 22877641Sgblack@eecs.umich.edu if (ltz(srcElem1) && !ltz(destElem)) { 22887639Sgblack@eecs.umich.edu destElem |= -((Element)1 << (sizeof(Element) * 8 - 22897639Sgblack@eecs.umich.edu 1 - shiftAmt)); 22907639Sgblack@eecs.umich.edu } 22917639Sgblack@eecs.umich.edu destElem += rBit; 22927639Sgblack@eecs.umich.edu } else if (shiftAmt > 0) { 22937639Sgblack@eecs.umich.edu if (shiftAmt >= sizeof(Element) * 8) { 22947639Sgblack@eecs.umich.edu destElem = 0; 22957639Sgblack@eecs.umich.edu } else { 22967639Sgblack@eecs.umich.edu destElem = srcElem1 << shiftAmt; 22977639Sgblack@eecs.umich.edu } 22987639Sgblack@eecs.umich.edu } else { 22997639Sgblack@eecs.umich.edu destElem = srcElem1; 23007639Sgblack@eecs.umich.edu } 23017639Sgblack@eecs.umich.edu ''' 23027760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vrshl", "VrshlD", "SimdAluOp", allTypes, 2, vrshlCode) 23037760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vrshl", "VrshlQ", "SimdAluOp", allTypes, 4, vrshlCode) 23047639Sgblack@eecs.umich.edu 23057639Sgblack@eecs.umich.edu vqshlUCode = ''' 23067639Sgblack@eecs.umich.edu int16_t shiftAmt = (int8_t)srcElem2; 23077783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrQc; 23087639Sgblack@eecs.umich.edu if (shiftAmt < 0) { 23097639Sgblack@eecs.umich.edu shiftAmt = -shiftAmt; 23107639Sgblack@eecs.umich.edu if (shiftAmt >= sizeof(Element) * 8) { 23117639Sgblack@eecs.umich.edu shiftAmt = sizeof(Element) * 8 - 1; 23127639Sgblack@eecs.umich.edu destElem = 0; 23137639Sgblack@eecs.umich.edu } else { 23147639Sgblack@eecs.umich.edu destElem = (srcElem1 >> shiftAmt); 23157639Sgblack@eecs.umich.edu } 23167639Sgblack@eecs.umich.edu } else if (shiftAmt > 0) { 23177639Sgblack@eecs.umich.edu if (shiftAmt >= sizeof(Element) * 8) { 23187639Sgblack@eecs.umich.edu if (srcElem1 != 0) { 23197639Sgblack@eecs.umich.edu destElem = mask(sizeof(Element) * 8); 23207639Sgblack@eecs.umich.edu fpscr.qc = 1; 23217639Sgblack@eecs.umich.edu } else { 23227639Sgblack@eecs.umich.edu destElem = 0; 23237639Sgblack@eecs.umich.edu } 23247639Sgblack@eecs.umich.edu } else { 23257639Sgblack@eecs.umich.edu if (bits(srcElem1, sizeof(Element) * 8 - 1, 23267639Sgblack@eecs.umich.edu sizeof(Element) * 8 - shiftAmt)) { 23277639Sgblack@eecs.umich.edu destElem = mask(sizeof(Element) * 8); 23287639Sgblack@eecs.umich.edu fpscr.qc = 1; 23297639Sgblack@eecs.umich.edu } else { 23307639Sgblack@eecs.umich.edu destElem = srcElem1 << shiftAmt; 23317639Sgblack@eecs.umich.edu } 23327639Sgblack@eecs.umich.edu } 23337639Sgblack@eecs.umich.edu } else { 23347639Sgblack@eecs.umich.edu destElem = srcElem1; 23357639Sgblack@eecs.umich.edu } 23367783SGiacomo.Gabrielli@arm.com FpscrQc = fpscr; 23377639Sgblack@eecs.umich.edu ''' 23387760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vqshl", "VqshlUD", "SimdAluOp", unsignedTypes, 2, vqshlUCode) 23397760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vqshl", "VqshlUQ", "SimdAluOp", unsignedTypes, 4, vqshlUCode) 23407639Sgblack@eecs.umich.edu 23417639Sgblack@eecs.umich.edu vqshlSCode = ''' 23427639Sgblack@eecs.umich.edu int16_t shiftAmt = (int8_t)srcElem2; 23437783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrQc; 23447639Sgblack@eecs.umich.edu if (shiftAmt < 0) { 23457639Sgblack@eecs.umich.edu shiftAmt = -shiftAmt; 23467639Sgblack@eecs.umich.edu if (shiftAmt >= sizeof(Element) * 8) { 23477639Sgblack@eecs.umich.edu shiftAmt = sizeof(Element) * 8 - 1; 23487639Sgblack@eecs.umich.edu destElem = 0; 23497639Sgblack@eecs.umich.edu } else { 23507639Sgblack@eecs.umich.edu destElem = (srcElem1 >> shiftAmt); 23517639Sgblack@eecs.umich.edu } 23527639Sgblack@eecs.umich.edu // Make sure the right shift sign extended when it should. 23537639Sgblack@eecs.umich.edu if (srcElem1 < 0 && destElem >= 0) { 23547639Sgblack@eecs.umich.edu destElem |= -((Element)1 << (sizeof(Element) * 8 - 23557639Sgblack@eecs.umich.edu 1 - shiftAmt)); 23567639Sgblack@eecs.umich.edu } 23577639Sgblack@eecs.umich.edu } else if (shiftAmt > 0) { 23587639Sgblack@eecs.umich.edu bool sat = false; 23597639Sgblack@eecs.umich.edu if (shiftAmt >= sizeof(Element) * 8) { 23607639Sgblack@eecs.umich.edu if (srcElem1 != 0) 23617639Sgblack@eecs.umich.edu sat = true; 23627639Sgblack@eecs.umich.edu else 23637639Sgblack@eecs.umich.edu destElem = 0; 23647639Sgblack@eecs.umich.edu } else { 23657639Sgblack@eecs.umich.edu if (bits(srcElem1, sizeof(Element) * 8 - 1, 23667639Sgblack@eecs.umich.edu sizeof(Element) * 8 - 1 - shiftAmt) != 23677639Sgblack@eecs.umich.edu ((srcElem1 < 0) ? mask(shiftAmt + 1) : 0)) { 23687639Sgblack@eecs.umich.edu sat = true; 23697639Sgblack@eecs.umich.edu } else { 23707639Sgblack@eecs.umich.edu destElem = srcElem1 << shiftAmt; 23717639Sgblack@eecs.umich.edu } 23727639Sgblack@eecs.umich.edu } 23737639Sgblack@eecs.umich.edu if (sat) { 23747639Sgblack@eecs.umich.edu fpscr.qc = 1; 23757639Sgblack@eecs.umich.edu destElem = mask(sizeof(Element) * 8 - 1); 23767639Sgblack@eecs.umich.edu if (srcElem1 < 0) 23777639Sgblack@eecs.umich.edu destElem = ~destElem; 23787639Sgblack@eecs.umich.edu } 23797639Sgblack@eecs.umich.edu } else { 23807639Sgblack@eecs.umich.edu destElem = srcElem1; 23817639Sgblack@eecs.umich.edu } 23827783SGiacomo.Gabrielli@arm.com FpscrQc = fpscr; 23837639Sgblack@eecs.umich.edu ''' 23847760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vqshl", "VqshlSD", "SimdCmpOp", signedTypes, 2, vqshlSCode) 23857760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vqshl", "VqshlSQ", "SimdCmpOp", signedTypes, 4, vqshlSCode) 23867639Sgblack@eecs.umich.edu 23877639Sgblack@eecs.umich.edu vqrshlUCode = ''' 23887639Sgblack@eecs.umich.edu int16_t shiftAmt = (int8_t)srcElem2; 23897783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrQc; 23907639Sgblack@eecs.umich.edu if (shiftAmt < 0) { 23917639Sgblack@eecs.umich.edu shiftAmt = -shiftAmt; 23927639Sgblack@eecs.umich.edu Element rBit = 0; 23937639Sgblack@eecs.umich.edu if (shiftAmt <= sizeof(Element) * 8) 23947639Sgblack@eecs.umich.edu rBit = bits(srcElem1, shiftAmt - 1); 23957639Sgblack@eecs.umich.edu if (shiftAmt >= sizeof(Element) * 8) { 23967639Sgblack@eecs.umich.edu shiftAmt = sizeof(Element) * 8 - 1; 23977639Sgblack@eecs.umich.edu destElem = 0; 23987639Sgblack@eecs.umich.edu } else { 23997639Sgblack@eecs.umich.edu destElem = (srcElem1 >> shiftAmt); 24007639Sgblack@eecs.umich.edu } 24017639Sgblack@eecs.umich.edu destElem += rBit; 24027639Sgblack@eecs.umich.edu } else { 24037639Sgblack@eecs.umich.edu if (shiftAmt >= sizeof(Element) * 8) { 24047639Sgblack@eecs.umich.edu if (srcElem1 != 0) { 24057639Sgblack@eecs.umich.edu destElem = mask(sizeof(Element) * 8); 24067639Sgblack@eecs.umich.edu fpscr.qc = 1; 24077639Sgblack@eecs.umich.edu } else { 24087639Sgblack@eecs.umich.edu destElem = 0; 24097639Sgblack@eecs.umich.edu } 24107639Sgblack@eecs.umich.edu } else { 24117639Sgblack@eecs.umich.edu if (bits(srcElem1, sizeof(Element) * 8 - 1, 24127639Sgblack@eecs.umich.edu sizeof(Element) * 8 - shiftAmt)) { 24137639Sgblack@eecs.umich.edu destElem = mask(sizeof(Element) * 8); 24147639Sgblack@eecs.umich.edu fpscr.qc = 1; 24157639Sgblack@eecs.umich.edu } else { 24167639Sgblack@eecs.umich.edu destElem = srcElem1 << shiftAmt; 24177639Sgblack@eecs.umich.edu } 24187639Sgblack@eecs.umich.edu } 24197639Sgblack@eecs.umich.edu } 24207783SGiacomo.Gabrielli@arm.com FpscrQc = fpscr; 24217639Sgblack@eecs.umich.edu ''' 24227760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vqrshl", "VqrshlUD", "SimdCmpOp", unsignedTypes, 2, vqrshlUCode) 24237760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vqrshl", "VqrshlUQ", "SimdCmpOp", unsignedTypes, 4, vqrshlUCode) 24247639Sgblack@eecs.umich.edu 24257639Sgblack@eecs.umich.edu vqrshlSCode = ''' 24267639Sgblack@eecs.umich.edu int16_t shiftAmt = (int8_t)srcElem2; 24277783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrQc; 24287639Sgblack@eecs.umich.edu if (shiftAmt < 0) { 24297639Sgblack@eecs.umich.edu shiftAmt = -shiftAmt; 24307639Sgblack@eecs.umich.edu Element rBit = 0; 24317639Sgblack@eecs.umich.edu if (shiftAmt <= sizeof(Element) * 8) 24327639Sgblack@eecs.umich.edu rBit = bits(srcElem1, shiftAmt - 1); 24337639Sgblack@eecs.umich.edu if (shiftAmt > sizeof(Element) * 8 && srcElem1 < 0) 24347639Sgblack@eecs.umich.edu rBit = 1; 24357639Sgblack@eecs.umich.edu if (shiftAmt >= sizeof(Element) * 8) { 24367639Sgblack@eecs.umich.edu shiftAmt = sizeof(Element) * 8 - 1; 24377639Sgblack@eecs.umich.edu destElem = 0; 24387639Sgblack@eecs.umich.edu } else { 24397639Sgblack@eecs.umich.edu destElem = (srcElem1 >> shiftAmt); 24407639Sgblack@eecs.umich.edu } 24417639Sgblack@eecs.umich.edu // Make sure the right shift sign extended when it should. 24427639Sgblack@eecs.umich.edu if (srcElem1 < 0 && destElem >= 0) { 24437639Sgblack@eecs.umich.edu destElem |= -((Element)1 << (sizeof(Element) * 8 - 24447639Sgblack@eecs.umich.edu 1 - shiftAmt)); 24457639Sgblack@eecs.umich.edu } 24467639Sgblack@eecs.umich.edu destElem += rBit; 24477639Sgblack@eecs.umich.edu } else if (shiftAmt > 0) { 24487639Sgblack@eecs.umich.edu bool sat = false; 24497639Sgblack@eecs.umich.edu if (shiftAmt >= sizeof(Element) * 8) { 24507639Sgblack@eecs.umich.edu if (srcElem1 != 0) 24517639Sgblack@eecs.umich.edu sat = true; 24527639Sgblack@eecs.umich.edu else 24537639Sgblack@eecs.umich.edu destElem = 0; 24547639Sgblack@eecs.umich.edu } else { 24557639Sgblack@eecs.umich.edu if (bits(srcElem1, sizeof(Element) * 8 - 1, 24567639Sgblack@eecs.umich.edu sizeof(Element) * 8 - 1 - shiftAmt) != 24577639Sgblack@eecs.umich.edu ((srcElem1 < 0) ? mask(shiftAmt + 1) : 0)) { 24587639Sgblack@eecs.umich.edu sat = true; 24597639Sgblack@eecs.umich.edu } else { 24607639Sgblack@eecs.umich.edu destElem = srcElem1 << shiftAmt; 24617639Sgblack@eecs.umich.edu } 24627639Sgblack@eecs.umich.edu } 24637639Sgblack@eecs.umich.edu if (sat) { 24647639Sgblack@eecs.umich.edu fpscr.qc = 1; 24657639Sgblack@eecs.umich.edu destElem = mask(sizeof(Element) * 8 - 1); 24667639Sgblack@eecs.umich.edu if (srcElem1 < 0) 24677639Sgblack@eecs.umich.edu destElem = ~destElem; 24687639Sgblack@eecs.umich.edu } 24697639Sgblack@eecs.umich.edu } else { 24707639Sgblack@eecs.umich.edu destElem = srcElem1; 24717639Sgblack@eecs.umich.edu } 24727783SGiacomo.Gabrielli@arm.com FpscrQc = fpscr; 24737639Sgblack@eecs.umich.edu ''' 24747760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vqrshl", "VqrshlSD", "SimdCmpOp", signedTypes, 2, vqrshlSCode) 24757760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vqrshl", "VqrshlSQ", "SimdCmpOp", signedTypes, 4, vqrshlSCode) 24767639Sgblack@eecs.umich.edu 24777639Sgblack@eecs.umich.edu vabaCode = ''' 24787639Sgblack@eecs.umich.edu destElem += (srcElem1 > srcElem2) ? (srcElem1 - srcElem2) : 24797639Sgblack@eecs.umich.edu (srcElem2 - srcElem1); 24807639Sgblack@eecs.umich.edu ''' 24817760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vaba", "VabaD", "SimdAddAccOp", allTypes, 2, vabaCode, True) 24827760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vaba", "VabaQ", "SimdAddAccOp", allTypes, 4, vabaCode, True) 24837639Sgblack@eecs.umich.edu vabalCode = ''' 24847639Sgblack@eecs.umich.edu destElem += (srcElem1 > srcElem2) ? 24857639Sgblack@eecs.umich.edu ((BigElement)srcElem1 - (BigElement)srcElem2) : 24867639Sgblack@eecs.umich.edu ((BigElement)srcElem2 - (BigElement)srcElem1); 24877639Sgblack@eecs.umich.edu ''' 24887760SGiacomo.Gabrielli@arm.com threeRegLongInst("vabal", "Vabal", "SimdAddAccOp", smallTypes, vabalCode, True) 24897639Sgblack@eecs.umich.edu 24907639Sgblack@eecs.umich.edu vabdCode = ''' 24917639Sgblack@eecs.umich.edu destElem = (srcElem1 > srcElem2) ? (srcElem1 - srcElem2) : 24927639Sgblack@eecs.umich.edu (srcElem2 - srcElem1); 24937639Sgblack@eecs.umich.edu ''' 24947760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vabd", "VabdD", "SimdAddOp", allTypes, 2, vabdCode) 24957760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vabd", "VabdQ", "SimdAddOp", allTypes, 4, vabdCode) 24967639Sgblack@eecs.umich.edu vabdlCode = ''' 24977639Sgblack@eecs.umich.edu destElem = (srcElem1 > srcElem2) ? 24987639Sgblack@eecs.umich.edu ((BigElement)srcElem1 - (BigElement)srcElem2) : 24997639Sgblack@eecs.umich.edu ((BigElement)srcElem2 - (BigElement)srcElem1); 25007639Sgblack@eecs.umich.edu ''' 25017760SGiacomo.Gabrielli@arm.com threeRegLongInst("vabdl", "Vabdl", "SimdAddOp", smallTypes, vabdlCode) 25027639Sgblack@eecs.umich.edu 25037639Sgblack@eecs.umich.edu vtstCode = ''' 25047639Sgblack@eecs.umich.edu destElem = (srcElem1 & srcElem2) ? (Element)(-1) : 0; 25057639Sgblack@eecs.umich.edu ''' 25067760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vtst", "VtstD", "SimdAluOp", unsignedTypes, 2, vtstCode) 25077760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vtst", "VtstQ", "SimdAluOp", unsignedTypes, 4, vtstCode) 25087639Sgblack@eecs.umich.edu 25097639Sgblack@eecs.umich.edu vmulCode = ''' 25107639Sgblack@eecs.umich.edu destElem = srcElem1 * srcElem2; 25117639Sgblack@eecs.umich.edu ''' 25127760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vmul", "NVmulD", "SimdMultOp", allTypes, 2, vmulCode) 25137760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vmul", "NVmulQ", "SimdMultOp", allTypes, 4, vmulCode) 25147639Sgblack@eecs.umich.edu vmullCode = ''' 25157639Sgblack@eecs.umich.edu destElem = (BigElement)srcElem1 * (BigElement)srcElem2; 25167639Sgblack@eecs.umich.edu ''' 25177760SGiacomo.Gabrielli@arm.com threeRegLongInst("vmull", "Vmull", "SimdMultOp", smallTypes, vmullCode) 25187639Sgblack@eecs.umich.edu 25197639Sgblack@eecs.umich.edu vmlaCode = ''' 25207639Sgblack@eecs.umich.edu destElem = destElem + srcElem1 * srcElem2; 25217639Sgblack@eecs.umich.edu ''' 25227760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vmla", "NVmlaD", "SimdMultAccOp", allTypes, 2, vmlaCode, True) 25237760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vmla", "NVmlaQ", "SimdMultAccOp", allTypes, 4, vmlaCode, True) 25247639Sgblack@eecs.umich.edu vmlalCode = ''' 25257639Sgblack@eecs.umich.edu destElem = destElem + (BigElement)srcElem1 * (BigElement)srcElem2; 25267639Sgblack@eecs.umich.edu ''' 25277760SGiacomo.Gabrielli@arm.com threeRegLongInst("vmlal", "Vmlal", "SimdMultAccOp", smallTypes, vmlalCode, True) 25287639Sgblack@eecs.umich.edu 25297639Sgblack@eecs.umich.edu vqdmlalCode = ''' 25307783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrQc; 25317639Sgblack@eecs.umich.edu BigElement midElem = (2 * (int64_t)srcElem1 * (int64_t)srcElem2); 253212038Srekai.gonzalezalberquilla@arm.com Element maxNeg = std::numeric_limits<Element>::min(); 25337639Sgblack@eecs.umich.edu Element halfNeg = maxNeg / 2; 25347639Sgblack@eecs.umich.edu if ((srcElem1 == maxNeg && srcElem2 == maxNeg) || 25357639Sgblack@eecs.umich.edu (srcElem1 == halfNeg && srcElem2 == maxNeg) || 25367639Sgblack@eecs.umich.edu (srcElem1 == maxNeg && srcElem2 == halfNeg)) { 25377639Sgblack@eecs.umich.edu midElem = ~((BigElement)maxNeg << (sizeof(Element) * 8)); 25387639Sgblack@eecs.umich.edu fpscr.qc = 1; 25397639Sgblack@eecs.umich.edu } 25407641Sgblack@eecs.umich.edu bool negPreDest = ltz(destElem); 25417639Sgblack@eecs.umich.edu destElem += midElem; 25427641Sgblack@eecs.umich.edu bool negDest = ltz(destElem); 25437641Sgblack@eecs.umich.edu bool negMid = ltz(midElem); 25447639Sgblack@eecs.umich.edu if (negPreDest == negMid && negMid != negDest) { 25457639Sgblack@eecs.umich.edu destElem = mask(sizeof(BigElement) * 8 - 1); 25467639Sgblack@eecs.umich.edu if (negPreDest) 25477639Sgblack@eecs.umich.edu destElem = ~destElem; 25487639Sgblack@eecs.umich.edu fpscr.qc = 1; 25497639Sgblack@eecs.umich.edu } 25507783SGiacomo.Gabrielli@arm.com FpscrQc = fpscr; 25517639Sgblack@eecs.umich.edu ''' 25527760SGiacomo.Gabrielli@arm.com threeRegLongInst("vqdmlal", "Vqdmlal", "SimdMultAccOp", smallTypes, vqdmlalCode, True) 25537639Sgblack@eecs.umich.edu 25547639Sgblack@eecs.umich.edu vqdmlslCode = ''' 25557783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrQc; 25567639Sgblack@eecs.umich.edu BigElement midElem = (2 * (int64_t)srcElem1 * (int64_t)srcElem2); 255712038Srekai.gonzalezalberquilla@arm.com Element maxNeg = std::numeric_limits<Element>::min(); 25587639Sgblack@eecs.umich.edu Element halfNeg = maxNeg / 2; 25597639Sgblack@eecs.umich.edu if ((srcElem1 == maxNeg && srcElem2 == maxNeg) || 25607639Sgblack@eecs.umich.edu (srcElem1 == halfNeg && srcElem2 == maxNeg) || 25617639Sgblack@eecs.umich.edu (srcElem1 == maxNeg && srcElem2 == halfNeg)) { 25627639Sgblack@eecs.umich.edu midElem = ~((BigElement)maxNeg << (sizeof(Element) * 8)); 25637639Sgblack@eecs.umich.edu fpscr.qc = 1; 25647639Sgblack@eecs.umich.edu } 25657641Sgblack@eecs.umich.edu bool negPreDest = ltz(destElem); 25667639Sgblack@eecs.umich.edu destElem -= midElem; 25677641Sgblack@eecs.umich.edu bool negDest = ltz(destElem); 25687641Sgblack@eecs.umich.edu bool posMid = ltz((BigElement)-midElem); 25697639Sgblack@eecs.umich.edu if (negPreDest == posMid && posMid != negDest) { 25707639Sgblack@eecs.umich.edu destElem = mask(sizeof(BigElement) * 8 - 1); 25717639Sgblack@eecs.umich.edu if (negPreDest) 25727639Sgblack@eecs.umich.edu destElem = ~destElem; 25737639Sgblack@eecs.umich.edu fpscr.qc = 1; 25747639Sgblack@eecs.umich.edu } 25757783SGiacomo.Gabrielli@arm.com FpscrQc = fpscr; 25767639Sgblack@eecs.umich.edu ''' 25777760SGiacomo.Gabrielli@arm.com threeRegLongInst("vqdmlsl", "Vqdmlsl", "SimdMultAccOp", smallTypes, vqdmlslCode, True) 25787639Sgblack@eecs.umich.edu 25797639Sgblack@eecs.umich.edu vqdmullCode = ''' 25807783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrQc; 25817639Sgblack@eecs.umich.edu destElem = (2 * (int64_t)srcElem1 * (int64_t)srcElem2); 25827639Sgblack@eecs.umich.edu if (srcElem1 == srcElem2 && 258312038Srekai.gonzalezalberquilla@arm.com srcElem1 == (Element)(std::numeric_limits<Element>::min())) { 25847639Sgblack@eecs.umich.edu destElem = ~((BigElement)srcElem1 << (sizeof(Element) * 8)); 25857639Sgblack@eecs.umich.edu fpscr.qc = 1; 25867639Sgblack@eecs.umich.edu } 25877783SGiacomo.Gabrielli@arm.com FpscrQc = fpscr; 25887639Sgblack@eecs.umich.edu ''' 25897760SGiacomo.Gabrielli@arm.com threeRegLongInst("vqdmull", "Vqdmull", "SimdMultAccOp", smallTypes, vqdmullCode) 25907639Sgblack@eecs.umich.edu 25917639Sgblack@eecs.umich.edu vmlsCode = ''' 25927639Sgblack@eecs.umich.edu destElem = destElem - srcElem1 * srcElem2; 25937639Sgblack@eecs.umich.edu ''' 25947760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vmls", "NVmlsD", "SimdMultAccOp", allTypes, 2, vmlsCode, True) 25957760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vmls", "NVmlsQ", "SimdMultAccOp", allTypes, 4, vmlsCode, True) 25967639Sgblack@eecs.umich.edu vmlslCode = ''' 25977639Sgblack@eecs.umich.edu destElem = destElem - (BigElement)srcElem1 * (BigElement)srcElem2; 25987639Sgblack@eecs.umich.edu ''' 25997760SGiacomo.Gabrielli@arm.com threeRegLongInst("vmlsl", "Vmlsl", "SimdMultAccOp", smallTypes, vmlslCode, True) 26007639Sgblack@eecs.umich.edu 26017639Sgblack@eecs.umich.edu vmulpCode = ''' 26027639Sgblack@eecs.umich.edu destElem = 0; 26037639Sgblack@eecs.umich.edu for (unsigned j = 0; j < sizeof(Element) * 8; j++) { 26047639Sgblack@eecs.umich.edu if (bits(srcElem2, j)) 26057639Sgblack@eecs.umich.edu destElem ^= srcElem1 << j; 26067639Sgblack@eecs.umich.edu } 26077639Sgblack@eecs.umich.edu ''' 26087760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vmul", "NVmulpD", "SimdMultOp", unsignedTypes, 2, vmulpCode) 26097760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vmul", "NVmulpQ", "SimdMultOp", unsignedTypes, 4, vmulpCode) 26107639Sgblack@eecs.umich.edu vmullpCode = ''' 26117639Sgblack@eecs.umich.edu destElem = 0; 26127639Sgblack@eecs.umich.edu for (unsigned j = 0; j < sizeof(Element) * 8; j++) { 26137639Sgblack@eecs.umich.edu if (bits(srcElem2, j)) 26147639Sgblack@eecs.umich.edu destElem ^= (BigElement)srcElem1 << j; 26157639Sgblack@eecs.umich.edu } 26167639Sgblack@eecs.umich.edu ''' 26177760SGiacomo.Gabrielli@arm.com threeRegLongInst("vmull", "Vmullp", "SimdMultOp", smallUnsignedTypes, vmullpCode) 26187639Sgblack@eecs.umich.edu 26198607Sgblack@eecs.umich.edu threeEqualRegInst("vpmax", "VpmaxD", "SimdCmpOp", smallTypes, 2, vmaxCode, pairwise=True) 26207639Sgblack@eecs.umich.edu 26218607Sgblack@eecs.umich.edu threeEqualRegInst("vpmin", "VpminD", "SimdCmpOp", smallTypes, 2, vminCode, pairwise=True) 26227639Sgblack@eecs.umich.edu 26237639Sgblack@eecs.umich.edu vqdmulhCode = ''' 26247783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrQc; 26257639Sgblack@eecs.umich.edu destElem = (2 * (int64_t)srcElem1 * (int64_t)srcElem2) >> 26267639Sgblack@eecs.umich.edu (sizeof(Element) * 8); 26277639Sgblack@eecs.umich.edu if (srcElem1 == srcElem2 && 262812038Srekai.gonzalezalberquilla@arm.com srcElem1 == (Element)(std::numeric_limits<Element>::min())) { 26297639Sgblack@eecs.umich.edu destElem = ~srcElem1; 26307639Sgblack@eecs.umich.edu fpscr.qc = 1; 26317639Sgblack@eecs.umich.edu } 26327783SGiacomo.Gabrielli@arm.com FpscrQc = fpscr; 26337639Sgblack@eecs.umich.edu ''' 26347760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vqdmulh", "VqdmulhD", "SimdMultOp", smallSignedTypes, 2, vqdmulhCode) 26357760SGiacomo.Gabrielli@arm.com threeEqualRegInst("vqdmulh", "VqdmulhQ", "SimdMultOp", smallSignedTypes, 4, vqdmulhCode) 26367639Sgblack@eecs.umich.edu 26377639Sgblack@eecs.umich.edu vqrdmulhCode = ''' 26387783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrQc; 26397639Sgblack@eecs.umich.edu destElem = (2 * (int64_t)srcElem1 * (int64_t)srcElem2 + 26407639Sgblack@eecs.umich.edu ((int64_t)1 << (sizeof(Element) * 8 - 1))) >> 26417639Sgblack@eecs.umich.edu (sizeof(Element) * 8); 264212038Srekai.gonzalezalberquilla@arm.com Element maxNeg = std::numeric_limits<Element>::min(); 26437639Sgblack@eecs.umich.edu Element halfNeg = maxNeg / 2; 26447639Sgblack@eecs.umich.edu if ((srcElem1 == maxNeg && srcElem2 == maxNeg) || 26457639Sgblack@eecs.umich.edu (srcElem1 == halfNeg && srcElem2 == maxNeg) || 26467639Sgblack@eecs.umich.edu (srcElem1 == maxNeg && srcElem2 == halfNeg)) { 26477639Sgblack@eecs.umich.edu if (destElem < 0) { 26487639Sgblack@eecs.umich.edu destElem = mask(sizeof(Element) * 8 - 1); 26497639Sgblack@eecs.umich.edu } else { 265012038Srekai.gonzalezalberquilla@arm.com destElem = std::numeric_limits<Element>::min(); 26517639Sgblack@eecs.umich.edu } 26527639Sgblack@eecs.umich.edu fpscr.qc = 1; 26537639Sgblack@eecs.umich.edu } 26547783SGiacomo.Gabrielli@arm.com FpscrQc = fpscr; 26557639Sgblack@eecs.umich.edu ''' 26567639Sgblack@eecs.umich.edu threeEqualRegInst("vqrdmulh", "VqrdmulhD", 26577760SGiacomo.Gabrielli@arm.com "SimdMultOp", smallSignedTypes, 2, vqrdmulhCode) 26587639Sgblack@eecs.umich.edu threeEqualRegInst("vqrdmulh", "VqrdmulhQ", 26597760SGiacomo.Gabrielli@arm.com "SimdMultOp", smallSignedTypes, 4, vqrdmulhCode) 26607639Sgblack@eecs.umich.edu 266113978Sciro.santilli@arm.com vMinMaxFpCode = ''' 266213978Sciro.santilli@arm.com destElem = fplib%s<Element>(srcElem1, srcElem2, fpscr); 26637639Sgblack@eecs.umich.edu ''' 266413978Sciro.santilli@arm.com vMinMaxInsts = [ 266513978Sciro.santilli@arm.com ("vmax", "VmaxDFp", 2, "Max", False, ), 266613978Sciro.santilli@arm.com ("vmax", "VmaxQFp", 4, "Max", False, ), 266713978Sciro.santilli@arm.com ("vmaxnm", "VmaxnmDFp", 2, "MaxNum", False, ), 266813978Sciro.santilli@arm.com ("vmaxnm", "VmaxnmQFp", 4, "MaxNum", False, ), 266913978Sciro.santilli@arm.com ("vpmax", "VpmaxDFp", 2, "Max", True, ), 267013978Sciro.santilli@arm.com ("vpmax", "VpmaxQFp", 4, "Max", True, ), 267113978Sciro.santilli@arm.com ("vmin", "VminDFp", 2, "Min", False, ), 267213978Sciro.santilli@arm.com ("vmin", "VminQFp", 4, "Min", False, ), 267313978Sciro.santilli@arm.com ("vminnm", "VminnmDFp", 2, "MinNum", False, ), 267413978Sciro.santilli@arm.com ("vminnm", "VminnmQFp", 4, "MinNum", False, ), 267513978Sciro.santilli@arm.com ("vpmin", "VpminDFp", 2, "Min", True, ), 267613978Sciro.santilli@arm.com ("vpmin", "VpminQFp", 4, "Min", True, ), 267713978Sciro.santilli@arm.com ] 267813978Sciro.santilli@arm.com for name, Name, rCount, op, pairwise in vMinMaxInsts: 267913978Sciro.santilli@arm.com threeEqualRegInst( 268013978Sciro.santilli@arm.com name, 268113978Sciro.santilli@arm.com Name, 268213978Sciro.santilli@arm.com "SimdFloatCmpOp", 268313978Sciro.santilli@arm.com ("uint32_t",), 268413978Sciro.santilli@arm.com rCount, 268513978Sciro.santilli@arm.com vMinMaxFpCode % op, 268613978Sciro.santilli@arm.com pairwise=pairwise, 268713978Sciro.santilli@arm.com standardFpcsr=True, 268813978Sciro.santilli@arm.com ) 26897639Sgblack@eecs.umich.edu 26907639Sgblack@eecs.umich.edu vaddfpCode = ''' 26917783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrExc; 26927639Sgblack@eecs.umich.edu destReg = binaryOp(fpscr, srcReg1, srcReg2, fpAddS, 26937639Sgblack@eecs.umich.edu true, true, VfpRoundNearest); 26947783SGiacomo.Gabrielli@arm.com FpscrExc = fpscr; 26957639Sgblack@eecs.umich.edu ''' 26967760SGiacomo.Gabrielli@arm.com threeEqualRegInstFp("vadd", "VaddDFp", "SimdFloatAddOp", ("float",), 2, vaddfpCode) 26977760SGiacomo.Gabrielli@arm.com threeEqualRegInstFp("vadd", "VaddQFp", "SimdFloatAddOp", ("float",), 4, vaddfpCode) 26987639Sgblack@eecs.umich.edu 26997760SGiacomo.Gabrielli@arm.com threeEqualRegInstFp("vpadd", "VpaddDFp", "SimdFloatAddOp", ("float",), 27007639Sgblack@eecs.umich.edu 2, vaddfpCode, pairwise=True) 27017760SGiacomo.Gabrielli@arm.com threeEqualRegInstFp("vpadd", "VpaddQFp", "SimdFloatAddOp", ("float",), 27027639Sgblack@eecs.umich.edu 4, vaddfpCode, pairwise=True) 27037639Sgblack@eecs.umich.edu 27047639Sgblack@eecs.umich.edu vsubfpCode = ''' 27057783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrExc; 27067639Sgblack@eecs.umich.edu destReg = binaryOp(fpscr, srcReg1, srcReg2, fpSubS, 27077639Sgblack@eecs.umich.edu true, true, VfpRoundNearest); 27087783SGiacomo.Gabrielli@arm.com FpscrExc = fpscr; 27097639Sgblack@eecs.umich.edu ''' 27107760SGiacomo.Gabrielli@arm.com threeEqualRegInstFp("vsub", "VsubDFp", "SimdFloatAddOp", ("float",), 2, vsubfpCode) 27117760SGiacomo.Gabrielli@arm.com threeEqualRegInstFp("vsub", "VsubQFp", "SimdFloatAddOp", ("float",), 4, vsubfpCode) 27127639Sgblack@eecs.umich.edu 27137639Sgblack@eecs.umich.edu vmulfpCode = ''' 27147783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrExc; 27157639Sgblack@eecs.umich.edu destReg = binaryOp(fpscr, srcReg1, srcReg2, fpMulS, 27167639Sgblack@eecs.umich.edu true, true, VfpRoundNearest); 27177783SGiacomo.Gabrielli@arm.com FpscrExc = fpscr; 27187639Sgblack@eecs.umich.edu ''' 27197760SGiacomo.Gabrielli@arm.com threeEqualRegInstFp("vmul", "NVmulDFp", "SimdFloatMultOp", ("float",), 2, vmulfpCode) 27207760SGiacomo.Gabrielli@arm.com threeEqualRegInstFp("vmul", "NVmulQFp", "SimdFloatMultOp", ("float",), 4, vmulfpCode) 27217639Sgblack@eecs.umich.edu 27227639Sgblack@eecs.umich.edu vmlafpCode = ''' 27237783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrExc; 27247639Sgblack@eecs.umich.edu float mid = binaryOp(fpscr, srcReg1, srcReg2, fpMulS, 27257639Sgblack@eecs.umich.edu true, true, VfpRoundNearest); 27267639Sgblack@eecs.umich.edu destReg = binaryOp(fpscr, mid, destReg, fpAddS, 27277639Sgblack@eecs.umich.edu true, true, VfpRoundNearest); 27287783SGiacomo.Gabrielli@arm.com FpscrExc = fpscr; 27297639Sgblack@eecs.umich.edu ''' 27307760SGiacomo.Gabrielli@arm.com threeEqualRegInstFp("vmla", "NVmlaDFp", "SimdFloatMultAccOp", ("float",), 2, vmlafpCode, True) 27317760SGiacomo.Gabrielli@arm.com threeEqualRegInstFp("vmla", "NVmlaQFp", "SimdFloatMultAccOp", ("float",), 4, vmlafpCode, True) 27327639Sgblack@eecs.umich.edu 273310037SARM gem5 Developers vfmafpCode = ''' 273410037SARM gem5 Developers FPSCR fpscr = (FPSCR) FpscrExc; 273510037SARM gem5 Developers destReg = ternaryOp(fpscr, srcReg1, srcReg2, destReg, fpMulAdd<float>, 273610037SARM gem5 Developers true, true, VfpRoundNearest); 273710037SARM gem5 Developers FpscrExc = fpscr; 273810037SARM gem5 Developers ''' 273910037SARM gem5 Developers threeEqualRegInstFp("vfma", "NVfmaDFp", "SimdFloatMultAccOp", ("float",), 2, vfmafpCode, True) 274010037SARM gem5 Developers threeEqualRegInstFp("vfma", "NVfmaQFp", "SimdFloatMultAccOp", ("float",), 4, vfmafpCode, True) 274110037SARM gem5 Developers 274210037SARM gem5 Developers vfmsfpCode = ''' 274310037SARM gem5 Developers FPSCR fpscr = (FPSCR) FpscrExc; 274410037SARM gem5 Developers destReg = ternaryOp(fpscr, -srcReg1, srcReg2, destReg, fpMulAdd<float>, 274510037SARM gem5 Developers true, true, VfpRoundNearest); 274610037SARM gem5 Developers FpscrExc = fpscr; 274710037SARM gem5 Developers ''' 274810037SARM gem5 Developers threeEqualRegInstFp("vfms", "NVfmsDFp", "SimdFloatMultAccOp", ("float",), 2, vfmsfpCode, True) 274910037SARM gem5 Developers threeEqualRegInstFp("vfms", "NVfmsQFp", "SimdFloatMultAccOp", ("float",), 4, vfmsfpCode, True) 275010037SARM gem5 Developers 27517639Sgblack@eecs.umich.edu vmlsfpCode = ''' 27527783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrExc; 27537639Sgblack@eecs.umich.edu float mid = binaryOp(fpscr, srcReg1, srcReg2, fpMulS, 27547639Sgblack@eecs.umich.edu true, true, VfpRoundNearest); 27557639Sgblack@eecs.umich.edu destReg = binaryOp(fpscr, destReg, mid, fpSubS, 27567639Sgblack@eecs.umich.edu true, true, VfpRoundNearest); 27577783SGiacomo.Gabrielli@arm.com FpscrExc = fpscr; 27587639Sgblack@eecs.umich.edu ''' 27597760SGiacomo.Gabrielli@arm.com threeEqualRegInstFp("vmls", "NVmlsDFp", "SimdFloatMultAccOp", ("float",), 2, vmlsfpCode, True) 27607760SGiacomo.Gabrielli@arm.com threeEqualRegInstFp("vmls", "NVmlsQFp", "SimdFloatMultAccOp", ("float",), 4, vmlsfpCode, True) 27617639Sgblack@eecs.umich.edu 27627639Sgblack@eecs.umich.edu vcgtfpCode = ''' 27637783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrExc; 27647639Sgblack@eecs.umich.edu float res = binaryOp(fpscr, srcReg1, srcReg2, vcgtFunc, 27657639Sgblack@eecs.umich.edu true, true, VfpRoundNearest); 27667639Sgblack@eecs.umich.edu destReg = (res == 0) ? -1 : 0; 27677639Sgblack@eecs.umich.edu if (res == 2.0) 27687639Sgblack@eecs.umich.edu fpscr.ioc = 1; 27697783SGiacomo.Gabrielli@arm.com FpscrExc = fpscr; 27707639Sgblack@eecs.umich.edu ''' 27717760SGiacomo.Gabrielli@arm.com threeEqualRegInstFp("vcgt", "VcgtDFp", "SimdFloatCmpOp", ("float",), 27727639Sgblack@eecs.umich.edu 2, vcgtfpCode, toInt = True) 27737760SGiacomo.Gabrielli@arm.com threeEqualRegInstFp("vcgt", "VcgtQFp", "SimdFloatCmpOp", ("float",), 27747639Sgblack@eecs.umich.edu 4, vcgtfpCode, toInt = True) 27757639Sgblack@eecs.umich.edu 27767639Sgblack@eecs.umich.edu vcgefpCode = ''' 27777783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrExc; 27787639Sgblack@eecs.umich.edu float res = binaryOp(fpscr, srcReg1, srcReg2, vcgeFunc, 27797639Sgblack@eecs.umich.edu true, true, VfpRoundNearest); 27807639Sgblack@eecs.umich.edu destReg = (res == 0) ? -1 : 0; 27817639Sgblack@eecs.umich.edu if (res == 2.0) 27827639Sgblack@eecs.umich.edu fpscr.ioc = 1; 27837783SGiacomo.Gabrielli@arm.com FpscrExc = fpscr; 27847639Sgblack@eecs.umich.edu ''' 27857760SGiacomo.Gabrielli@arm.com threeEqualRegInstFp("vcge", "VcgeDFp", "SimdFloatCmpOp", ("float",), 27867639Sgblack@eecs.umich.edu 2, vcgefpCode, toInt = True) 27877760SGiacomo.Gabrielli@arm.com threeEqualRegInstFp("vcge", "VcgeQFp", "SimdFloatCmpOp", ("float",), 27887639Sgblack@eecs.umich.edu 4, vcgefpCode, toInt = True) 27897639Sgblack@eecs.umich.edu 27907639Sgblack@eecs.umich.edu vacgtfpCode = ''' 27917783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrExc; 27927639Sgblack@eecs.umich.edu float res = binaryOp(fpscr, srcReg1, srcReg2, vacgtFunc, 27937639Sgblack@eecs.umich.edu true, true, VfpRoundNearest); 27947639Sgblack@eecs.umich.edu destReg = (res == 0) ? -1 : 0; 27957639Sgblack@eecs.umich.edu if (res == 2.0) 27967639Sgblack@eecs.umich.edu fpscr.ioc = 1; 27977783SGiacomo.Gabrielli@arm.com FpscrExc = fpscr; 27987639Sgblack@eecs.umich.edu ''' 27997760SGiacomo.Gabrielli@arm.com threeEqualRegInstFp("vacgt", "VacgtDFp", "SimdFloatCmpOp", ("float",), 28007639Sgblack@eecs.umich.edu 2, vacgtfpCode, toInt = True) 28017760SGiacomo.Gabrielli@arm.com threeEqualRegInstFp("vacgt", "VacgtQFp", "SimdFloatCmpOp", ("float",), 28027639Sgblack@eecs.umich.edu 4, vacgtfpCode, toInt = True) 28037639Sgblack@eecs.umich.edu 28047639Sgblack@eecs.umich.edu vacgefpCode = ''' 28057783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrExc; 28067639Sgblack@eecs.umich.edu float res = binaryOp(fpscr, srcReg1, srcReg2, vacgeFunc, 28077639Sgblack@eecs.umich.edu true, true, VfpRoundNearest); 28087639Sgblack@eecs.umich.edu destReg = (res == 0) ? -1 : 0; 28097639Sgblack@eecs.umich.edu if (res == 2.0) 28107639Sgblack@eecs.umich.edu fpscr.ioc = 1; 28117783SGiacomo.Gabrielli@arm.com FpscrExc = fpscr; 28127639Sgblack@eecs.umich.edu ''' 28137760SGiacomo.Gabrielli@arm.com threeEqualRegInstFp("vacge", "VacgeDFp", "SimdFloatCmpOp", ("float",), 28147639Sgblack@eecs.umich.edu 2, vacgefpCode, toInt = True) 28157760SGiacomo.Gabrielli@arm.com threeEqualRegInstFp("vacge", "VacgeQFp", "SimdFloatCmpOp", ("float",), 28167639Sgblack@eecs.umich.edu 4, vacgefpCode, toInt = True) 28177639Sgblack@eecs.umich.edu 28187639Sgblack@eecs.umich.edu vceqfpCode = ''' 28197783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrExc; 28207639Sgblack@eecs.umich.edu float res = binaryOp(fpscr, srcReg1, srcReg2, vceqFunc, 28217639Sgblack@eecs.umich.edu true, true, VfpRoundNearest); 28227639Sgblack@eecs.umich.edu destReg = (res == 0) ? -1 : 0; 28237639Sgblack@eecs.umich.edu if (res == 2.0) 28247639Sgblack@eecs.umich.edu fpscr.ioc = 1; 28257783SGiacomo.Gabrielli@arm.com FpscrExc = fpscr; 28267639Sgblack@eecs.umich.edu ''' 28277760SGiacomo.Gabrielli@arm.com threeEqualRegInstFp("vceq", "VceqDFp", "SimdFloatCmpOp", ("float",), 28287639Sgblack@eecs.umich.edu 2, vceqfpCode, toInt = True) 28297760SGiacomo.Gabrielli@arm.com threeEqualRegInstFp("vceq", "VceqQFp", "SimdFloatCmpOp", ("float",), 28307639Sgblack@eecs.umich.edu 4, vceqfpCode, toInt = True) 28317639Sgblack@eecs.umich.edu 28327639Sgblack@eecs.umich.edu vrecpsCode = ''' 28337783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrExc; 28347639Sgblack@eecs.umich.edu destReg = binaryOp(fpscr, srcReg1, srcReg2, fpRecpsS, 28357639Sgblack@eecs.umich.edu true, true, VfpRoundNearest); 28367783SGiacomo.Gabrielli@arm.com FpscrExc = fpscr; 28377639Sgblack@eecs.umich.edu ''' 28387760SGiacomo.Gabrielli@arm.com threeEqualRegInstFp("vrecps", "VrecpsDFp", "SimdFloatMultAccOp", ("float",), 2, vrecpsCode) 28397760SGiacomo.Gabrielli@arm.com threeEqualRegInstFp("vrecps", "VrecpsQFp", "SimdFloatMultAccOp", ("float",), 4, vrecpsCode) 28407639Sgblack@eecs.umich.edu 28417639Sgblack@eecs.umich.edu vrsqrtsCode = ''' 28427783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrExc; 28437639Sgblack@eecs.umich.edu destReg = binaryOp(fpscr, srcReg1, srcReg2, fpRSqrtsS, 28447639Sgblack@eecs.umich.edu true, true, VfpRoundNearest); 28457783SGiacomo.Gabrielli@arm.com FpscrExc = fpscr; 28467639Sgblack@eecs.umich.edu ''' 28477760SGiacomo.Gabrielli@arm.com threeEqualRegInstFp("vrsqrts", "VrsqrtsDFp", "SimdFloatMiscOp", ("float",), 2, vrsqrtsCode) 28487760SGiacomo.Gabrielli@arm.com threeEqualRegInstFp("vrsqrts", "VrsqrtsQFp", "SimdFloatMiscOp", ("float",), 4, vrsqrtsCode) 28497639Sgblack@eecs.umich.edu 28507639Sgblack@eecs.umich.edu vabdfpCode = ''' 28517783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrExc; 28527639Sgblack@eecs.umich.edu float mid = binaryOp(fpscr, srcReg1, srcReg2, fpSubS, 28537639Sgblack@eecs.umich.edu true, true, VfpRoundNearest); 28547639Sgblack@eecs.umich.edu destReg = fabs(mid); 28557783SGiacomo.Gabrielli@arm.com FpscrExc = fpscr; 28567639Sgblack@eecs.umich.edu ''' 28577760SGiacomo.Gabrielli@arm.com threeEqualRegInstFp("vabd", "VabdDFp", "SimdFloatAddOp", ("float",), 2, vabdfpCode) 28587760SGiacomo.Gabrielli@arm.com threeEqualRegInstFp("vabd", "VabdQFp", "SimdFloatAddOp", ("float",), 4, vabdfpCode) 28597639Sgblack@eecs.umich.edu 28607760SGiacomo.Gabrielli@arm.com twoEqualRegInst("vmla", "VmlasD", "SimdMultAccOp", unsignedTypes, 2, vmlaCode, True) 28617760SGiacomo.Gabrielli@arm.com twoEqualRegInst("vmla", "VmlasQ", "SimdMultAccOp", unsignedTypes, 4, vmlaCode, True) 28627760SGiacomo.Gabrielli@arm.com twoEqualRegInstFp("vmla", "VmlasDFp", "SimdFloatMultAccOp", ("float",), 2, vmlafpCode, True) 28637760SGiacomo.Gabrielli@arm.com twoEqualRegInstFp("vmla", "VmlasQFp", "SimdFloatMultAccOp", ("float",), 4, vmlafpCode, True) 28647760SGiacomo.Gabrielli@arm.com twoRegLongInst("vmlal", "Vmlals", "SimdMultAccOp", smallTypes, vmlalCode, True) 28657639Sgblack@eecs.umich.edu 28667760SGiacomo.Gabrielli@arm.com twoEqualRegInst("vmls", "VmlssD", "SimdMultAccOp", allTypes, 2, vmlsCode, True) 28677760SGiacomo.Gabrielli@arm.com twoEqualRegInst("vmls", "VmlssQ", "SimdMultAccOp", allTypes, 4, vmlsCode, True) 28687760SGiacomo.Gabrielli@arm.com twoEqualRegInstFp("vmls", "VmlssDFp", "SimdFloatMultAccOp", ("float",), 2, vmlsfpCode, True) 28697760SGiacomo.Gabrielli@arm.com twoEqualRegInstFp("vmls", "VmlssQFp", "SimdFloatMultAccOp", ("float",), 4, vmlsfpCode, True) 28707760SGiacomo.Gabrielli@arm.com twoRegLongInst("vmlsl", "Vmlsls", "SimdMultAccOp", smallTypes, vmlslCode, True) 28717639Sgblack@eecs.umich.edu 28727760SGiacomo.Gabrielli@arm.com twoEqualRegInst("vmul", "VmulsD", "SimdMultOp", allTypes, 2, vmulCode) 28737760SGiacomo.Gabrielli@arm.com twoEqualRegInst("vmul", "VmulsQ", "SimdMultOp", allTypes, 4, vmulCode) 28747760SGiacomo.Gabrielli@arm.com twoEqualRegInstFp("vmul", "VmulsDFp", "SimdFloatMultOp", ("float",), 2, vmulfpCode) 28757760SGiacomo.Gabrielli@arm.com twoEqualRegInstFp("vmul", "VmulsQFp", "SimdFloatMultOp", ("float",), 4, vmulfpCode) 28767760SGiacomo.Gabrielli@arm.com twoRegLongInst("vmull", "Vmulls", "SimdMultOp", smallTypes, vmullCode) 28777639Sgblack@eecs.umich.edu 28787760SGiacomo.Gabrielli@arm.com twoRegLongInst("vqdmull", "Vqdmulls", "SimdMultOp", smallTypes, vqdmullCode) 28797760SGiacomo.Gabrielli@arm.com twoRegLongInst("vqdmlal", "Vqdmlals", "SimdMultAccOp", smallTypes, vqdmlalCode, True) 28807760SGiacomo.Gabrielli@arm.com twoRegLongInst("vqdmlsl", "Vqdmlsls", "SimdMultAccOp", smallTypes, vqdmlslCode, True) 28817760SGiacomo.Gabrielli@arm.com twoEqualRegInst("vqdmulh", "VqdmulhsD", "SimdMultOp", smallSignedTypes, 2, vqdmulhCode) 28827760SGiacomo.Gabrielli@arm.com twoEqualRegInst("vqdmulh", "VqdmulhsQ", "SimdMultOp", smallSignedTypes, 4, vqdmulhCode) 28837639Sgblack@eecs.umich.edu twoEqualRegInst("vqrdmulh", "VqrdmulhsD", 28847760SGiacomo.Gabrielli@arm.com "SimdMultOp", smallSignedTypes, 2, vqrdmulhCode) 28857639Sgblack@eecs.umich.edu twoEqualRegInst("vqrdmulh", "VqrdmulhsQ", 28867760SGiacomo.Gabrielli@arm.com "SimdMultOp", smallSignedTypes, 4, vqrdmulhCode) 28877639Sgblack@eecs.umich.edu 28887639Sgblack@eecs.umich.edu vshrCode = ''' 28897639Sgblack@eecs.umich.edu if (imm >= sizeof(srcElem1) * 8) { 28907641Sgblack@eecs.umich.edu if (ltz(srcElem1)) 28917639Sgblack@eecs.umich.edu destElem = -1; 28927639Sgblack@eecs.umich.edu else 28937639Sgblack@eecs.umich.edu destElem = 0; 28947639Sgblack@eecs.umich.edu } else { 28957639Sgblack@eecs.umich.edu destElem = srcElem1 >> imm; 28967639Sgblack@eecs.umich.edu } 28977639Sgblack@eecs.umich.edu ''' 28987760SGiacomo.Gabrielli@arm.com twoRegShiftInst("vshr", "NVshrD", "SimdShiftOp", allTypes, 2, vshrCode) 28997760SGiacomo.Gabrielli@arm.com twoRegShiftInst("vshr", "NVshrQ", "SimdShiftOp", allTypes, 4, vshrCode) 29007639Sgblack@eecs.umich.edu 29017639Sgblack@eecs.umich.edu vsraCode = ''' 29027639Sgblack@eecs.umich.edu Element mid;; 29037639Sgblack@eecs.umich.edu if (imm >= sizeof(srcElem1) * 8) { 29047641Sgblack@eecs.umich.edu mid = ltz(srcElem1) ? -1 : 0; 29057639Sgblack@eecs.umich.edu } else { 29067639Sgblack@eecs.umich.edu mid = srcElem1 >> imm; 29077641Sgblack@eecs.umich.edu if (ltz(srcElem1) && !ltz(mid)) { 29087639Sgblack@eecs.umich.edu mid |= -(mid & ((Element)1 << 29097639Sgblack@eecs.umich.edu (sizeof(Element) * 8 - 1 - imm))); 29107639Sgblack@eecs.umich.edu } 29117639Sgblack@eecs.umich.edu } 29127639Sgblack@eecs.umich.edu destElem += mid; 29137639Sgblack@eecs.umich.edu ''' 29147760SGiacomo.Gabrielli@arm.com twoRegShiftInst("vsra", "NVsraD", "SimdShiftAccOp", allTypes, 2, vsraCode, True) 29157760SGiacomo.Gabrielli@arm.com twoRegShiftInst("vsra", "NVsraQ", "SimdShiftAccOp", allTypes, 4, vsraCode, True) 29167639Sgblack@eecs.umich.edu 29177639Sgblack@eecs.umich.edu vrshrCode = ''' 29187639Sgblack@eecs.umich.edu if (imm > sizeof(srcElem1) * 8) { 29197639Sgblack@eecs.umich.edu destElem = 0; 29207639Sgblack@eecs.umich.edu } else if (imm) { 29217639Sgblack@eecs.umich.edu Element rBit = bits(srcElem1, imm - 1); 29227639Sgblack@eecs.umich.edu destElem = ((srcElem1 >> (imm - 1)) >> 1) + rBit; 29237639Sgblack@eecs.umich.edu } else { 29247639Sgblack@eecs.umich.edu destElem = srcElem1; 29257639Sgblack@eecs.umich.edu } 29267639Sgblack@eecs.umich.edu ''' 29277760SGiacomo.Gabrielli@arm.com twoRegShiftInst("vrshr", "NVrshrD", "SimdShiftOp", allTypes, 2, vrshrCode) 29287760SGiacomo.Gabrielli@arm.com twoRegShiftInst("vrshr", "NVrshrQ", "SimdShiftOp", allTypes, 4, vrshrCode) 29297639Sgblack@eecs.umich.edu 29307639Sgblack@eecs.umich.edu vrsraCode = ''' 29317639Sgblack@eecs.umich.edu if (imm > sizeof(srcElem1) * 8) { 29327639Sgblack@eecs.umich.edu destElem += 0; 29337639Sgblack@eecs.umich.edu } else if (imm) { 29347639Sgblack@eecs.umich.edu Element rBit = bits(srcElem1, imm - 1); 29357639Sgblack@eecs.umich.edu destElem += ((srcElem1 >> (imm - 1)) >> 1) + rBit; 29367639Sgblack@eecs.umich.edu } else { 29377639Sgblack@eecs.umich.edu destElem += srcElem1; 29387639Sgblack@eecs.umich.edu } 29397639Sgblack@eecs.umich.edu ''' 29407760SGiacomo.Gabrielli@arm.com twoRegShiftInst("vrsra", "NVrsraD", "SimdShiftAccOp", allTypes, 2, vrsraCode, True) 29417760SGiacomo.Gabrielli@arm.com twoRegShiftInst("vrsra", "NVrsraQ", "SimdShiftAccOp", allTypes, 4, vrsraCode, True) 29427639Sgblack@eecs.umich.edu 29437639Sgblack@eecs.umich.edu vsriCode = ''' 294411443Sandreas.hansson@arm.com if (imm >= sizeof(Element) * 8) { 29457639Sgblack@eecs.umich.edu destElem = destElem; 294611443Sandreas.hansson@arm.com } else { 29477639Sgblack@eecs.umich.edu destElem = (srcElem1 >> imm) | 29487639Sgblack@eecs.umich.edu (destElem & ~mask(sizeof(Element) * 8 - imm)); 294911443Sandreas.hansson@arm.com } 29507639Sgblack@eecs.umich.edu ''' 29517760SGiacomo.Gabrielli@arm.com twoRegShiftInst("vsri", "NVsriD", "SimdShiftOp", unsignedTypes, 2, vsriCode, True) 29527760SGiacomo.Gabrielli@arm.com twoRegShiftInst("vsri", "NVsriQ", "SimdShiftOp", unsignedTypes, 4, vsriCode, True) 29537639Sgblack@eecs.umich.edu 29547639Sgblack@eecs.umich.edu vshlCode = ''' 295511443Sandreas.hansson@arm.com if (imm >= sizeof(Element) * 8) { 29567639Sgblack@eecs.umich.edu destElem = (srcElem1 << (sizeof(Element) * 8 - 1)) << 1; 295711443Sandreas.hansson@arm.com } else { 29587639Sgblack@eecs.umich.edu destElem = srcElem1 << imm; 295911443Sandreas.hansson@arm.com } 29607639Sgblack@eecs.umich.edu ''' 29617760SGiacomo.Gabrielli@arm.com twoRegShiftInst("vshl", "NVshlD", "SimdShiftOp", unsignedTypes, 2, vshlCode) 29627760SGiacomo.Gabrielli@arm.com twoRegShiftInst("vshl", "NVshlQ", "SimdShiftOp", unsignedTypes, 4, vshlCode) 29637639Sgblack@eecs.umich.edu 29647639Sgblack@eecs.umich.edu vsliCode = ''' 296511443Sandreas.hansson@arm.com if (imm >= sizeof(Element) * 8) { 29667639Sgblack@eecs.umich.edu destElem = destElem; 296711443Sandreas.hansson@arm.com } else { 29687639Sgblack@eecs.umich.edu destElem = (srcElem1 << imm) | (destElem & mask(imm)); 296911443Sandreas.hansson@arm.com } 29707639Sgblack@eecs.umich.edu ''' 29717760SGiacomo.Gabrielli@arm.com twoRegShiftInst("vsli", "NVsliD", "SimdShiftOp", unsignedTypes, 2, vsliCode, True) 29727760SGiacomo.Gabrielli@arm.com twoRegShiftInst("vsli", "NVsliQ", "SimdShiftOp", unsignedTypes, 4, vsliCode, True) 29737639Sgblack@eecs.umich.edu 29747639Sgblack@eecs.umich.edu vqshlCode = ''' 29757783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrQc; 29767639Sgblack@eecs.umich.edu if (imm >= sizeof(Element) * 8) { 29777639Sgblack@eecs.umich.edu if (srcElem1 != 0) { 297812038Srekai.gonzalezalberquilla@arm.com destElem = std::numeric_limits<Element>::min(); 29797639Sgblack@eecs.umich.edu if (srcElem1 > 0) 29807639Sgblack@eecs.umich.edu destElem = ~destElem; 29817639Sgblack@eecs.umich.edu fpscr.qc = 1; 29827639Sgblack@eecs.umich.edu } else { 29837639Sgblack@eecs.umich.edu destElem = 0; 29847639Sgblack@eecs.umich.edu } 29857639Sgblack@eecs.umich.edu } else if (imm) { 29867639Sgblack@eecs.umich.edu destElem = (srcElem1 << imm); 29877639Sgblack@eecs.umich.edu uint64_t topBits = bits((uint64_t)srcElem1, 29887639Sgblack@eecs.umich.edu sizeof(Element) * 8 - 1, 29897639Sgblack@eecs.umich.edu sizeof(Element) * 8 - 1 - imm); 29907639Sgblack@eecs.umich.edu if (topBits != 0 && topBits != mask(imm + 1)) { 299112038Srekai.gonzalezalberquilla@arm.com destElem = std::numeric_limits<Element>::min(); 29927639Sgblack@eecs.umich.edu if (srcElem1 > 0) 29937639Sgblack@eecs.umich.edu destElem = ~destElem; 29947639Sgblack@eecs.umich.edu fpscr.qc = 1; 29957639Sgblack@eecs.umich.edu } 29967639Sgblack@eecs.umich.edu } else { 29977639Sgblack@eecs.umich.edu destElem = srcElem1; 29987639Sgblack@eecs.umich.edu } 29997783SGiacomo.Gabrielli@arm.com FpscrQc = fpscr; 30007639Sgblack@eecs.umich.edu ''' 30017760SGiacomo.Gabrielli@arm.com twoRegShiftInst("vqshl", "NVqshlD", "SimdShiftOp", signedTypes, 2, vqshlCode) 30027760SGiacomo.Gabrielli@arm.com twoRegShiftInst("vqshl", "NVqshlQ", "SimdShiftOp", signedTypes, 4, vqshlCode) 30037639Sgblack@eecs.umich.edu 30047639Sgblack@eecs.umich.edu vqshluCode = ''' 30057783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrQc; 30067639Sgblack@eecs.umich.edu if (imm >= sizeof(Element) * 8) { 30077639Sgblack@eecs.umich.edu if (srcElem1 != 0) { 30087639Sgblack@eecs.umich.edu destElem = mask(sizeof(Element) * 8); 30097639Sgblack@eecs.umich.edu fpscr.qc = 1; 30107639Sgblack@eecs.umich.edu } else { 30117639Sgblack@eecs.umich.edu destElem = 0; 30127639Sgblack@eecs.umich.edu } 30137639Sgblack@eecs.umich.edu } else if (imm) { 30147639Sgblack@eecs.umich.edu destElem = (srcElem1 << imm); 30157639Sgblack@eecs.umich.edu uint64_t topBits = bits((uint64_t)srcElem1, 30167639Sgblack@eecs.umich.edu sizeof(Element) * 8 - 1, 30177639Sgblack@eecs.umich.edu sizeof(Element) * 8 - imm); 30187639Sgblack@eecs.umich.edu if (topBits != 0) { 30197639Sgblack@eecs.umich.edu destElem = mask(sizeof(Element) * 8); 30207639Sgblack@eecs.umich.edu fpscr.qc = 1; 30217639Sgblack@eecs.umich.edu } 30227639Sgblack@eecs.umich.edu } else { 30237639Sgblack@eecs.umich.edu destElem = srcElem1; 30247639Sgblack@eecs.umich.edu } 30257783SGiacomo.Gabrielli@arm.com FpscrQc = fpscr; 30267639Sgblack@eecs.umich.edu ''' 30277760SGiacomo.Gabrielli@arm.com twoRegShiftInst("vqshlu", "NVqshluD", "SimdShiftOp", unsignedTypes, 2, vqshluCode) 30287760SGiacomo.Gabrielli@arm.com twoRegShiftInst("vqshlu", "NVqshluQ", "SimdShiftOp", unsignedTypes, 4, vqshluCode) 30297639Sgblack@eecs.umich.edu 30307639Sgblack@eecs.umich.edu vqshlusCode = ''' 30317783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrQc; 30327639Sgblack@eecs.umich.edu if (imm >= sizeof(Element) * 8) { 30337639Sgblack@eecs.umich.edu if (srcElem1 < 0) { 30347639Sgblack@eecs.umich.edu destElem = 0; 30357639Sgblack@eecs.umich.edu fpscr.qc = 1; 30367639Sgblack@eecs.umich.edu } else if (srcElem1 > 0) { 30377639Sgblack@eecs.umich.edu destElem = mask(sizeof(Element) * 8); 30387639Sgblack@eecs.umich.edu fpscr.qc = 1; 30397639Sgblack@eecs.umich.edu } else { 30407639Sgblack@eecs.umich.edu destElem = 0; 30417639Sgblack@eecs.umich.edu } 30427639Sgblack@eecs.umich.edu } else if (imm) { 30437639Sgblack@eecs.umich.edu destElem = (srcElem1 << imm); 30447639Sgblack@eecs.umich.edu uint64_t topBits = bits((uint64_t)srcElem1, 30457639Sgblack@eecs.umich.edu sizeof(Element) * 8 - 1, 30467639Sgblack@eecs.umich.edu sizeof(Element) * 8 - imm); 30477639Sgblack@eecs.umich.edu if (srcElem1 < 0) { 30487639Sgblack@eecs.umich.edu destElem = 0; 30497639Sgblack@eecs.umich.edu fpscr.qc = 1; 30507639Sgblack@eecs.umich.edu } else if (topBits != 0) { 30517639Sgblack@eecs.umich.edu destElem = mask(sizeof(Element) * 8); 30527639Sgblack@eecs.umich.edu fpscr.qc = 1; 30537639Sgblack@eecs.umich.edu } 30547639Sgblack@eecs.umich.edu } else { 30557639Sgblack@eecs.umich.edu if (srcElem1 < 0) { 30567639Sgblack@eecs.umich.edu fpscr.qc = 1; 30577639Sgblack@eecs.umich.edu destElem = 0; 30587639Sgblack@eecs.umich.edu } else { 30597639Sgblack@eecs.umich.edu destElem = srcElem1; 30607639Sgblack@eecs.umich.edu } 30617639Sgblack@eecs.umich.edu } 30627783SGiacomo.Gabrielli@arm.com FpscrQc = fpscr; 30637639Sgblack@eecs.umich.edu ''' 30647760SGiacomo.Gabrielli@arm.com twoRegShiftInst("vqshlus", "NVqshlusD", "SimdShiftOp", signedTypes, 2, vqshlusCode) 30657760SGiacomo.Gabrielli@arm.com twoRegShiftInst("vqshlus", "NVqshlusQ", "SimdShiftOp", signedTypes, 4, vqshlusCode) 30667639Sgblack@eecs.umich.edu 30677639Sgblack@eecs.umich.edu vshrnCode = ''' 30687639Sgblack@eecs.umich.edu if (imm >= sizeof(srcElem1) * 8) { 30697639Sgblack@eecs.umich.edu destElem = 0; 30707639Sgblack@eecs.umich.edu } else { 30717639Sgblack@eecs.umich.edu destElem = srcElem1 >> imm; 30727639Sgblack@eecs.umich.edu } 30737639Sgblack@eecs.umich.edu ''' 30747760SGiacomo.Gabrielli@arm.com twoRegNarrowShiftInst("vshrn", "NVshrn", "SimdShiftOp", smallUnsignedTypes, vshrnCode) 30757639Sgblack@eecs.umich.edu 30767639Sgblack@eecs.umich.edu vrshrnCode = ''' 30777639Sgblack@eecs.umich.edu if (imm > sizeof(srcElem1) * 8) { 30787639Sgblack@eecs.umich.edu destElem = 0; 30797639Sgblack@eecs.umich.edu } else if (imm) { 30807639Sgblack@eecs.umich.edu Element rBit = bits(srcElem1, imm - 1); 30817639Sgblack@eecs.umich.edu destElem = ((srcElem1 >> (imm - 1)) >> 1) + rBit; 30827639Sgblack@eecs.umich.edu } else { 30837639Sgblack@eecs.umich.edu destElem = srcElem1; 30847639Sgblack@eecs.umich.edu } 30857639Sgblack@eecs.umich.edu ''' 30867760SGiacomo.Gabrielli@arm.com twoRegNarrowShiftInst("vrshrn", "NVrshrn", "SimdShiftOp", smallUnsignedTypes, vrshrnCode) 30877639Sgblack@eecs.umich.edu 30887639Sgblack@eecs.umich.edu vqshrnCode = ''' 30897783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrQc; 30907639Sgblack@eecs.umich.edu if (imm > sizeof(srcElem1) * 8) { 30917639Sgblack@eecs.umich.edu if (srcElem1 != 0 && srcElem1 != -1) 30927639Sgblack@eecs.umich.edu fpscr.qc = 1; 30937639Sgblack@eecs.umich.edu destElem = 0; 30947639Sgblack@eecs.umich.edu } else if (imm) { 30957639Sgblack@eecs.umich.edu BigElement mid = ((srcElem1 >> (imm - 1)) >> 1); 30967639Sgblack@eecs.umich.edu mid |= -(mid & ((BigElement)1 << 30977639Sgblack@eecs.umich.edu (sizeof(BigElement) * 8 - 1 - imm))); 30987639Sgblack@eecs.umich.edu if (mid != (Element)mid) { 30997639Sgblack@eecs.umich.edu destElem = mask(sizeof(Element) * 8 - 1); 31007639Sgblack@eecs.umich.edu if (srcElem1 < 0) 31017639Sgblack@eecs.umich.edu destElem = ~destElem; 31027639Sgblack@eecs.umich.edu fpscr.qc = 1; 31037639Sgblack@eecs.umich.edu } else { 31047639Sgblack@eecs.umich.edu destElem = mid; 31057639Sgblack@eecs.umich.edu } 31067639Sgblack@eecs.umich.edu } else { 31077639Sgblack@eecs.umich.edu destElem = srcElem1; 31087639Sgblack@eecs.umich.edu } 31097783SGiacomo.Gabrielli@arm.com FpscrQc = fpscr; 31107639Sgblack@eecs.umich.edu ''' 31117760SGiacomo.Gabrielli@arm.com twoRegNarrowShiftInst("vqshrn", "NVqshrn", "SimdShiftOp", smallSignedTypes, vqshrnCode) 31127639Sgblack@eecs.umich.edu 31137639Sgblack@eecs.umich.edu vqshrunCode = ''' 31147783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrQc; 31157639Sgblack@eecs.umich.edu if (imm > sizeof(srcElem1) * 8) { 31167639Sgblack@eecs.umich.edu if (srcElem1 != 0) 31177639Sgblack@eecs.umich.edu fpscr.qc = 1; 31187639Sgblack@eecs.umich.edu destElem = 0; 31197639Sgblack@eecs.umich.edu } else if (imm) { 31207639Sgblack@eecs.umich.edu BigElement mid = ((srcElem1 >> (imm - 1)) >> 1); 31217639Sgblack@eecs.umich.edu if (mid != (Element)mid) { 31227639Sgblack@eecs.umich.edu destElem = mask(sizeof(Element) * 8); 31237639Sgblack@eecs.umich.edu fpscr.qc = 1; 31247639Sgblack@eecs.umich.edu } else { 31257639Sgblack@eecs.umich.edu destElem = mid; 31267639Sgblack@eecs.umich.edu } 31277639Sgblack@eecs.umich.edu } else { 31287639Sgblack@eecs.umich.edu destElem = srcElem1; 31297639Sgblack@eecs.umich.edu } 31307783SGiacomo.Gabrielli@arm.com FpscrQc = fpscr; 31317639Sgblack@eecs.umich.edu ''' 31327639Sgblack@eecs.umich.edu twoRegNarrowShiftInst("vqshrun", "NVqshrun", 31337760SGiacomo.Gabrielli@arm.com "SimdShiftOp", smallUnsignedTypes, vqshrunCode) 31347639Sgblack@eecs.umich.edu 31357639Sgblack@eecs.umich.edu vqshrunsCode = ''' 31367783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrQc; 31377639Sgblack@eecs.umich.edu if (imm > sizeof(srcElem1) * 8) { 31387639Sgblack@eecs.umich.edu if (srcElem1 != 0) 31397639Sgblack@eecs.umich.edu fpscr.qc = 1; 31407639Sgblack@eecs.umich.edu destElem = 0; 31417639Sgblack@eecs.umich.edu } else if (imm) { 31427639Sgblack@eecs.umich.edu BigElement mid = ((srcElem1 >> (imm - 1)) >> 1); 31437639Sgblack@eecs.umich.edu if (bits(mid, sizeof(BigElement) * 8 - 1, 31447639Sgblack@eecs.umich.edu sizeof(Element) * 8) != 0) { 31457639Sgblack@eecs.umich.edu if (srcElem1 < 0) { 31467639Sgblack@eecs.umich.edu destElem = 0; 31477639Sgblack@eecs.umich.edu } else { 31487639Sgblack@eecs.umich.edu destElem = mask(sizeof(Element) * 8); 31497639Sgblack@eecs.umich.edu } 31507639Sgblack@eecs.umich.edu fpscr.qc = 1; 31517639Sgblack@eecs.umich.edu } else { 31527639Sgblack@eecs.umich.edu destElem = mid; 31537639Sgblack@eecs.umich.edu } 31547639Sgblack@eecs.umich.edu } else { 31557639Sgblack@eecs.umich.edu destElem = srcElem1; 31567639Sgblack@eecs.umich.edu } 31577783SGiacomo.Gabrielli@arm.com FpscrQc = fpscr; 31587639Sgblack@eecs.umich.edu ''' 31597639Sgblack@eecs.umich.edu twoRegNarrowShiftInst("vqshrun", "NVqshruns", 31607760SGiacomo.Gabrielli@arm.com "SimdShiftOp", smallSignedTypes, vqshrunsCode) 31617639Sgblack@eecs.umich.edu 31627639Sgblack@eecs.umich.edu vqrshrnCode = ''' 31637783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrQc; 31647639Sgblack@eecs.umich.edu if (imm > sizeof(srcElem1) * 8) { 31657639Sgblack@eecs.umich.edu if (srcElem1 != 0 && srcElem1 != -1) 31667639Sgblack@eecs.umich.edu fpscr.qc = 1; 31677639Sgblack@eecs.umich.edu destElem = 0; 31687639Sgblack@eecs.umich.edu } else if (imm) { 31697639Sgblack@eecs.umich.edu BigElement mid = (srcElem1 >> (imm - 1)); 31707639Sgblack@eecs.umich.edu uint64_t rBit = mid & 0x1; 31717639Sgblack@eecs.umich.edu mid >>= 1; 31727639Sgblack@eecs.umich.edu mid |= -(mid & ((BigElement)1 << 31737639Sgblack@eecs.umich.edu (sizeof(BigElement) * 8 - 1 - imm))); 31747639Sgblack@eecs.umich.edu mid += rBit; 31757639Sgblack@eecs.umich.edu if (mid != (Element)mid) { 31767639Sgblack@eecs.umich.edu destElem = mask(sizeof(Element) * 8 - 1); 31777639Sgblack@eecs.umich.edu if (srcElem1 < 0) 31787639Sgblack@eecs.umich.edu destElem = ~destElem; 31797639Sgblack@eecs.umich.edu fpscr.qc = 1; 31807639Sgblack@eecs.umich.edu } else { 31817639Sgblack@eecs.umich.edu destElem = mid; 31827639Sgblack@eecs.umich.edu } 31837639Sgblack@eecs.umich.edu } else { 31847639Sgblack@eecs.umich.edu if (srcElem1 != (Element)srcElem1) { 31857639Sgblack@eecs.umich.edu destElem = mask(sizeof(Element) * 8 - 1); 31867639Sgblack@eecs.umich.edu if (srcElem1 < 0) 31877639Sgblack@eecs.umich.edu destElem = ~destElem; 31887639Sgblack@eecs.umich.edu fpscr.qc = 1; 31897639Sgblack@eecs.umich.edu } else { 31907639Sgblack@eecs.umich.edu destElem = srcElem1; 31917639Sgblack@eecs.umich.edu } 31927639Sgblack@eecs.umich.edu } 31937783SGiacomo.Gabrielli@arm.com FpscrQc = fpscr; 31947639Sgblack@eecs.umich.edu ''' 31957639Sgblack@eecs.umich.edu twoRegNarrowShiftInst("vqrshrn", "NVqrshrn", 31967760SGiacomo.Gabrielli@arm.com "SimdShiftOp", smallSignedTypes, vqrshrnCode) 31977639Sgblack@eecs.umich.edu 31987639Sgblack@eecs.umich.edu vqrshrunCode = ''' 31997783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrQc; 32007639Sgblack@eecs.umich.edu if (imm > sizeof(srcElem1) * 8) { 32017639Sgblack@eecs.umich.edu if (srcElem1 != 0) 32027639Sgblack@eecs.umich.edu fpscr.qc = 1; 32037639Sgblack@eecs.umich.edu destElem = 0; 32047639Sgblack@eecs.umich.edu } else if (imm) { 32057639Sgblack@eecs.umich.edu BigElement mid = (srcElem1 >> (imm - 1)); 32067639Sgblack@eecs.umich.edu uint64_t rBit = mid & 0x1; 32077639Sgblack@eecs.umich.edu mid >>= 1; 32087639Sgblack@eecs.umich.edu mid += rBit; 32097639Sgblack@eecs.umich.edu if (mid != (Element)mid) { 32107639Sgblack@eecs.umich.edu destElem = mask(sizeof(Element) * 8); 32117639Sgblack@eecs.umich.edu fpscr.qc = 1; 32127639Sgblack@eecs.umich.edu } else { 32137639Sgblack@eecs.umich.edu destElem = mid; 32147639Sgblack@eecs.umich.edu } 32157639Sgblack@eecs.umich.edu } else { 32167639Sgblack@eecs.umich.edu if (srcElem1 != (Element)srcElem1) { 32177639Sgblack@eecs.umich.edu destElem = mask(sizeof(Element) * 8 - 1); 32187639Sgblack@eecs.umich.edu fpscr.qc = 1; 32197639Sgblack@eecs.umich.edu } else { 32207639Sgblack@eecs.umich.edu destElem = srcElem1; 32217639Sgblack@eecs.umich.edu } 32227639Sgblack@eecs.umich.edu } 32237783SGiacomo.Gabrielli@arm.com FpscrQc = fpscr; 32247639Sgblack@eecs.umich.edu ''' 32257639Sgblack@eecs.umich.edu twoRegNarrowShiftInst("vqrshrun", "NVqrshrun", 32267760SGiacomo.Gabrielli@arm.com "SimdShiftOp", smallUnsignedTypes, vqrshrunCode) 32277639Sgblack@eecs.umich.edu 32287639Sgblack@eecs.umich.edu vqrshrunsCode = ''' 32297783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrQc; 32307639Sgblack@eecs.umich.edu if (imm > sizeof(srcElem1) * 8) { 32317639Sgblack@eecs.umich.edu if (srcElem1 != 0) 32327639Sgblack@eecs.umich.edu fpscr.qc = 1; 32337639Sgblack@eecs.umich.edu destElem = 0; 32347639Sgblack@eecs.umich.edu } else if (imm) { 32357639Sgblack@eecs.umich.edu BigElement mid = (srcElem1 >> (imm - 1)); 32367639Sgblack@eecs.umich.edu uint64_t rBit = mid & 0x1; 32377639Sgblack@eecs.umich.edu mid >>= 1; 32387639Sgblack@eecs.umich.edu mid |= -(mid & ((BigElement)1 << 32397639Sgblack@eecs.umich.edu (sizeof(BigElement) * 8 - 1 - imm))); 32407639Sgblack@eecs.umich.edu mid += rBit; 32417639Sgblack@eecs.umich.edu if (bits(mid, sizeof(BigElement) * 8 - 1, 32427639Sgblack@eecs.umich.edu sizeof(Element) * 8) != 0) { 32437639Sgblack@eecs.umich.edu if (srcElem1 < 0) { 32447639Sgblack@eecs.umich.edu destElem = 0; 32457639Sgblack@eecs.umich.edu } else { 32467639Sgblack@eecs.umich.edu destElem = mask(sizeof(Element) * 8); 32477639Sgblack@eecs.umich.edu } 32487639Sgblack@eecs.umich.edu fpscr.qc = 1; 32497639Sgblack@eecs.umich.edu } else { 32507639Sgblack@eecs.umich.edu destElem = mid; 32517639Sgblack@eecs.umich.edu } 32527639Sgblack@eecs.umich.edu } else { 32537639Sgblack@eecs.umich.edu if (srcElem1 < 0) { 32547639Sgblack@eecs.umich.edu fpscr.qc = 1; 32557639Sgblack@eecs.umich.edu destElem = 0; 32567639Sgblack@eecs.umich.edu } else { 32577639Sgblack@eecs.umich.edu destElem = srcElem1; 32587639Sgblack@eecs.umich.edu } 32597639Sgblack@eecs.umich.edu } 32607783SGiacomo.Gabrielli@arm.com FpscrQc = fpscr; 32617639Sgblack@eecs.umich.edu ''' 32627639Sgblack@eecs.umich.edu twoRegNarrowShiftInst("vqrshrun", "NVqrshruns", 32637760SGiacomo.Gabrielli@arm.com "SimdShiftOp", smallSignedTypes, vqrshrunsCode) 32647639Sgblack@eecs.umich.edu 32657639Sgblack@eecs.umich.edu vshllCode = ''' 32667639Sgblack@eecs.umich.edu if (imm >= sizeof(destElem) * 8) { 32677639Sgblack@eecs.umich.edu destElem = 0; 32687639Sgblack@eecs.umich.edu } else { 32697639Sgblack@eecs.umich.edu destElem = (BigElement)srcElem1 << imm; 32707639Sgblack@eecs.umich.edu } 32717639Sgblack@eecs.umich.edu ''' 32727760SGiacomo.Gabrielli@arm.com twoRegLongShiftInst("vshll", "NVshll", "SimdShiftOp", smallTypes, vshllCode) 32737639Sgblack@eecs.umich.edu 32747639Sgblack@eecs.umich.edu vmovlCode = ''' 32757639Sgblack@eecs.umich.edu destElem = srcElem1; 32767639Sgblack@eecs.umich.edu ''' 32777760SGiacomo.Gabrielli@arm.com twoRegLongShiftInst("vmovl", "NVmovl", "SimdMiscOp", smallTypes, vmovlCode) 32787639Sgblack@eecs.umich.edu 32797639Sgblack@eecs.umich.edu vcvt2ufxCode = ''' 32807783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrExc; 32817639Sgblack@eecs.umich.edu if (flushToZero(srcElem1)) 32827639Sgblack@eecs.umich.edu fpscr.idc = 1; 32837639Sgblack@eecs.umich.edu VfpSavedState state = prepFpState(VfpRoundNearest); 32847639Sgblack@eecs.umich.edu __asm__ __volatile__("" : "=m" (srcElem1) : "m" (srcElem1)); 328510037SARM gem5 Developers destReg = vfpFpToFixed<float>(srcElem1, false, 32, imm); 32867639Sgblack@eecs.umich.edu __asm__ __volatile__("" :: "m" (destReg)); 32877639Sgblack@eecs.umich.edu finishVfp(fpscr, state, true); 32887783SGiacomo.Gabrielli@arm.com FpscrExc = fpscr; 32897639Sgblack@eecs.umich.edu ''' 32907760SGiacomo.Gabrielli@arm.com twoRegShiftInst("vcvt", "NVcvt2ufxD", "SimdCvtOp", ("float",), 32917639Sgblack@eecs.umich.edu 2, vcvt2ufxCode, toInt = True) 32927760SGiacomo.Gabrielli@arm.com twoRegShiftInst("vcvt", "NVcvt2ufxQ", "SimdCvtOp", ("float",), 32937639Sgblack@eecs.umich.edu 4, vcvt2ufxCode, toInt = True) 32947639Sgblack@eecs.umich.edu 32957639Sgblack@eecs.umich.edu vcvt2sfxCode = ''' 32967783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrExc; 32977639Sgblack@eecs.umich.edu if (flushToZero(srcElem1)) 32987639Sgblack@eecs.umich.edu fpscr.idc = 1; 32997639Sgblack@eecs.umich.edu VfpSavedState state = prepFpState(VfpRoundNearest); 33007639Sgblack@eecs.umich.edu __asm__ __volatile__("" : "=m" (srcElem1) : "m" (srcElem1)); 330110037SARM gem5 Developers destReg = vfpFpToFixed<float>(srcElem1, true, 32, imm); 33027639Sgblack@eecs.umich.edu __asm__ __volatile__("" :: "m" (destReg)); 33037639Sgblack@eecs.umich.edu finishVfp(fpscr, state, true); 33047783SGiacomo.Gabrielli@arm.com FpscrExc = fpscr; 33057639Sgblack@eecs.umich.edu ''' 33067760SGiacomo.Gabrielli@arm.com twoRegShiftInst("vcvt", "NVcvt2sfxD", "SimdCvtOp", ("float",), 33077639Sgblack@eecs.umich.edu 2, vcvt2sfxCode, toInt = True) 33087760SGiacomo.Gabrielli@arm.com twoRegShiftInst("vcvt", "NVcvt2sfxQ", "SimdCvtOp", ("float",), 33097639Sgblack@eecs.umich.edu 4, vcvt2sfxCode, toInt = True) 33107639Sgblack@eecs.umich.edu 33117639Sgblack@eecs.umich.edu vcvtu2fpCode = ''' 33127783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrExc; 33137639Sgblack@eecs.umich.edu VfpSavedState state = prepFpState(VfpRoundNearest); 33147639Sgblack@eecs.umich.edu __asm__ __volatile__("" : "=m" (srcReg1) : "m" (srcReg1)); 331510037SARM gem5 Developers destElem = vfpUFixedToFpS(true, true, srcReg1, 32, imm); 33167639Sgblack@eecs.umich.edu __asm__ __volatile__("" :: "m" (destElem)); 33177639Sgblack@eecs.umich.edu finishVfp(fpscr, state, true); 33187783SGiacomo.Gabrielli@arm.com FpscrExc = fpscr; 33197639Sgblack@eecs.umich.edu ''' 33207760SGiacomo.Gabrielli@arm.com twoRegShiftInst("vcvt", "NVcvtu2fpD", "SimdCvtOp", ("float",), 33217639Sgblack@eecs.umich.edu 2, vcvtu2fpCode, fromInt = True) 33227760SGiacomo.Gabrielli@arm.com twoRegShiftInst("vcvt", "NVcvtu2fpQ", "SimdCvtOp", ("float",), 33237639Sgblack@eecs.umich.edu 4, vcvtu2fpCode, fromInt = True) 33247639Sgblack@eecs.umich.edu 33257639Sgblack@eecs.umich.edu vcvts2fpCode = ''' 33267783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrExc; 33277639Sgblack@eecs.umich.edu VfpSavedState state = prepFpState(VfpRoundNearest); 33287639Sgblack@eecs.umich.edu __asm__ __volatile__("" : "=m" (srcReg1) : "m" (srcReg1)); 332910037SARM gem5 Developers destElem = vfpSFixedToFpS(true, true, srcReg1, 32, imm); 33307639Sgblack@eecs.umich.edu __asm__ __volatile__("" :: "m" (destElem)); 33317639Sgblack@eecs.umich.edu finishVfp(fpscr, state, true); 33327783SGiacomo.Gabrielli@arm.com FpscrExc = fpscr; 33337639Sgblack@eecs.umich.edu ''' 33347760SGiacomo.Gabrielli@arm.com twoRegShiftInst("vcvt", "NVcvts2fpD", "SimdCvtOp", ("float",), 33357639Sgblack@eecs.umich.edu 2, vcvts2fpCode, fromInt = True) 33367760SGiacomo.Gabrielli@arm.com twoRegShiftInst("vcvt", "NVcvts2fpQ", "SimdCvtOp", ("float",), 33377639Sgblack@eecs.umich.edu 4, vcvts2fpCode, fromInt = True) 33387639Sgblack@eecs.umich.edu 33397639Sgblack@eecs.umich.edu vcvts2hCode = ''' 33409557Sandreas.hansson@arm.com destElem = 0; 33417783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrExc; 33427639Sgblack@eecs.umich.edu float srcFp1 = bitsToFp(srcElem1, (float)0.0); 33437639Sgblack@eecs.umich.edu if (flushToZero(srcFp1)) 33447639Sgblack@eecs.umich.edu fpscr.idc = 1; 33457639Sgblack@eecs.umich.edu VfpSavedState state = prepFpState(VfpRoundNearest); 33467639Sgblack@eecs.umich.edu __asm__ __volatile__("" : "=m" (srcFp1), "=m" (destElem) 33477639Sgblack@eecs.umich.edu : "m" (srcFp1), "m" (destElem)); 33487639Sgblack@eecs.umich.edu destElem = vcvtFpSFpH(fpscr, true, true, VfpRoundNearest, 33497639Sgblack@eecs.umich.edu fpscr.ahp, srcFp1); 33507639Sgblack@eecs.umich.edu __asm__ __volatile__("" :: "m" (destElem)); 33517639Sgblack@eecs.umich.edu finishVfp(fpscr, state, true); 33527783SGiacomo.Gabrielli@arm.com FpscrExc = fpscr; 33537639Sgblack@eecs.umich.edu ''' 33547760SGiacomo.Gabrielli@arm.com twoRegNarrowMiscInst("vcvt", "NVcvts2h", "SimdCvtOp", ("uint16_t",), vcvts2hCode) 33557639Sgblack@eecs.umich.edu 33567639Sgblack@eecs.umich.edu vcvth2sCode = ''' 33579557Sandreas.hansson@arm.com destElem = 0; 33587783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrExc; 33597639Sgblack@eecs.umich.edu VfpSavedState state = prepFpState(VfpRoundNearest); 33607639Sgblack@eecs.umich.edu __asm__ __volatile__("" : "=m" (srcElem1), "=m" (destElem) 33617639Sgblack@eecs.umich.edu : "m" (srcElem1), "m" (destElem)); 33627639Sgblack@eecs.umich.edu destElem = fpToBits(vcvtFpHFpS(fpscr, true, fpscr.ahp, srcElem1)); 33637639Sgblack@eecs.umich.edu __asm__ __volatile__("" :: "m" (destElem)); 33647639Sgblack@eecs.umich.edu finishVfp(fpscr, state, true); 33657783SGiacomo.Gabrielli@arm.com FpscrExc = fpscr; 33667639Sgblack@eecs.umich.edu ''' 33677760SGiacomo.Gabrielli@arm.com twoRegLongMiscInst("vcvt", "NVcvth2s", "SimdCvtOp", ("uint16_t",), vcvth2sCode) 33687639Sgblack@eecs.umich.edu 33697639Sgblack@eecs.umich.edu vrsqrteCode = ''' 33707639Sgblack@eecs.umich.edu destElem = unsignedRSqrtEstimate(srcElem1); 33717639Sgblack@eecs.umich.edu ''' 33727760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vrsqrte", "NVrsqrteD", "SimdSqrtOp", ("uint32_t",), 2, vrsqrteCode) 33737760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vrsqrte", "NVrsqrteQ", "SimdSqrtOp", ("uint32_t",), 4, vrsqrteCode) 33747639Sgblack@eecs.umich.edu 33757639Sgblack@eecs.umich.edu vrsqrtefpCode = ''' 33767783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrExc; 33777639Sgblack@eecs.umich.edu if (flushToZero(srcReg1)) 33787639Sgblack@eecs.umich.edu fpscr.idc = 1; 33797639Sgblack@eecs.umich.edu destReg = fprSqrtEstimate(fpscr, srcReg1); 33807783SGiacomo.Gabrielli@arm.com FpscrExc = fpscr; 33817639Sgblack@eecs.umich.edu ''' 33827760SGiacomo.Gabrielli@arm.com twoRegMiscInstFp("vrsqrte", "NVrsqrteDFp", "SimdFloatSqrtOp", ("float",), 2, vrsqrtefpCode) 33837760SGiacomo.Gabrielli@arm.com twoRegMiscInstFp("vrsqrte", "NVrsqrteQFp", "SimdFloatSqrtOp", ("float",), 4, vrsqrtefpCode) 33847639Sgblack@eecs.umich.edu 33857639Sgblack@eecs.umich.edu vrecpeCode = ''' 33867639Sgblack@eecs.umich.edu destElem = unsignedRecipEstimate(srcElem1); 33877639Sgblack@eecs.umich.edu ''' 33887760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vrecpe", "NVrecpeD", "SimdMultAccOp", ("uint32_t",), 2, vrecpeCode) 33897760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vrecpe", "NVrecpeQ", "SimdMultAccOp", ("uint32_t",), 4, vrecpeCode) 33907639Sgblack@eecs.umich.edu 33917639Sgblack@eecs.umich.edu vrecpefpCode = ''' 33927783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrExc; 33937639Sgblack@eecs.umich.edu if (flushToZero(srcReg1)) 33947639Sgblack@eecs.umich.edu fpscr.idc = 1; 33957639Sgblack@eecs.umich.edu destReg = fpRecipEstimate(fpscr, srcReg1); 33967783SGiacomo.Gabrielli@arm.com FpscrExc = fpscr; 33977639Sgblack@eecs.umich.edu ''' 33987760SGiacomo.Gabrielli@arm.com twoRegMiscInstFp("vrecpe", "NVrecpeDFp", "SimdFloatMultAccOp", ("float",), 2, vrecpefpCode) 33997760SGiacomo.Gabrielli@arm.com twoRegMiscInstFp("vrecpe", "NVrecpeQFp", "SimdFloatMultAccOp", ("float",), 4, vrecpefpCode) 34007639Sgblack@eecs.umich.edu 34017639Sgblack@eecs.umich.edu vrev16Code = ''' 34027639Sgblack@eecs.umich.edu destElem = srcElem1; 34037639Sgblack@eecs.umich.edu unsigned groupSize = ((1 << 1) / sizeof(Element)); 34047639Sgblack@eecs.umich.edu unsigned reverseMask = (groupSize - 1); 34057639Sgblack@eecs.umich.edu j = i ^ reverseMask; 34067639Sgblack@eecs.umich.edu ''' 34077760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vrev16", "NVrev16D", "SimdAluOp", ("uint8_t",), 2, vrev16Code) 34087760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vrev16", "NVrev16Q", "SimdAluOp", ("uint8_t",), 4, vrev16Code) 34097639Sgblack@eecs.umich.edu vrev32Code = ''' 34107639Sgblack@eecs.umich.edu destElem = srcElem1; 34117639Sgblack@eecs.umich.edu unsigned groupSize = ((1 << 2) / sizeof(Element)); 34127639Sgblack@eecs.umich.edu unsigned reverseMask = (groupSize - 1); 34137639Sgblack@eecs.umich.edu j = i ^ reverseMask; 34147639Sgblack@eecs.umich.edu ''' 34157639Sgblack@eecs.umich.edu twoRegMiscInst("vrev32", "NVrev32D", 34167760SGiacomo.Gabrielli@arm.com "SimdAluOp", ("uint8_t", "uint16_t"), 2, vrev32Code) 34177639Sgblack@eecs.umich.edu twoRegMiscInst("vrev32", "NVrev32Q", 34187760SGiacomo.Gabrielli@arm.com "SimdAluOp", ("uint8_t", "uint16_t"), 4, vrev32Code) 34197639Sgblack@eecs.umich.edu vrev64Code = ''' 34207639Sgblack@eecs.umich.edu destElem = srcElem1; 34217639Sgblack@eecs.umich.edu unsigned groupSize = ((1 << 3) / sizeof(Element)); 34227639Sgblack@eecs.umich.edu unsigned reverseMask = (groupSize - 1); 34237639Sgblack@eecs.umich.edu j = i ^ reverseMask; 34247639Sgblack@eecs.umich.edu ''' 34257760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vrev64", "NVrev64D", "SimdAluOp", smallUnsignedTypes, 2, vrev64Code) 34267760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vrev64", "NVrev64Q", "SimdAluOp", smallUnsignedTypes, 4, vrev64Code) 34277639Sgblack@eecs.umich.edu 342810197SCurtis.Dunham@arm.com split('exec') 342910197SCurtis.Dunham@arm.com exec_output += vcompares + vcomparesL 343010197SCurtis.Dunham@arm.com 34317639Sgblack@eecs.umich.edu vpaddlCode = ''' 34327639Sgblack@eecs.umich.edu destElem = (BigElement)srcElem1 + (BigElement)srcElem2; 34337639Sgblack@eecs.umich.edu ''' 34347760SGiacomo.Gabrielli@arm.com twoRegCondenseInst("vpaddl", "NVpaddlD", "SimdAddOp", smallTypes, 2, vpaddlCode) 34357760SGiacomo.Gabrielli@arm.com twoRegCondenseInst("vpaddl", "NVpaddlQ", "SimdAddOp", smallTypes, 4, vpaddlCode) 34367639Sgblack@eecs.umich.edu 34377639Sgblack@eecs.umich.edu vpadalCode = ''' 34387639Sgblack@eecs.umich.edu destElem += (BigElement)srcElem1 + (BigElement)srcElem2; 34397639Sgblack@eecs.umich.edu ''' 34407760SGiacomo.Gabrielli@arm.com twoRegCondenseInst("vpadal", "NVpadalD", "SimdAddAccOp", smallTypes, 2, vpadalCode, True) 34417760SGiacomo.Gabrielli@arm.com twoRegCondenseInst("vpadal", "NVpadalQ", "SimdAddAccOp", smallTypes, 4, vpadalCode, True) 34427639Sgblack@eecs.umich.edu 34437639Sgblack@eecs.umich.edu vclsCode = ''' 34447639Sgblack@eecs.umich.edu unsigned count = 0; 34457639Sgblack@eecs.umich.edu if (srcElem1 < 0) { 34467639Sgblack@eecs.umich.edu srcElem1 <<= 1; 34477639Sgblack@eecs.umich.edu while (srcElem1 < 0 && count < sizeof(Element) * 8 - 1) { 34487639Sgblack@eecs.umich.edu count++; 34497639Sgblack@eecs.umich.edu srcElem1 <<= 1; 34507639Sgblack@eecs.umich.edu } 34517639Sgblack@eecs.umich.edu } else { 34527639Sgblack@eecs.umich.edu srcElem1 <<= 1; 34537639Sgblack@eecs.umich.edu while (srcElem1 >= 0 && count < sizeof(Element) * 8 - 1) { 34547639Sgblack@eecs.umich.edu count++; 34557639Sgblack@eecs.umich.edu srcElem1 <<= 1; 34567639Sgblack@eecs.umich.edu } 34577639Sgblack@eecs.umich.edu } 34587639Sgblack@eecs.umich.edu destElem = count; 34597639Sgblack@eecs.umich.edu ''' 34607760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vcls", "NVclsD", "SimdAluOp", signedTypes, 2, vclsCode) 34617760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vcls", "NVclsQ", "SimdAluOp", signedTypes, 4, vclsCode) 34627639Sgblack@eecs.umich.edu 34637639Sgblack@eecs.umich.edu vclzCode = ''' 34647639Sgblack@eecs.umich.edu unsigned count = 0; 34657639Sgblack@eecs.umich.edu while (srcElem1 >= 0 && count < sizeof(Element) * 8) { 34667639Sgblack@eecs.umich.edu count++; 34677639Sgblack@eecs.umich.edu srcElem1 <<= 1; 34687639Sgblack@eecs.umich.edu } 34697639Sgblack@eecs.umich.edu destElem = count; 34707639Sgblack@eecs.umich.edu ''' 34717760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vclz", "NVclzD", "SimdAluOp", signedTypes, 2, vclzCode) 34727760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vclz", "NVclzQ", "SimdAluOp", signedTypes, 4, vclzCode) 34737639Sgblack@eecs.umich.edu 34747639Sgblack@eecs.umich.edu vcntCode = ''' 34757639Sgblack@eecs.umich.edu unsigned count = 0; 34767639Sgblack@eecs.umich.edu while (srcElem1 && count < sizeof(Element) * 8) { 34777639Sgblack@eecs.umich.edu count += srcElem1 & 0x1; 34787639Sgblack@eecs.umich.edu srcElem1 >>= 1; 34797639Sgblack@eecs.umich.edu } 34807639Sgblack@eecs.umich.edu destElem = count; 34817639Sgblack@eecs.umich.edu ''' 34827760SGiacomo.Gabrielli@arm.com 34837760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vcnt", "NVcntD", "SimdAluOp", unsignedTypes, 2, vcntCode) 34847760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vcnt", "NVcntQ", "SimdAluOp", unsignedTypes, 4, vcntCode) 34857639Sgblack@eecs.umich.edu 34867639Sgblack@eecs.umich.edu vmvnCode = ''' 34877639Sgblack@eecs.umich.edu destElem = ~srcElem1; 34887639Sgblack@eecs.umich.edu ''' 34897760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vmvn", "NVmvnD", "SimdAluOp", ("uint64_t",), 2, vmvnCode) 34907760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vmvn", "NVmvnQ", "SimdAluOp", ("uint64_t",), 4, vmvnCode) 34917639Sgblack@eecs.umich.edu 34927639Sgblack@eecs.umich.edu vqabsCode = ''' 34937783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrQc; 349412038Srekai.gonzalezalberquilla@arm.com if (srcElem1 == (Element)(std::numeric_limits<Element>::min())) { 34957639Sgblack@eecs.umich.edu fpscr.qc = 1; 34967639Sgblack@eecs.umich.edu destElem = ~srcElem1; 34977639Sgblack@eecs.umich.edu } else if (srcElem1 < 0) { 34987639Sgblack@eecs.umich.edu destElem = -srcElem1; 34997639Sgblack@eecs.umich.edu } else { 35007639Sgblack@eecs.umich.edu destElem = srcElem1; 35017639Sgblack@eecs.umich.edu } 35027783SGiacomo.Gabrielli@arm.com FpscrQc = fpscr; 35037639Sgblack@eecs.umich.edu ''' 35047760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vqabs", "NVqabsD", "SimdAluOp", signedTypes, 2, vqabsCode) 35057760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vqabs", "NVqabsQ", "SimdAluOp", signedTypes, 4, vqabsCode) 35067639Sgblack@eecs.umich.edu 35077639Sgblack@eecs.umich.edu vqnegCode = ''' 35087783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrQc; 350912038Srekai.gonzalezalberquilla@arm.com if (srcElem1 == (Element)(std::numeric_limits<Element>::min())) { 35107639Sgblack@eecs.umich.edu fpscr.qc = 1; 35117639Sgblack@eecs.umich.edu destElem = ~srcElem1; 35127639Sgblack@eecs.umich.edu } else { 35137639Sgblack@eecs.umich.edu destElem = -srcElem1; 35147639Sgblack@eecs.umich.edu } 35157783SGiacomo.Gabrielli@arm.com FpscrQc = fpscr; 35167639Sgblack@eecs.umich.edu ''' 35177760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vqneg", "NVqnegD", "SimdAluOp", signedTypes, 2, vqnegCode) 35187760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vqneg", "NVqnegQ", "SimdAluOp", signedTypes, 4, vqnegCode) 35197639Sgblack@eecs.umich.edu 35207639Sgblack@eecs.umich.edu vabsCode = ''' 35217639Sgblack@eecs.umich.edu if (srcElem1 < 0) { 35227639Sgblack@eecs.umich.edu destElem = -srcElem1; 35237639Sgblack@eecs.umich.edu } else { 35247639Sgblack@eecs.umich.edu destElem = srcElem1; 35257639Sgblack@eecs.umich.edu } 35267639Sgblack@eecs.umich.edu ''' 35277760SGiacomo.Gabrielli@arm.com 35287760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vabs", "NVabsD", "SimdAluOp", signedTypes, 2, vabsCode) 35297760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vabs", "NVabsQ", "SimdAluOp", signedTypes, 4, vabsCode) 35307639Sgblack@eecs.umich.edu vabsfpCode = ''' 35317639Sgblack@eecs.umich.edu union 35327639Sgblack@eecs.umich.edu { 35337639Sgblack@eecs.umich.edu uint32_t i; 35347639Sgblack@eecs.umich.edu float f; 35357639Sgblack@eecs.umich.edu } cStruct; 35367639Sgblack@eecs.umich.edu cStruct.f = srcReg1; 35377639Sgblack@eecs.umich.edu cStruct.i &= mask(sizeof(Element) * 8 - 1); 35387639Sgblack@eecs.umich.edu destReg = cStruct.f; 35397639Sgblack@eecs.umich.edu ''' 35407760SGiacomo.Gabrielli@arm.com twoRegMiscInstFp("vabs", "NVabsDFp", "SimdFloatAluOp", ("float",), 2, vabsfpCode) 35417760SGiacomo.Gabrielli@arm.com twoRegMiscInstFp("vabs", "NVabsQFp", "SimdFloatAluOp", ("float",), 4, vabsfpCode) 35427639Sgblack@eecs.umich.edu 35437639Sgblack@eecs.umich.edu vnegCode = ''' 35447639Sgblack@eecs.umich.edu destElem = -srcElem1; 35457639Sgblack@eecs.umich.edu ''' 35467760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vneg", "NVnegD", "SimdAluOp", signedTypes, 2, vnegCode) 35477760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vneg", "NVnegQ", "SimdAluOp", signedTypes, 4, vnegCode) 35487639Sgblack@eecs.umich.edu vnegfpCode = ''' 35497639Sgblack@eecs.umich.edu destReg = -srcReg1; 35507639Sgblack@eecs.umich.edu ''' 35517760SGiacomo.Gabrielli@arm.com twoRegMiscInstFp("vneg", "NVnegDFp", "SimdFloatAluOp", ("float",), 2, vnegfpCode) 35527760SGiacomo.Gabrielli@arm.com twoRegMiscInstFp("vneg", "NVnegQFp", "SimdFloatAluOp", ("float",), 4, vnegfpCode) 35537639Sgblack@eecs.umich.edu 35547639Sgblack@eecs.umich.edu vcgtCode = 'destElem = (srcElem1 > 0) ? mask(sizeof(Element) * 8) : 0;' 35557760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vcgt", "NVcgtD", "SimdCmpOp", signedTypes, 2, vcgtCode) 35567760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vcgt", "NVcgtQ", "SimdCmpOp", signedTypes, 4, vcgtCode) 35577639Sgblack@eecs.umich.edu vcgtfpCode = ''' 35587783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrExc; 355913544Sgabeblack@google.com float res = binaryOp(fpscr, srcReg1, (float)0.0, vcgtFunc, 35607639Sgblack@eecs.umich.edu true, true, VfpRoundNearest); 35617639Sgblack@eecs.umich.edu destReg = (res == 0) ? -1 : 0; 35627639Sgblack@eecs.umich.edu if (res == 2.0) 35637639Sgblack@eecs.umich.edu fpscr.ioc = 1; 35647783SGiacomo.Gabrielli@arm.com FpscrExc = fpscr; 35657639Sgblack@eecs.umich.edu ''' 35667760SGiacomo.Gabrielli@arm.com twoRegMiscInstFp("vcgt", "NVcgtDFp", "SimdFloatCmpOp", ("float",), 35677639Sgblack@eecs.umich.edu 2, vcgtfpCode, toInt = True) 35687760SGiacomo.Gabrielli@arm.com twoRegMiscInstFp("vcgt", "NVcgtQFp", "SimdFloatCmpOp", ("float",), 35697639Sgblack@eecs.umich.edu 4, vcgtfpCode, toInt = True) 35707639Sgblack@eecs.umich.edu 35717639Sgblack@eecs.umich.edu vcgeCode = 'destElem = (srcElem1 >= 0) ? mask(sizeof(Element) * 8) : 0;' 35727760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vcge", "NVcgeD", "SimdCmpOp", signedTypes, 2, vcgeCode) 35737760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vcge", "NVcgeQ", "SimdCmpOp", signedTypes, 4, vcgeCode) 35747639Sgblack@eecs.umich.edu vcgefpCode = ''' 35757783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrExc; 357613544Sgabeblack@google.com float res = binaryOp(fpscr, srcReg1, (float)0.0, vcgeFunc, 35777639Sgblack@eecs.umich.edu true, true, VfpRoundNearest); 35787639Sgblack@eecs.umich.edu destReg = (res == 0) ? -1 : 0; 35797639Sgblack@eecs.umich.edu if (res == 2.0) 35807639Sgblack@eecs.umich.edu fpscr.ioc = 1; 35817783SGiacomo.Gabrielli@arm.com FpscrExc = fpscr; 35827639Sgblack@eecs.umich.edu ''' 35837760SGiacomo.Gabrielli@arm.com twoRegMiscInstFp("vcge", "NVcgeDFp", "SimdFloatCmpOp", ("float",), 35847639Sgblack@eecs.umich.edu 2, vcgefpCode, toInt = True) 35857760SGiacomo.Gabrielli@arm.com twoRegMiscInstFp("vcge", "NVcgeQFp", "SimdFloatCmpOp", ("float",), 35867639Sgblack@eecs.umich.edu 4, vcgefpCode, toInt = True) 35877639Sgblack@eecs.umich.edu 35887639Sgblack@eecs.umich.edu vceqCode = 'destElem = (srcElem1 == 0) ? mask(sizeof(Element) * 8) : 0;' 35897760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vceq", "NVceqD", "SimdCmpOp", signedTypes, 2, vceqCode) 35907760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vceq", "NVceqQ", "SimdCmpOp", signedTypes, 4, vceqCode) 35917639Sgblack@eecs.umich.edu vceqfpCode = ''' 35927783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrExc; 359313544Sgabeblack@google.com float res = binaryOp(fpscr, srcReg1, (float)0.0, vceqFunc, 35947639Sgblack@eecs.umich.edu true, true, VfpRoundNearest); 35957639Sgblack@eecs.umich.edu destReg = (res == 0) ? -1 : 0; 35967639Sgblack@eecs.umich.edu if (res == 2.0) 35977639Sgblack@eecs.umich.edu fpscr.ioc = 1; 35987783SGiacomo.Gabrielli@arm.com FpscrExc = fpscr; 35997639Sgblack@eecs.umich.edu ''' 36007760SGiacomo.Gabrielli@arm.com twoRegMiscInstFp("vceq", "NVceqDFp", "SimdFloatCmpOp", ("float",), 36017639Sgblack@eecs.umich.edu 2, vceqfpCode, toInt = True) 36027760SGiacomo.Gabrielli@arm.com twoRegMiscInstFp("vceq", "NVceqQFp", "SimdFloatCmpOp", ("float",), 36037639Sgblack@eecs.umich.edu 4, vceqfpCode, toInt = True) 36047639Sgblack@eecs.umich.edu 36057639Sgblack@eecs.umich.edu vcleCode = 'destElem = (srcElem1 <= 0) ? mask(sizeof(Element) * 8) : 0;' 36067760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vcle", "NVcleD", "SimdCmpOp", signedTypes, 2, vcleCode) 36077760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vcle", "NVcleQ", "SimdCmpOp", signedTypes, 4, vcleCode) 36087639Sgblack@eecs.umich.edu vclefpCode = ''' 36097783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrExc; 361013544Sgabeblack@google.com float res = binaryOp(fpscr, srcReg1, (float)0.0, vcleFunc, 36117639Sgblack@eecs.umich.edu true, true, VfpRoundNearest); 36127639Sgblack@eecs.umich.edu destReg = (res == 0) ? -1 : 0; 36137639Sgblack@eecs.umich.edu if (res == 2.0) 36147639Sgblack@eecs.umich.edu fpscr.ioc = 1; 36157783SGiacomo.Gabrielli@arm.com FpscrExc = fpscr; 36167639Sgblack@eecs.umich.edu ''' 36177760SGiacomo.Gabrielli@arm.com twoRegMiscInstFp("vcle", "NVcleDFp", "SimdFloatCmpOp", ("float",), 36187639Sgblack@eecs.umich.edu 2, vclefpCode, toInt = True) 36197760SGiacomo.Gabrielli@arm.com twoRegMiscInstFp("vcle", "NVcleQFp", "SimdFloatCmpOp", ("float",), 36207639Sgblack@eecs.umich.edu 4, vclefpCode, toInt = True) 36217639Sgblack@eecs.umich.edu 36227639Sgblack@eecs.umich.edu vcltCode = 'destElem = (srcElem1 < 0) ? mask(sizeof(Element) * 8) : 0;' 36237760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vclt", "NVcltD", "SimdCmpOp", signedTypes, 2, vcltCode) 36247760SGiacomo.Gabrielli@arm.com twoRegMiscInst("vclt", "NVcltQ", "SimdCmpOp", signedTypes, 4, vcltCode) 36257639Sgblack@eecs.umich.edu vcltfpCode = ''' 36267783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrExc; 362713544Sgabeblack@google.com float res = binaryOp(fpscr, srcReg1, (float)0.0, vcltFunc, 36287639Sgblack@eecs.umich.edu true, true, VfpRoundNearest); 36297639Sgblack@eecs.umich.edu destReg = (res == 0) ? -1 : 0; 36307639Sgblack@eecs.umich.edu if (res == 2.0) 36317639Sgblack@eecs.umich.edu fpscr.ioc = 1; 36327783SGiacomo.Gabrielli@arm.com FpscrExc = fpscr; 36337639Sgblack@eecs.umich.edu ''' 36347760SGiacomo.Gabrielli@arm.com twoRegMiscInstFp("vclt", "NVcltDFp", "SimdFloatCmpOp", ("float",), 36357639Sgblack@eecs.umich.edu 2, vcltfpCode, toInt = True) 36367760SGiacomo.Gabrielli@arm.com twoRegMiscInstFp("vclt", "NVcltQFp", "SimdFloatCmpOp", ("float",), 36377639Sgblack@eecs.umich.edu 4, vcltfpCode, toInt = True) 36387639Sgblack@eecs.umich.edu 36397639Sgblack@eecs.umich.edu vswpCode = ''' 364013544Sgabeblack@google.com uint32_t mid; 36417639Sgblack@eecs.umich.edu for (unsigned r = 0; r < rCount; r++) { 36427639Sgblack@eecs.umich.edu mid = srcReg1.regs[r]; 36437639Sgblack@eecs.umich.edu srcReg1.regs[r] = destReg.regs[r]; 36447639Sgblack@eecs.umich.edu destReg.regs[r] = mid; 36457639Sgblack@eecs.umich.edu } 36467639Sgblack@eecs.umich.edu ''' 36477760SGiacomo.Gabrielli@arm.com twoRegMiscScramble("vswp", "NVswpD", "SimdAluOp", ("uint64_t",), 2, vswpCode) 36487760SGiacomo.Gabrielli@arm.com twoRegMiscScramble("vswp", "NVswpQ", "SimdAluOp", ("uint64_t",), 4, vswpCode) 36497639Sgblack@eecs.umich.edu 36507639Sgblack@eecs.umich.edu vtrnCode = ''' 36517639Sgblack@eecs.umich.edu Element mid; 36527639Sgblack@eecs.umich.edu for (unsigned i = 0; i < eCount; i += 2) { 36537639Sgblack@eecs.umich.edu mid = srcReg1.elements[i]; 36547639Sgblack@eecs.umich.edu srcReg1.elements[i] = destReg.elements[i + 1]; 36557639Sgblack@eecs.umich.edu destReg.elements[i + 1] = mid; 36567639Sgblack@eecs.umich.edu } 36577639Sgblack@eecs.umich.edu ''' 36588607Sgblack@eecs.umich.edu twoRegMiscScramble("vtrn", "NVtrnD", "SimdAluOp", 36598607Sgblack@eecs.umich.edu smallUnsignedTypes, 2, vtrnCode) 36608607Sgblack@eecs.umich.edu twoRegMiscScramble("vtrn", "NVtrnQ", "SimdAluOp", 36618607Sgblack@eecs.umich.edu smallUnsignedTypes, 4, vtrnCode) 36627639Sgblack@eecs.umich.edu 36637639Sgblack@eecs.umich.edu vuzpCode = ''' 36647639Sgblack@eecs.umich.edu Element mid[eCount]; 36657639Sgblack@eecs.umich.edu memcpy(&mid, &srcReg1, sizeof(srcReg1)); 36667639Sgblack@eecs.umich.edu for (unsigned i = 0; i < eCount / 2; i++) { 36677639Sgblack@eecs.umich.edu srcReg1.elements[i] = destReg.elements[2 * i + 1]; 36687639Sgblack@eecs.umich.edu srcReg1.elements[eCount / 2 + i] = mid[2 * i + 1]; 36697639Sgblack@eecs.umich.edu destReg.elements[i] = destReg.elements[2 * i]; 36707639Sgblack@eecs.umich.edu } 36717639Sgblack@eecs.umich.edu for (unsigned i = 0; i < eCount / 2; i++) { 36727639Sgblack@eecs.umich.edu destReg.elements[eCount / 2 + i] = mid[2 * i]; 36737639Sgblack@eecs.umich.edu } 36747639Sgblack@eecs.umich.edu ''' 36757760SGiacomo.Gabrielli@arm.com twoRegMiscScramble("vuzp", "NVuzpD", "SimdAluOp", unsignedTypes, 2, vuzpCode) 36767760SGiacomo.Gabrielli@arm.com twoRegMiscScramble("vuzp", "NVuzpQ", "SimdAluOp", unsignedTypes, 4, vuzpCode) 36777639Sgblack@eecs.umich.edu 36787639Sgblack@eecs.umich.edu vzipCode = ''' 36797639Sgblack@eecs.umich.edu Element mid[eCount]; 36807639Sgblack@eecs.umich.edu memcpy(&mid, &destReg, sizeof(destReg)); 36817639Sgblack@eecs.umich.edu for (unsigned i = 0; i < eCount / 2; i++) { 36827639Sgblack@eecs.umich.edu destReg.elements[2 * i] = mid[i]; 36837639Sgblack@eecs.umich.edu destReg.elements[2 * i + 1] = srcReg1.elements[i]; 36847639Sgblack@eecs.umich.edu } 36857639Sgblack@eecs.umich.edu for (int i = 0; i < eCount / 2; i++) { 36867639Sgblack@eecs.umich.edu srcReg1.elements[2 * i] = mid[eCount / 2 + i]; 36877639Sgblack@eecs.umich.edu srcReg1.elements[2 * i + 1] = srcReg1.elements[eCount / 2 + i]; 36887639Sgblack@eecs.umich.edu } 36897639Sgblack@eecs.umich.edu ''' 36907760SGiacomo.Gabrielli@arm.com twoRegMiscScramble("vzip", "NVzipD", "SimdAluOp", unsignedTypes, 2, vzipCode) 36917760SGiacomo.Gabrielli@arm.com twoRegMiscScramble("vzip", "NVzipQ", "SimdAluOp", unsignedTypes, 4, vzipCode) 36927639Sgblack@eecs.umich.edu 36937639Sgblack@eecs.umich.edu vmovnCode = 'destElem = srcElem1;' 36947760SGiacomo.Gabrielli@arm.com twoRegNarrowMiscInst("vmovn", "NVmovn", "SimdMiscOp", smallUnsignedTypes, vmovnCode) 36957639Sgblack@eecs.umich.edu 36967639Sgblack@eecs.umich.edu vdupCode = 'destElem = srcElem1;' 36977760SGiacomo.Gabrielli@arm.com twoRegMiscScInst("vdup", "NVdupD", "SimdAluOp", smallUnsignedTypes, 2, vdupCode) 36987760SGiacomo.Gabrielli@arm.com twoRegMiscScInst("vdup", "NVdupQ", "SimdAluOp", smallUnsignedTypes, 4, vdupCode) 36997639Sgblack@eecs.umich.edu 37007760SGiacomo.Gabrielli@arm.com def vdupGprInst(name, Name, opClass, types, rCount): 37017639Sgblack@eecs.umich.edu global header_output, exec_output 370210829Sandreas.hansson@arm.com eWalkCode = simdEnabledCheckCode + ''' 37037639Sgblack@eecs.umich.edu RegVect destReg; 37047639Sgblack@eecs.umich.edu for (unsigned i = 0; i < eCount; i++) { 37057639Sgblack@eecs.umich.edu destReg.elements[i] = htog((Element)Op1); 37067639Sgblack@eecs.umich.edu } 37077639Sgblack@eecs.umich.edu ''' 37087639Sgblack@eecs.umich.edu for reg in range(rCount): 37097639Sgblack@eecs.umich.edu eWalkCode += ''' 37108588Sgblack@eecs.umich.edu FpDestP%(reg)d_uw = gtoh(destReg.regs[%(reg)d]); 37117639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 37127639Sgblack@eecs.umich.edu iop = InstObjParams(name, Name, 37137639Sgblack@eecs.umich.edu "RegRegOp", 37147639Sgblack@eecs.umich.edu { "code": eWalkCode, 37157639Sgblack@eecs.umich.edu "r_count": rCount, 37167760SGiacomo.Gabrielli@arm.com "predicate_test": predicateTest, 37177760SGiacomo.Gabrielli@arm.com "op_class": opClass }, []) 37187639Sgblack@eecs.umich.edu header_output += NeonRegRegOpDeclare.subst(iop) 37197639Sgblack@eecs.umich.edu exec_output += NeonEqualRegExecute.subst(iop) 37207639Sgblack@eecs.umich.edu for type in types: 37217639Sgblack@eecs.umich.edu substDict = { "targs" : type, 37227639Sgblack@eecs.umich.edu "class_name" : Name } 37237639Sgblack@eecs.umich.edu exec_output += NeonExecDeclare.subst(substDict) 37248206SWilliam.Wang@arm.com vdupGprInst("vdup", "NVdupDGpr", "SimdMiscOp", smallUnsignedTypes, 2) 37258206SWilliam.Wang@arm.com vdupGprInst("vdup", "NVdupQGpr", "SimdMiscOp", smallUnsignedTypes, 4) 37267639Sgblack@eecs.umich.edu 37277639Sgblack@eecs.umich.edu vmovCode = 'destElem = imm;' 37287760SGiacomo.Gabrielli@arm.com oneRegImmInst("vmov", "NVmoviD", "SimdMiscOp", ("uint64_t",), 2, vmovCode) 37297760SGiacomo.Gabrielli@arm.com oneRegImmInst("vmov", "NVmoviQ", "SimdMiscOp", ("uint64_t",), 4, vmovCode) 37307639Sgblack@eecs.umich.edu 37317639Sgblack@eecs.umich.edu vorrCode = 'destElem |= imm;' 37327760SGiacomo.Gabrielli@arm.com oneRegImmInst("vorr", "NVorriD", "SimdAluOp", ("uint64_t",), 2, vorrCode, True) 37337760SGiacomo.Gabrielli@arm.com oneRegImmInst("vorr", "NVorriQ", "SimdAluOp", ("uint64_t",), 4, vorrCode, True) 37347639Sgblack@eecs.umich.edu 37357639Sgblack@eecs.umich.edu vmvnCode = 'destElem = ~imm;' 37367760SGiacomo.Gabrielli@arm.com oneRegImmInst("vmvn", "NVmvniD", "SimdAluOp", ("uint64_t",), 2, vmvnCode) 37377760SGiacomo.Gabrielli@arm.com oneRegImmInst("vmvn", "NVmvniQ", "SimdAluOp", ("uint64_t",), 4, vmvnCode) 37387639Sgblack@eecs.umich.edu 37397639Sgblack@eecs.umich.edu vbicCode = 'destElem &= ~imm;' 37407760SGiacomo.Gabrielli@arm.com oneRegImmInst("vbic", "NVbiciD", "SimdAluOp", ("uint64_t",), 2, vbicCode, True) 37417760SGiacomo.Gabrielli@arm.com oneRegImmInst("vbic", "NVbiciQ", "SimdAluOp", ("uint64_t",), 4, vbicCode, True) 37427639Sgblack@eecs.umich.edu 37437639Sgblack@eecs.umich.edu vqmovnCode = ''' 37447783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrQc; 37457639Sgblack@eecs.umich.edu destElem = srcElem1; 37467639Sgblack@eecs.umich.edu if ((BigElement)destElem != srcElem1) { 37477639Sgblack@eecs.umich.edu fpscr.qc = 1; 37487639Sgblack@eecs.umich.edu destElem = mask(sizeof(Element) * 8 - 1); 37497639Sgblack@eecs.umich.edu if (srcElem1 < 0) 37507639Sgblack@eecs.umich.edu destElem = ~destElem; 37517639Sgblack@eecs.umich.edu } 37527783SGiacomo.Gabrielli@arm.com FpscrQc = fpscr; 37537639Sgblack@eecs.umich.edu ''' 37547760SGiacomo.Gabrielli@arm.com twoRegNarrowMiscInst("vqmovn", "NVqmovn", "SimdMiscOp", smallSignedTypes, vqmovnCode) 37557639Sgblack@eecs.umich.edu 37567639Sgblack@eecs.umich.edu vqmovunCode = ''' 37577783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrQc; 37587639Sgblack@eecs.umich.edu destElem = srcElem1; 37597639Sgblack@eecs.umich.edu if ((BigElement)destElem != srcElem1) { 37607639Sgblack@eecs.umich.edu fpscr.qc = 1; 37617639Sgblack@eecs.umich.edu destElem = mask(sizeof(Element) * 8); 37627639Sgblack@eecs.umich.edu } 37637783SGiacomo.Gabrielli@arm.com FpscrQc = fpscr; 37647639Sgblack@eecs.umich.edu ''' 37657639Sgblack@eecs.umich.edu twoRegNarrowMiscInst("vqmovun", "NVqmovun", 37667760SGiacomo.Gabrielli@arm.com "SimdMiscOp", smallUnsignedTypes, vqmovunCode) 37677639Sgblack@eecs.umich.edu 37687639Sgblack@eecs.umich.edu vqmovunsCode = ''' 37697783SGiacomo.Gabrielli@arm.com FPSCR fpscr = (FPSCR) FpscrQc; 37707639Sgblack@eecs.umich.edu destElem = srcElem1; 37717639Sgblack@eecs.umich.edu if (srcElem1 < 0 || 37727639Sgblack@eecs.umich.edu ((BigElement)destElem & mask(sizeof(Element) * 8)) != srcElem1) { 37737639Sgblack@eecs.umich.edu fpscr.qc = 1; 37747639Sgblack@eecs.umich.edu destElem = mask(sizeof(Element) * 8); 37757639Sgblack@eecs.umich.edu if (srcElem1 < 0) 37767639Sgblack@eecs.umich.edu destElem = ~destElem; 37777639Sgblack@eecs.umich.edu } 37787783SGiacomo.Gabrielli@arm.com FpscrQc = fpscr; 37797639Sgblack@eecs.umich.edu ''' 37807639Sgblack@eecs.umich.edu twoRegNarrowMiscInst("vqmovun", "NVqmovuns", 37817760SGiacomo.Gabrielli@arm.com "SimdMiscOp", smallSignedTypes, vqmovunsCode) 37827639Sgblack@eecs.umich.edu 37837760SGiacomo.Gabrielli@arm.com def buildVext(name, Name, opClass, types, rCount, op): 37847639Sgblack@eecs.umich.edu global header_output, exec_output 378510829Sandreas.hansson@arm.com eWalkCode = simdEnabledCheckCode + ''' 37867639Sgblack@eecs.umich.edu RegVect srcReg1, srcReg2, destReg; 37877639Sgblack@eecs.umich.edu ''' 37887639Sgblack@eecs.umich.edu for reg in range(rCount): 378910829Sandreas.hansson@arm.com eWalkCode += ''' 37908588Sgblack@eecs.umich.edu srcReg1.regs[%(reg)d] = htog(FpOp1P%(reg)d_uw); 37918588Sgblack@eecs.umich.edu srcReg2.regs[%(reg)d] = htog(FpOp2P%(reg)d_uw); 37927639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 37937639Sgblack@eecs.umich.edu eWalkCode += op 37947639Sgblack@eecs.umich.edu for reg in range(rCount): 37957639Sgblack@eecs.umich.edu eWalkCode += ''' 37968588Sgblack@eecs.umich.edu FpDestP%(reg)d_uw = gtoh(destReg.regs[%(reg)d]); 37977639Sgblack@eecs.umich.edu ''' % { "reg" : reg } 37987639Sgblack@eecs.umich.edu iop = InstObjParams(name, Name, 37997639Sgblack@eecs.umich.edu "RegRegRegImmOp", 38007639Sgblack@eecs.umich.edu { "code": eWalkCode, 38017639Sgblack@eecs.umich.edu "r_count": rCount, 38027760SGiacomo.Gabrielli@arm.com "predicate_test": predicateTest, 38037760SGiacomo.Gabrielli@arm.com "op_class": opClass }, []) 38047639Sgblack@eecs.umich.edu header_output += NeonRegRegRegImmOpDeclare.subst(iop) 38057639Sgblack@eecs.umich.edu exec_output += NeonEqualRegExecute.subst(iop) 38067639Sgblack@eecs.umich.edu for type in types: 38077639Sgblack@eecs.umich.edu substDict = { "targs" : type, 38087639Sgblack@eecs.umich.edu "class_name" : Name } 38097639Sgblack@eecs.umich.edu exec_output += NeonExecDeclare.subst(substDict) 38107639Sgblack@eecs.umich.edu 38117639Sgblack@eecs.umich.edu vextCode = ''' 38127639Sgblack@eecs.umich.edu for (unsigned i = 0; i < eCount; i++) { 38137639Sgblack@eecs.umich.edu unsigned index = i + imm; 38147639Sgblack@eecs.umich.edu if (index < eCount) { 38157639Sgblack@eecs.umich.edu destReg.elements[i] = srcReg1.elements[index]; 38167639Sgblack@eecs.umich.edu } else { 38177639Sgblack@eecs.umich.edu index -= eCount; 38188782Sgblack@eecs.umich.edu if (index >= eCount) { 381910474Sandreas.hansson@arm.com fault = std::make_shared<UndefinedInstruction>(machInst, 382010474Sandreas.hansson@arm.com false, 382110474Sandreas.hansson@arm.com mnemonic); 38228782Sgblack@eecs.umich.edu } else { 38237853SMatt.Horsnell@ARM.com destReg.elements[i] = srcReg2.elements[index]; 38248782Sgblack@eecs.umich.edu } 38257639Sgblack@eecs.umich.edu } 38267639Sgblack@eecs.umich.edu } 38277639Sgblack@eecs.umich.edu ''' 38288206SWilliam.Wang@arm.com buildVext("vext", "NVextD", "SimdMiscOp", ("uint8_t",), 2, vextCode) 38298206SWilliam.Wang@arm.com buildVext("vext", "NVextQ", "SimdMiscOp", ("uint8_t",), 4, vextCode) 38307639Sgblack@eecs.umich.edu 38317760SGiacomo.Gabrielli@arm.com def buildVtbxl(name, Name, opClass, length, isVtbl): 38327639Sgblack@eecs.umich.edu global header_output, decoder_output, exec_output 383310829Sandreas.hansson@arm.com code = simdEnabledCheckCode + ''' 38347639Sgblack@eecs.umich.edu union 38357639Sgblack@eecs.umich.edu { 38367639Sgblack@eecs.umich.edu uint8_t bytes[32]; 383713544Sgabeblack@google.com uint32_t regs[8]; 38387639Sgblack@eecs.umich.edu } table; 38397639Sgblack@eecs.umich.edu 38407639Sgblack@eecs.umich.edu union 38417639Sgblack@eecs.umich.edu { 38427639Sgblack@eecs.umich.edu uint8_t bytes[8]; 384313544Sgabeblack@google.com uint32_t regs[2]; 38447639Sgblack@eecs.umich.edu } destReg, srcReg2; 38457639Sgblack@eecs.umich.edu 38467639Sgblack@eecs.umich.edu const unsigned length = %(length)d; 38477639Sgblack@eecs.umich.edu const bool isVtbl = %(isVtbl)s; 38487639Sgblack@eecs.umich.edu 38498588Sgblack@eecs.umich.edu srcReg2.regs[0] = htog(FpOp2P0_uw); 38508588Sgblack@eecs.umich.edu srcReg2.regs[1] = htog(FpOp2P1_uw); 38517639Sgblack@eecs.umich.edu 38528588Sgblack@eecs.umich.edu destReg.regs[0] = htog(FpDestP0_uw); 38538588Sgblack@eecs.umich.edu destReg.regs[1] = htog(FpDestP1_uw); 38547639Sgblack@eecs.umich.edu ''' % { "length" : length, "isVtbl" : isVtbl } 38557639Sgblack@eecs.umich.edu for reg in range(8): 38567639Sgblack@eecs.umich.edu if reg < length * 2: 38578588Sgblack@eecs.umich.edu code += 'table.regs[%(reg)d] = htog(FpOp1P%(reg)d_uw);\n' % \ 38587639Sgblack@eecs.umich.edu { "reg" : reg } 38597639Sgblack@eecs.umich.edu else: 38607639Sgblack@eecs.umich.edu code += 'table.regs[%(reg)d] = 0;\n' % { "reg" : reg } 38617639Sgblack@eecs.umich.edu code += ''' 38627639Sgblack@eecs.umich.edu for (unsigned i = 0; i < sizeof(destReg); i++) { 38637639Sgblack@eecs.umich.edu uint8_t index = srcReg2.bytes[i]; 38647639Sgblack@eecs.umich.edu if (index < 8 * length) { 38657639Sgblack@eecs.umich.edu destReg.bytes[i] = table.bytes[index]; 38667639Sgblack@eecs.umich.edu } else { 38677639Sgblack@eecs.umich.edu if (isVtbl) 38687639Sgblack@eecs.umich.edu destReg.bytes[i] = 0; 38697639Sgblack@eecs.umich.edu // else destReg.bytes[i] unchanged 38707639Sgblack@eecs.umich.edu } 38717639Sgblack@eecs.umich.edu } 38727639Sgblack@eecs.umich.edu 38738588Sgblack@eecs.umich.edu FpDestP0_uw = gtoh(destReg.regs[0]); 38748588Sgblack@eecs.umich.edu FpDestP1_uw = gtoh(destReg.regs[1]); 38757639Sgblack@eecs.umich.edu ''' 38767639Sgblack@eecs.umich.edu iop = InstObjParams(name, Name, 38777639Sgblack@eecs.umich.edu "RegRegRegOp", 38787639Sgblack@eecs.umich.edu { "code": code, 38797760SGiacomo.Gabrielli@arm.com "predicate_test": predicateTest, 38807760SGiacomo.Gabrielli@arm.com "op_class": opClass }, []) 38817639Sgblack@eecs.umich.edu header_output += RegRegRegOpDeclare.subst(iop) 38827639Sgblack@eecs.umich.edu decoder_output += RegRegRegOpConstructor.subst(iop) 38837639Sgblack@eecs.umich.edu exec_output += PredOpExecute.subst(iop) 38847639Sgblack@eecs.umich.edu 38858206SWilliam.Wang@arm.com buildVtbxl("vtbl", "NVtbl1", "SimdMiscOp", 1, "true") 38868206SWilliam.Wang@arm.com buildVtbxl("vtbl", "NVtbl2", "SimdMiscOp", 2, "true") 38878206SWilliam.Wang@arm.com buildVtbxl("vtbl", "NVtbl3", "SimdMiscOp", 3, "true") 38888206SWilliam.Wang@arm.com buildVtbxl("vtbl", "NVtbl4", "SimdMiscOp", 4, "true") 38897639Sgblack@eecs.umich.edu 38908206SWilliam.Wang@arm.com buildVtbxl("vtbx", "NVtbx1", "SimdMiscOp", 1, "false") 38918206SWilliam.Wang@arm.com buildVtbxl("vtbx", "NVtbx2", "SimdMiscOp", 2, "false") 38928206SWilliam.Wang@arm.com buildVtbxl("vtbx", "NVtbx3", "SimdMiscOp", 3, "false") 38938206SWilliam.Wang@arm.com buildVtbxl("vtbx", "NVtbx4", "SimdMiscOp", 4, "false") 38947639Sgblack@eecs.umich.edu}}; 3895