[PATCH] D119115: [RISCV] Improve insert_vector_elt for fixed mask registers.
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 9 18:44:26 PST 2022
craig.topper added a comment.
I may have an alternate suggestion for the bit manipulation
%old_bit = srl %wideelt, %bitindex // shift old_bit to bit 0
%b = xor %old_bit, new_bit // xor the old and new values together
%c = andi %b, 1 // clear all bits except bit 0. This will clear all the extra bits from the shift and remove any extra bits that came with new_bit.
%shl = shl %c, %bitindex // shift the xored value back to the correction position
%xor = xor %wideelt, shl // at bitindex this will be old_bit^(old_bit^new_bit) which cancels to new_bit. Every other index will xor with 0.
This might be a shorter sequence, but I'm not sure.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119115/new/
https://reviews.llvm.org/D119115
More information about the llvm-commits
mailing list