1 /* -*- mode: C; c-basic-offset: 3; -*- */
3 /*---------------------------------------------------------------*/
4 /*--- begin host_s390_defs.h ---*/
5 /*---------------------------------------------------------------*/
8 This file is part of Valgrind, a dynamic binary instrumentation
11 Copyright IBM Corp. 2010-2020
13 This program is free software; you can redistribute it and/or
14 modify it under the terms of the GNU General Public License as
15 published by the Free Software Foundation; either version 2 of the
16 License, or (at your option) any later version.
18 This program is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, see <http://www.gnu.org/licenses/>.
26 The GNU General Public License is contained in the file COPYING.
29 /* Contributed by Florian Krohm */
31 #ifndef __VEX_HOST_S390_DEFS_H
32 #define __VEX_HOST_S390_DEFS_H
34 #include "libvex_basictypes.h" /* Bool */
35 #include "libvex.h" /* VexArchInfo */
36 #include "host_generic_regs.h" /* HReg */
37 #include "s390_defs.h" /* s390_cc_t */
39 /* --------- Registers --------- */
40 const HChar
*s390_hreg_as_string(HReg
);
41 HReg
s390_hreg_gpr(UInt regno
);
42 HReg
s390_hreg_fpr(UInt regno
);
43 HReg
s390_hreg_vr(UInt regno
);
45 /* Dedicated registers */
46 HReg
s390_hreg_guest_state_pointer(void);
47 HReg
s390_hreg_stack_pointer(void);
50 /* Given the index of a function argument, return the number of the
51 general purpose register in which it is being passed. Arguments are
52 counted 0, 1, 2, ... and they are being passed in r2, r3, r4, ... */
53 static __inline__ UInt
54 s390_gprno_from_arg_index(UInt ix
)
59 /* --------- Memory address expressions (amodes). --------- */
61 /* These are the address modes:
62 (1) b12: base register + 12-bit unsigned offset (e.g. RS)
63 (2) b20: base register + 20-bit signed offset (e.g. RSY)
64 (3) bx12: base register + index register + 12-bit unsigned offset (e.g. RX)
65 (4) bx20: base register + index register + 20-bit signed offset (e.g. RXY)
66 fixs390: There is also pc-relative stuff.. e.g. LARL
79 HReg x
; /* hregNumber(x) == 0 for S390_AMODE_B12/B20 kinds */
80 Int d
; /* 12 bit unsigned or 20 bit signed */
84 s390_amode
*s390_amode_b12(Int d
, HReg b
);
85 s390_amode
*s390_amode_b20(Int d
, HReg b
);
86 s390_amode
*s390_amode_bx12(Int d
, HReg b
, HReg x
);
87 s390_amode
*s390_amode_bx20(Int d
, HReg b
, HReg x
);
88 s390_amode
*s390_amode_for_guest_state(Int d
);
89 s390_amode
*s390_amode_for_stack_pointer(Int d
);
90 Bool
s390_amode_is_sane(const s390_amode
*);
92 const HChar
*s390_amode_as_string(const s390_amode
*);
94 /* ------------- 2nd (right) operand of binary operation ---------------- */
103 /* Naming convention for operand locations:
106 M - memory (any Amode may be used)
109 /* An operand that is either in a GPR or is addressable via a BX20 amode */
120 /* The kind of instructions */
122 S390_INSN_LOAD
, /* load register from memory */
123 S390_INSN_STORE
, /* store register to memory */
124 S390_INSN_MOVE
, /* from register to register */
125 S390_INSN_MEMCPY
, /* from memory to memory */
126 S390_INSN_COND_MOVE
, /* conditonal "move" to register */
127 S390_INSN_LOAD_IMMEDIATE
,
129 S390_INSN_SMUL
, /* signed multiply; n-bit operands; 2n-bit result */
130 S390_INSN_UMUL
, /* unsigned multiply; n-bit operands; 2n-bit result */
131 S390_INSN_SDIV
, /* signed division; 2n-bit / n-bit -> n-bit quot/rem */
132 S390_INSN_UDIV
, /* unsigned division; 2n-bit / n-bit -> n-bit quot/rem */
133 S390_INSN_DIVS
, /* n-bit dividend; n-bit divisor; n-bit quot/rem */
134 S390_INSN_CLZ
, /* count left-most zeroes */
136 S390_INSN_TEST
, /* test operand and set cc */
137 S390_INSN_CC2BOOL
,/* convert condition code to 0/1 */
139 S390_INSN_HELPER_CALL
,
140 S390_INSN_CAS
, /* compare and swap */
141 S390_INSN_CDAS
, /* compare double and swap */
142 S390_INSN_BFP_BINOP
, /* Binary floating point */
145 S390_INSN_BFP_COMPARE
,
146 S390_INSN_BFP_CONVERT
,
147 S390_INSN_DFP_BINOP
, /* Decimal floating point */
150 S390_INSN_DFP_COMPARE
,
151 S390_INSN_DFP_CONVERT
,
152 S390_INSN_DFP_REROUND
,
153 S390_INSN_FP_CONVERT
,
155 S390_INSN_MIMM
, /* Assign an immediate constant to a memory location */
156 S390_INSN_MADD
, /* Add a value to a memory location */
157 S390_INSN_SET_FPC_BFPRM
, /* Set the bfp rounding mode in the FPC */
158 S390_INSN_SET_FPC_DFPRM
, /* Set the dfp rounding mode in the FPC */
159 /* The following 5 insns are mandated by translation chaining */
160 S390_INSN_XDIRECT
, /* direct transfer to guest address */
161 S390_INSN_XINDIR
, /* indirect transfer to guest address */
162 S390_INSN_XASSISTED
, /* assisted transfer to guest address */
163 S390_INSN_EVCHECK
, /* Event check */
164 S390_INSN_PROFINC
, /* 64-bit profile counter increment */
165 S390_INSN_VEC_AMODEOP
,
166 S390_INSN_VEC_AMODEINTOP
,
170 S390_INSN_VEC_REPLICATE
174 /* The kind of ALU instructions */
178 S390_ALU_MUL
, /* n-bit operands; result is lower n-bit of product */
182 S390_ALU_ILIH
, /* insert low half of 2nd operand into high half of 1st
186 S390_ALU_RSHA
/* arithmetic */
190 /* The kind of unary integer operations */
204 S390_VEC_COUNT_LEADING_ZEROES
,
205 S390_VEC_COUNT_TRAILING_ZEROES
,
214 /* The kind of ternary BFP operations */
220 /* The kind of binary BFP operations */
228 /* The kind of unary BFP operations */
236 /* Type conversion operations: to and/or from binary floating point */
240 S390_BFP_I32_TO_F128
,
243 S390_BFP_I64_TO_F128
,
246 S390_BFP_U32_TO_F128
,
249 S390_BFP_U64_TO_F128
,
255 S390_BFP_F32_TO_F128
,
261 S390_BFP_F64_TO_F128
,
262 S390_BFP_F128_TO_I32
,
263 S390_BFP_F128_TO_I64
,
264 S390_BFP_F128_TO_U32
,
265 S390_BFP_F128_TO_U64
,
266 S390_BFP_F128_TO_F32
,
267 S390_BFP_F128_TO_F64
,
268 S390_BFP_F32_TO_F32I
,
269 S390_BFP_F64_TO_F64I
,
270 S390_BFP_F128_TO_F128I
273 /* Type conversion operations: to and/or from decimal floating point */
277 S390_DFP_D64_TO_D128
,
278 S390_DFP_D128_TO_D64
,
280 S390_DFP_I32_TO_D128
,
282 S390_DFP_I64_TO_D128
,
284 S390_DFP_U32_TO_D128
,
286 S390_DFP_U64_TO_D128
,
291 S390_DFP_D128_TO_I32
,
292 S390_DFP_D128_TO_I64
,
293 S390_DFP_D128_TO_U32
,
306 S390_FP_F128_TO_D128
,
318 /* The kind of binary DFP operations */
327 /* The kind of unary DFP operations */
329 S390_DFP_EXTRACT_EXP_D64
,
330 S390_DFP_EXTRACT_EXP_D128
,
331 S390_DFP_EXTRACT_SIG_D64
,
332 S390_DFP_EXTRACT_SIG_D128
,
335 /* The DFP operations with 2 operands one of them being integer */
338 S390_DFP_SHIFT_RIGHT
,
342 /* The kind of DFP compare operations */
345 S390_DFP_COMPARE_EXP
,
348 /* The vector operations with 2 operands one of them being amode */
351 S390_VEC_ELEM_SHL_INT
,
352 S390_VEC_ELEM_SHRA_INT
,
353 S390_VEC_ELEM_SHRL_INT
,
354 S390_VEC_AMODEOP_T_INVALID
355 } s390_vec_amodeop_t
;
357 /* The vector operations with three (vector, amode and integer) operands */
360 } s390_vec_amodeintop_t
;
362 /* The vector operations with two operands */
365 S390_VEC_PACK_SATURS
,
366 S390_VEC_PACK_SATURU
,
367 S390_VEC_COMPARE_EQUAL
,
383 S390_VEC_COMPARE_GREATERS
,
384 S390_VEC_COMPARE_GREATERU
,
385 S390_VEC_INT_MUL_HIGHS
,
386 S390_VEC_INT_MUL_HIGHU
,
387 S390_VEC_INT_MUL_LOW
,
388 S390_VEC_INT_MUL_EVENS
,
389 S390_VEC_INT_MUL_EVENU
,
391 S390_VEC_ELEM_SHRA_V
,
392 S390_VEC_ELEM_SHRL_V
,
393 S390_VEC_ELEM_ROLL_V
,
395 /* host_s390_isel depends on this order. */
396 S390_VEC_SHL_BITS
, S390_VEC_SHL_BYTES
,
397 S390_VEC_SHRL_BITS
, S390_VEC_SHRL_BYTES
,
398 S390_VEC_SHRA_BITS
, S390_VEC_SHRA_BYTES
,
404 S390_VEC_INIT_FROM_GPRS
,
405 S390_VEC_INIT_FROM_FPRS
,
410 S390_VEC_FLOAT_COMPARE_EQUAL
,
411 S390_VEC_FLOAT_COMPARE_LESS_OR_EQUAL
,
412 S390_VEC_FLOAT_COMPARE_LESS
,
413 S390_VEC_BINOP_T_INVALID
416 /* The vector operations with three operands */
423 /* The details of a CDAS insn. Carved out to keep the size of
436 /* The details of a binary DFP insn. Carved out to keep the size of
439 s390_dfp_binop_t tag
;
440 s390_dfp_round_t rounding_mode
;
441 HReg dst_hi
; /* 128-bit result high part; 64-bit result */
442 HReg dst_lo
; /* 128-bit result low part */
443 HReg op2_hi
; /* 128-bit operand high part; 64-bit opnd 1 */
444 HReg op2_lo
; /* 128-bit operand low part */
445 HReg op3_hi
; /* 128-bit operand high part; 64-bit opnd 2 */
446 HReg op3_lo
; /* 128-bit operand low part */
451 s390_dfp_round_t rounding_mode
;
452 HReg dst_hi
; /* 128-bit result high part; 32/64-bit result */
453 HReg dst_lo
; /* 128-bit result low part */
454 HReg op_hi
; /* 128-bit operand high part; 32/64-bit opnd */
455 HReg op_lo
; /* 128-bit operand low part */
456 HReg r1
; /* clobbered register GPR #1 */
459 /* Pseudo-insn for representing a helper call.
460 TARGET is the absolute address of the helper function
461 NUM_ARGS says how many arguments are being passed.
462 All arguments have integer type and are being passed according to ABI,
463 i.e. in registers r2, r3, r4, r5, and r6, with argument #0 being
464 passed in r2 and so forth. */
468 RetLoc rloc
; /* where the return value will be */
470 const HChar
*name
; /* callee's name (for debugging) */
475 /* Usually, this is the size of the result of an operation.
477 - for comparisons it is the size of the operand
504 ULong value
; /* not sign extended */
506 /* add, and, or, xor */
513 HReg dst_hi
; /* r10 */
514 HReg dst_lo
; /* also op1 r11 */
518 HReg op1_hi
; /* also remainder r10 */
519 HReg op1_lo
; /* also quotient r11 */
523 HReg rem
; /* remainder r10 */
524 HReg op1
; /* also quotient r11 */
528 HReg num_bits
; /* number of leftmost '0' bits r10 */
529 HReg clobber
; /* unspecified r11 */
538 Bool signed_comparison
;
545 /* Convert the condition code to a boolean value. */
560 s390_helper_call
*details
;
563 /* Floating point instructions (including conversion to/from floating
566 128-bit floating point requires register pairs. As the registers
567 in a register pair cannot be chosen independently it would suffice
568 to store only one register of the pair in order to represent it.
569 We chose not to do that as being explicit about all registers
570 helps with debugging and does not require special handling in
571 e.g. s390_insn_get_reg_usage, It'd be all too easy to forget about
572 the "other" register in a pair if it is implicit.
574 The convention for all fp s390_insn is that the _hi register will
575 be used to store the result / operand of a 32/64-bit operation.
576 The _hi register holds the 8 bytes of HIgher significance of a
577 128-bit value (hence the suffix). However, it is the lower numbered
578 register of a register pair. POP says that the lower numbered
579 register is used to identify the pair in an insn encoding. So,
580 when an insn is emitted, only the _hi registers need to be looked
581 at. Nothing special is needed for 128-bit BFP which is nice.
584 /* There are currently no ternary 128-bit BFP operations. */
586 s390_bfp_triop_t tag
;
592 s390_bfp_binop_t tag
;
593 HReg dst_hi
; /* 128-bit result high part; 32/64-bit result */
594 HReg dst_lo
; /* 128-bit result low part */
595 HReg op2_hi
; /* 128-bit operand high part; 32/64-bit opnd */
596 HReg op2_lo
; /* 128-bit operand low part */
600 HReg dst_hi
; /* 128-bit result high part; 32/64-bit result */
601 HReg dst_lo
; /* 128-bit result low part */
602 HReg op_hi
; /* 128-bit operand high part; 32/64-bit opnd */
603 HReg op_lo
; /* 128-bit operand low part */
607 s390_bfp_round_t rounding_mode
;
608 HReg dst_hi
; /* 128-bit result high part; 32/64-bit result */
609 HReg dst_lo
; /* 128-bit result low part */
610 HReg op_hi
; /* 128-bit operand high part; 32/64-bit opnd */
611 HReg op_lo
; /* 128-bit operand low part */
614 HReg dst
; /* condition code in s390 encoding */
615 HReg op1_hi
; /* 128-bit operand high part; 32/64-bit opnd */
616 HReg op1_lo
; /* 128-bit operand low part */
617 HReg op2_hi
; /* 128-bit operand high part; 32/64-bit opnd */
618 HReg op2_lo
; /* 128-bit operand low part */
621 s390_dfp_binop
*details
;
625 HReg dst_hi
; /* 128-bit result high part; 64-bit result */
626 HReg dst_lo
; /* 128-bit result low part */
627 HReg op_hi
; /* 128-bit operand high part; 64-bit opnd */
628 HReg op_lo
; /* 128-bit operand low part */
631 s390_dfp_intop_t tag
;
632 HReg dst_hi
; /* 128-bit result high part; 64-bit result */
633 HReg dst_lo
; /* 128-bit result low part */
634 HReg op2
; /* integer operand */
635 HReg op3_hi
; /* 128-bit operand high part; 64-bit opnd */
636 HReg op3_lo
; /* 128-bit operand low part */
640 s390_dfp_round_t rounding_mode
;
641 HReg dst_hi
; /* 128-bit result high part; 64-bit result */
642 HReg dst_lo
; /* 128-bit result low part */
643 HReg op_hi
; /* 128-bit operand high part; 64-bit opnd */
644 HReg op_lo
; /* 128-bit operand low part */
647 s390_fp_convert
*details
;
651 HReg dst
; /* condition code in s390 encoding */
652 HReg op1_hi
; /* 128-bit operand high part; 64-bit opnd 1 */
653 HReg op1_lo
; /* 128-bit operand low part */
654 HReg op2_hi
; /* 128-bit operand high part; 64-bit opnd 2 */
655 HReg op2_lo
; /* 128-bit operand low part */
658 s390_dfp_round_t rounding_mode
;
659 HReg dst_hi
; /* 128-bit result high part; 64-bit result */
660 HReg dst_lo
; /* 128-bit result low part */
661 HReg op2
; /* integer operand */
662 HReg op3_hi
; /* 128-bit operand high part; 64-bit opnd */
663 HReg op3_lo
; /* 128-bit operand low part */
669 ULong value
; /* sign extended */
674 ULong value
; /* for debugging only */
683 /* The next 5 entries are generic to support translation chaining */
685 /* Update the guest IA value, then exit requesting to chain
686 to it. May be conditional. */
689 Bool to_fast_entry
; /* chain to the what entry point? */
690 Addr64 dst
; /* next guest address */
691 s390_amode
*guest_IA
;
693 /* Boring transfer to a guest address not known at JIT time.
694 Not chainable. May be conditional. */
698 s390_amode
*guest_IA
;
700 /* Assisted transfer to a guest address, most general case.
701 Not chainable. May be conditional. */
706 s390_amode
*guest_IA
;
709 /* fixs390: I don't think these are really needed
710 as the gsp and the offset are fixed no ? */
711 s390_amode
*counter
; /* dispatch counter */
712 s390_amode
*fail_addr
;
715 /* No fields. The address of the counter to increment is
716 installed later, post-translation, by patching it in,
717 as it is not known at translation time. */
720 s390_vec_amodeop_t tag
;
721 HReg dst
; /* 64-bit result */
722 HReg op1
; /* 128-bit operand */
723 s390_amode
*op2
; /* amode operand */
726 s390_vec_amodeintop_t tag
;
727 HReg dst
; /* 128-bit result */
728 s390_amode
*op2
; /* amode operand */
729 HReg op3
; /* integer operand */
732 s390_vec_binop_t tag
;
733 HReg dst
; /* 128-bit result */
734 HReg op1
; /* 128-bit first operand */
735 HReg op2
; /* 128-bit second operand */
738 s390_vec_triop_t tag
;
739 HReg dst
; /* 128-bit result */
740 HReg op1
; /* 128-bit first operand */
741 HReg op2
; /* 128-bit second operand */
742 HReg op3
; /* 128-bit third operand */
745 HReg dst
; /* 128-bit result */
746 HReg op1
; /* 128-bit first operand */
747 UChar idx
; /* index of element to replicate */
752 s390_insn
*s390_insn_load(UChar size
, HReg dst
, s390_amode
*src
);
753 s390_insn
*s390_insn_store(UChar size
, s390_amode
*dst
, HReg src
);
754 s390_insn
*s390_insn_move(UChar size
, HReg dst
, HReg src
);
755 s390_insn
*s390_insn_memcpy(UChar size
, s390_amode
*dst
, s390_amode
*src
);
756 s390_insn
*s390_insn_cond_move(UChar size
, s390_cc_t cond
, HReg dst
,
758 s390_insn
*s390_insn_load_immediate(UChar size
, HReg dst
, ULong val
);
759 s390_insn
*s390_insn_alu(UChar size
, s390_alu_t
, HReg dst
,
761 s390_insn
*s390_insn_mul(UChar size
, HReg dst_hi
, HReg dst_lo
,
762 s390_opnd_RMI op2
, Bool signed_multiply
);
763 s390_insn
*s390_insn_div(UChar size
, HReg op1_hi
, HReg op1_lo
,
764 s390_opnd_RMI op2
, Bool signed_divide
);
765 s390_insn
*s390_insn_divs(UChar size
, HReg rem
, HReg op1
, s390_opnd_RMI op2
);
766 s390_insn
*s390_insn_clz(UChar size
, HReg num_bits
, HReg clobber
,
768 s390_insn
*s390_insn_cas(UChar size
, HReg op1
, s390_amode
*op2
, HReg op3
,
770 s390_insn
*s390_insn_cdas(UChar size
, HReg op1_high
, HReg op1_low
,
771 s390_amode
*op2
, HReg op3_high
, HReg op3_low
,
772 HReg old_high
, HReg old_low
, HReg scratch
);
773 s390_insn
*s390_insn_unop(UChar size
, s390_unop_t tag
, HReg dst
,
775 s390_insn
*s390_insn_cc2bool(HReg dst
, s390_cc_t src
);
776 s390_insn
*s390_insn_test(UChar size
, s390_opnd_RMI src
);
777 s390_insn
*s390_insn_compare(UChar size
, HReg dst
, s390_opnd_RMI opnd
,
778 Bool signed_comparison
);
779 s390_insn
*s390_insn_helper_call(s390_cc_t cond
, Addr64 target
, UInt num_args
,
780 const HChar
*name
, RetLoc rloc
);
781 s390_insn
*s390_insn_bfp_triop(UChar size
, s390_bfp_triop_t
, HReg dst
,
783 s390_insn
*s390_insn_bfp_binop(UChar size
, s390_bfp_binop_t
, HReg dst
,
785 s390_insn
*s390_insn_bfp_unop(UChar size
, s390_bfp_unop_t tag
, HReg dst
,
787 s390_insn
*s390_insn_bfp_compare(UChar size
, HReg dst
, HReg op1
, HReg op2
);
788 s390_insn
*s390_insn_bfp_convert(UChar size
, s390_bfp_conv_t tag
, HReg dst
,
789 HReg op
, s390_bfp_round_t
);
790 s390_insn
*s390_insn_bfp128_convert(UChar size
, s390_bfp_conv_t tag
, HReg dst_hi
,
791 HReg dst_lo
, HReg op_hi
, HReg op_lo
,
792 s390_bfp_round_t rounding_mode
);
793 s390_insn
*s390_insn_bfp128_binop(UChar size
, s390_bfp_binop_t
, HReg dst_hi
,
794 HReg dst_lo
, HReg op2_hi
, HReg op2_lo
);
795 s390_insn
*s390_insn_bfp128_unop(UChar size
, s390_bfp_unop_t
, HReg dst_hi
,
796 HReg dst_lo
, HReg op_hi
, HReg op_lo
);
797 s390_insn
*s390_insn_bfp128_compare(UChar size
, HReg dst
, HReg op1_hi
,
798 HReg op1_lo
, HReg op2_hi
, HReg op2_lo
);
799 s390_insn
*s390_insn_bfp128_convert_to(UChar size
, s390_bfp_conv_t
,
800 HReg dst_hi
, HReg dst_lo
, HReg op
);
801 s390_insn
*s390_insn_bfp128_convert_from(UChar size
, s390_bfp_conv_t
,
802 HReg dst_hi
, HReg dst_lo
, HReg op_hi
,
803 HReg op_lo
, s390_bfp_round_t
);
804 s390_insn
*s390_insn_dfp_binop(UChar size
, s390_dfp_binop_t
, HReg dst
,
806 s390_dfp_round_t rounding_mode
);
807 s390_insn
*s390_insn_dfp_unop(UChar size
, s390_dfp_unop_t
, HReg dst
, HReg op
);
808 s390_insn
*s390_insn_dfp_intop(UChar size
, s390_dfp_intop_t
, HReg dst
,
810 s390_insn
*s390_insn_dfp_compare(UChar size
, s390_dfp_cmp_t
, HReg dst
,
812 s390_insn
*s390_insn_dfp_convert(UChar size
, s390_dfp_conv_t tag
, HReg dst
,
813 HReg op
, s390_dfp_round_t
);
814 s390_insn
*s390_insn_dfp_reround(UChar size
, HReg dst
, HReg op2
, HReg op3
,
816 s390_insn
*s390_insn_fp_convert(UChar size
, s390_fp_conv_t tag
,
817 HReg dst
, HReg op
, HReg r1
, s390_dfp_round_t
);
818 s390_insn
*s390_insn_fp128_convert(UChar size
, s390_fp_conv_t tag
,
819 HReg dst_hi
, HReg dst_lo
, HReg op_hi
,
820 HReg op_lo
, HReg r1
, s390_dfp_round_t
);
821 s390_insn
*s390_insn_dfp128_binop(UChar size
, s390_dfp_binop_t
, HReg dst_hi
,
822 HReg dst_lo
, HReg op2_hi
, HReg op2_lo
,
823 HReg op3_hi
, HReg op3_lo
,
824 s390_dfp_round_t rounding_mode
);
825 s390_insn
*s390_insn_dfp128_unop(UChar size
, s390_dfp_unop_t
, HReg dst
,
826 HReg op_hi
, HReg op_lo
);
827 s390_insn
*s390_insn_dfp128_intop(UChar size
, s390_dfp_intop_t
, HReg dst_hi
,
828 HReg dst_lo
, HReg op2
,
829 HReg op3_hi
, HReg op3_lo
);
830 s390_insn
*s390_insn_dfp128_compare(UChar size
, s390_dfp_cmp_t
, HReg dst
,
831 HReg op1_hi
, HReg op1_lo
, HReg op2_hi
,
833 s390_insn
*s390_insn_dfp128_convert_to(UChar size
, s390_dfp_conv_t
,
834 HReg dst_hi
, HReg dst_lo
, HReg op
);
835 s390_insn
*s390_insn_dfp128_convert_from(UChar size
, s390_dfp_conv_t
,
836 HReg dst_hi
, HReg dst_lo
, HReg op_hi
,
837 HReg op_lo
, s390_dfp_round_t
);
838 s390_insn
*s390_insn_dfp128_reround(UChar size
, HReg dst_hi
, HReg dst_lo
,
839 HReg op2
, HReg op3_hi
, HReg op3_lo
,
841 s390_insn
*s390_insn_mfence(void);
842 s390_insn
*s390_insn_mimm(UChar size
, s390_amode
*dst
, ULong value
);
843 s390_insn
*s390_insn_madd(UChar size
, s390_amode
*dst
, UChar delta
,
845 s390_insn
*s390_insn_set_fpc_bfprm(UChar size
, HReg mode
);
846 s390_insn
*s390_insn_set_fpc_dfprm(UChar size
, HReg mode
);
848 /* Five for translation chaining */
849 s390_insn
*s390_insn_xdirect(s390_cc_t cond
, Addr64 dst
, s390_amode
*guest_IA
,
851 s390_insn
*s390_insn_xindir(s390_cc_t cond
, HReg dst
, s390_amode
*guest_IA
);
852 s390_insn
*s390_insn_xassisted(s390_cc_t cond
, HReg dst
, s390_amode
*guest_IA
,
854 s390_insn
*s390_insn_evcheck(s390_amode
*counter
, s390_amode
*fail_addr
);
855 s390_insn
*s390_insn_profinc(void);
856 s390_insn
*s390_insn_vec_amodeop(UChar size
, s390_vec_amodeop_t
, HReg dst
,
857 HReg op1
, s390_amode
* op2
);
858 s390_insn
*s390_insn_vec_amodeintop(UChar size
, s390_vec_amodeintop_t
, HReg dst
,
859 s390_amode
* op2
, HReg op3
);
860 s390_insn
*s390_insn_vec_binop(UChar size
, s390_vec_binop_t
, HReg dst
, HReg op1
,
862 s390_insn
*s390_insn_vec_triop(UChar size
, s390_vec_triop_t
, HReg dst
, HReg op1
,
864 s390_insn
*s390_insn_vec_replicate(UChar size
, HReg dst
, HReg op1
, UChar idx
);
866 const HChar
*s390_insn_as_string(const s390_insn
*);
868 /*--------------------------------------------------------*/
869 /* --- Interface exposed to VEX --- */
870 /*--------------------------------------------------------*/
872 void ppS390AMode(const s390_amode
*);
873 void ppS390Instr(const s390_insn
*, Bool mode64
);
874 UInt
ppHRegS390(HReg
);
876 /* Some functions that insulate the register allocator from details
877 of the underlying instruction set. */
878 void getRegUsage_S390Instr( HRegUsage
*, const s390_insn
*, Bool
);
879 void mapRegs_S390Instr ( HRegRemap
*, s390_insn
*, Bool
);
880 Int
emit_S390Instr ( Bool
*, UChar
*, Int
, const s390_insn
*, Bool
,
881 VexEndness
, const void *, const void *,
882 const void *, const void *);
883 const RRegUniverse
*getRRegUniverse_S390( void );
884 void genSpill_S390 ( HInstr
**, HInstr
**, HReg
, Int
, Bool
);
885 void genReload_S390 ( HInstr
**, HInstr
**, HReg
, Int
, Bool
);
886 HInstr
* directReload_S390 ( HInstr
*, HReg
, Short
);
887 extern s390_insn
* genMove_S390(HReg from
, HReg to
, Bool mode64
);
888 HInstrArray
*iselSB_S390 ( const IRSB
*, VexArch
, const VexArchInfo
*,
889 const VexAbiInfo
*, Int
, Int
, Bool
, Bool
, Addr
);
891 /* Return the number of bytes of code needed for an event check */
892 Int
evCheckSzB_S390(void);
894 /* Perform a chaining and unchaining of an XDirect jump. */
895 VexInvalRange
chainXDirect_S390(VexEndness endness_host
,
896 void *place_to_chain
,
897 const void *disp_cp_chain_me_EXPECTED
,
898 const void *place_to_jump_to
);
900 VexInvalRange
unchainXDirect_S390(VexEndness endness_host
,
901 void *place_to_unchain
,
902 const void *place_to_jump_to_EXPECTED
,
903 const void *disp_cp_chain_me
);
905 /* Patch the counter location into an existing ProfInc point. */
906 VexInvalRange
patchProfInc_S390(VexEndness endness_host
,
908 const ULong
*location_of_counter
);
910 /* KLUDGE: See detailled comment in host_s390_defs.c. */
911 extern UInt s390_host_hwcaps
;
913 /* Convenience macros to test installed facilities */
914 #define s390_host_has_ldisp \
915 (s390_host_hwcaps & (VEX_HWCAPS_S390X_LDISP))
916 #define s390_host_has_eimm \
917 (s390_host_hwcaps & (VEX_HWCAPS_S390X_EIMM))
918 #define s390_host_has_gie \
919 (s390_host_hwcaps & (VEX_HWCAPS_S390X_GIE))
920 #define s390_host_has_dfp \
921 (s390_host_hwcaps & (VEX_HWCAPS_S390X_DFP))
922 #define s390_host_has_fgx \
923 (s390_host_hwcaps & (VEX_HWCAPS_S390X_FGX))
924 #define s390_host_has_etf2 \
925 (s390_host_hwcaps & (VEX_HWCAPS_S390X_ETF2))
926 #define s390_host_has_stfle \
927 (s390_host_hwcaps & (VEX_HWCAPS_S390X_STFLE))
928 #define s390_host_has_etf3 \
929 (s390_host_hwcaps & (VEX_HWCAPS_S390X_ETF3))
930 #define s390_host_has_stckf \
931 (s390_host_hwcaps & (VEX_HWCAPS_S390X_STCKF))
932 #define s390_host_has_fpext \
933 (s390_host_hwcaps & (VEX_HWCAPS_S390X_FPEXT))
934 #define s390_host_has_lsc \
935 (s390_host_hwcaps & (VEX_HWCAPS_S390X_LSC))
936 #define s390_host_has_pfpo \
937 (s390_host_hwcaps & (VEX_HWCAPS_S390X_PFPO))
938 #define s390_host_has_vx \
939 (s390_host_hwcaps & (VEX_HWCAPS_S390X_VX))
940 #define s390_host_has_msa5 \
941 (s390_host_hwcaps & (VEX_HWCAPS_S390X_MSA5))
942 #define s390_host_has_lsc2 \
943 (s390_host_hwcaps & (VEX_HWCAPS_S390X_LSC2))
944 #define s390_host_has_vxe \
945 (s390_host_hwcaps & (VEX_HWCAPS_S390X_VXE))
946 #define s390_host_has_nnpa \
947 (s390_host_hwcaps & (VEX_HWCAPS_S390X_NNPA))
948 #define s390_host_has_dflt \
949 (s390_host_hwcaps & (VEX_HWCAPS_S390X_DFLT))
950 #endif /* ndef __VEX_HOST_S390_DEFS_H */
952 /*---------------------------------------------------------------*/
953 /*--- end host_s390_defs.h ---*/
954 /*---------------------------------------------------------------*/