]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Remove deprecated IROps Iop_Clz32, Iop_Clz64, Iop_Ctz32, and Iop_Ctz64 master
authorFlorian Krohm <flo2030@eich-krohm.de>
Sun, 24 Aug 2025 20:46:25 +0000 (20:46 +0000)
committerFlorian Krohm <flo2030@eich-krohm.de>
Sun, 24 Aug 2025 20:46:25 +0000 (20:46 +0000)
Part of fixing https://bugs.kde.org/show_bug.cgi?id=507033

NEWS
VEX/priv/ir_defs.c
VEX/priv/ir_opt.c
VEX/pub/libvex_ir.h
VEX/useful/test_main.c
memcheck/mc_translate.c
memcheck/tests/vbit-test/irops.c
none/tests/iropt-test/irops.tab

diff --git a/NEWS b/NEWS
index c39e4f9f1c2707702d24468db6e86249e0eceaa4..853ba47d2d80274de9cb4e03578f66cf6666c44e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,8 @@ X86/macOS 10.13, AMD64/macOS 10.13 and nanoMIPS/Linux.
 
 * New VEX API function LibVEX_set_VexControl
 
+* The deprecated IROps: Iop_Clz32/64 and Iop_Ctz32/64 have been removed
+
 * ================== PLATFORM CHANGES =================
 
 * ==================== TOOL CHANGES ===================
@@ -69,6 +71,7 @@ are not entered into bugzilla tend to get forgotten about or ignored.
 506930  valgrind allows SIGKILL being reset to SIG_DFL
 506967  Implement and override mallinfo2
 506970  mmap needs an EBADF fd_allowed check
+507033  Remove deprecated Iop_Clz32/64 and Iop_Ctz32/64
 507173  s390x: Crash when constant folding is disabled
 507720  Review syscalls returning file descriptors (other platforms)
 507721  Wire up illumos and Solaris mallinfo
index ba61758d74d326a97fac355207dd2f7f3c73c47e..79b7cce6432d65cfd55e736f771fea105f3a0b0b 100644 (file)
@@ -190,11 +190,6 @@ void ppIROp ( IROp op )
       case Iop_MullU32:  vex_printf("MullU32"); return;
       case Iop_MullU64:  vex_printf("MullU64"); return;
 
-      case Iop_Clz64:    vex_printf("Clz64"); return;
-      case Iop_Clz32:    vex_printf("Clz32"); return;
-      case Iop_Ctz64:    vex_printf("Ctz64"); return;
-      case Iop_Ctz32:    vex_printf("Ctz32"); return;
-
       case Iop_ClzNat64: vex_printf("ClzNat64"); return;
       case Iop_ClzNat32: vex_printf("ClzNat32"); return;
       case Iop_CtzNat64: vex_printf("CtzNat64"); return;
@@ -1416,7 +1411,6 @@ Bool primopMightTrap ( IROp op )
    case Iop_ExpCmpNE16: case Iop_ExpCmpNE32: case Iop_ExpCmpNE64:
    case Iop_MullS8: case Iop_MullS16: case Iop_MullS32: case Iop_MullS64:
    case Iop_MullU8: case Iop_MullU16: case Iop_MullU32: case Iop_MullU64:
-   case Iop_Clz64: case Iop_Clz32: case Iop_Ctz64: case Iop_Ctz32:
    case Iop_ClzNat64: case Iop_ClzNat32: case Iop_CtzNat64: case Iop_CtzNat32:
    case Iop_PopCount64: case Iop_PopCount32:
    case Iop_CmpLT32S: case Iop_CmpLT64S: case Iop_CmpLE32S: case Iop_CmpLE64S:
@@ -3292,12 +3286,10 @@ void typeOfPrimop ( IROp op,
       case Iop_MullU64: case Iop_MullS64:
          BINARY(Ity_I64,Ity_I64, Ity_I128);
 
-      case Iop_Clz32: case Iop_Ctz32:
       case Iop_ClzNat32: case Iop_CtzNat32:
       case Iop_PopCount32:
          UNARY(Ity_I32, Ity_I32);
 
-      case Iop_Clz64: case Iop_Ctz64:
       case Iop_ClzNat64: case Iop_CtzNat64:
       case Iop_PopCount64:
          UNARY(Ity_I64, Ity_I64);
index fa2877f6bdaca46970967a6077f803edab06f5cf..100f6396f92272905f66b9dde003c9f4c6bc4f07 100644 (file)
@@ -1321,31 +1321,6 @@ static IRExpr* mkOnesOfPrimopResultType ( IROp op )
    }
 }
 
-/* Helpers for folding Clz32/64. */
-static UInt fold_Clz64 ( ULong value )
-{
-   UInt i;
-   vassert(value != 0ULL); /* no defined semantics for arg==0 */
-   for (i = 0; i < 64; ++i) {
-      if (0ULL != (value & (((ULong)1) << (63 - i)))) return i;
-   }
-   vassert(0);
-   /*NOTREACHED*/
-   return 0;
-}
-
-static UInt fold_Clz32 ( UInt value )
-{
-   UInt i;
-   vassert(value != 0); /* no defined semantics for arg==0 */
-   for (i = 0; i < 32; ++i) {
-      if (0 != (value & (((UInt)1) << (31 - i)))) return i;
-   }
-   vassert(0);
-   /*NOTREACHED*/
-   return 0;
-}
-
 /* Helpers for folding ClzNat32/64. */
 static UInt fold_ClzNat64 ( ULong value )
 {
@@ -1741,19 +1716,6 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e )
             break;
          }
 
-         case Iop_Clz32: {
-            UInt u32 = e->Iex.Unop.arg->Iex.Const.con->Ico.U32;
-            if (u32 != 0)
-               e2 = IRExpr_Const(IRConst_U32(fold_Clz32(u32)));
-            break;
-         }
-         case Iop_Clz64: {
-            ULong u64 = e->Iex.Unop.arg->Iex.Const.con->Ico.U64;
-            if (u64 != 0ULL)
-               e2 = IRExpr_Const(IRConst_U64(fold_Clz64(u64)));
-            break;
-         }
-
          case Iop_ClzNat32: {
             UInt u32 = e->Iex.Unop.arg->Iex.Const.con->Ico.U32;
             e2 = IRExpr_Const(IRConst_U32(fold_ClzNat32(u32)));
index 983cd50bcaf0aa26f6618799187e665deaf44e9c..750ba0701870bc793fde2eb2d8d6b9c7f2463941 100644 (file)
@@ -462,13 +462,6 @@ typedef
       Iop_MullU8, Iop_MullU16, Iop_MullU32, Iop_MullU64,
 
       /* Counting bits */
-      /* Ctz64/Ctz32/Clz64/Clz32 are UNDEFINED when given arguments of zero.
-         You must ensure they are never given a zero argument.  As of
-         2018-Nov-14 they are deprecated.  Try to use the Nat variants
-         immediately below, if you can.
-      */
-      Iop_Clz64, Iop_Clz32,   /* count leading zeroes */
-      Iop_Ctz64, Iop_Ctz32,   /* count trailing zeros */
       /* Count leading/trailing zeroes, with "natural" semantics for the
          case where the input is zero: then the result is the number of bits
          in the word. */
index 85168e7043cd213d2e741b188fdf6290658003a0..ba4e25017323525aba60ed412fb0c55ed0c40f03 100644 (file)
@@ -2022,10 +2022,6 @@ IRExpr* expr2vbits_Unop ( MCEnv* mce, IROp op, IRAtom* atom )
       case Iop_2xm1F64:
          return mkPCastTo(mce, Ity_I64, vatom);
 
-      case Iop_Clz32:
-      case Iop_Ctz32:
-         return mkPCastTo(mce, Ity_I32, vatom);
-
       case Iop_32Sto64:
       case Iop_32Uto64:
       case Iop_V128to64:
index b4e499cc00c0ad024191e6685eb9a1d2b76df633..dfaf10c2b5caa61e943956506dc3a8237faa275d 100644 (file)
@@ -2424,14 +2424,14 @@ IRAtom* expensiveCountTrailingZeroes ( MCEnv* mce, IROp czop,
    tl_assert(sameKindedAtoms(atom,vatom));
 
    switch (czop) {
-      case Iop_Ctz32: case Iop_CtzNat32:
+      case Iop_CtzNat32:
          ty = Ity_I32;
          xorOp = Iop_Xor32;
          subOp = Iop_Sub32;
          andOp = Iop_And32;
          one = mkU32(1);
          break;
-      case Iop_Ctz64: case Iop_CtzNat64:
+      case Iop_CtzNat64:
          ty = Ity_I64;
          xorOp = Iop_Xor64;
          subOp = Iop_Sub64;
@@ -2499,14 +2499,14 @@ IRAtom* expensiveCountLeadingZeroes ( MCEnv* mce, IROp czop,
    tl_assert(sameKindedAtoms(atom,vatom));
 
    switch (czop) {
-      case Iop_Clz32: case Iop_ClzNat32:
+      case Iop_ClzNat32:
          ty = Ity_I32;
          shrOp = Iop_Shr32;
          notOp = Iop_Not32;
          andOp = Iop_And32;
          mkRight = mkRight32;
          break;
-      case Iop_Clz64: case Iop_ClzNat64:
+      case Iop_ClzNat64:
          ty = Ity_I64;
          shrOp = Iop_Shr64;
          notOp = Iop_Not64;
@@ -5316,12 +5316,12 @@ IRExpr* expr2vbits_Unop ( MCEnv* mce, IROp op, IRAtom* atom )
       case Iop_NegF16:
          return mkPCastTo(mce, Ity_I16, vatom);
 
-      case Iop_Ctz32: case Iop_CtzNat32:
-      case Iop_Ctz64: case Iop_CtzNat64:
+      case Iop_CtzNat32:
+      case Iop_CtzNat64:
          return expensiveCountTrailingZeroes(mce, op, atom, vatom);
 
-      case Iop_Clz32: case Iop_ClzNat32:
-      case Iop_Clz64: case Iop_ClzNat64:
+      case Iop_ClzNat32:
+      case Iop_ClzNat64:
          return expensiveCountLeadingZeroes(mce, op, atom, vatom);
 
       // PopCount32: this is slightly pessimistic.  It is true that the
index 2f0ea8a6afda6a32c9e62e5a225e6fdac05fe686..aec2670b8996bb804df1bace9029404341a7e4e0 100644 (file)
@@ -108,10 +108,6 @@ static irop_t irops[] = {
   { DEFOP(Iop_MullU16,    UNDEF_LEFT), .s390x = 1, .amd64 = 1, .x86 = 1, .arm = 0, .ppc64 = 0, .ppc32 = 0, .mips32 =0, .mips64 = 0 },
   { DEFOP(Iop_MullU32,    UNDEF_LEFT), .s390x = 1, .amd64 = 1, .x86 = 1, .arm = 1, .ppc64 = 1, .ppc32 = 1, .mips32 =0, .mips64 = 1 }, // mips asserts
   { DEFOP(Iop_MullU64,    UNDEF_LEFT), .s390x = 1, .amd64 = 1, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 1 }, // ppc32, mips assert
-  { DEFOP(Iop_Clz64,      UNDEF_ALL),  .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 0 }, // ppc32 asserts
-  { DEFOP(Iop_Clz32,      UNDEF_ALL),  .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 1, .mips32 =0, .mips64 = 0 },
-  { DEFOP(Iop_Ctz64,      UNDEF_ALL),  .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 0, .ppc32 = 0, .mips32 =0, .mips64 = 0 },
-  { DEFOP(Iop_Ctz32,      UNDEF_ALL),  .s390x = 0, .amd64 = 0, .x86 = 0, .arm = 0, .ppc64 = 0, .ppc32 = 0, .mips32 =0, .mips64 = 0 },
   { DEFOP(Iop_ClzNat64,   UNDEF_ALL),  .s390x = 1, .amd64 = 1, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 1 }, // ppc32 asserts
   { DEFOP(Iop_ClzNat32,   UNDEF_ALL),  .s390x = 0, .amd64 = 0, .x86 = 1, .arm = 1, .ppc64 = 1, .ppc32 = 1, .mips32 =1, .mips64 = 1 },
   { DEFOP(Iop_CtzNat64,   UNDEF_ALL),  .s390x = 0, .amd64 = 1, .x86 = 0, .arm = 0, .ppc64 = 1, .ppc32 = 0, .mips32 =0, .mips64 = 0 },
index c65ff4cfb4f6212681506c02ba26a7761a243495..4163edfcd57fc918dc2d916c8ff7bb4f7dd9b946 100644 (file)
    { OPNAME(Left32), Ity_I32,  1, Ity_I32 },
    { OPNAME(Left64), Ity_I64,  1, Ity_I64 },
 
-// { OPNAME(Clz32),  Ity_I32,  1, Ity_I32 }, // deprecated, undefined behaviour
-// { OPNAME(Clz64),  Ity_I64,  1, Ity_I64 }, // deprecated, undefined behaviour
-
-// { OPNAME(Ctz32),  Ity_I32,  1, Ity_I32 }, // deprecated, undefined behaviour
-// { OPNAME(Ctz64),  Ity_I64,  1, Ity_I64 }, // deprecated, undefined behaviour
-
    { OPNAME(ClzNat32), Ity_I32, 1, Ity_I32, ONLY2(ppc, x86) },
    { OPNAME(ClzNat64), Ity_I64, 1, Ity_I64, EXCEPT2(ppc32, x86) },