BZHI transform triggers on things that don’t mean zeroing upper bits.
@CuriousKit, your [BZHI thing](https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/315) is very cool at times, except when it triggers on `or` and `xor`. This example compiled for x86-64 with `-CpCOREAVX2 -OpCOREAVX2`:
```pascal
procedure Verify(const op: string; got, expected: SizeUint);
begin
write('%10101010 ' + op + ' %111 = %' + BinStr(got, 1 + BsrQWord(got or 1)));
if got = expected then
writeln(' - ok')
else
writeln(' - FAIL, must be %' + BinStr(expected, 1 + BsrQWord(expected or 1)));
end;
var
b, nbits: SizeUint;
begin
nbits := 3 + random(0);
b := %10101010 + random(0);
b := b or (SizeUint(1) shl nbits - 1);
Verify('or', b, %10101111);
b := %10101010 + random(0);
b := b xor (SizeUint(1) shl nbits - 1);
Verify('xor', b, %10101101);
b := %10101010 + random(0);
b := b and (SizeUint(1) shl nbits - 1);
Verify('and', b, %10);
end.
```
outputs:
```
%10101010 or %111 = %10 - FAIL, must be %10101111
%10101010 xor %111 = %10 - FAIL, must be %10101101
%10101010 and %111 = %10 - ok
```
issue