From a4b9465e30e87c34826c28d67caec87a8026f962 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Sun, 15 Jul 2012 02:25:55 +0000 Subject: [PATCH] Move helper functions to guest_s390_helpers.c for consistency with other frontends. git-svn-id: svn://svn.valgrind.org/vex/trunk@2434 --- VEX/priv/guest_s390_defs.h | 5 +++- VEX/priv/guest_s390_helpers.c | 48 +++++++++++++++++++++++++++++++++++ VEX/priv/guest_s390_toIR.c | 37 --------------------------- 3 files changed, 52 insertions(+), 38 deletions(-) diff --git a/VEX/priv/guest_s390_defs.h b/VEX/priv/guest_s390_defs.h index 01a35bc32a..e319f315c4 100644 --- a/VEX/priv/guest_s390_defs.h +++ b/VEX/priv/guest_s390_defs.h @@ -72,7 +72,7 @@ extern VexGuestLayout s390xGuest_layout; #define S390X_GUEST_OFFSET(x) offsetof(VexGuestS390XState, x) /*------------------------------------------------------------*/ -/*--- Dirty Helper functions. ---*/ +/*--- Helper functions. ---*/ /*------------------------------------------------------------*/ void s390x_dirtyhelper_00(VexGuestS390XState *guest_state); void s390x_dirtyhelper_EX(ULong torun); @@ -81,6 +81,9 @@ ULong s390x_dirtyhelper_STCKF(ULong *addr); ULong s390x_dirtyhelper_STCKE(ULong *addr); ULong s390x_dirtyhelper_STFLE(VexGuestS390XState *guest_state, HWord addr); +UInt s390_do_cvb(ULong decimal); +ULong s390_do_cvd(ULong binary); + /* The various ways to compute the condition code. */ enum { S390_CC_OP_BITWISE = 0, diff --git a/VEX/priv/guest_s390_helpers.c b/VEX/priv/guest_s390_helpers.c index 55dfeecbed..c898f2725c 100644 --- a/VEX/priv/guest_s390_helpers.c +++ b/VEX/priv/guest_s390_helpers.c @@ -339,6 +339,54 @@ s390x_dirtyhelper_STFLE(VexGuestS390XState *guest_state, HWord addr) } #endif /* VGA_s390x */ + +/*------------------------------------------------------------*/ +/*--- Clean helper for "convert to binary". ---*/ +/*------------------------------------------------------------*/ +#if defined(VGA_s390x) +UInt +s390_do_cvb(ULong decimal) +{ + UInt binary; + + __asm__ volatile ( + "cvb %[result],%[input]\n\t" + : [result] "=d"(binary) + : [input] "m"(decimal) + ); + + return binary; +} + +#else +UInt s390_do_cvb(ULong decimal) { return 0; } +#endif + + +/*------------------------------------------------------------*/ +/*--- Clean helper for "convert to decimal". ---*/ +/*------------------------------------------------------------*/ +#if defined(VGA_s390x) +ULong +s390_do_cvd(ULong binary_in) +{ + UInt binary = binary_in & 0xffffffffULL; + ULong decimal; + + __asm__ volatile ( + "cvd %[input],%[result]\n\t" + : [result] "=m"(decimal) + : [input] "d"(binary) + ); + + return decimal; +} + +#else +ULong s390_do_cvd(ULong binary) { return 0; } +#endif + + /*------------------------------------------------------------*/ /*--- Helper for condition code. ---*/ /*------------------------------------------------------------*/ diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c index 50d948d9fb..2f017e350f 100644 --- a/VEX/priv/guest_s390_toIR.c +++ b/VEX/priv/guest_s390_toIR.c @@ -10670,24 +10670,6 @@ s390_irgen_CPSDR(UChar r3, UChar r1, UChar r2) } -static UInt -s390_do_cvb(ULong decimal) -{ -#if defined(VGA_s390x) - UInt binary; - - __asm__ volatile ( - "cvb %[result],%[input]\n\t" - : [result] "=d"(binary) - : [input] "m"(decimal) - ); - - return binary; -#else - return 0; -#endif -} - static IRExpr * s390_call_cvb(IRExpr *in) { @@ -10720,25 +10702,6 @@ s390_irgen_CVBY(UChar r1, IRTemp op2addr) } -static ULong -s390_do_cvd(ULong binary_in) -{ -#if defined(VGA_s390x) - UInt binary = binary_in & 0xffffffffULL; - ULong decimal; - - __asm__ volatile ( - "cvd %[input],%[result]\n\t" - : [result] "=m"(decimal) - : [input] "d"(binary) - ); - - return decimal; -#else - return 0; -#endif -} - static IRExpr * s390_call_cvd(IRExpr *in) { -- 2.47.2