Improve sign and zero extension analysis.

Rationale:
This was needed to fix the regression introduced by
a prior type based cl. With the new type system ramping
up, however, this is actually more  simplification (remove
the And recognition for example) than new code!

Test: test-art-host test-art-target

Bug: 67935418
Change-Id: I4284f8f29f3d26e4033a3014d0c697677cc0d795
diff --git a/compiler/optimizing/nodes_vector.h b/compiler/optimizing/nodes_vector.h
index 4e78e4e..17540b9 100644
--- a/compiler/optimizing/nodes_vector.h
+++ b/compiler/optimizing/nodes_vector.h
@@ -136,6 +136,20 @@
     }
   }
 
+  // Maps an integral type to the same-size unsigned type and leaves other types alone.
+  static DataType::Type ToUnsignedType(DataType::Type type) {
+    switch (type) {
+      case DataType::Type::kBool:  // 1-byte storage unit
+      case DataType::Type::kInt8:
+        return DataType::Type::kUint8;
+      case DataType::Type::kInt16:
+        return DataType::Type::kUint16;
+      default:
+        DCHECK(type != DataType::Type::kVoid && type != DataType::Type::kReference) << type;
+        return type;
+    }
+  }
+
   DECLARE_ABSTRACT_INSTRUCTION(VecOperation);
 
  protected:
@@ -254,6 +268,8 @@
   }
   DCHECK(input->IsVecOperation());
   DataType::Type input_type = input->AsVecOperation()->GetPackedType();
+  DCHECK_EQ(HVecOperation::ToUnsignedType(input_type) == HVecOperation::ToUnsignedType(type),
+            HVecOperation::ToSignedType(input_type) == HVecOperation::ToSignedType(type));
   return HVecOperation::ToSignedType(input_type) == HVecOperation::ToSignedType(type);
 }