Skip to content

Commit 8dcf652

Browse files
committed
Change test to SIL test
1 parent 76db09a commit 8dcf652

File tree

2 files changed

+26
-15
lines changed

2 files changed

+26
-15
lines changed

test/IRGen/assume.sil

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// RUN: %target-swift-frontend -assume-parsing-unqualified-ownership-sil-parse-stdlib -O -emit-ir %s | %FileCheck %s
2+
sil_stage canonical
3+
4+
import Swift
5+
import Builtin
6+
7+
// CHECK-LABEL: define{{.*}} swiftcc i64 @test_assume(i64)
8+
// CHECK: [[COND:%.*]] = icmp sgt i64 %0, -1
9+
// CHECK: tail call void @llvm.assume(i1 [[COND]])
10+
// CHECK: [[RES:%.*]] = lshr i64 %0, 6
11+
// CHECK: ret i64 [[RES]]
12+
// CHECK: }
13+
14+
sil @test_assume : $@convention(thin) (Int) -> Int {
15+
bb0(%0 : $Int):
16+
%2 = integer_literal $Builtin.Int64, 0
17+
%3 = struct_extract %0 : $Int, #Int._value
18+
%4 = builtin "cmp_slt_Int64"(%3 : $Builtin.Int64, %2 : $Builtin.Int64) : $Builtin.Int1
19+
%5 = integer_literal $Builtin.Int1, -1
20+
%6 = builtin "xor_Int1"(%4 : $Builtin.Int1, %5 : $Builtin.Int1) : $Builtin.Int1
21+
%7 = builtin "assume_Int1"(%6 : $Builtin.Int1) : $Builtin.Int1
22+
%8 = integer_literal $Builtin.Int64, 64
23+
%9 = builtin "sdiv_Int64"(%3 : $Builtin.Int64, %8 : $Builtin.Int64) : $Builtin.Int64
24+
%10 = struct $Int (%9 : $Builtin.Int64)
25+
return %10 : $Int
26+
}

test/IRGen/assume.swift

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)