about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-12-04 20:05:32 +0000
committerbors <bors@rust-lang.org>2022-12-04 20:05:32 +0000
commit53e4b9dd74c29cc9308b8d0f10facac70bb101a7 (patch)
treeb770ff68bf5b62e8a8171b4f0511ce48762a6d69 /src/test/codegen
parent0f0d5d716a00c1f29cfbf240e12bdccc4f9b9a94 (diff)
parent31c0645b9d2539f47eecb096142474b29dc542f7 (diff)
downloadrust-53e4b9dd74c29cc9308b8d0f10facac70bb101a7.tar.gz
rust-53e4b9dd74c29cc9308b8d0f10facac70bb101a7.zip
Auto merge of #104535 - mikebenfield:discr-fix, r=pnkfelix
rustc_codegen_ssa: Fix for codegen_get_discr

When doing the optimized implementation of getting the discriminant, the arithmetic needs to be done in the tag type so wrapping behavior works correctly.

Fixes #104519
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/enum-match.rs7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/test/codegen/enum-match.rs b/src/test/codegen/enum-match.rs
index efab189fd7b..44f1b408d21 100644
--- a/src/test/codegen/enum-match.rs
+++ b/src/test/codegen/enum-match.rs
@@ -34,11 +34,8 @@ pub enum Enum1 {
 
 // CHECK: define i8 @match1{{.*}}
 // CHECK-NEXT: start:
-// CHECK-NEXT: %1 = icmp ugt i8 %0, 1
-// CHECK-NEXT: %2 = zext i8 %0 to i64
-// CHECK-NEXT: %3 = add nsw i64 %2, -1
-// CHECK-NEXT: %_2 = select i1 %1, i64 %3, i64 0
-// CHECK-NEXT: switch i64 %_2, label {{.*}} [
+// CHECK-NEXT: %1 = {{.*}}call i8 @llvm.usub.sat.i8(i8 %0, i8 1)
+// CHECK-NEXT: switch i8 %1, label {{.*}} [
 #[no_mangle]
 pub fn match1(e: Enum1) -> u8 {
     use Enum1::*;