64 lines · plain
1; RUN: llc < %s -mtriple=armv7-none-linux-gnueabi | FileCheck %s2; Test that we correctly use registers and align elements when using va_arg3 4%struct_t = type { double, double, double }5@static_val = constant %struct_t { double 1.0, double 2.0, double 3.0 }6 7declare void @llvm.va_start(ptr) nounwind8declare void @llvm.va_end(ptr) nounwind9 10; CHECK-LABEL: test_byval_8_bytes_alignment:11define void @test_byval_8_bytes_alignment(i32 %i, ...) {12entry:13; CHECK: sub sp, sp, #1614; CHECK: add r0, sp, #415; CHECK: stmib sp, {r1, r2, r3}16 %g = alloca ptr17 call void @llvm.va_start(ptr %g)18 19; CHECK: add [[REG:(r[0-9]+)|(lr)]], {{(r[0-9]+)|(lr)}}, #720; CHECK: bic [[REG]], [[REG]], #721 %0 = va_arg ptr %g, double22 call void @llvm.va_end(ptr %g)23 24 ret void25}26 27; CHECK-LABEL: main:28; CHECK: movw [[BASE:r[0-9]+]], :lower16:static_val29; CHECK: movt [[BASE]], :upper16:static_val30; ldm is not formed when the coalescer failed to coalesce everything.31; CHECK: ldrd r2, [[TMP:r[0-9]+]], [[[BASE]]]32; CHECK: movw r0, #55533define i32 @main() {34entry:35 call void (i32, ...) @test_byval_8_bytes_alignment(i32 555, ptr byval(%struct_t) @static_val)36 ret i32 037}38 39declare void @f(double);40 41; CHECK-LABEL: test_byval_8_bytes_alignment_fixed_arg:42; CHECK-NOT: str r143; CHECK-DAG: str r3, [sp, #12]44; CHECK-DAG: str r2, [sp, #8]45; CHECK-NOT: str r146define void @test_byval_8_bytes_alignment_fixed_arg(i32 %n1, ptr byval(%struct_t) %val) nounwind {47entry:48 %0 = load double, ptr %val49 call void (double) @f(double %0)50 ret void51}52 53; CHECK-LABEL: main_fixed_arg:54; CHECK: movw [[BASE:r[0-9]+]], :lower16:static_val55; CHECK: movt [[BASE]], :upper16:static_val56; ldm is not formed when the coalescer failed to coalesce everything.57; CHECK: ldrd r2, [[TMP:r[0-9]+]], [[[BASE]]]58; CHECK: movw r0, #55559define i32 @main_fixed_arg() {60entry:61 call void (i32, ptr) @test_byval_8_bytes_alignment_fixed_arg(i32 555, ptr byval(%struct_t) @static_val)62 ret i32 063}64