> But isn't canonicalization of EQ/NE safe, even for IEEE NaN and +-0.0? > > target = (a == b) ? x : y > target = (a != b) ? y : x > > Are equivalent, even for IEEE IIRC.
Yes, that should be fine. My concern was not that we do a canonicalization but that we might not do it for some of the vector cases. In particular when one of the operands is wrapped in a vec_duplicate and we end up with it first rather than second. My general feeling is that the patch is good but I wasn't entirely sure about all cases (in particular in case we transform something after expand). That's why I would have liked to see at least some small test cases for it along with the patch (for the combinations we don't test yet). Regards Robin