1 ; RUN: llc -verify-machineinstrs < %s -mtriple=arm-eabi -mattr=v7,neon | FileCheck --check-prefix=CHECK --check-prefix=CHECK-LE %s 2 ; RUN: llc -verify-machineinstrs < %s -mtriple=armeb-eabi -mattr=v7,neon | FileCheck --check-prefix=CHECK --check-prefix=CHECK-BE %s 3 4 @var32 = global i32 0 5 @vardouble = global double 0.0 6 7 define void @arg_longint( i64 %val ) { 8 ; CHECK-LABEL: arg_longint: 9 ; CHECK-LE: str r0, [r1] 10 ; CHECK-BE: str r1, [r0] 11 %tmp = trunc i64 %val to i32 12 store i32 %tmp, i32* @var32 13 ret void 14 } 15 16 define void @arg_double( double %val ) { 17 ; CHECK-LABEL: arg_double: 18 ; CHECK: strd r0, r1, [r2] 19 store double %val, double* @vardouble 20 ret void 21 } 22 23 define void @arg_v4i32(<4 x i32> %vec ) { 24 ; CHECK-LABEL: arg_v4i32: 25 ; CHECK-LE: vmov {{d[0-9]+}}, r2, r3 26 ; CHECK-LE: vmov [[ARG_V4I32_REG:d[0-9]+]], r0, r1 27 ; CHECK-BE: vmov {{d[0-9]+}}, r3, r2 28 ; CHECK-BE: vmov [[ARG_V4I32_REG:d[0-9]+]], r1, r0 29 ; CHECK: vst1.32 {[[ARG_V4I32_REG]][0]}, [r0:32] 30 %tmp = extractelement <4 x i32> %vec, i32 0 31 store i32 %tmp, i32* @var32 32 ret void 33 } 34 35 define void @arg_v2f64(<2 x double> %vec ) { 36 ; CHECK-LABEL: arg_v2f64: 37 ; CHECK: strd r0, r1, [r2] 38 %tmp = extractelement <2 x double> %vec, i32 0 39 store double %tmp, double* @vardouble 40 ret void 41 } 42 43 define i64 @return_longint() { 44 ; CHECK-LABEL: return_longint: 45 ; CHECK-LE: mov r0, #42 46 ; CHECK-LE: mov r1, #0 47 ; CHECK-BE: mov r0, #0 48 ; CHECK-BE: mov r1, #42 49 ret i64 42 50 } 51 52 define double @return_double() { 53 ; CHECK-LABEL: return_double: 54 ; CHECK-LE: vmov r0, r1, {{d[0-9]+}} 55 ; CHECK-BE: vmov r1, r0, {{d[0-9]+}} 56 ret double 1.0 57 } 58 59 define <4 x i32> @return_v4i32() { 60 ; CHECK-LABEL: return_v4i32: 61 ; CHECK-LE: vmov r0, r1, {{d[0-9]+}} 62 ; CHECK-LE: vmov r2, r3, {{d[0-9]+}} 63 ; CHECK-BE: vmov r1, r0, {{d[0-9]+}} 64 ; CHECK-BE: vmov r3, r2, {{d[0-9]+}} 65 ret < 4 x i32> < i32 42, i32 43, i32 44, i32 45 > 66 } 67 68 define <2 x double> @return_v2f64() { 69 ; CHECK-LABEL: return_v2f64: 70 ; CHECK-LE: vmov r0, r1, {{d[0-9]+}} 71 ; CHECK-LE: vmov r2, r3, {{d[0-9]+}} 72 ; CHECK-BE: vmov r1, r0, {{d[0-9]+}} 73 ; CHECK-BE: vmov r3, r2, {{d[0-9]+}} 74 ret <2 x double> < double 3.14, double 6.28 > 75 } 76 77 define void @caller_arg_longint() { 78 ; CHECK-LABEL: caller_arg_longint: 79 ; CHECK-LE: mov r0, #42 80 ; CHECK-LE: mov r1, #0 81 ; CHECK-BE: mov r0, #0 82 ; CHECK-BE: mov r1, #42 83 call void @arg_longint( i64 42 ) 84 ret void 85 } 86 87 define void @caller_arg_double() { 88 ; CHECK-LABEL: caller_arg_double: 89 ; CHECK-LE: vmov r0, r1, {{d[0-9]+}} 90 ; CHECK-BE: vmov r1, r0, {{d[0-9]+}} 91 call void @arg_double( double 1.0 ) 92 ret void 93 } 94 95 define void @caller_return_longint() { 96 ; CHECK-LABEL: caller_return_longint: 97 ; CHECK-LE: str r0, [r1] 98 ; CHECK-BE: str r1, [r0] 99 %val = call i64 @return_longint() 100 %tmp = trunc i64 %val to i32 101 store i32 %tmp, i32* @var32 102 ret void 103 } 104 105 define void @caller_return_double() { 106 ; CHECK-LABEL: caller_return_double: 107 ; CHECK-LE: vmov {{d[0-9]+}}, r0, r1 108 ; CHECK-BE: vmov {{d[0-9]+}}, r1, r0 109 %val = call double @return_double( ) 110 %tmp = fadd double %val, 3.14 111 store double %tmp, double* @vardouble 112 ret void 113 } 114 115 define void @caller_return_v2f64() { 116 ; CHECK-LABEL: caller_return_v2f64: 117 ; CHECK: strd r0, r1, [r2] 118 %val = call <2 x double> @return_v2f64( ) 119 %tmp = extractelement <2 x double> %val, i32 0 120 store double %tmp, double* @vardouble 121 ret void 122 } 123