mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-09-01 19:29:22 +00:00
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182397 91177308-0d34-0410-b5e6-96231b3b80d8
70 lines
1.4 KiB
LLVM
70 lines
1.4 KiB
LLVM
; RUN: llc -march=mips < %s | FileCheck %s -check-prefix=TRAP
|
|
; RUN: llc -march=mips -mno-check-zero-division < %s |\
|
|
; RUN: FileCheck %s -check-prefix=NOCHECK
|
|
|
|
; TRAP: sdiv1:
|
|
; TRAP: div $zero, ${{[0-9]+}}, $[[R0:[0-9]+]]
|
|
; TRAP: teq $[[R0]], $zero, 7
|
|
; TRAP: mflo
|
|
|
|
; NOCHECK: sdiv1:
|
|
; NOCHECK-NOT: teq
|
|
; NOCHECK: .end sdiv1
|
|
|
|
define i32 @sdiv1(i32 %a0, i32 %a1) nounwind readnone {
|
|
entry:
|
|
%div = sdiv i32 %a0, %a1
|
|
ret i32 %div
|
|
}
|
|
|
|
; TRAP: srem1:
|
|
; TRAP: div $zero, ${{[0-9]+}}, $[[R0:[0-9]+]]
|
|
; TRAP: teq $[[R0]], $zero, 7
|
|
; TRAP: mfhi
|
|
|
|
define i32 @srem1(i32 %a0, i32 %a1) nounwind readnone {
|
|
entry:
|
|
%rem = srem i32 %a0, %a1
|
|
ret i32 %rem
|
|
}
|
|
|
|
; TRAP: udiv1:
|
|
; TRAP: divu $zero, ${{[0-9]+}}, $[[R0:[0-9]+]]
|
|
; TRAP: teq $[[R0]], $zero, 7
|
|
; TRAP: mflo
|
|
|
|
define i32 @udiv1(i32 %a0, i32 %a1) nounwind readnone {
|
|
entry:
|
|
%div = udiv i32 %a0, %a1
|
|
ret i32 %div
|
|
}
|
|
|
|
; TRAP: urem1:
|
|
; TRAP: divu $zero, ${{[0-9]+}}, $[[R0:[0-9]+]]
|
|
; TRAP: teq $[[R0]], $zero, 7
|
|
; TRAP: mfhi
|
|
|
|
define i32 @urem1(i32 %a0, i32 %a1) nounwind readnone {
|
|
entry:
|
|
%rem = urem i32 %a0, %a1
|
|
ret i32 %rem
|
|
}
|
|
|
|
; TRAP: div $zero,
|
|
define i32 @sdivrem1(i32 %a0, i32 %a1, i32* nocapture %r) nounwind {
|
|
entry:
|
|
%rem = srem i32 %a0, %a1
|
|
store i32 %rem, i32* %r, align 4
|
|
%div = sdiv i32 %a0, %a1
|
|
ret i32 %div
|
|
}
|
|
|
|
; TRAP: divu $zero,
|
|
define i32 @udivrem1(i32 %a0, i32 %a1, i32* nocapture %r) nounwind {
|
|
entry:
|
|
%rem = urem i32 %a0, %a1
|
|
store i32 %rem, i32* %r, align 4
|
|
%div = udiv i32 %a0, %a1
|
|
ret i32 %div
|
|
}
|