1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64" 4*9880d681SAndroid Build Coastguard Workertarget triple = "armv7-none--gnueabihf" 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Worker%struct.s = type { float, float } 7*9880d681SAndroid Build Coastguard Worker%union.t = type { [4 x float] } 8*9880d681SAndroid Build Coastguard Worker 9*9880d681SAndroid Build Coastguard Worker; Equivalent C code: 10*9880d681SAndroid Build Coastguard Worker; struct s { float a; float b; }; 11*9880d681SAndroid Build Coastguard Worker; float foo(float a, double b, struct s c) { return c.a; } 12*9880d681SAndroid Build Coastguard Worker; Argument allocation: 13*9880d681SAndroid Build Coastguard Worker; a -> s0 14*9880d681SAndroid Build Coastguard Worker; b -> d1 15*9880d681SAndroid Build Coastguard Worker; c -> s4, s5 16*9880d681SAndroid Build Coastguard Worker; s1 is unused 17*9880d681SAndroid Build Coastguard Worker; return in s0 18*9880d681SAndroid Build Coastguard Workerdefine float @test1(float %a, double %b, %struct.s %c) { 19*9880d681SAndroid Build Coastguard Workerentry: 20*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test1 21*9880d681SAndroid Build Coastguard Worker; CHECK: vmov.f32 s0, s4 22*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: vmov.f32 s0, s1 23*9880d681SAndroid Build Coastguard Worker 24*9880d681SAndroid Build Coastguard Worker %result = extractvalue %struct.s %c, 0 25*9880d681SAndroid Build Coastguard Worker ret float %result 26*9880d681SAndroid Build Coastguard Worker} 27*9880d681SAndroid Build Coastguard Worker 28*9880d681SAndroid Build Coastguard Worker; Equivalent C code: 29*9880d681SAndroid Build Coastguard Worker; union t { float a[4] }; 30*9880d681SAndroid Build Coastguard Worker; float foo(float a, double b, union s c) { return c.a[0]; } 31*9880d681SAndroid Build Coastguard Worker; Argument allocation: 32*9880d681SAndroid Build Coastguard Worker; a -> s0 33*9880d681SAndroid Build Coastguard Worker; b -> d1 34*9880d681SAndroid Build Coastguard Worker; c -> s4..s7 35*9880d681SAndroid Build Coastguard Workerdefine float @test2(float %a, double %b, %union.t %c) #0 { 36*9880d681SAndroid Build Coastguard Workerentry: 37*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test2 38*9880d681SAndroid Build Coastguard Worker; CHECK: vmov.f32 s0, s4 39*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: vmov.f32 s0, s1 40*9880d681SAndroid Build Coastguard Worker 41*9880d681SAndroid Build Coastguard Worker %result = extractvalue %union.t %c, 0, 0 42*9880d681SAndroid Build Coastguard Worker ret float %result 43*9880d681SAndroid Build Coastguard Worker} 44*9880d681SAndroid Build Coastguard Worker 45*9880d681SAndroid Build Coastguard Worker; Equivalent C code: 46*9880d681SAndroid Build Coastguard Worker; struct s { float a; float b; }; 47*9880d681SAndroid Build Coastguard Worker; float foo(float a, double b, struct s c, float d) { return d; } 48*9880d681SAndroid Build Coastguard Worker; Argument allocation: 49*9880d681SAndroid Build Coastguard Worker; a -> s0 50*9880d681SAndroid Build Coastguard Worker; b -> d1 51*9880d681SAndroid Build Coastguard Worker; c -> s4, s5 52*9880d681SAndroid Build Coastguard Worker; d -> s1 53*9880d681SAndroid Build Coastguard Worker; return in s0 54*9880d681SAndroid Build Coastguard Workerdefine float @test3(float %a, double %b, %struct.s %c, float %d) { 55*9880d681SAndroid Build Coastguard Workerentry: 56*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test3 57*9880d681SAndroid Build Coastguard Worker; CHECK: vmov.f32 s0, s1 58*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: vmov.f32 s0, s5 59*9880d681SAndroid Build Coastguard Worker 60*9880d681SAndroid Build Coastguard Worker ret float %d 61*9880d681SAndroid Build Coastguard Worker} 62*9880d681SAndroid Build Coastguard Worker 63*9880d681SAndroid Build Coastguard Worker; Equivalent C code: 64*9880d681SAndroid Build Coastguard Worker; struct s { float a; float b; }; 65*9880d681SAndroid Build Coastguard Worker; float foo(struct s a, struct s b) { return b.b; } 66*9880d681SAndroid Build Coastguard Worker; Argument allocation: 67*9880d681SAndroid Build Coastguard Worker; a -> s0, s1 68*9880d681SAndroid Build Coastguard Worker; b -> s2, s3 69*9880d681SAndroid Build Coastguard Worker; return in s0 70*9880d681SAndroid Build Coastguard Workerdefine float @test4(%struct.s %a, %struct.s %b) { 71*9880d681SAndroid Build Coastguard Workerentry: 72*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test4 73*9880d681SAndroid Build Coastguard Worker; CHECK: vmov.f32 s0, s3 74*9880d681SAndroid Build Coastguard Worker 75*9880d681SAndroid Build Coastguard Worker %result = extractvalue %struct.s %b, 1 76*9880d681SAndroid Build Coastguard Worker ret float %result 77*9880d681SAndroid Build Coastguard Worker} 78*9880d681SAndroid Build Coastguard Worker 79*9880d681SAndroid Build Coastguard Worker; Equivalent C code: 80*9880d681SAndroid Build Coastguard Worker; struct s { float a; float b; }; 81*9880d681SAndroid Build Coastguard Worker; float foo(struct s a, float b, struct s c) { return c.a; } 82*9880d681SAndroid Build Coastguard Worker; Argument allocation: 83*9880d681SAndroid Build Coastguard Worker; a -> s0, s1 84*9880d681SAndroid Build Coastguard Worker; b -> s2 85*9880d681SAndroid Build Coastguard Worker; c -> s3, s4 86*9880d681SAndroid Build Coastguard Worker; return in s0 87*9880d681SAndroid Build Coastguard Workerdefine float @test5(%struct.s %a, float %b, %struct.s %c) { 88*9880d681SAndroid Build Coastguard Workerentry: 89*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test5 90*9880d681SAndroid Build Coastguard Worker; CHECK: vmov.f32 s0, s3 91*9880d681SAndroid Build Coastguard Worker 92*9880d681SAndroid Build Coastguard Worker %result = extractvalue %struct.s %c, 0 93*9880d681SAndroid Build Coastguard Worker ret float %result 94*9880d681SAndroid Build Coastguard Worker} 95