helper_template.h revision 4b9d6701570cb98fd36e209314239d104ec584d3
/*
* i386 helpers
*
* Copyright (c) 2008 Fabrice Bellard
*
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
* other than GPL or LGPL is available it will apply instead, Oracle elects to use only
* the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
* a choice of LGPL license versions is made available with the language indicating
* that LGPLv2 or any later version may be used, or where a choice of which version
* of the LGPL is applied is otherwise unspecified.
*/
#if DATA_BITS <= 32
#define SHIFT1_MASK 0x1f
#else
#define SHIFT1_MASK 0x3f
#endif
#if DATA_BITS == 8
#define SUFFIX b
#define DATA_STYPE int8_t
#define DATA_MASK 0xff
#define SUFFIX w
#define DATA_STYPE int16_t
#define DATA_MASK 0xffff
#define SUFFIX l
#define DATA_STYPE int32_t
#define DATA_MASK 0xffffffff
#define SUFFIX q
#define DATA_STYPE int64_t
#define DATA_MASK 0xffffffffffffffffULL
#else
#endif
/* dynamic flags computation */
{
}
{
int cf;
return cf;
}
{
}
{
int cf;
return cf;
}
{
}
{
int cf;
return cf;
}
{
}
{
int cf;
return cf;
}
{
cf = 0;
af = 0;
of = 0;
}
{
return 0;
}
{
src2 = 1;
}
#if DATA_BITS == 32
{
return CC_SRC;
}
#endif
{
src2 = 1;
}
{
af = 0; /* undefined */
/* of is defined if shift count == 1 */
}
{
}
#if DATA_BITS == 32
{
return CC_SRC & 1;
}
#endif
{
af = 0; /* undefined */
/* of is defined if shift count == 1 */
}
#if DATA_BITS == 32
{
int cf;
return cf;
}
#endif
/* NOTE: we compute the flags like the P4. On olders CPUs, only OF and
CF are modified and it is slower to do that. */
{
af = 0; /* undefined */
}
/* shifts */
{
#if DATA_BITS == 16
#endif
if (count) {
if (count > 1)
} else {
}
return t0;
}
{
#if DATA_BITS == 16
#endif
if (count) {
if (count > 1)
} else {
}
return t0;
}