mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-28 19:31:58 +00:00
1ef70ff39b
Now that `Metadata` is typeless, reflect that in the assembly. These are the matching assembly changes for the metadata/value split in r223802. - Only use the `metadata` type when referencing metadata from a call intrinsic -- i.e., only when it's used as a `Value`. - Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode` when referencing it from call intrinsics. So, assembly like this: define @foo(i32 %v) { call void @llvm.foo(metadata !{i32 %v}, metadata !0) call void @llvm.foo(metadata !{i32 7}, metadata !0) call void @llvm.foo(metadata !1, metadata !0) call void @llvm.foo(metadata !3, metadata !0) call void @llvm.foo(metadata !{metadata !3}, metadata !0) ret void, !bar !2 } !0 = metadata !{metadata !2} !1 = metadata !{i32* @global} !2 = metadata !{metadata !3} !3 = metadata !{} turns into this: define @foo(i32 %v) { call void @llvm.foo(metadata i32 %v, metadata !0) call void @llvm.foo(metadata i32 7, metadata !0) call void @llvm.foo(metadata i32* @global, metadata !0) call void @llvm.foo(metadata !3, metadata !0) call void @llvm.foo(metadata !{!3}, metadata !0) ret void, !bar !2 } !0 = !{!2} !1 = !{i32* @global} !2 = !{!3} !3 = !{} I wrote an upgrade script that handled almost all of the tests in llvm and many of the tests in cfe (even handling many `CHECK` lines). I've attached it (or will attach it in a moment if you're speedy) to PR21532 to help everyone update their out-of-tree testcases. This is part of PR21532. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224257 91177308-0d34-0410-b5e6-96231b3b80d8
232 lines
4.7 KiB
LLVM
232 lines
4.7 KiB
LLVM
; RUN: llc -mtriple=aarch64-none-linux-gnu < %s | FileCheck %s
|
|
|
|
; This test checks that LLVM can do basic stripping and reapplying of branches
|
|
; to basic blocks.
|
|
|
|
declare void @test_true()
|
|
declare void @test_false()
|
|
|
|
; !0 corresponds to a branch being taken, !1 to not being takne.
|
|
!0 = !{!"branch_weights", i32 64, i32 4}
|
|
!1 = !{!"branch_weights", i32 4, i32 64}
|
|
|
|
define void @test_Bcc_fallthrough_taken(i32 %in) nounwind {
|
|
; CHECK-LABEL: test_Bcc_fallthrough_taken:
|
|
%tst = icmp eq i32 %in, 42
|
|
br i1 %tst, label %true, label %false, !prof !0
|
|
|
|
; CHECK: cmp {{w[0-9]+}}, #42
|
|
|
|
; CHECK: b.ne [[FALSE:.LBB[0-9]+_[0-9]+]]
|
|
; CHECK-NEXT: // BB#
|
|
; CHECK-NEXT: bl test_true
|
|
|
|
; CHECK: [[FALSE]]:
|
|
; CHECK: bl test_false
|
|
|
|
true:
|
|
call void @test_true()
|
|
ret void
|
|
|
|
false:
|
|
call void @test_false()
|
|
ret void
|
|
}
|
|
|
|
define void @test_Bcc_fallthrough_nottaken(i32 %in) nounwind {
|
|
; CHECK-LABEL: test_Bcc_fallthrough_nottaken:
|
|
%tst = icmp eq i32 %in, 42
|
|
br i1 %tst, label %true, label %false, !prof !1
|
|
|
|
; CHECK: cmp {{w[0-9]+}}, #42
|
|
|
|
; CHECK: b.eq [[TRUE:.LBB[0-9]+_[0-9]+]]
|
|
; CHECK-NEXT: // BB#
|
|
; CHECK-NEXT: bl test_false
|
|
|
|
; CHECK: [[TRUE]]:
|
|
; CHECK: bl test_true
|
|
|
|
true:
|
|
call void @test_true()
|
|
ret void
|
|
|
|
false:
|
|
call void @test_false()
|
|
ret void
|
|
}
|
|
|
|
define void @test_CBZ_fallthrough_taken(i32 %in) nounwind {
|
|
; CHECK-LABEL: test_CBZ_fallthrough_taken:
|
|
%tst = icmp eq i32 %in, 0
|
|
br i1 %tst, label %true, label %false, !prof !0
|
|
|
|
; CHECK: cbnz {{w[0-9]+}}, [[FALSE:.LBB[0-9]+_[0-9]+]]
|
|
; CHECK-NEXT: // BB#
|
|
; CHECK-NEXT: bl test_true
|
|
|
|
; CHECK: [[FALSE]]:
|
|
; CHECK: bl test_false
|
|
|
|
true:
|
|
call void @test_true()
|
|
ret void
|
|
|
|
false:
|
|
call void @test_false()
|
|
ret void
|
|
}
|
|
|
|
define void @test_CBZ_fallthrough_nottaken(i64 %in) nounwind {
|
|
; CHECK-LABEL: test_CBZ_fallthrough_nottaken:
|
|
%tst = icmp eq i64 %in, 0
|
|
br i1 %tst, label %true, label %false, !prof !1
|
|
|
|
; CHECK: cbz {{x[0-9]+}}, [[TRUE:.LBB[0-9]+_[0-9]+]]
|
|
; CHECK-NEXT: // BB#
|
|
; CHECK-NEXT: bl test_false
|
|
|
|
; CHECK: [[TRUE]]:
|
|
; CHECK: bl test_true
|
|
|
|
true:
|
|
call void @test_true()
|
|
ret void
|
|
|
|
false:
|
|
call void @test_false()
|
|
ret void
|
|
}
|
|
|
|
define void @test_CBNZ_fallthrough_taken(i32 %in) nounwind {
|
|
; CHECK-LABEL: test_CBNZ_fallthrough_taken:
|
|
%tst = icmp ne i32 %in, 0
|
|
br i1 %tst, label %true, label %false, !prof !0
|
|
|
|
; CHECK: cbz {{w[0-9]+}}, [[FALSE:.LBB[0-9]+_[0-9]+]]
|
|
; CHECK-NEXT: // BB#
|
|
; CHECK-NEXT: bl test_true
|
|
|
|
; CHECK: [[FALSE]]:
|
|
; CHECK: bl test_false
|
|
|
|
true:
|
|
call void @test_true()
|
|
ret void
|
|
|
|
false:
|
|
call void @test_false()
|
|
ret void
|
|
}
|
|
|
|
define void @test_CBNZ_fallthrough_nottaken(i64 %in) nounwind {
|
|
; CHECK-LABEL: test_CBNZ_fallthrough_nottaken:
|
|
%tst = icmp ne i64 %in, 0
|
|
br i1 %tst, label %true, label %false, !prof !1
|
|
|
|
; CHECK: cbnz {{x[0-9]+}}, [[TRUE:.LBB[0-9]+_[0-9]+]]
|
|
; CHECK-NEXT: // BB#
|
|
; CHECK-NEXT: bl test_false
|
|
|
|
; CHECK: [[TRUE]]:
|
|
; CHECK: bl test_true
|
|
|
|
true:
|
|
call void @test_true()
|
|
ret void
|
|
|
|
false:
|
|
call void @test_false()
|
|
ret void
|
|
}
|
|
|
|
define void @test_TBZ_fallthrough_taken(i32 %in) nounwind {
|
|
; CHECK-LABEL: test_TBZ_fallthrough_taken:
|
|
%bit = and i32 %in, 32768
|
|
%tst = icmp eq i32 %bit, 0
|
|
br i1 %tst, label %true, label %false, !prof !0
|
|
|
|
; CHECK: tbnz {{w[0-9]+}}, #15, [[FALSE:.LBB[0-9]+_[0-9]+]]
|
|
; CHECK-NEXT: // BB#
|
|
; CHECK-NEXT: bl test_true
|
|
|
|
; CHECK: [[FALSE]]:
|
|
; CHECK: bl test_false
|
|
|
|
true:
|
|
call void @test_true()
|
|
ret void
|
|
|
|
false:
|
|
call void @test_false()
|
|
ret void
|
|
}
|
|
|
|
define void @test_TBZ_fallthrough_nottaken(i64 %in) nounwind {
|
|
; CHECK-LABEL: test_TBZ_fallthrough_nottaken:
|
|
%bit = and i64 %in, 32768
|
|
%tst = icmp eq i64 %bit, 0
|
|
br i1 %tst, label %true, label %false, !prof !1
|
|
|
|
; CHECK: tbz {{[wx][0-9]+}}, #15, [[TRUE:.LBB[0-9]+_[0-9]+]]
|
|
; CHECK-NEXT: // BB#
|
|
; CHECK-NEXT: bl test_false
|
|
|
|
; CHECK: [[TRUE]]:
|
|
; CHECK: bl test_true
|
|
|
|
true:
|
|
call void @test_true()
|
|
ret void
|
|
|
|
false:
|
|
call void @test_false()
|
|
ret void
|
|
}
|
|
|
|
|
|
define void @test_TBNZ_fallthrough_taken(i32 %in) nounwind {
|
|
; CHECK-LABEL: test_TBNZ_fallthrough_taken:
|
|
%bit = and i32 %in, 32768
|
|
%tst = icmp ne i32 %bit, 0
|
|
br i1 %tst, label %true, label %false, !prof !0
|
|
|
|
; CHECK: tbz {{w[0-9]+}}, #15, [[FALSE:.LBB[0-9]+_[0-9]+]]
|
|
; CHECK-NEXT: // BB#
|
|
; CHECK-NEXT: bl test_true
|
|
|
|
; CHECK: [[FALSE]]:
|
|
; CHECK: bl test_false
|
|
|
|
true:
|
|
call void @test_true()
|
|
ret void
|
|
|
|
false:
|
|
call void @test_false()
|
|
ret void
|
|
}
|
|
|
|
define void @test_TBNZ_fallthrough_nottaken(i64 %in) nounwind {
|
|
; CHECK-LABEL: test_TBNZ_fallthrough_nottaken:
|
|
%bit = and i64 %in, 32768
|
|
%tst = icmp ne i64 %bit, 0
|
|
br i1 %tst, label %true, label %false, !prof !1
|
|
|
|
; CHECK: tbnz {{[wx][0-9]+}}, #15, [[TRUE:.LBB[0-9]+_[0-9]+]]
|
|
; CHECK-NEXT: // BB#
|
|
; CHECK-NEXT: bl test_false
|
|
|
|
; CHECK: [[TRUE]]:
|
|
; CHECK: bl test_true
|
|
|
|
true:
|
|
call void @test_true()
|
|
ret void
|
|
|
|
false:
|
|
call void @test_false()
|
|
ret void
|
|
}
|
|
|