mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-21 16:31:16 +00:00
8b2b8a1835
This update was done with the following bash script: find test/CodeGen -name "*.ll" | \ while read NAME; do echo "$NAME" if ! grep -q "^; *RUN: *llc.*debug" $NAME; then TEMP=`mktemp -t temp` cp $NAME $TEMP sed -n "s/^define [^@]*@\([A-Za-z0-9_]*\)(.*$/\1/p" < $NAME | \ while read FUNC; do sed -i '' "s/;\(.*\)\([A-Za-z0-9_-]*\):\( *\)$FUNC: *\$/;\1\2-LABEL:\3$FUNC:/g" $TEMP done sed -i '' "s/;\(.*\)-LABEL-LABEL:/;\1-LABEL:/" $TEMP sed -i '' "s/;\(.*\)-NEXT-LABEL:/;\1-NEXT:/" $TEMP sed -i '' "s/;\(.*\)-NOT-LABEL:/;\1-NOT:/" $TEMP sed -i '' "s/;\(.*\)-DAG-LABEL:/;\1-DAG:/" $TEMP mv $TEMP $NAME fi done git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186280 91177308-0d34-0410-b5e6-96231b3b80d8
70 lines
1.5 KiB
LLVM
70 lines
1.5 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-LABEL: sdiv1:
|
|
; TRAP: div $zero, ${{[0-9]+}}, $[[R0:[0-9]+]]
|
|
; TRAP: teq $[[R0]], $zero, 7
|
|
; TRAP: mflo
|
|
|
|
; NOCHECK-LABEL: 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-LABEL: 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-LABEL: 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-LABEL: 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
|
|
}
|