Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[LoongArch] Add support for llvm.trap and llvm.debugtrap
Similar to D69390 for RISCV, use a guaranteed non-existing insn for llvm.trap and the break insn for llvm.debugtrap. Differential Revision: https://reviews.llvm.org/D134365
- Loading branch information
1 parent
f793597
commit f017e92
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py | ||
; RUN: llc --mtriple=loongarch32 --verify-machineinstrs < %s | FileCheck %s | ||
; RUN: llc --mtriple=loongarch64 --verify-machineinstrs < %s | FileCheck %s | ||
|
||
;; Verify that we lower @llvm.trap() and @llvm.debugtrap() correctly. | ||
|
||
declare void @llvm.trap() | ||
declare void @llvm.debugtrap() | ||
|
||
define void @test_trap() nounwind { | ||
; CHECK-LABEL: test_trap: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: amswap.w $zero, $ra, $zero | ||
; CHECK-NEXT: ret | ||
tail call void @llvm.trap() | ||
ret void | ||
} | ||
|
||
define void @test_debugtrap() nounwind { | ||
; CHECK-LABEL: test_debugtrap: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: break 0 | ||
; CHECK-NEXT: ret | ||
tail call void @llvm.debugtrap() | ||
ret void | ||
} |