Skip to content

Commit 263f611

Browse files
committed
[stdlib] Add IRGen test for heterogeneous integer comparison.
1 parent f671e50 commit 263f611

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/IRGen/integer-comparison.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %target-swift-frontend -primary-file %s -O -emit-ir | %FileCheck %s
2+
3+
func f(_ x: Int, _ y: UInt32) -> Bool { x < y }
4+
// CHECK-LABEL: define {{.*}} @"$s4main1fySbSi_s6UInt32VtF"(i64 %0, i32 %1)
5+
// CHECK: %2 = zext i32 %1 to i64
6+
// CHECK-NEXT: %3 = icmp sgt i64 %2, %0
7+
// CHECK-NEXT: ret i1 %3
8+
9+
func g(_ x: UInt32, _ y: Int) -> Bool { x < y }
10+
// CHECK-LABEL: define {{.*}} @"$s4main1gySbs6UInt32V_SitF"(i32 %0, i64 %1)
11+
// CHECK: %2 = zext i32 %0 to i64
12+
// CHECK-NEXT: %3 = icmp slt i64 %2, %1
13+
// CHECK-NEXT: ret i1 %3

0 commit comments

Comments
 (0)