xref: /aosp_15_r20/external/llvm/test/CodeGen/AArch64/fpimm.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=aarch64-linux-gnu                                                  -verify-machineinstrs < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=aarch64-apple-darwin -code-model=large                             -verify-machineinstrs < %s | FileCheck %s --check-prefix=LARGE
3*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=aarch64-apple-darwin -code-model=large -fast-isel -fast-isel-abort=1 -verify-machineinstrs < %s | FileCheck %s --check-prefix=LARGE
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker@varf32 = global float 0.0
6*9880d681SAndroid Build Coastguard Worker@varf64 = global double 0.0
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Workerdefine void @check_float() {
9*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: check_float:
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Worker  %val = load float, float* @varf32
12*9880d681SAndroid Build Coastguard Worker  %newval1 = fadd float %val, 8.5
13*9880d681SAndroid Build Coastguard Worker  store volatile float %newval1, float* @varf32
14*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: fmov [[EIGHT5:s[0-9]+]], #8.5
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Worker  %newval2 = fadd float %val, 128.0
17*9880d681SAndroid Build Coastguard Worker  store volatile float %newval2, float* @varf32
18*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: ldr [[HARD:s[0-9]+]], [{{x[0-9]+}}, {{#?}}:lo12:.LCPI0_0
19*9880d681SAndroid Build Coastguard Worker
20*9880d681SAndroid Build Coastguard Worker; CHECK: ret
21*9880d681SAndroid Build Coastguard Worker  ret void
22*9880d681SAndroid Build Coastguard Worker}
23*9880d681SAndroid Build Coastguard Worker
24*9880d681SAndroid Build Coastguard Workerdefine void @check_double() {
25*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: check_double:
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Worker  %val = load double, double* @varf64
28*9880d681SAndroid Build Coastguard Worker  %newval1 = fadd double %val, 8.5
29*9880d681SAndroid Build Coastguard Worker  store volatile double %newval1, double* @varf64
30*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: fmov {{d[0-9]+}}, #8.5
31*9880d681SAndroid Build Coastguard Worker
32*9880d681SAndroid Build Coastguard Worker  %newval2 = fadd double %val, 128.0
33*9880d681SAndroid Build Coastguard Worker  store volatile double %newval2, double* @varf64
34*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: ldr {{d[0-9]+}}, [{{x[0-9]+}}, {{#?}}:lo12:.LCPI1_0
35*9880d681SAndroid Build Coastguard Worker
36*9880d681SAndroid Build Coastguard Worker; CHECK: ret
37*9880d681SAndroid Build Coastguard Worker  ret void
38*9880d681SAndroid Build Coastguard Worker}
39*9880d681SAndroid Build Coastguard Worker
40*9880d681SAndroid Build Coastguard Worker; LARGE-LABEL: check_float2
41*9880d681SAndroid Build Coastguard Worker; LARGE:       mov [[REG:w[0-9]+]], #1078525952
42*9880d681SAndroid Build Coastguard Worker; LARGE-NEXT:  movk [[REG]], #4059
43*9880d681SAndroid Build Coastguard Worker; LARGE-NEXT:  fmov s0, [[REG]]
44*9880d681SAndroid Build Coastguard Workerdefine float @check_float2() {
45*9880d681SAndroid Build Coastguard Worker  ret float 3.14159274101257324218750
46*9880d681SAndroid Build Coastguard Worker}
47*9880d681SAndroid Build Coastguard Worker
48*9880d681SAndroid Build Coastguard Worker; LARGE-LABEL: check_double2
49*9880d681SAndroid Build Coastguard Worker; LARGE:       mov [[REG:x[0-9]+]], #4614219293217783808
50*9880d681SAndroid Build Coastguard Worker; LARGE-NEXT:  movk [[REG]], #8699, lsl #32
51*9880d681SAndroid Build Coastguard Worker; LARGE-NEXT:  movk [[REG]], #21572, lsl #16
52*9880d681SAndroid Build Coastguard Worker; LARGE-NEXT:  movk [[REG]], #11544
53*9880d681SAndroid Build Coastguard Worker; LARGE-NEXT:  fmov d0, [[REG]]
54*9880d681SAndroid Build Coastguard Workerdefine double @check_double2() {
55*9880d681SAndroid Build Coastguard Worker  ret double 3.1415926535897931159979634685441851615905761718750
56*9880d681SAndroid Build Coastguard Worker}
57