We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 953418c + 71e3ea3 commit 6c12546Copy full SHA for 6c12546
tests/codegen/range_to_inclusive.rs
@@ -0,0 +1,28 @@
1
+//! Test that `RangeTo` and `RangeToInclusive` generate identical
2
+//! (and optimal) code; #63646
3
+//@ compile-flags: -O -Zmerge-functions=disabled
4
+#![crate_type = "lib"]
5
+
6
+#[no_mangle]
7
+// CHECK-LABEL: range_to(
8
+pub fn range_to(a: i32, mut b: i32) -> i32 {
9
+ // CHECK: %1 = and i32 %0, %a
10
+ // CHECK-NEXT: ret i32 %1
11
+ for _ in 0..65 {
12
+ b &= a;
13
+ }
14
15
+ b
16
+}
17
18
19
+// CHECK-LABEL: range_to_inclusive(
20
+pub fn range_to_inclusive(a: i32, mut b: i32) -> i32 {
21
22
23
+ for _ in 0..=64 {
24
25
26
27
28
0 commit comments