From: Florian Krohm Date: Sun, 24 Aug 2025 20:46:25 +0000 (+0000) Subject: Remove deprecated IROps Iop_Clz32, Iop_Clz64, Iop_Ctz32, and Iop_Ctz64 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=HEAD;p=thirdparty%2Fvalgrind.git Remove deprecated IROps Iop_Clz32, Iop_Clz64, Iop_Ctz32, and Iop_Ctz64 Part of fixing https://bugs.kde.org/show_bug.cgi?id=507033 --- diff --git a/NEWS b/NEWS index c39e4f9f1..853ba47d2 100644 --- 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 diff --git a/VEX/priv/ir_defs.c b/VEX/priv/ir_defs.c index ba61758d7..79b7cce64 100644 --- a/VEX/priv/ir_defs.c +++ b/VEX/priv/ir_defs.c @@ -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); diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index fa2877f6b..100f6396f 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -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))); diff --git a/VEX/pub/libvex_ir.h b/VEX/pub/libvex_ir.h index 983cd50bc..750ba0701 100644 --- a/VEX/pub/libvex_ir.h +++ b/VEX/pub/libvex_ir.h @@ -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. */ diff --git a/VEX/useful/test_main.c b/VEX/useful/test_main.c index 85168e704..ba4e25017 100644 --- a/VEX/useful/test_main.c +++ b/VEX/useful/test_main.c @@ -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: diff --git a/memcheck/mc_translate.c b/memcheck/mc_translate.c index b4e499cc0..dfaf10c2b 100644 --- a/memcheck/mc_translate.c +++ b/memcheck/mc_translate.c @@ -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 diff --git a/memcheck/tests/vbit-test/irops.c b/memcheck/tests/vbit-test/irops.c index 2f0ea8a6a..aec2670b8 100644 --- a/memcheck/tests/vbit-test/irops.c +++ b/memcheck/tests/vbit-test/irops.c @@ -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 }, diff --git a/none/tests/iropt-test/irops.tab b/none/tests/iropt-test/irops.tab index c65ff4cfb..4163edfcd 100644 --- a/none/tests/iropt-test/irops.tab +++ b/none/tests/iropt-test/irops.tab @@ -124,12 +124,6 @@ { 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) },