Skip to content

Commit d0df146

Browse files
committed
[SDAG] Test lower range attribute to AssertZext
1 parent e387299 commit d0df146

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

llvm/test/CodeGen/AArch64/lower-range-metadata-func-call.ll

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,28 @@ entry:
3434
ret i32 %and
3535
}
3636

37+
; CHECK-LABEL: {{^}}test_call_known_max_range_attr:
38+
; CHECK: bl foo
39+
; CHECK: and w{{[0-9]+}}, w0, #0x3ff
40+
; CHECK: ret
41+
define i32 @test_call_known_max_range_attr() #0 {
42+
entry:
43+
%id = tail call noundef range(i32 0, 1024) i32 @foo()
44+
%and = and i32 %id, 1023
45+
ret i32 %and
46+
}
47+
48+
; CHECK-LABEL: {{^}}test_call_known_max_range_attr_no_noundef:
49+
; CHECK: bl foo
50+
; CHECK: and w{{[0-9]+}}, w0, #0x3ff
51+
; CHECK: ret
52+
define i32 @test_call_known_max_range_attr_no_noundef() #0 {
53+
entry:
54+
%id = tail call range(i32 0, 1024) i32 @foo()
55+
%and = and i32 %id, 1023
56+
ret i32 %and
57+
}
58+
3759

3860
declare i32 @foo()
3961

llvm/test/CodeGen/X86/legalize-vec-assertzext.ll

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,21 @@ define i64 @widen_assertzext(ptr %x) nounwind {
3434
ret i64 %d
3535
}
3636

37+
define i64 @widen_assertzext_range_attr(ptr %x) nounwind {
38+
; CHECK-LABEL: widen_assertzext_range_attr:
39+
; CHECK: # %bb.0:
40+
; CHECK-NEXT: pushq %rax
41+
; CHECK-NEXT: callq test2@PLT
42+
; CHECK-NEXT: vextracti32x4 $3, %zmm0, %xmm0
43+
; CHECK-NEXT: vmovq %xmm0, %rax
44+
; CHECK-NEXT: popq %rcx
45+
; CHECK-NEXT: vzeroupper
46+
; CHECK-NEXT: retq
47+
%e = call noundef range(i64 0, 2) <7 x i64> @test2()
48+
%d = extractelement <7 x i64> %e, i32 6
49+
ret i64 %d
50+
}
51+
3752
declare <16 x i64> @test()
3853
declare <7 x i64> @test2()
3954
!0 = !{ i64 0, i64 2 }

0 commit comments

Comments
 (0)