@pshufb Looks like Clang didn't use RVV because there is no vredmul instruction. So it used fixed vectors so it could generate a fixed number of shuffles to emulate it.
@pshufb@dyaroshev Clang is using vsetvli zero, zero, e64, m2, ta, mu to change the vtype without changing vl. This should be the cheapest form of vsetvli.
@damageboy For better or worse, llvm made a decision a long time ago to convert shuffle/permute intrinsics into generic IR shuffles and allow them to be combined. There is a substantial amount of code in the X86 backend devoted to untangling it back into instructions that exist.
@trav_downs@lemire@richardstartin Is the add keeping clang from seeing that the popcnt is being compared with zero? Hopefully we handle that for a single popcnt?
@kamidphish But doesn't seem to be handling NaNs the same way as clang and icc. clang and icc check that the Z flag is set and the P flag is cleared. The Z flag is set for equality or if either input is a NaN. Checking P rules out the latter.
@kamidphish clang isn't thinking about the if statement and the ucomieq as one operation. ucomieq returns an integer, that's the code up to the movzx. Then the result gets compared to 0.