1; RUN: llc -mtriple=aarch64-linux-gnu -verify-machineinstrs < %s | FileCheck %s 2; RUN: llc -mtriple=aarch64-apple-darwin -code-model=large -verify-machineinstrs < %s | FileCheck %s --check-prefix=LARGE 3; RUN: llc -mtriple=aarch64-apple-darwin -code-model=large -fast-isel -fast-isel-abort=1 -verify-machineinstrs < %s | FileCheck %s --check-prefix=LARGE 4; RUN: llc -mtriple=aarch64-none-eabi -code-model=tiny -verify-machineinstrs < %s | FileCheck %s --check-prefix=TINY 5 6@varf32 = global float 0.0 7@varf64 = global double 0.0 8 9define void @check_float() { 10; CHECK-LABEL: check_float: 11; TINY-LABEL: check_float: 12 13 %val = load float, float* @varf32 14 %newval1 = fadd float %val, 8.5 15 store volatile float %newval1, float* @varf32 16; CHECK-DAG: fmov {{s[0-9]+}}, #8.5 17; TINY-DAG: fmov {{s[0-9]+}}, #8.5 18 19 %newval2 = fadd float %val, 128.0 20 store volatile float %newval2, float* @varf32 21; CHECK-DAG: mov [[W128:w[0-9]+]], #1124073472 22; CHECK-DAG: fmov {{s[0-9]+}}, [[W128]] 23; TINY-DAG: mov [[W128:w[0-9]+]], #1124073472 24; TINY-DAG: fmov {{s[0-9]+}}, [[W128]] 25 26; CHECK: ret 27; TINY: ret 28 ret void 29} 30 31define void @check_double() { 32; CHECK-LABEL: check_double: 33; TINY-LABEL: check_double: 34 35 %val = load double, double* @varf64 36 %newval1 = fadd double %val, 8.5 37 store volatile double %newval1, double* @varf64 38; CHECK-DAG: fmov {{d[0-9]+}}, #8.5 39; TINY-DAG: fmov {{d[0-9]+}}, #8.5 40 41 %newval2 = fadd double %val, 128.0 42 store volatile double %newval2, double* @varf64 43; CHECK-DAG: mov [[X128:x[0-9]+]], #4638707616191610880 44; CHECK-DAG: fmov {{d[0-9]+}}, [[X128]] 45; TINY-DAG: mov [[X128:x[0-9]+]], #4638707616191610880 46; TINY-DAG: fmov {{d[0-9]+}}, [[X128]] 47 48; 64-bit ORR followed by MOVK. 49; CHECK-DAG: mov [[XFP0:x[0-9]+]], #1082331758844 50; CHECK-DAG: movk [[XFP0]], #64764, lsl #16 51; CHECk-DAG: fmov {{d[0-9]+}}, [[XFP0]] 52 %newval3 = fadd double %val, 0xFCFCFC00FC 53 store volatile double %newval3, double* @varf64 54 55; CHECK: ret 56; TINY: ret 57 ret void 58} 59 60; LARGE-LABEL: check_float2 61; LARGE: mov [[REG:w[0-9]+]], #4059 62; LARGE-NEXT: movk [[REG]], #16457, lsl #16 63; LARGE-NEXT: fmov s0, [[REG]] 64; TINY-LABEL: check_float2 65; TINY: mov [[REG:w[0-9]+]], #4059 66; TINY-NEXT: movk [[REG]], #16457, lsl #16 67define float @check_float2() { 68 ret float 3.14159274101257324218750 69} 70 71; LARGE-LABEL: check_double2 72; LARGE: mov [[REG:x[0-9]+]], #11544 73; LARGE-NEXT: movk [[REG]], #21572, lsl #16 74; LARGE-NEXT: movk [[REG]], #8699, lsl #32 75; LARGE-NEXT: movk [[REG]], #16393, lsl #48 76; LARGE-NEXT: fmov d0, [[REG]] 77; TINY-LABEL: check_double2 78; TINY: ldr d0, .LCPI3_0 79define double @check_double2() { 80 ret double 3.1415926535897931159979634685441851615905761718750 81} 82