Alien-LibJIT

 view release on metacpan or  search on metacpan

libjit/attic/jit-rules-alpha.ins  view on Meta::CPAN

/*
 * jit-rules-alpha.ins - Instruction selector for alpha.
 *
 * Copyright (C) 2006  Southern Storm Software, Pty Ltd.
 *
 * This file is part of the libjit library.
 *
 * The libjit library is free software: you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation, either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * The libjit 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 the libjit library.  If not, see
 * <http://www.gnu.org/licenses/>.
 */

%inst_type alpha_inst

%regclass reg alpha_reg
%regclass lreg alpha_reg
%regclass freg alpha_freg

/*
 * Conversion opcodes.
 */

JIT_OP_TRUNC_SBYTE:
	[reg] -> {
		alpha_slli(inst,$1,56,$1);
		alpha_srai(inst,$1,56,$1);
	}

JIT_OP_TRUNC_UBYTE:
	[reg] -> {
		_alpha_li8(inst,ALPHA_AT,0xff);
		alpha_and(inst,$1,ALPHA_AT,$1);
	}

JIT_OP_TRUNC_SHORT:
	[reg] -> {
		alpha_slli(inst,$1,56,$1);
		alpha_srai(inst,$1,56,$1);
	}

JIT_OP_TRUNC_USHORT:
	[reg] -> {
		alpha_slli(inst,$1,56,$1);
		alpha_srli(inst,$1,56,$1);
	}

/*
 * TODO: JIT_OP_NFLOAT_TO_FLOAT32 JIT_OP_NFLOAT_TO_FLOAT64
 * TODO: JIT_OP_FLOAT32_TO_NFLOAT JIT_OP_FLOAT64_TO_NFLOAT
 *
 * Requires floating-point opcodes
 */

/*
 * Arithmetic opcodes.
 *
 * These operations take the two parameters [$1, $2] and perform the 
 * operation on them and store the result in $1. The format of most of 
 * the alpha arithmetic operations is alpha_opl(inst,sreg0,sreg1,dreg).
 * For operations with imediate values we use alpha_liN to load the 
 * value into ALPHA_AT, a register reserved for the assembler, before
 * doing any operations on it.
 *
 * Perform an arithmetic operation on signed 32-bit integers.
 */

/* return value1 + value2; */
JIT_OP_IADD:
	[=reg, reg, imm, if("$3 == 0")] -> {
		alpha_mov(inst,$2,$1);



( run in 1.046 second using v1.01-cache-2.11-cpan-df04353d9ac )