about summary refs log tree commit diff
diff options
context:
space:
mode:
authorScott McMurray <scottmcm@users.noreply.github.com>2021-06-01 06:19:49 -0700
committerScott McMurray <scottmcm@users.noreply.github.com>2021-07-08 14:55:58 -0700
commite3091d74d876bbb6b02cf218b064ee47d1551e41 (patch)
tree8aa508fa2cebb705227262413ff946425875c808
parent7a0574d826d3bb03941b5cc80bfe99e8e5742aa0 (diff)
downloadrust-e3091d74d876bbb6b02cf218b064ee47d1551e41.tar.gz
rust-e3091d74d876bbb6b02cf218b064ee47d1551e41.zip
Use cranelift's `Type::int` instead of doing the match myself
<https://docs.rs/cranelift-codegen/0.74.0/cranelift_codegen/ir/types/struct.Type.html#method.int>
-rw-r--r--src/intrinsics/mod.rs9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/intrinsics/mod.rs b/src/intrinsics/mod.rs
index 31f7e0d4e37..3979886e10c 100644
--- a/src/intrinsics/mod.rs
+++ b/src/intrinsics/mod.rs
@@ -1118,14 +1118,7 @@ pub(crate) fn codegen_intrinsic_call<'tcx>(
 
         raw_eq, <T>(v lhs_ref, v rhs_ref) {
             fn type_by_size(size: Size) -> Option<Type> {
-                Some(match size.bits() {
-                    8 => types::I8,
-                    16 => types::I16,
-                    32 => types::I32,
-                    64 => types::I64,
-                    128 => types::I128,
-                    _ => return None,
-                })
+                Type::int(size.bits().try_into().ok()?)
             }
 
             let size = fx.layout_of(T).layout.size;