1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+d -verify-machineinstrs < %s \
3 ; RUN: -target-abi=ilp32d | FileCheck %s
4 ; RUN: llc -mtriple=riscv64 -mattr=+d -verify-machineinstrs < %s \
5 ; RUN: -target-abi=lp64d | FileCheck %s
6 ; RUN: llc -mtriple=riscv32 -mattr=+zdinx -verify-machineinstrs < %s \
7 ; RUN: -target-abi=ilp32 | FileCheck --check-prefix=CHECKRV32ZDINX %s
8 ; RUN: llc -mtriple=riscv64 -mattr=+zdinx -verify-machineinstrs < %s \
9 ; RUN: -target-abi=lp64 | FileCheck --check-prefix=CHECKRV64ZDINX %s
11 define double @double_imm() nounwind {
12 ; CHECK-LABEL: double_imm:
14 ; CHECK-NEXT: lui a0, %hi(.LCPI0_0)
15 ; CHECK-NEXT: fld fa0, %lo(.LCPI0_0)(a0)
18 ; CHECKRV32ZDINX-LABEL: double_imm:
19 ; CHECKRV32ZDINX: # %bb.0:
20 ; CHECKRV32ZDINX-NEXT: lui a0, 345155
21 ; CHECKRV32ZDINX-NEXT: addi a0, a0, -744
22 ; CHECKRV32ZDINX-NEXT: lui a1, 262290
23 ; CHECKRV32ZDINX-NEXT: addi a1, a1, 507
24 ; CHECKRV32ZDINX-NEXT: ret
26 ; CHECKRV64ZDINX-LABEL: double_imm:
27 ; CHECKRV64ZDINX: # %bb.0:
28 ; CHECKRV64ZDINX-NEXT: lui a0, %hi(.LCPI0_0)
29 ; CHECKRV64ZDINX-NEXT: ld a0, %lo(.LCPI0_0)(a0)
30 ; CHECKRV64ZDINX-NEXT: ret
31 ret double 3.1415926535897931159979634685441851615905761718750
34 define double @double_imm_op(double %a) nounwind {
35 ; CHECK-LABEL: double_imm_op:
37 ; CHECK-NEXT: lui a0, %hi(.LCPI1_0)
38 ; CHECK-NEXT: fld fa5, %lo(.LCPI1_0)(a0)
39 ; CHECK-NEXT: fadd.d fa0, fa0, fa5
42 ; CHECKRV32ZDINX-LABEL: double_imm_op:
43 ; CHECKRV32ZDINX: # %bb.0:
44 ; CHECKRV32ZDINX-NEXT: addi sp, sp, -16
45 ; CHECKRV32ZDINX-NEXT: sw a0, 8(sp)
46 ; CHECKRV32ZDINX-NEXT: sw a1, 12(sp)
47 ; CHECKRV32ZDINX-NEXT: lw a0, 8(sp)
48 ; CHECKRV32ZDINX-NEXT: lw a1, 12(sp)
49 ; CHECKRV32ZDINX-NEXT: lui a2, %hi(.LCPI1_0)
50 ; CHECKRV32ZDINX-NEXT: lw a3, %lo(.LCPI1_0+4)(a2)
51 ; CHECKRV32ZDINX-NEXT: lw a2, %lo(.LCPI1_0)(a2)
52 ; CHECKRV32ZDINX-NEXT: fadd.d a0, a0, a2
53 ; CHECKRV32ZDINX-NEXT: sw a0, 8(sp)
54 ; CHECKRV32ZDINX-NEXT: sw a1, 12(sp)
55 ; CHECKRV32ZDINX-NEXT: lw a0, 8(sp)
56 ; CHECKRV32ZDINX-NEXT: lw a1, 12(sp)
57 ; CHECKRV32ZDINX-NEXT: addi sp, sp, 16
58 ; CHECKRV32ZDINX-NEXT: ret
60 ; CHECKRV64ZDINX-LABEL: double_imm_op:
61 ; CHECKRV64ZDINX: # %bb.0:
62 ; CHECKRV64ZDINX-NEXT: lui a1, %hi(.LCPI1_0)
63 ; CHECKRV64ZDINX-NEXT: ld a1, %lo(.LCPI1_0)(a1)
64 ; CHECKRV64ZDINX-NEXT: fadd.d a0, a0, a1
65 ; CHECKRV64ZDINX-NEXT: ret
66 %1 = fadd double %a, 1.0
70 define double @double_positive_zero(ptr %pd) nounwind {
71 ; CHECKRV32ZDINX-LABEL: double_positive_zero:
72 ; CHECKRV32ZDINX: # %bb.0:
73 ; CHECKRV32ZDINX-NEXT: li a0, 0
74 ; CHECKRV32ZDINX-NEXT: li a1, 0
75 ; CHECKRV32ZDINX-NEXT: ret
77 ; CHECKRV64ZDINX-LABEL: double_positive_zero:
78 ; CHECKRV64ZDINX: # %bb.0:
79 ; CHECKRV64ZDINX-NEXT: li a0, 0
80 ; CHECKRV64ZDINX-NEXT: ret
84 define double @double_negative_zero(ptr %pd) nounwind {
85 ; CHECKRV32ZDINX-LABEL: double_negative_zero:
86 ; CHECKRV32ZDINX: # %bb.0:
87 ; CHECKRV32ZDINX-NEXT: lui a1, 524288
88 ; CHECKRV32ZDINX-NEXT: li a0, 0
89 ; CHECKRV32ZDINX-NEXT: ret
91 ; CHECKRV64ZDINX-LABEL: double_negative_zero:
92 ; CHECKRV64ZDINX: # %bb.0:
93 ; CHECKRV64ZDINX-NEXT: li a0, -1
94 ; CHECKRV64ZDINX-NEXT: slli a0, a0, 63
95 ; CHECKRV64ZDINX-NEXT: ret