mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-19 06:31:18 +00:00
Define first regression test (copied from SPARC)
This commit is contained in:
parent
f6cfc7d588
commit
0f0de95ee3
61
test/CodeGen/Mos6502/basictest.ll
Normal file
61
test/CodeGen/Mos6502/basictest.ll
Normal file
@ -0,0 +1,61 @@
|
||||
; RUN: llc < %s -march=mos6502 | FileCheck %s
|
||||
|
||||
define i32 @test0(i32 %X) {
|
||||
%tmp.1 = add i32 %X, 1
|
||||
ret i32 %tmp.1
|
||||
; CHECK-LABEL: test0:
|
||||
; CHECK: add %o0, 1, %o0
|
||||
}
|
||||
|
||||
|
||||
;; xnor tests.
|
||||
define i32 @test1(i32 %X, i32 %Y) {
|
||||
%A = xor i32 %X, %Y
|
||||
%B = xor i32 %A, -1
|
||||
ret i32 %B
|
||||
; CHECK-LABEL: test1:
|
||||
; CHECK: xnor %o0, %o1, %o0
|
||||
}
|
||||
|
||||
define i32 @test2(i32 %X, i32 %Y) {
|
||||
%A = xor i32 %X, -1
|
||||
%B = xor i32 %A, %Y
|
||||
ret i32 %B
|
||||
; CHECK-LABEL: test2:
|
||||
; CHECK: xnor %o0, %o1, %o0
|
||||
}
|
||||
|
||||
; CHECK-LABEL: store_zero:
|
||||
; CHECK: st %g0, [%o0]
|
||||
; CHECK: st %g0, [%o1+4]
|
||||
define i32 @store_zero(i32* %a, i32* %b) {
|
||||
entry:
|
||||
store i32 0, i32* %a, align 4
|
||||
%0 = getelementptr inbounds i32, i32* %b, i32 1
|
||||
store i32 0, i32* %0, align 4
|
||||
ret i32 0
|
||||
}
|
||||
|
||||
; CHECK-LABEL: signed_divide:
|
||||
; CHECK: sra %o0, 31, %o2
|
||||
; CHECK: wr %g0, %o2, %y
|
||||
; CHECK: sdiv %o0, %o1, %o0
|
||||
define i32 @signed_divide(i32 %a, i32 %b) {
|
||||
%r = sdiv i32 %a, %b
|
||||
ret i32 %r
|
||||
}
|
||||
|
||||
; CHECK-LABEL: unsigned_divide:
|
||||
; CHECK: wr %g0, %g0, %y
|
||||
; CHECK: udiv %o0, %o1, %o0
|
||||
define i32 @unsigned_divide(i32 %a, i32 %b) {
|
||||
%r = udiv i32 %a, %b
|
||||
ret i32 %r
|
||||
}
|
||||
|
||||
; CHECK-LABEL: multiply_32x32:
|
||||
; CHECK: smul %o0, %o1, %o0
|
||||
define i32 @multiply_32x32(i32 %a, i32 %b) {
|
||||
%r = mul i32 %a, %b
|
||||
ret i32 %r
|
||||
}
|
2
test/CodeGen/Mos6502/lit.local.cfg
Normal file
2
test/CodeGen/Mos6502/lit.local.cfg
Normal file
@ -0,0 +1,2 @@
|
||||
if not 'Mos6502' in config.root.targets:
|
||||
config.unsupported = True
|
Loading…
x
Reference in New Issue
Block a user