1 ; RUN: llc < %s -mtriple=aarch64-none-linux-gnu | FileCheck %s
3 ; and can be eliminated
4 ; CHECK-LABEL: {{^}}test_call_known_max_range:
8 define i32 @test_call_known_max_range() #0 {
10 %id = tail call i32 @foo(), !range !0, !noundef !{}
11 %and = and i32 %id, 1023
15 ; CHECK-LABEL: {{^}}test_call_known_trunc_1_bit_range:
17 ; CHECK: and w{{[0-9]+}}, w0, #0x1ff
19 define i32 @test_call_known_trunc_1_bit_range() #0 {
21 %id = tail call i32 @foo(), !range !0, !noundef !{}
22 %and = and i32 %id, 511
26 ; CHECK-LABEL: {{^}}test_call_known_max_range_m1:
28 ; CHECK: and w{{[0-9]+}}, w0, #0xff
30 define i32 @test_call_known_max_range_m1() #0 {
32 %id = tail call i32 @foo(), !range !1, !noundef !{}
33 %and = and i32 %id, 255
37 ; and can be eliminated
38 ; CHECK-LABEL: {{^}}test_call_known_max_range_attr:
42 define i32 @test_call_known_max_range_attr() #0 {
44 %id = tail call noundef range(i32 0, 1024) i32 @foo()
45 %and = and i32 %id, 1023
49 ; CHECK-LABEL: {{^}}test_call_known_max_range_attr_no_noundef:
51 ; CHECK: and w{{[0-9]+}}, w0, #0x3ff
53 define i32 @test_call_known_max_range_attr_no_noundef() #0 {
55 %id = tail call range(i32 0, 1024) i32 @foo()
56 %and = and i32 %id, 1023
62 attributes #0 = { norecurse nounwind }
63 attributes #1 = { nounwind readnone }
65 !0 = !{i32 0, i32 1024}
66 !1 = !{i32 0, i32 1023}