mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-20 09:30:43 +00:00
a9a94ce839
TableGen has a fairly dubious heuristic to decide whether an alias should be printed: does the alias have lest operands than the real instruction. This is bad enough (particularly with no way to override it), but it should at least be calculated consistently for both strings. This patch implements that logic: first get the *correct* string for the variant, in the same way as the Matcher, without guessing; then count the number of whitespace chars. There are basically 4 changes this brings about after the previous commits; all of these appear to be good, so I have changed the tests: + ARM64: we print "neg X, Y" instead of "sub X, xzr, Y". + ARM64: we skip implicit "uxtx" and "uxtw" modifiers. + Sparc: we print "mov A, B" instead of "or %g0, A, B". + Sparc: we print "fcmpX A, B" instead of "fcmpX %fcc0, A, B" git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208969 91177308-0d34-0410-b5e6-96231b3b80d8
81 lines
2.0 KiB
LLVM
81 lines
2.0 KiB
LLVM
; RUN: llc -march=sparc -disable-sparc-leaf-proc=0 < %s | FileCheck %s
|
|
|
|
; CHECK-LABEL: func_nobody:
|
|
; CHECK: retl
|
|
; CHECK-NEXT: nop
|
|
define void @func_nobody() {
|
|
entry:
|
|
ret void
|
|
}
|
|
|
|
|
|
; CHECK-LABEL: return_int_const:
|
|
; CHECK: retl
|
|
; CHECK-NEXT: mov 1729, %o0
|
|
define i32 @return_int_const() {
|
|
entry:
|
|
ret i32 1729
|
|
}
|
|
|
|
; CHECK-LABEL: return_double_const:
|
|
; CHECK: sethi
|
|
; CHECK: retl
|
|
; CHECK-NEXT: ldd {{.*}}, %f0
|
|
|
|
define double @return_double_const() {
|
|
entry:
|
|
ret double 0.000000e+00
|
|
}
|
|
|
|
; CHECK-LABEL: leaf_proc_with_args:
|
|
; CHECK: add {{%o[0-1]}}, {{%o[0-1]}}, [[R:%[go][0-7]]]
|
|
; CHECK: retl
|
|
; CHECK-NEXT: add [[R]], %o2, %o0
|
|
|
|
define i32 @leaf_proc_with_args(i32 %a, i32 %b, i32 %c) {
|
|
entry:
|
|
%0 = add nsw i32 %b, %a
|
|
%1 = add nsw i32 %0, %c
|
|
ret i32 %1
|
|
}
|
|
|
|
; CHECK-LABEL: leaf_proc_with_args_in_stack:
|
|
; CHECK-DAG: ld [%sp+92], {{%[go][0-7]}}
|
|
; CHECK-DAG: ld [%sp+96], {{%[go][0-7]}}
|
|
; CHECK: retl
|
|
; CHECK-NEXT: add {{.*}}, %o0
|
|
define i32 @leaf_proc_with_args_in_stack(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f, i32 %g, i32 %h) {
|
|
entry:
|
|
%0 = add nsw i32 %b, %a
|
|
%1 = add nsw i32 %0, %c
|
|
%2 = add nsw i32 %1, %d
|
|
%3 = add nsw i32 %2, %e
|
|
%4 = add nsw i32 %3, %f
|
|
%5 = add nsw i32 %4, %g
|
|
%6 = add nsw i32 %5, %h
|
|
ret i32 %6
|
|
}
|
|
|
|
; CHECK-LABEL: leaf_proc_with_local_array:
|
|
; CHECK: add %sp, -104, %sp
|
|
; CHECK: mov 1, [[R1:%[go][0-7]]]
|
|
; CHECK: st [[R1]], [%sp+96]
|
|
; CHECK: mov 2, [[R2:%[go][0-7]]]
|
|
; CHECK: st [[R2]], [%sp+100]
|
|
; CHECK: ld {{.+}}, %o0
|
|
; CHECK: retl
|
|
; CHECK-NEXT: add %sp, 104, %sp
|
|
|
|
define i32 @leaf_proc_with_local_array(i32 %a, i32 %b, i32 %c) {
|
|
entry:
|
|
%array = alloca [2 x i32], align 4
|
|
%0 = sub nsw i32 %b, %c
|
|
%1 = getelementptr inbounds [2 x i32]* %array, i32 0, i32 0
|
|
store i32 1, i32* %1, align 4
|
|
%2 = getelementptr inbounds [2 x i32]* %array, i32 0, i32 1
|
|
store i32 2, i32* %2, align 4
|
|
%3 = getelementptr inbounds [2 x i32]* %array, i32 0, i32 %a
|
|
%4 = load i32* %3, align 4
|
|
ret i32 %4
|
|
}
|