Change enum values in to avoid implicit bitfield conversion

Signed values are stored using two's complement, so when a signed
value is converted to a 1-bit bitfield, it transforms the value 1
into -1, causing clang to issue a warning. See here for a more
detailed discussion: https://github.com/llvm/llvm-project/issues/53253
This warning is currently disabled in chrome (crbug.com/40234766),
but we'd like to re-enable it.

The conversion is happening with the enum values in IceIntrinsics.h.
To avoid it, we set the _T values to -1 instead of 1 at the beginning,
so there's no implicit conversion. This is rather ugly, since
intuitively we would like the "true" value to be 1, but it's the only
solution I'm aware of.

I tried several other options to force clang to treat the enum as an
unsigned value, but this causes it to change the memory layout of the
IntrinsicInfo struct, doubling its size (4 bytes -> 8 bytes).

There should be no change in program semantics, since the value was
being treated as -1 anyway -- this change just makes it explicit.

Change-Id: I9bf0259bb81677b50951755118f2492300d166a4
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/73748
Tested-by: Shahbaz Youssefi <syoussefi@google.com>
Reviewed-by: Shahbaz Youssefi <syoussefi@google.com>
Commit-Queue: Shahbaz Youssefi <syoussefi@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
diff --git a/third_party/subzero/src/IceIntrinsics.h b/third_party/subzero/src/IceIntrinsics.h
index b18eef4..8104ee1 100644
--- a/third_party/subzero/src/IceIntrinsics.h
+++ b/third_party/subzero/src/IceIntrinsics.h
@@ -110,11 +110,15 @@
 bool isMemoryOrderValid(IntrinsicID ID, uint64_t Order,
                         uint64_t OrderOther = MemoryOrderInvalid);
 
-enum SideEffects { SideEffects_F = 0, SideEffects_T = 1 };
+/// The _T values are set to -1 rather than 1 to avoid an implicit conversion
+/// warning. A good explanation of the warning is here:
+/// https://github.com/llvm/llvm-project/issues/53253.
+/// Allows us to re-enable the warning in crbug.com/40234766
+enum SideEffects { SideEffects_F = 0, SideEffects_T = -1 };
 
-enum ReturnsTwice { ReturnsTwice_F = 0, ReturnsTwice_T = 1 };
+enum ReturnsTwice { ReturnsTwice_F = 0, ReturnsTwice_T = -1 };
 
-enum MemoryWrite { MemoryWrite_F = 0, MemoryWrite_T = 1 };
+enum MemoryWrite { MemoryWrite_F = 0, MemoryWrite_T = -1 };
 
 /// Basic attributes related to each intrinsic, that are relevant to code
 /// generation.