mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-13 09:33:50 +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
71 lines
2.2 KiB
LLVM
71 lines
2.2 KiB
LLVM
; RUN: llc < %s -mtriple=armv7-none-linux-gnueabi | FileCheck %s
|
|
; Test that we correctly use registers and align elements when using va_arg
|
|
|
|
%struct_t = type { double, double, double }
|
|
@static_val = constant %struct_t { double 1.0, double 2.0, double 3.0 }
|
|
|
|
declare void @llvm.va_start(i8*) nounwind
|
|
declare void @llvm.va_end(i8*) nounwind
|
|
|
|
; CHECK-LABEL: test_byval_8_bytes_alignment:
|
|
define void @test_byval_8_bytes_alignment(i32 %i, ...) {
|
|
entry:
|
|
; CHECK: stm r0, {r1, r2, r3}
|
|
%g = alloca i8*
|
|
%g1 = bitcast i8** %g to i8*
|
|
call void @llvm.va_start(i8* %g1)
|
|
|
|
; CHECK: add [[REG:(r[0-9]+)|(lr)]], {{(r[0-9]+)|(lr)}}, #7
|
|
; CHECK: bfc [[REG]], #0, #3
|
|
%0 = va_arg i8** %g, double
|
|
call void @llvm.va_end(i8* %g1)
|
|
|
|
ret void
|
|
}
|
|
|
|
; CHECK-LABEL: main:
|
|
; CHECK: movw [[BASE:r[0-9]+]], :lower16:static_val
|
|
; CHECK: movt [[BASE]], :upper16:static_val
|
|
; ldm is not formed when the coalescer failed to coalesce everything.
|
|
; CHECK: ldr r2, {{\[}}[[BASE]]{{\]}}
|
|
; CHECK: ldr [[TMP:r[0-9]+]], {{\[}}[[BASE]], #4{{\]}}
|
|
; CHECK: movw r0, #555
|
|
; Currently the coalescer misses this opportunity.
|
|
; CHECK: mov r3, [[TMP]]
|
|
define i32 @main() {
|
|
entry:
|
|
call void (i32, ...)* @test_byval_8_bytes_alignment(i32 555, %struct_t* byval @static_val)
|
|
ret i32 0
|
|
}
|
|
|
|
declare void @f(double);
|
|
|
|
; CHECK-LABEL: test_byval_8_bytes_alignment_fixed_arg:
|
|
; CHECK-NOT: str r1
|
|
; CHECK: str r3, [sp, #12]
|
|
; CHECK: str r2, [sp, #8]
|
|
; CHECK-NOT: str r1
|
|
define void @test_byval_8_bytes_alignment_fixed_arg(i32 %n1, %struct_t* byval %val) nounwind {
|
|
entry:
|
|
%a = getelementptr inbounds %struct_t* %val, i32 0, i32 0
|
|
%0 = load double* %a
|
|
call void (double)* @f(double %0)
|
|
ret void
|
|
}
|
|
|
|
; CHECK-LABEL: main_fixed_arg:
|
|
; CHECK: movw [[BASE:r[0-9]+]], :lower16:static_val
|
|
; CHECK: movt [[BASE]], :upper16:static_val
|
|
; ldm is not formed when the coalescer failed to coalesce everything.
|
|
; CHECK: ldr r2, {{\[}}[[BASE]]{{\]}}
|
|
; CHECK: ldr [[TMP:r[0-9]+]], {{\[}}[[BASE]], #4{{\]}}
|
|
; CHECK: movw r0, #555
|
|
; Currently the coalescer misses this opportunity.
|
|
; CHECK: mov r3, [[TMP]]
|
|
define i32 @main_fixed_arg() {
|
|
entry:
|
|
call void (i32, %struct_t*)* @test_byval_8_bytes_alignment_fixed_arg(i32 555, %struct_t* byval @static_val)
|
|
ret i32 0
|
|
}
|
|
|