blob: 4075db10c42b4feed3e94c8e5bda103da30017b5 [file] [log] [blame]
Simon Pilgrimfc4d4b22016-07-19 13:35:11 +00001; RUN: llc < %s -mtriple=aarch64-none-linux-gnu | FileCheck %s
Matt Arsenault2bba7792016-02-08 16:28:19 +00002
3; and can be eliminated
4; CHECK-LABEL: {{^}}test_call_known_max_range:
5; CHECK: bl foo
6; CHECK-NOT: and
7; CHECK: ret
8define i32 @test_call_known_max_range() #0 {
9entry:
10 %id = tail call i32 @foo(), !range !0
11 %and = and i32 %id, 1023
12 ret i32 %and
13}
14
15; CHECK-LABEL: {{^}}test_call_known_trunc_1_bit_range:
16; CHECK: bl foo
17; CHECK: and w{{[0-9]+}}, w0, #0x1ff
18; CHECK: ret
19define i32 @test_call_known_trunc_1_bit_range() #0 {
20entry:
21 %id = tail call i32 @foo(), !range !0
22 %and = and i32 %id, 511
23 ret i32 %and
24}
25
26; CHECK-LABEL: {{^}}test_call_known_max_range_m1:
27; CHECK: bl foo
28; CHECK: and w{{[0-9]+}}, w0, #0xff
29; CHECK: ret
30define i32 @test_call_known_max_range_m1() #0 {
31entry:
32 %id = tail call i32 @foo(), !range !1
33 %and = and i32 %id, 255
34 ret i32 %and
35}
36
37
38declare i32 @foo()
39
40attributes #0 = { norecurse nounwind }
41attributes #1 = { nounwind readnone }
42
43!0 = !{i32 0, i32 1024}
44!1 = !{i32 0, i32 1023}