Jakub Jelinek 888c61
--- valgrind-3.3.0/VEX/priv/guest-ppc/toIR.c.jj	2007-12-11 00:18:52.000000000 +0100
Jakub Jelinek 888c61
+++ valgrind-3.3.0/VEX/priv/guest-ppc/toIR.c	2008-03-03 09:58:59.000000000 +0100
Jakub Jelinek 888c61
@@ -333,6 +333,7 @@ typedef enum {
Jakub Jelinek 4963ef
 } PPC_GST;
Jakub Jelinek 4963ef
 
Jakub Jelinek 4963ef
 #define MASK_FPSCR_RN   0x3
Jakub Jelinek 4963ef
+#define MASK_FPSCR_FPRF 0x1F000
Jakub Jelinek 4963ef
 #define MASK_VSCR_VALID 0x00010001
Jakub Jelinek 4963ef
 
Jakub Jelinek 4963ef
 
Jakub Jelinek 888c61
@@ -2142,7 +2143,7 @@ static IRExpr* /* ::Ity_I32 */ getGST_ma
Jakub Jelinek 4963ef
 
Jakub Jelinek 4963ef
       /* We're only keeping track of the rounding mode,
Jakub Jelinek 4963ef
          so if the mask isn't asking for this, just return 0x0 */
Jakub Jelinek 4963ef
-      if (mask & 0x3) {
Jakub Jelinek 4963ef
+      if (mask & (MASK_FPSCR_RN|MASK_FPSCR_FPRF)) {
Jakub Jelinek 4963ef
          assign( val, IRExpr_Get( OFFB_FPROUND, Ity_I32 ) );
Jakub Jelinek 4963ef
       } else {
Jakub Jelinek 4963ef
          assign( val, mkU32(0x0) );
Jakub Jelinek 888c61
@@ -2271,7 +2272,7 @@ static void putGST_masked ( PPC_GST reg,
Jakub Jelinek 4963ef
    switch (reg) {
Jakub Jelinek 4963ef
    case PPC_GST_FPSCR: {
Jakub Jelinek 4963ef
       /* Allow writes to Rounding Mode */
Jakub Jelinek 4963ef
-      if (mask & 0x3) {
Jakub Jelinek 4963ef
+      if (mask & (MASK_FPSCR_RN|MASK_FPSCR_FPRF)) {
Jakub Jelinek 4963ef
          /* construct new fpround from new and old values as per mask:
Jakub Jelinek 4963ef
             new fpround = (src & (3 & mask)) | (fpround & (3 & ~mask)) */
Jakub Jelinek 4963ef
          stmt( 
Jakub Jelinek 888c61
@@ -2279,11 +2280,11 @@ static void putGST_masked ( PPC_GST reg,
Jakub Jelinek 4963ef
                OFFB_FPROUND,
Jakub Jelinek 4963ef
                binop(
Jakub Jelinek 4963ef
                   Iop_Or32, 
Jakub Jelinek 4963ef
-                  binop(Iop_And32, src, mkU32(3 & mask)),
Jakub Jelinek 4963ef
+                  binop(Iop_And32, src, mkU32((MASK_FPSCR_RN|MASK_FPSCR_FPRF) & mask)),
Jakub Jelinek 4963ef
                   binop(
Jakub Jelinek 4963ef
                      Iop_And32, 
Jakub Jelinek 4963ef
                      IRExpr_Get(OFFB_FPROUND,Ity_I32),
Jakub Jelinek 4963ef
-                     mkU32(3 & ~mask)
Jakub Jelinek 4963ef
+                     mkU32((MASK_FPSCR_RN|MASK_FPSCR_FPRF) & ~mask)
Jakub Jelinek 4963ef
                   )
Jakub Jelinek 4963ef
                )
Jakub Jelinek 4963ef
             )
Jakub Jelinek 888c61
@@ -3224,6 +3225,48 @@ static Bool dis_int_logic ( UInt theInst
Jakub Jelinek 4963ef
          // TODO: alternatively: assign(rA, verbose_Clz64(rS));
Jakub Jelinek 4963ef
          break;
Jakub Jelinek 4963ef
 
Jakub Jelinek 4963ef
+      case 0x1FC: // cmpb (Power6: compare bytes)
Jakub Jelinek 4963ef
+         DIP("cmpb r%u,r%u,r%u\n", rA_addr, rS_addr, rB_addr);
Jakub Jelinek 4963ef
+	 
Jakub Jelinek 4963ef
+	 if (mode64) 
Jakub Jelinek 4963ef
+	    assign( rA, unop( Iop_V128to64,
Jakub Jelinek 4963ef
+		binop( Iop_CmpEQ8x16,
Jakub Jelinek 4963ef
+		binop( Iop_64HLtoV128, mkU64(0), mkexpr(rS) ),
Jakub Jelinek 4963ef
+		binop( Iop_64HLtoV128, mkU64(0), mkexpr(rB) )
Jakub Jelinek 4963ef
+		)) );
Jakub Jelinek 4963ef
+	 else
Jakub Jelinek 4963ef
+	    assign( rA, unop( Iop_V128to32,
Jakub Jelinek 4963ef
+		binop( Iop_CmpEQ8x16,
Jakub Jelinek 4963ef
+		unop( Iop_32UtoV128, mkexpr(rS) ),
Jakub Jelinek 4963ef
+		unop( Iop_32UtoV128, mkexpr(rB) )
Jakub Jelinek 4963ef
+		)) );
Jakub Jelinek 4963ef
+	 break;
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+      case 0x2DF: { // mftgpr (move floating-point to general purpose register)
Jakub Jelinek 4963ef
+	 IRTemp frB = newTemp(Ity_F64);
Jakub Jelinek 4963ef
+         DIP("mftgpr r%u,fr%u\n", rS_addr, rB_addr);
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+	 assign( frB, getFReg(rB_addr));  // always F64
Jakub Jelinek 4963ef
+	 if (mode64)
Jakub Jelinek 4963ef
+	    assign( rA, unop( Iop_ReinterpF64asI64, mkexpr(frB)) );
Jakub Jelinek 4963ef
+	 else
Jakub Jelinek 4963ef
+	    assign( rA, unop( Iop_64to32, unop( Iop_ReinterpF64asI64, mkexpr(frB))) );
Jakub Jelinek 4963ef
+	    
Jakub Jelinek 4963ef
+	 putIReg( rS_addr, mkexpr(rA));
Jakub Jelinek 4963ef
+         return True;
Jakub Jelinek 4963ef
+         }
Jakub Jelinek 4963ef
+      case 0x25F: { // mffgpr (move floating-point from general purpose register)
Jakub Jelinek 4963ef
+	 IRTemp frA = newTemp(Ity_F64);
Jakub Jelinek 4963ef
+         DIP("mffgpr fr%u,r%u\n", rS_addr, rB_addr);
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+	 if (mode64)
Jakub Jelinek 4963ef
+	    assign( frA, unop( Iop_ReinterpI64asF64, mkexpr(rB)) );
Jakub Jelinek 4963ef
+	 else
Jakub Jelinek 4963ef
+	    assign( frA, unop( Iop_ReinterpI64asF64, unop( Iop_32Uto64, mkexpr(rB))) );
Jakub Jelinek 4963ef
+	    
Jakub Jelinek 4963ef
+         putFReg( rS_addr, mkexpr(frA));
Jakub Jelinek 4963ef
+         return True;
Jakub Jelinek 4963ef
+	 }
Jakub Jelinek 4963ef
       default:
Jakub Jelinek 4963ef
          vex_printf("dis_int_logic(ppc)(opc2)\n");
Jakub Jelinek 4963ef
          return False;
Jakub Jelinek 888c61
@@ -6533,6 +6576,45 @@ static Bool dis_fp_round ( UInt theInstr
Jakub Jelinek 4963ef
               binop(Iop_I64toF64, rm, mkexpr(r_tmp64)) );
Jakub Jelinek 4963ef
       break;
Jakub Jelinek 4963ef
 
Jakub Jelinek 4963ef
+   case 0x188: case 0x1A8: case 0x1C8: case 0x1E8: // frin, friz, frip, frim
Jakub Jelinek 4963ef
+      switch(opc2) {
Jakub Jelinek 4963ef
+      case 0x188: // frin (Floating Round to Integer Nearest)
Jakub Jelinek 4963ef
+         DIP("frin%s fr%u,fr%u\n", flag_rC ? ".":"", frD_addr, frB_addr);
Jakub Jelinek 4963ef
+         assign( r_tmp64,
Jakub Jelinek 4963ef
+               binop(Iop_F64toI64, mkU32(Irrm_NEAREST), mkexpr(frB)) );
Jakub Jelinek 4963ef
+         break;
Jakub Jelinek 4963ef
+      case 0x1A8: // friz (Floating Round to Integer Toward Zero)
Jakub Jelinek 4963ef
+         DIP("friz%s fr%u,fr%u\n", flag_rC ? ".":"", frD_addr, frB_addr);
Jakub Jelinek 4963ef
+         assign( r_tmp64,
Jakub Jelinek 4963ef
+               binop(Iop_F64toI64, mkU32(Irrm_ZERO), mkexpr(frB)) );
Jakub Jelinek 4963ef
+         break;
Jakub Jelinek 4963ef
+      case 0x1C8: // frip (Floating Round to Integer Plus)
Jakub Jelinek 4963ef
+         DIP("frip%s fr%u,fr%u\n", flag_rC ? ".":"", frD_addr, frB_addr);
Jakub Jelinek 4963ef
+         assign( r_tmp64,
Jakub Jelinek 4963ef
+               binop(Iop_F64toI64, mkU32(Irrm_PosINF), mkexpr(frB)) );
Jakub Jelinek 4963ef
+         break;
Jakub Jelinek 4963ef
+      case 0x1E8: // frim (Floating Round to Integer Minus)
Jakub Jelinek 4963ef
+         DIP("frim%s fr%u,fr%u\n", flag_rC ? ".":"", frD_addr, frB_addr);
Jakub Jelinek 4963ef
+         assign( r_tmp64,
Jakub Jelinek 4963ef
+               binop(Iop_F64toI64, mkU32(Irrm_NegINF), mkexpr(frB)) );
Jakub Jelinek 4963ef
+         break;
Jakub Jelinek 4963ef
+      }
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+      /* don't use the rounded integer if frB is outside -9e18..9e18 */
Jakub Jelinek 4963ef
+      /* F64 has only log10(2**52) significant digits anyway */
Jakub Jelinek 4963ef
+      /* need to preserve sign of zero */
Jakub Jelinek 4963ef
+      /*   frD = (fabs(frB) > 9e18) ? frB :
Jakub Jelinek 4963ef
+                 (sign(frB)) ? -fabs((double)r_tmp64) : (double)r_tmp64  */
Jakub Jelinek 4963ef
+      assign( frD, IRExpr_Mux0X( unop( Iop_32to8, binop( Iop_CmpF64,
Jakub Jelinek 4963ef
+          IRExpr_Const(IRConst_F64(9e18)), unop( Iop_AbsF64, mkexpr(frB)))),
Jakub Jelinek 4963ef
+         IRExpr_Mux0X( unop( Iop_32to8, binop( Iop_Shr32, unop( Iop_64HIto32,
Jakub Jelinek 4963ef
+                     unop(Iop_ReinterpF64asI64, mkexpr(frB))), mkU8(31))),
Jakub Jelinek 4963ef
+          binop( Iop_I64toF64, mkU32(0), mkexpr(r_tmp64) ),
Jakub Jelinek 4963ef
+          unop( Iop_NegF64, unop( Iop_AbsF64,
Jakub Jelinek 4963ef
+             binop(Iop_I64toF64, mkU32(0), mkexpr(r_tmp64)) )) ),
Jakub Jelinek 4963ef
+       mkexpr(frB) ));
Jakub Jelinek 4963ef
+      break;
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
    default:
Jakub Jelinek 4963ef
       vex_printf("dis_fp_round(ppc)(opc2)\n");
Jakub Jelinek 4963ef
       return False;
Jakub Jelinek 888c61
@@ -9139,6 +9221,10 @@ DisResult disInstr_PPC_WRK ( 
Jakub Jelinek 4963ef
       case 0x32E: // fctid
Jakub Jelinek 4963ef
       case 0x32F: // fctidz
Jakub Jelinek 4963ef
       case 0x34E: // fcfid
Jakub Jelinek 4963ef
+      case 0x188: // frin (Power5+)
Jakub Jelinek 4963ef
+      case 0x1A8: // friz (Power5+)
Jakub Jelinek 4963ef
+      case 0x1C8: // frip (Power5+)
Jakub Jelinek 4963ef
+      case 0x1E8: // frim (Power5+)
Jakub Jelinek 4963ef
          if (dis_fp_round(theInstr)) goto decode_success;
Jakub Jelinek 4963ef
          goto decode_failure;
Jakub Jelinek 4963ef
          
Jakub Jelinek 888c61
@@ -9216,6 +9302,10 @@ DisResult disInstr_PPC_WRK ( 
Jakub Jelinek 4963ef
          if (dis_int_arith( theInstr )) goto decode_success;
Jakub Jelinek 4963ef
          goto decode_failure;
Jakub Jelinek 4963ef
 
Jakub Jelinek 4963ef
+      case 0x1FC:                         // cmpb
Jakub Jelinek 4963ef
+	 if (dis_int_logic( theInstr )) goto decode_success;
Jakub Jelinek 4963ef
+         goto decode_failure;
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
       default:
Jakub Jelinek 4963ef
          break;  // Fall through...
Jakub Jelinek 4963ef
       }
Jakub Jelinek 888c61
@@ -9234,6 +9324,7 @@ DisResult disInstr_PPC_WRK ( 
Jakub Jelinek 4963ef
       case 0x11C: case 0x3BA: case 0x39A: // eqv,  extsb, extsh
Jakub Jelinek 4963ef
       case 0x1DC: case 0x07C: case 0x1BC: // nand, nor,   or
Jakub Jelinek 4963ef
       case 0x19C: case 0x13C:             // orc,  xor
Jakub Jelinek 4963ef
+      case 0x2DF: case 0x25F:		  // mftgpr, mffgpr
Jakub Jelinek 4963ef
          if (dis_int_logic( theInstr )) goto decode_success;
Jakub Jelinek 4963ef
          goto decode_failure;
Jakub Jelinek 4963ef
 
Jakub Jelinek 888c61
--- valgrind-3.3.0/none/tests/ppc32/Makefile.am.jj	2007-12-11 00:18:32.000000000 +0100
Jakub Jelinek 888c61
+++ valgrind-3.3.0/none/tests/ppc32/Makefile.am	2008-03-03 10:00:36.000000000 +0100
Jakub Jelinek 888c61
@@ -19,13 +19,15 @@ EXTRA_DIST = $(noinst_SCRIPTS) \
Jakub Jelinek 4963ef
 	testVMX.stderr.exp  testVMX.stdout.exp  testVMX.vgtest \
Jakub Jelinek 4963ef
 	twi.stderr.exp twi.stdout.exp twi.vgtest \
Jakub Jelinek 888c61
 	tw.stderr.exp tw.stdout.exp tw.vgtest \
Jakub Jelinek 4963ef
-	xlc_dbl_u32.stderr.exp xlc_dbl_u32.stdout.exp xlc_dbl_u32.vgtest
Jakub Jelinek 4963ef
+	xlc_dbl_u32.stderr.exp xlc_dbl_u32.stdout.exp xlc_dbl_u32.vgtest \
Jakub Jelinek 4963ef
+	power5+_round.stderr.exp power5+_round.stdout.exp power5+_round.vgtest \
Jakub Jelinek 4963ef
+	power6_bcmp.stderr.exp power6_bcmp.stdout.exp power6_bcmp.vgtest
Jakub Jelinek 4963ef
 
Jakub Jelinek 4963ef
 check_PROGRAMS = \
Jakub Jelinek 888c61
 	bug129390-ppc32 \
Jakub Jelinek 888c61
 	bug139050-ppc32 \
Jakub Jelinek 888c61
 	ldstrev lsw jm-insns mftocrf mcrfs round test_fx test_gx \
Jakub Jelinek 888c61
-	testVMX twi tw xlc_dbl_u32
Jakub Jelinek 888c61
+	testVMX twi tw xlc_dbl_u32 power5+_round power6_bcmp
Jakub Jelinek 4963ef
 
Jakub Jelinek 4963ef
 AM_CFLAGS   = $(WERROR) -Winline -Wall -Wshadow -g -I$(top_srcdir)/include \
Jakub Jelinek 4963ef
 		@FLAG_M32@
Jakub Jelinek 888c61
--- valgrind-3.3.0/none/tests/ppc32/power5+_round.c.jj	2008-03-03 09:58:59.000000000 +0100
Jakub Jelinek 888c61
+++ valgrind-3.3.0/none/tests/ppc32/power5+_round.c	2008-03-03 09:58:59.000000000 +0100
Jakub Jelinek 4963ef
@@ -0,0 +1,147 @@
Jakub Jelinek 4963ef
+/*  Copyright (C) 2007  Pete Eberlein  eberlein@us.ibm.com
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+    This program is free software; you can redistribute it and/or
Jakub Jelinek 4963ef
+    modify it under the terms of the GNU General Public License as
Jakub Jelinek 4963ef
+    published by the Free Software Foundation; either version 2 of the
Jakub Jelinek 4963ef
+    License, or (at your option) any later version.
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+    This program is distributed in the hope that it will be useful, but
Jakub Jelinek 4963ef
+    WITHOUT ANY WARRANTY; without even the implied warranty of
Jakub Jelinek 4963ef
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Jakub Jelinek 4963ef
+    General Public License for more details.
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+    You should have received a copy of the GNU General Public License
Jakub Jelinek 4963ef
+    along with this program; if not, write to the Free Software
Jakub Jelinek 4963ef
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
Jakub Jelinek 4963ef
+    02111-1307, USA.
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+    The GNU General Public License is contained in the file COPYING.
Jakub Jelinek 4963ef
+*/
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+#include <stdio.h>
Jakub Jelinek 4963ef
+#include <stdlib.h>
Jakub Jelinek 4963ef
+#include <strings.h>
Jakub Jelinek 4963ef
+#include <math.h>
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+#define POS_NORMAL   0x4000
Jakub Jelinek 4963ef
+#define NEG_NORMAL   0x8000
Jakub Jelinek 4963ef
+#define POS_INF      0x5000
Jakub Jelinek 4963ef
+#define NEG_INF      0x9000
Jakub Jelinek 4963ef
+#define POS_ZERO     0x2000
Jakub Jelinek 4963ef
+#define NEG_ZERO     0x12000
Jakub Jelinek 4963ef
+#define POS_DENORMAL 0x14000
Jakub Jelinek 4963ef
+#define NEG_DENORMAL 0x18000
Jakub Jelinek 4963ef
+#define NAN          0x11000
Jakub Jelinek 4963ef
+#define FPRF_MASK    0x1F000
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+int main (int argc, char* argv[]) {
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+  double inf, neg0, nan;
Jakub Jelinek 4963ef
+  union {
Jakub Jelinek 4963ef
+    double d;
Jakub Jelinek 4963ef
+    struct { unsigned int dummy, dummy2: 15, fprf:17; };
Jakub Jelinek 4963ef
+  } fpscr;
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+  inf = strtod("inf", NULL);
Jakub Jelinek 4963ef
+  neg0 = copysign(0, -1);
Jakub Jelinek 4963ef
+  nan = strtod("nan", NULL);
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+ /* This set is disabled until fprf is implemented. */
Jakub Jelinek 4963ef
+ if (0) {  
Jakub Jelinek 4963ef
+  double set[] = {inf, 1.5, 0, neg0, -1.5, -inf, nan};
Jakub Jelinek 4963ef
+  int i, j, fprf;
Jakub Jelinek 4963ef
+  for (i=0; i<7; ++i) {
Jakub Jelinek 4963ef
+   for (j=0; j<7; ++j) {
Jakub Jelinek 4963ef
+    asm ("fcmpu 1, %1, %2\n\t" \
Jakub Jelinek 4963ef
+         "mffs %0\n" \
Jakub Jelinek 4963ef
+    : "=f" (fpscr.d) \
Jakub Jelinek 4963ef
+    : "f" (set[i]), "f" (set[j]) \
Jakub Jelinek 4963ef
+    );
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+    if (i == 6 || j == 6) {
Jakub Jelinek 4963ef
+      fprf = 0x1000; // Unordered
Jakub Jelinek 4963ef
+    } else if (i == j || (i==2 && j==3) || (i==3 && j==2)) {
Jakub Jelinek 4963ef
+      fprf = 0x2000; // Equal
Jakub Jelinek 4963ef
+    } else if (i < j) {
Jakub Jelinek 4963ef
+      fprf = 0x4000; // Greater Than
Jakub Jelinek 4963ef
+    } else if (i > j) {
Jakub Jelinek 4963ef
+      fprf = 0x8000; // Less Than
Jakub Jelinek 4963ef
+    }
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+    printf("fcmpu\t%.1f\t%.1f\t%x\t%s\n", set[i], set[j], fpscr.fprf,
Jakub Jelinek 4963ef
+                                   fpscr.fprf == fprf ? "PASS" : "FAIL");
Jakub Jelinek 4963ef
+   }
Jakub Jelinek 4963ef
+  }
Jakub Jelinek 4963ef
+ }
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+ {
Jakub Jelinek 4963ef
+  double set[]  = {inf, 1.9, 1.1, 0, neg0, -1.1, -1.9, -inf, nan};
Jakub Jelinek 4963ef
+  double frin[] = {inf, 2.0, 1.0, 0, neg0, -1.0, -2.0, -inf, nan};
Jakub Jelinek 4963ef
+  double friz[] = {inf, 1.0, 1.0, 0, neg0, -1.0, -1.0, -inf, nan};
Jakub Jelinek 4963ef
+  double frip[] = {inf, 2.0, 2.0, 0, neg0, -1.0, -1.0, -inf, nan};
Jakub Jelinek 4963ef
+  double frim[] = {inf, 1.0, 1.0, 0, neg0, -2.0, -2.0, -inf, nan};
Jakub Jelinek 4963ef
+  int fprf[] = {POS_INF, POS_NORMAL, POS_NORMAL, POS_ZERO, NEG_ZERO, 
Jakub Jelinek 4963ef
+                NEG_NORMAL, NEG_NORMAL, NEG_INF, NAN};
Jakub Jelinek 4963ef
+  double set2[]  = {0.9, 0.1, -0.1, -0.9, 1e-40, -1e-40};
Jakub Jelinek 4963ef
+  double frin2[] = {1.0, 0.0, -0.0, -1.0, 0.0,   -0.0};
Jakub Jelinek 4963ef
+  int frin2rf[]  = {POS_NORMAL,POS_ZERO,NEG_ZERO,NEG_NORMAL,POS_ZERO,NEG_ZERO};
Jakub Jelinek 4963ef
+  double friz2[] = {0.0, 0.0, -0.0, -0.0, 0.0,   -0.0};
Jakub Jelinek 4963ef
+  int friz2rf[]  = {POS_ZERO,POS_ZERO,NEG_ZERO,NEG_ZERO,POS_ZERO,NEG_ZERO};
Jakub Jelinek 4963ef
+  double frip2[] = {1.0, 1.0, -0.0, -0.0, 1.0,   -0.0};
Jakub Jelinek 4963ef
+  int frip2rf[]  = {POS_NORMAL,POS_NORMAL,NEG_ZERO,NEG_ZERO,POS_NORMAL,NEG_ZERO};
Jakub Jelinek 4963ef
+  double frim2[] = {0.0, 0.0, -1.0, -1.0, 0.0,   -1.0};
Jakub Jelinek 4963ef
+  int frim2rf[]  = {POS_ZERO,POS_ZERO,NEG_NORMAL,NEG_NORMAL,POS_ZERO,NEG_NORMAL};
Jakub Jelinek 4963ef
+  double ret;
Jakub Jelinek 4963ef
+  int i;
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+#define DO_TEST(op,in,out,rf)  for (i=0; i
Jakub Jelinek 4963ef
+    asm (#op" %0, %2\n\t" \
Jakub Jelinek 4963ef
+       "mffs %1\n" \
Jakub Jelinek 4963ef
+    : "=f" (ret), "=f" (fpscr.d) \
Jakub Jelinek 4963ef
+    : "f" (in[i]) \
Jakub Jelinek 4963ef
+    ); \
Jakub Jelinek 4963ef
+    printf(#op"\t%g\t%g\t%x\t%s\n", in[i], ret, fpscr.fprf, \
Jakub Jelinek 4963ef
+           (!bcmp(&ret, &out[i], sizeof(double))) /*&& (rf[i] == fpscr.fprf)*/ \
Jakub Jelinek 4963ef
+	   ? "PASS" : "FAIL"); \
Jakub Jelinek 4963ef
+  }
Jakub Jelinek 4963ef
+  /* Note: fprf check above is disabled until fprf is implemented. */
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+  DO_TEST(frin,set, frin, fprf);
Jakub Jelinek 4963ef
+  DO_TEST(frin,set2,frin2,frin2rf);
Jakub Jelinek 4963ef
+  DO_TEST(friz,set, friz, fprf);
Jakub Jelinek 4963ef
+  DO_TEST(friz,set2,friz2,friz2rf);
Jakub Jelinek 4963ef
+  DO_TEST(frip,set, frip, fprf);
Jakub Jelinek 4963ef
+  DO_TEST(frip,set2,frip2,frip2rf);
Jakub Jelinek 4963ef
+  DO_TEST(frim,set, frim, fprf);
Jakub Jelinek 4963ef
+  DO_TEST(frim,set2,frim2,frim2rf);
Jakub Jelinek 4963ef
+ }
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+ /* This set is disabled until fprf is implemented. */
Jakub Jelinek 4963ef
+ if (0) { 
Jakub Jelinek 4963ef
+  double set1[]    = {inf, 0.9, 0.1, 0, neg0, -0.1, -0.9, -inf, nan};
Jakub Jelinek 4963ef
+  double frsp1[]   = {inf, 0.9f,0.1f,0, neg0, -0.1f,-0.9f,-inf, nan};
Jakub Jelinek 4963ef
+  int fprf1[] = {POS_INF, POS_NORMAL, POS_NORMAL, POS_ZERO, NEG_ZERO, NEG_NORMAL,
Jakub Jelinek 4963ef
+                NEG_NORMAL, NEG_INF, NAN};
Jakub Jelinek 4963ef
+  double set2[]    = {1.2e-38, 1.1e-38, 1e-40, 8e-44, 9e-44, 8e-46, 7e-46};
Jakub Jelinek 4963ef
+  double frsp2[]   = {1.2e-38f,1.1e-38f,1e-40f,8e-44f,9e-44f,8e-46f,0.0};
Jakub Jelinek 4963ef
+  int fprf2[] = {POS_NORMAL, POS_DENORMAL, POS_DENORMAL, POS_DENORMAL, 
Jakub Jelinek 4963ef
+                POS_DENORMAL, POS_DENORMAL, POS_ZERO};
Jakub Jelinek 4963ef
+  double set3[]    = {-1.2e-38, -1.1e-38, -1e-40, -8e-44, -9e-44, -8e-46, -7e-46};
Jakub Jelinek 4963ef
+  double frsp3[]   = {-1.2e-38f,-1.1e-38f,-1e-40f,-8e-44f,-9e-44f,-8e-46f,-0.0};
Jakub Jelinek 4963ef
+  int fprf3[] = {NEG_NORMAL, NEG_DENORMAL, NEG_DENORMAL, NEG_DENORMAL, 
Jakub Jelinek 4963ef
+                NEG_DENORMAL, NEG_DENORMAL, NEG_ZERO};
Jakub Jelinek 4963ef
+  double ret;
Jakub Jelinek 4963ef
+  int i;
Jakub Jelinek 4963ef
+  DO_TEST(frsp,set1,frsp1,fprf1);
Jakub Jelinek 4963ef
+  DO_TEST(frsp,set2,frsp2,fprf2);
Jakub Jelinek 4963ef
+  DO_TEST(frsp,set3,frsp3,fprf3);
Jakub Jelinek 4963ef
+ }
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+ return 0;
Jakub Jelinek 4963ef
+}
Jakub Jelinek 888c61
--- valgrind-3.3.0/none/tests/ppc32/power5+_round.stderr.exp.jj	2008-03-03 09:58:59.000000000 +0100
Jakub Jelinek 888c61
+++ valgrind-3.3.0/none/tests/ppc32/power5+_round.stderr.exp	2008-03-03 09:58:59.000000000 +0100
Jakub Jelinek 4963ef
@@ -0,0 +1,2 @@
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+
Jakub Jelinek 888c61
--- valgrind-3.3.0/none/tests/ppc32/power5+_round.stdout.exp.jj	2008-03-03 09:58:59.000000000 +0100
Jakub Jelinek 888c61
+++ valgrind-3.3.0/none/tests/ppc32/power5+_round.stdout.exp	2008-03-03 09:58:59.000000000 +0100
Jakub Jelinek 4963ef
@@ -0,0 +1,60 @@
Jakub Jelinek 4963ef
+frin	inf	inf	0	PASS
Jakub Jelinek 4963ef
+frin	1.9	2	0	PASS
Jakub Jelinek 4963ef
+frin	1.1	1	0	PASS
Jakub Jelinek 4963ef
+frin	0	0	0	PASS
Jakub Jelinek 4963ef
+frin	-0	-0	0	PASS
Jakub Jelinek 4963ef
+frin	-1.1	-1	0	PASS
Jakub Jelinek 4963ef
+frin	-1.9	-2	0	PASS
Jakub Jelinek 4963ef
+frin	-inf	-inf	0	PASS
Jakub Jelinek 4963ef
+frin	nan	nan	0	PASS
Jakub Jelinek 4963ef
+frin	0.9	1	0	PASS
Jakub Jelinek 4963ef
+frin	0.1	0	0	PASS
Jakub Jelinek 4963ef
+frin	-0.1	-0	0	PASS
Jakub Jelinek 4963ef
+frin	-0.9	-1	0	PASS
Jakub Jelinek 4963ef
+frin	1e-40	0	0	PASS
Jakub Jelinek 4963ef
+frin	-1e-40	-0	0	PASS
Jakub Jelinek 4963ef
+friz	inf	inf	0	PASS
Jakub Jelinek 4963ef
+friz	1.9	1	0	PASS
Jakub Jelinek 4963ef
+friz	1.1	1	0	PASS
Jakub Jelinek 4963ef
+friz	0	0	0	PASS
Jakub Jelinek 4963ef
+friz	-0	-0	0	PASS
Jakub Jelinek 4963ef
+friz	-1.1	-1	0	PASS
Jakub Jelinek 4963ef
+friz	-1.9	-1	0	PASS
Jakub Jelinek 4963ef
+friz	-inf	-inf	0	PASS
Jakub Jelinek 4963ef
+friz	nan	nan	0	PASS
Jakub Jelinek 4963ef
+friz	0.9	0	0	PASS
Jakub Jelinek 4963ef
+friz	0.1	0	0	PASS
Jakub Jelinek 4963ef
+friz	-0.1	-0	0	PASS
Jakub Jelinek 4963ef
+friz	-0.9	-0	0	PASS
Jakub Jelinek 4963ef
+friz	1e-40	0	0	PASS
Jakub Jelinek 4963ef
+friz	-1e-40	-0	0	PASS
Jakub Jelinek 4963ef
+frip	inf	inf	0	PASS
Jakub Jelinek 4963ef
+frip	1.9	2	0	PASS
Jakub Jelinek 4963ef
+frip	1.1	2	0	PASS
Jakub Jelinek 4963ef
+frip	0	0	0	PASS
Jakub Jelinek 4963ef
+frip	-0	-0	0	PASS
Jakub Jelinek 4963ef
+frip	-1.1	-1	0	PASS
Jakub Jelinek 4963ef
+frip	-1.9	-1	0	PASS
Jakub Jelinek 4963ef
+frip	-inf	-inf	0	PASS
Jakub Jelinek 4963ef
+frip	nan	nan	0	PASS
Jakub Jelinek 4963ef
+frip	0.9	1	0	PASS
Jakub Jelinek 4963ef
+frip	0.1	1	0	PASS
Jakub Jelinek 4963ef
+frip	-0.1	-0	0	PASS
Jakub Jelinek 4963ef
+frip	-0.9	-0	0	PASS
Jakub Jelinek 4963ef
+frip	1e-40	1	0	PASS
Jakub Jelinek 4963ef
+frip	-1e-40	-0	0	PASS
Jakub Jelinek 4963ef
+frim	inf	inf	0	PASS
Jakub Jelinek 4963ef
+frim	1.9	1	0	PASS
Jakub Jelinek 4963ef
+frim	1.1	1	0	PASS
Jakub Jelinek 4963ef
+frim	0	0	0	PASS
Jakub Jelinek 4963ef
+frim	-0	-0	0	PASS
Jakub Jelinek 4963ef
+frim	-1.1	-2	0	PASS
Jakub Jelinek 4963ef
+frim	-1.9	-2	0	PASS
Jakub Jelinek 4963ef
+frim	-inf	-inf	0	PASS
Jakub Jelinek 4963ef
+frim	nan	nan	0	PASS
Jakub Jelinek 4963ef
+frim	0.9	0	0	PASS
Jakub Jelinek 4963ef
+frim	0.1	0	0	PASS
Jakub Jelinek 4963ef
+frim	-0.1	-1	0	PASS
Jakub Jelinek 4963ef
+frim	-0.9	-1	0	PASS
Jakub Jelinek 4963ef
+frim	1e-40	0	0	PASS
Jakub Jelinek 4963ef
+frim	-1e-40	-1	0	PASS
Jakub Jelinek 888c61
--- valgrind-3.3.0/none/tests/ppc32/power5+_round.vgtest.jj	2008-03-03 09:58:59.000000000 +0100
Jakub Jelinek 888c61
+++ valgrind-3.3.0/none/tests/ppc32/power5+_round.vgtest	2008-03-03 09:58:59.000000000 +0100
Jakub Jelinek 4963ef
@@ -0,0 +1 @@
Jakub Jelinek 4963ef
+prog: power5+_round
Jakub Jelinek 888c61
--- valgrind-3.3.0/none/tests/ppc32/power6_bcmp.c.jj	2008-03-03 09:58:59.000000000 +0100
Jakub Jelinek 888c61
+++ valgrind-3.3.0/none/tests/ppc32/power6_bcmp.c	2008-03-03 09:58:59.000000000 +0100
Jakub Jelinek 4963ef
@@ -0,0 +1,58 @@
Jakub Jelinek 4963ef
+/*  Copyright (C) 2007  Pete Eberlein  eberlein@us.ibm.com
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+    This program is free software; you can redistribute it and/or
Jakub Jelinek 4963ef
+    modify it under the terms of the GNU General Public License as
Jakub Jelinek 4963ef
+    published by the Free Software Foundation; either version 2 of the
Jakub Jelinek 4963ef
+    License, or (at your option) any later version.
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+    This program is distributed in the hope that it will be useful, but
Jakub Jelinek 4963ef
+    WITHOUT ANY WARRANTY; without even the implied warranty of
Jakub Jelinek 4963ef
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Jakub Jelinek 4963ef
+    General Public License for more details.
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+    You should have received a copy of the GNU General Public License
Jakub Jelinek 4963ef
+    along with this program; if not, write to the Free Software
Jakub Jelinek 4963ef
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
Jakub Jelinek 4963ef
+    02111-1307, USA.
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+    The GNU General Public License is contained in the file COPYING.
Jakub Jelinek 4963ef
+*/
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+#include <stdio.h>
Jakub Jelinek 4963ef
+#include <stdlib.h>
Jakub Jelinek 4963ef
+#include <strings.h>
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+#define CMPB(result,a,b) \
Jakub Jelinek 4963ef
+    asm __volatile ("cmpb %0, %1, %2\n" : "=r"(result) : "r"(a), "r"(b))
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+int main (int argc, char* argv[]) {
Jakub Jelinek 4963ef
+  int i,j,k;
Jakub Jelinek 4963ef
+  long mask;
Jakub Jelinek 4963ef
+  for (i=1; i<16; i++) {
Jakub Jelinek 4963ef
+   mask = 0;
Jakub Jelinek 4963ef
+   if(i&1) mask+=0xff;
Jakub Jelinek 4963ef
+   if(i&2) mask+=0xff00;
Jakub Jelinek 4963ef
+   if(i&4) mask+=0xff0000;
Jakub Jelinek 4963ef
+   if(i&8) mask+=0xff000000;
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+   for (j=0; j<256; j++)
Jakub Jelinek 4963ef
+    for (k=0; k<256; k++)
Jakub Jelinek 4963ef
+      if (j!=k) {
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+    long a, b, result;
Jakub Jelinek 4963ef
+    a = (mask & (j*0x1010101)) + ((~mask) & (k*0x1010101));
Jakub Jelinek 4963ef
+    b = j*0x1010101;
Jakub Jelinek 4963ef
+    CMPB(result, a, b);
Jakub Jelinek 4963ef
+    if (result != mask)
Jakub Jelinek 4963ef
+      printf("%8x %8x %8x %8x\n", mask, a, b, result);
Jakub Jelinek 4963ef
+      exit(1);
Jakub Jelinek 4963ef
+    }
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+  }
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+  return 0;
Jakub Jelinek 4963ef
+}
Jakub Jelinek 4963ef
+
Jakub Jelinek 888c61
--- valgrind-3.3.0/none/tests/ppc32/power6_bcmp.stderr.exp.jj	2008-03-03 09:58:59.000000000 +0100
Jakub Jelinek 888c61
+++ valgrind-3.3.0/none/tests/ppc32/power6_bcmp.stderr.exp	2008-03-03 09:58:59.000000000 +0100
Jakub Jelinek 4963ef
@@ -0,0 +1,2 @@
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+
Jakub Jelinek 888c61
--- valgrind-3.3.0/none/tests/ppc32/power6_bcmp.vgtest.jj	2008-03-03 09:58:59.000000000 +0100
Jakub Jelinek 888c61
+++ valgrind-3.3.0/none/tests/ppc32/power6_bcmp.vgtest	2008-03-03 09:58:59.000000000 +0100
Jakub Jelinek 4963ef
@@ -0,0 +1 @@
Jakub Jelinek 4963ef
+prog: power6_bcmp
Jakub Jelinek 888c61
--- valgrind-3.3.0/none/tests/ppc64/Makefile.am.jj	2007-12-11 00:18:35.000000000 +0100
Jakub Jelinek 888c61
+++ valgrind-3.3.0/none/tests/ppc64/Makefile.am	2008-03-03 10:01:52.000000000 +0100
Jakub Jelinek 888c61
@@ -9,10 +9,12 @@ EXTRA_DIST = $(noinst_SCRIPTS) \
Jakub Jelinek 888c61
 	std_reg_imm.vgtest std_reg_imm.stderr.exp std_reg_imm.stdout.exp \
Jakub Jelinek 4963ef
 	round.stderr.exp round.stdout.exp round.vgtest \
Jakub Jelinek 888c61
 	twi_tdi.stderr.exp twi_tdi.stdout.exp twi_tdi.vgtest \
Jakub Jelinek 888c61
-	tw_td.stderr.exp tw_td.stdout.exp tw_td.vgtest
Jakub Jelinek 888c61
+	tw_td.stderr.exp tw_td.stdout.exp tw_td.vgtest \
Jakub Jelinek 4963ef
+	power6_bcmp.stderr.exp power6_bcmp.stdout.exp power6_bcmp.vgtest \
Jakub Jelinek 4963ef
+	power6_mf_gpr.stderr.exp power6_mf_gpr.stdout.exp power6_mf_gpr.vgtest
Jakub Jelinek 4963ef
 
Jakub Jelinek 4963ef
 check_PROGRAMS = \
Jakub Jelinek 888c61
-	jm-insns lsw round std_reg_imm twi_tdi tw_td
Jakub Jelinek 888c61
+	jm-insns lsw round std_reg_imm twi_tdi tw_td power6_bcmp power6_mf_gpr
Jakub Jelinek 4963ef
 
Jakub Jelinek 4963ef
 AM_CFLAGS   = $(WERROR) -Winline -Wall -Wshadow -g -I$(top_srcdir)/include \
Jakub Jelinek 4963ef
 		@FLAG_M64@
Jakub Jelinek 888c61
--- valgrind-3.3.0/none/tests/ppc64/power6_bcmp.c.jj	2008-03-03 09:58:59.000000000 +0100
Jakub Jelinek 888c61
+++ valgrind-3.3.0/none/tests/ppc64/power6_bcmp.c	2008-03-03 09:58:59.000000000 +0100
Jakub Jelinek 4963ef
@@ -0,0 +1,61 @@
Jakub Jelinek 4963ef
+/*  Copyright (C) 2007  Pete Eberlein  eberlein@us.ibm.com
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+    This program is free software; you can redistribute it and/or
Jakub Jelinek 4963ef
+    modify it under the terms of the GNU General Public License as
Jakub Jelinek 4963ef
+    published by the Free Software Foundation; either version 2 of the
Jakub Jelinek 4963ef
+    License, or (at your option) any later version.
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+    This program is distributed in the hope that it will be useful, but
Jakub Jelinek 4963ef
+    WITHOUT ANY WARRANTY; without even the implied warranty of
Jakub Jelinek 4963ef
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Jakub Jelinek 4963ef
+    General Public License for more details.
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+    You should have received a copy of the GNU General Public License
Jakub Jelinek 4963ef
+    along with this program; if not, write to the Free Software
Jakub Jelinek 4963ef
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
Jakub Jelinek 4963ef
+    02111-1307, USA.
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+    The GNU General Public License is contained in the file COPYING.
Jakub Jelinek 4963ef
+*/
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+#include <stdio.h>
Jakub Jelinek 4963ef
+#include <stdlib.h>
Jakub Jelinek 4963ef
+#include <strings.h>
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+#define CMPB(result,a,b) \
Jakub Jelinek 4963ef
+    asm ("cmpb %0, %1, %2\n" : "=r"(result) : "r"(a), "r"(b))
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+int main (int argc, char* argv[]) {
Jakub Jelinek 4963ef
+  int i,j,k;
Jakub Jelinek 4963ef
+  unsigned long mask;
Jakub Jelinek 4963ef
+  for (i=1; i<256; i++) {
Jakub Jelinek 4963ef
+   mask = 0;
Jakub Jelinek 4963ef
+   if(i&1) mask+=0xff;
Jakub Jelinek 4963ef
+   if(i&2) mask+=0xff00;
Jakub Jelinek 4963ef
+   if(i&4) mask+=0xff0000;
Jakub Jelinek 4963ef
+   if(i&8) mask+=0xff000000;
Jakub Jelinek 4963ef
+   if(i&16) mask+=0xff00000000;
Jakub Jelinek 4963ef
+   if(i&32) mask+=0xff0000000000;
Jakub Jelinek 4963ef
+   if(i&64) mask+=0xff000000000000;
Jakub Jelinek 4963ef
+   if(i&128) mask+=0xff00000000000000;
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+   for (j=0; j<256; j++)
Jakub Jelinek 4963ef
+    for (k=0; k<256; k++)
Jakub Jelinek 4963ef
+      if (j!=k) {
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+    unsigned long a, b, result;
Jakub Jelinek 4963ef
+    a = (mask & (j*0x101010101010101)) + ((~mask) & (k*0x101010101010101));
Jakub Jelinek 4963ef
+    b = j*0x101010101010101;
Jakub Jelinek 4963ef
+    CMPB(result, a, b);
Jakub Jelinek 4963ef
+    if (result != mask)
Jakub Jelinek 4963ef
+      printf("%8lx %8lx %8lx %8lx\n", mask, a, b, result);
Jakub Jelinek 4963ef
+      exit(1);
Jakub Jelinek 4963ef
+    }
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+  }
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+  return 0;
Jakub Jelinek 4963ef
+}
Jakub Jelinek 4963ef
+
Jakub Jelinek 888c61
--- valgrind-3.3.0/none/tests/ppc64/power6_bcmp.stderr.exp.jj	2008-03-03 09:58:59.000000000 +0100
Jakub Jelinek 888c61
+++ valgrind-3.3.0/none/tests/ppc64/power6_bcmp.stderr.exp	2008-03-03 09:58:59.000000000 +0100
Jakub Jelinek 4963ef
@@ -0,0 +1,2 @@
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+
Jakub Jelinek 888c61
--- valgrind-3.3.0/none/tests/ppc64/power6_bcmp.vgtest.jj	2008-03-03 09:58:59.000000000 +0100
Jakub Jelinek 888c61
+++ valgrind-3.3.0/none/tests/ppc64/power6_bcmp.vgtest	2008-03-03 09:58:59.000000000 +0100
Jakub Jelinek 4963ef
@@ -0,0 +1 @@
Jakub Jelinek 4963ef
+prog: power6_bcmp
Jakub Jelinek 888c61
--- valgrind-3.3.0/none/tests/ppc64/power6_mf_gpr.c.jj	2008-03-03 09:58:59.000000000 +0100
Jakub Jelinek 888c61
+++ valgrind-3.3.0/none/tests/ppc64/power6_mf_gpr.c	2008-03-03 09:58:59.000000000 +0100
Jakub Jelinek 4963ef
@@ -0,0 +1,47 @@
Jakub Jelinek 4963ef
+/*  Copyright (C) 2007  Pete Eberlein  eberlein@us.ibm.com
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+    This program is free software; you can redistribute it and/or
Jakub Jelinek 4963ef
+    modify it under the terms of the GNU General Public License as
Jakub Jelinek 4963ef
+    published by the Free Software Foundation; either version 2 of the
Jakub Jelinek 4963ef
+    License, or (at your option) any later version.
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+    This program is distributed in the hope that it will be useful, but
Jakub Jelinek 4963ef
+    WITHOUT ANY WARRANTY; without even the implied warranty of
Jakub Jelinek 4963ef
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Jakub Jelinek 4963ef
+    General Public License for more details.
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+    You should have received a copy of the GNU General Public License
Jakub Jelinek 4963ef
+    along with this program; if not, write to the Free Software
Jakub Jelinek 4963ef
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
Jakub Jelinek 4963ef
+    02111-1307, USA.
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+    The GNU General Public License is contained in the file COPYING.
Jakub Jelinek 4963ef
+*/
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+#include <stdio.h>
Jakub Jelinek 4963ef
+#include <string.h>
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+int main (int argc, char* argv[]) 
Jakub Jelinek 4963ef
+{
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+  long i;
Jakub Jelinek 4963ef
+  double f;
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+  i = 0;
Jakub Jelinek 4963ef
+  f = 100.0;
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+  printf("%lx %f\n", i, f);
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+  asm ("mftgpr %0, %1\n" : "=r"(i) : "f"(f));
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+  f=0.0;
Jakub Jelinek 4963ef
+  printf("%lx %f\n", i, f);
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+  asm ("mffgpr %0, %1\n" : "=f"(f) : "r"(i));
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+  printf("%lx %f\n", i, f);
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+  return 0;
Jakub Jelinek 4963ef
+}
Jakub Jelinek 888c61
--- valgrind-3.3.0/none/tests/ppc64/power6_mf_gpr.stderr.exp.jj	2008-03-03 09:58:59.000000000 +0100
Jakub Jelinek 888c61
+++ valgrind-3.3.0/none/tests/ppc64/power6_mf_gpr.stderr.exp	2008-03-03 09:58:59.000000000 +0100
Jakub Jelinek 4963ef
@@ -0,0 +1,2 @@
Jakub Jelinek 4963ef
+
Jakub Jelinek 4963ef
+
Jakub Jelinek 888c61
--- valgrind-3.3.0/none/tests/ppc64/power6_mf_gpr.stdout.exp.jj	2008-03-03 09:58:59.000000000 +0100
Jakub Jelinek 888c61
+++ valgrind-3.3.0/none/tests/ppc64/power6_mf_gpr.stdout.exp	2008-03-03 09:58:59.000000000 +0100
Jakub Jelinek 4963ef
@@ -0,0 +1,3 @@
Jakub Jelinek 4963ef
+0 100.000000
Jakub Jelinek 4963ef
+4059000000000000 0.000000
Jakub Jelinek 4963ef
+4059000000000000 100.000000
Jakub Jelinek 888c61
--- valgrind-3.3.0/none/tests/ppc64/power6_mf_gpr.vgtest.jj	2008-03-03 09:58:59.000000000 +0100
Jakub Jelinek 888c61
+++ valgrind-3.3.0/none/tests/ppc64/power6_mf_gpr.vgtest	2008-03-03 09:58:59.000000000 +0100
Jakub Jelinek 4963ef
@@ -0,0 +1 @@
Jakub Jelinek 4963ef
+prog: power6_mf_gpr
Jakub Jelinek 888c61
--- valgrind-3.3.0/none/tests/ppc32/Makefile.in.jj	2007-12-11 00:23:53.000000000 +0100
Jakub Jelinek 888c61
+++ valgrind-3.3.0/none/tests/ppc32/Makefile.in	2008-03-03 10:02:14.000000000 +0100
Jakub Jelinek 888c61
@@ -40,7 +40,8 @@ check_PROGRAMS = bug129390-ppc32$(EXEEXT
Jakub Jelinek 888c61
 	ldstrev$(EXEEXT) lsw$(EXEEXT) jm-insns$(EXEEXT) \
Jakub Jelinek 888c61
 	mftocrf$(EXEEXT) mcrfs$(EXEEXT) round$(EXEEXT) \
Jakub Jelinek 888c61
 	test_fx$(EXEEXT) test_gx$(EXEEXT) testVMX$(EXEEXT) \
Jakub Jelinek 888c61
-	twi$(EXEEXT) tw$(EXEEXT) xlc_dbl_u32$(EXEEXT)
Jakub Jelinek 888c61
+	twi$(EXEEXT) tw$(EXEEXT) xlc_dbl_u32$(EXEEXT) \
Jakub Jelinek 888c61
+	power5+_round$(EXEEXT) power6_bcmp$(EXEEXT)
Jakub Jelinek 4963ef
 subdir = none/tests/ppc32
Jakub Jelinek 4963ef
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
Jakub Jelinek 4963ef
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
Jakub Jelinek 888c61
@@ -71,6 +72,12 @@ mcrfs_LDADD = $(LDADD)
Jakub Jelinek 4963ef
 mftocrf_SOURCES = mftocrf.c
Jakub Jelinek 4963ef
 mftocrf_OBJECTS = mftocrf.$(OBJEXT)
Jakub Jelinek 4963ef
 mftocrf_LDADD = $(LDADD)
Jakub Jelinek 4963ef
+power5__round_SOURCES = power5+_round.c
Jakub Jelinek 4963ef
+power5__round_OBJECTS = power5+_round.$(OBJEXT)
Jakub Jelinek 4963ef
+power5__round_LDADD = $(LDADD)
Jakub Jelinek 4963ef
+power6_bcmp_SOURCES = power6_bcmp.c
Jakub Jelinek 4963ef
+power6_bcmp_OBJECTS = power6_bcmp.$(OBJEXT)
Jakub Jelinek 4963ef
+power6_bcmp_LDADD = $(LDADD)
Jakub Jelinek 4963ef
 round_SOURCES = round.c
Jakub Jelinek 4963ef
 round_OBJECTS = round.$(OBJEXT)
Jakub Jelinek 4963ef
 round_LDADD = $(LDADD)
Jakub Jelinek 888c61
@@ -101,11 +108,12 @@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUD
Jakub Jelinek 4963ef
 CCLD = $(CC)
Jakub Jelinek 4963ef
 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
Jakub Jelinek 888c61
 SOURCES = bug129390-ppc32.c bug139050-ppc32.c jm-insns.c ldstrev.c \
Jakub Jelinek 888c61
-	lsw.c mcrfs.c mftocrf.c round.c testVMX.c test_fx.c test_gx.c \
Jakub Jelinek 888c61
-	tw.c twi.c xlc_dbl_u32.c
Jakub Jelinek 888c61
+	lsw.c mcrfs.c mftocrf.c power5+_round.c power6_bcmp.c round.c \
Jakub Jelinek 888c61
+	testVMX.c test_fx.c test_gx.c tw.c twi.c xlc_dbl_u32.c
Jakub Jelinek 888c61
 DIST_SOURCES = bug129390-ppc32.c bug139050-ppc32.c jm-insns.c \
Jakub Jelinek 888c61
-	ldstrev.c lsw.c mcrfs.c mftocrf.c round.c testVMX.c test_fx.c \
Jakub Jelinek 888c61
-	test_gx.c tw.c twi.c xlc_dbl_u32.c
Jakub Jelinek 888c61
+	ldstrev.c lsw.c mcrfs.c mftocrf.c power5+_round.c \
Jakub Jelinek 888c61
+	power6_bcmp.c round.c testVMX.c test_fx.c test_gx.c tw.c twi.c \
Jakub Jelinek 4963ef
+	xlc_dbl_u32.c
Jakub Jelinek 4963ef
 ETAGS = etags
Jakub Jelinek 4963ef
 CTAGS = ctags
Jakub Jelinek 4963ef
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
Jakub Jelinek 888c61
@@ -266,7 +275,9 @@ EXTRA_DIST = $(noinst_SCRIPTS) \
Jakub Jelinek 4963ef
 	testVMX.stderr.exp  testVMX.stdout.exp  testVMX.vgtest \
Jakub Jelinek 4963ef
 	twi.stderr.exp twi.stdout.exp twi.vgtest \
Jakub Jelinek 888c61
 	tw.stderr.exp tw.stdout.exp tw.vgtest \
Jakub Jelinek 4963ef
-	xlc_dbl_u32.stderr.exp xlc_dbl_u32.stdout.exp xlc_dbl_u32.vgtest
Jakub Jelinek 4963ef
+	xlc_dbl_u32.stderr.exp xlc_dbl_u32.stdout.exp xlc_dbl_u32.vgtest \
Jakub Jelinek 4963ef
+	power5+_round.stderr.exp power5+_round.stdout.exp power5+_round.vgtest \
Jakub Jelinek 4963ef
+	power6_bcmp.stderr.exp power6_bcmp.stdout.exp power6_bcmp.vgtest
Jakub Jelinek 4963ef
 
Jakub Jelinek 4963ef
 AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -g -I$(top_srcdir)/include \
Jakub Jelinek 4963ef
 		@FLAG_M32@
Jakub Jelinek 888c61
@@ -335,6 +346,12 @@ mcrfs$(EXEEXT): $(mcrfs_OBJECTS) $(mcrfs
Jakub Jelinek 4963ef
 mftocrf$(EXEEXT): $(mftocrf_OBJECTS) $(mftocrf_DEPENDENCIES) 
Jakub Jelinek 4963ef
 	@rm -f mftocrf$(EXEEXT)
Jakub Jelinek 4963ef
 	$(LINK) $(mftocrf_LDFLAGS) $(mftocrf_OBJECTS) $(mftocrf_LDADD) $(LIBS)
Jakub Jelinek 4963ef
+power5+_round$(EXEEXT): $(power5__round_OBJECTS) $(power5__round_DEPENDENCIES) 
Jakub Jelinek 4963ef
+	@rm -f power5+_round$(EXEEXT)
Jakub Jelinek 4963ef
+	$(LINK) $(power5__round_LDFLAGS) $(power5__round_OBJECTS) $(power5__round_LDADD) $(LIBS)
Jakub Jelinek 4963ef
+power6_bcmp$(EXEEXT): $(power6_bcmp_OBJECTS) $(power6_bcmp_DEPENDENCIES) 
Jakub Jelinek 4963ef
+	@rm -f power6_bcmp$(EXEEXT)
Jakub Jelinek 4963ef
+	$(LINK) $(power6_bcmp_LDFLAGS) $(power6_bcmp_OBJECTS) $(power6_bcmp_LDADD) $(LIBS)
Jakub Jelinek 4963ef
 round$(EXEEXT): $(round_OBJECTS) $(round_DEPENDENCIES) 
Jakub Jelinek 4963ef
 	@rm -f round$(EXEEXT)
Jakub Jelinek 4963ef
 	$(LINK) $(round_LDFLAGS) $(round_OBJECTS) $(round_LDADD) $(LIBS)
Jakub Jelinek 888c61
@@ -370,6 +387,8 @@ distclean-compile:
Jakub Jelinek 4963ef
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsw.Po@am__quote@
Jakub Jelinek 888c61
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mcrfs.Po@am__quote@
Jakub Jelinek 4963ef
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mftocrf.Po@am__quote@
Jakub Jelinek 4963ef
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/power5+_round.Po@am__quote@
Jakub Jelinek 4963ef
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/power6_bcmp.Po@am__quote@
Jakub Jelinek 4963ef
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/round.Po@am__quote@
Jakub Jelinek 4963ef
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testVMX-testVMX.Po@am__quote@
Jakub Jelinek 4963ef
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_fx.Po@am__quote@
Jakub Jelinek 888c61
--- valgrind-3.3.0/none/tests/ppc64/Makefile.in.jj	2007-12-11 00:23:55.000000000 +0100
Jakub Jelinek 888c61
+++ valgrind-3.3.0/none/tests/ppc64/Makefile.in	2008-03-03 10:02:14.000000000 +0100
Jakub Jelinek 888c61
@@ -37,7 +37,8 @@ POST_UNINSTALL = :
Jakub Jelinek 4963ef
 build_triplet = @build@
Jakub Jelinek 4963ef
 host_triplet = @host@
Jakub Jelinek 4963ef
 check_PROGRAMS = jm-insns$(EXEEXT) lsw$(EXEEXT) round$(EXEEXT) \
Jakub Jelinek 888c61
-	std_reg_imm$(EXEEXT) twi_tdi$(EXEEXT) tw_td$(EXEEXT)
Jakub Jelinek 888c61
+	std_reg_imm$(EXEEXT) twi_tdi$(EXEEXT) tw_td$(EXEEXT) \
Jakub Jelinek 888c61
+	power6_bcmp$(EXEEXT) power6_mf_gpr$(EXEEXT)
Jakub Jelinek 4963ef
 subdir = none/tests/ppc64
Jakub Jelinek 4963ef
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
Jakub Jelinek 4963ef
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
Jakub Jelinek 888c61
@@ -53,6 +54,12 @@ jm_insns_LDADD = $(LDADD)
Jakub Jelinek 4963ef
 lsw_SOURCES = lsw.c
Jakub Jelinek 4963ef
 lsw_OBJECTS = lsw.$(OBJEXT)
Jakub Jelinek 4963ef
 lsw_LDADD = $(LDADD)
Jakub Jelinek 4963ef
+power6_bcmp_SOURCES = power6_bcmp.c
Jakub Jelinek 4963ef
+power6_bcmp_OBJECTS = power6_bcmp.$(OBJEXT)
Jakub Jelinek 4963ef
+power6_bcmp_LDADD = $(LDADD)
Jakub Jelinek 4963ef
+power6_mf_gpr_SOURCES = power6_mf_gpr.c
Jakub Jelinek 4963ef
+power6_mf_gpr_OBJECTS = power6_mf_gpr.$(OBJEXT)
Jakub Jelinek 4963ef
+power6_mf_gpr_LDADD = $(LDADD)
Jakub Jelinek 4963ef
 round_SOURCES = round.c
Jakub Jelinek 4963ef
 round_OBJECTS = round.$(OBJEXT)
Jakub Jelinek 4963ef
 round_LDADD = $(LDADD)
Jakub Jelinek 888c61
@@ -73,9 +80,10 @@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUD
Jakub Jelinek 4963ef
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
Jakub Jelinek 4963ef
 CCLD = $(CC)
Jakub Jelinek 4963ef
 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
Jakub Jelinek 888c61
-SOURCES = jm-insns.c lsw.c round.c std_reg_imm.c tw_td.c twi_tdi.c
Jakub Jelinek 888c61
-DIST_SOURCES = jm-insns.c lsw.c round.c std_reg_imm.c tw_td.c \
Jakub Jelinek 888c61
-	twi_tdi.c
Jakub Jelinek 4963ef
+SOURCES = jm-insns.c lsw.c power6_bcmp.c power6_mf_gpr.c round.c \
Jakub Jelinek 888c61
+	std_reg_imm.c tw_td.c twi_tdi.c
Jakub Jelinek 4963ef
+DIST_SOURCES = jm-insns.c lsw.c power6_bcmp.c power6_mf_gpr.c round.c \
Jakub Jelinek 888c61
+	std_reg_imm.c tw_td.c twi_tdi.c
Jakub Jelinek 4963ef
 ETAGS = etags
Jakub Jelinek 4963ef
 CTAGS = ctags
Jakub Jelinek 4963ef
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
Jakub Jelinek 888c61
@@ -226,7 +235,9 @@ EXTRA_DIST = $(noinst_SCRIPTS) \
Jakub Jelinek 888c61
 	std_reg_imm.vgtest std_reg_imm.stderr.exp std_reg_imm.stdout.exp \
Jakub Jelinek 4963ef
 	round.stderr.exp round.stdout.exp round.vgtest \
Jakub Jelinek 888c61
 	twi_tdi.stderr.exp twi_tdi.stdout.exp twi_tdi.vgtest \
Jakub Jelinek 888c61
-	tw_td.stderr.exp tw_td.stdout.exp tw_td.vgtest
Jakub Jelinek 888c61
+	tw_td.stderr.exp tw_td.stdout.exp tw_td.vgtest \
Jakub Jelinek 4963ef
+	power6_bcmp.stderr.exp power6_bcmp.stdout.exp power6_bcmp.vgtest \
Jakub Jelinek 4963ef
+	power6_mf_gpr.stderr.exp power6_mf_gpr.stdout.exp power6_mf_gpr.vgtest
Jakub Jelinek 4963ef
 
Jakub Jelinek 4963ef
 AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -g -I$(top_srcdir)/include \
Jakub Jelinek 4963ef
 		@FLAG_M64@
Jakub Jelinek 888c61
@@ -277,6 +288,12 @@ jm-insns$(EXEEXT): $(jm_insns_OBJECTS) $
Jakub Jelinek 4963ef
 lsw$(EXEEXT): $(lsw_OBJECTS) $(lsw_DEPENDENCIES) 
Jakub Jelinek 4963ef
 	@rm -f lsw$(EXEEXT)
Jakub Jelinek 4963ef
 	$(LINK) $(lsw_LDFLAGS) $(lsw_OBJECTS) $(lsw_LDADD) $(LIBS)
Jakub Jelinek 4963ef
+power6_bcmp$(EXEEXT): $(power6_bcmp_OBJECTS) $(power6_bcmp_DEPENDENCIES) 
Jakub Jelinek 4963ef
+	@rm -f power6_bcmp$(EXEEXT)
Jakub Jelinek 4963ef
+	$(LINK) $(power6_bcmp_LDFLAGS) $(power6_bcmp_OBJECTS) $(power6_bcmp_LDADD) $(LIBS)
Jakub Jelinek 4963ef
+power6_mf_gpr$(EXEEXT): $(power6_mf_gpr_OBJECTS) $(power6_mf_gpr_DEPENDENCIES) 
Jakub Jelinek 4963ef
+	@rm -f power6_mf_gpr$(EXEEXT)
Jakub Jelinek 4963ef
+	$(LINK) $(power6_mf_gpr_LDFLAGS) $(power6_mf_gpr_OBJECTS) $(power6_mf_gpr_LDADD) $(LIBS)
Jakub Jelinek 4963ef
 round$(EXEEXT): $(round_OBJECTS) $(round_DEPENDENCIES) 
Jakub Jelinek 4963ef
 	@rm -f round$(EXEEXT)
Jakub Jelinek 4963ef
 	$(LINK) $(round_LDFLAGS) $(round_OBJECTS) $(round_LDADD) $(LIBS)
Jakub Jelinek 888c61
@@ -298,6 +315,8 @@ distclean-compile:
Jakub Jelinek 4963ef
 
Jakub Jelinek 4963ef
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jm_insns-jm-insns.Po@am__quote@
Jakub Jelinek 4963ef
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsw.Po@am__quote@
Jakub Jelinek 4963ef
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/power6_bcmp.Po@am__quote@
Jakub Jelinek 4963ef
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/power6_mf_gpr.Po@am__quote@
Jakub Jelinek 4963ef
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/round.Po@am__quote@
Jakub Jelinek 888c61
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/std_reg_imm.Po@am__quote@
Jakub Jelinek 888c61
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tw_td.Po@am__quote@