Auto merge of #36321 - uweigand:enum-abi, r=eddyb
Auto merge of #36321 - uweigand:enum-abi, r=eddyb

Follow target ABI sign-/zero-extension rules for enum types

While attempting to port Rust to s390x, I ran into an ABI violation
(that caused rust_eh_personality to be miscompiled, breaking unwinding).
The problem is that this function returns an enum type, which is
supposed to be sign-extended according to the s390x ABI.  However,
common code would ignore target sign-/zero-extension rules for any
types that do not satisfy is_integral(), which includes enums.

For the general case of Rust enum types, which map to structure types
with a discriminant, that seems correct.  However, in the special case
of simple enums that map directly to C enum types (i.e. LLVM integers),
this is incorrect; we must follow the target extension rules for those.

Signed-off-by: Ulrich Weigand <dfbb67861321c3a0b65599ad75850a0b877f5c0d@de.ibm.com>

aidancully/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,graydon/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,aidancully/rust,graydon/rust,graydon/rust,GBGamer/rust,GBGamer/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust