1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \
3 ; RUN: | FileCheck -check-prefix=RV32I %s
5 @x = local_unnamed_addr global fp128 0xL00000000000000007FFF000000000000, align 16
6 @y = local_unnamed_addr global fp128 0xL00000000000000007FFF000000000000, align 16
8 ; Besides anything else, these tests help verify that libcall ABI lowering
11 define i32 @test_load_and_cmp() nounwind {
12 ; RV32I-LABEL: test_load_and_cmp:
14 ; RV32I-NEXT: addi sp, sp, -48
15 ; RV32I-NEXT: sw ra, 44(sp)
16 ; RV32I-NEXT: lui a0, %hi(x)
17 ; RV32I-NEXT: addi a1, a0, %lo(x)
18 ; RV32I-NEXT: lw a6, 4(a1)
19 ; RV32I-NEXT: lw a7, 8(a1)
20 ; RV32I-NEXT: lw a1, 12(a1)
21 ; RV32I-NEXT: lw a0, %lo(x)(a0)
22 ; RV32I-NEXT: lui a4, %hi(y)
23 ; RV32I-NEXT: addi a5, a4, %lo(y)
24 ; RV32I-NEXT: lw a2, 4(a5)
25 ; RV32I-NEXT: lw a3, 8(a5)
26 ; RV32I-NEXT: lw a5, 12(a5)
27 ; RV32I-NEXT: lw a4, %lo(y)(a4)
28 ; RV32I-NEXT: sw a4, 8(sp)
29 ; RV32I-NEXT: sw a0, 24(sp)
30 ; RV32I-NEXT: sw a5, 20(sp)
31 ; RV32I-NEXT: sw a3, 16(sp)
32 ; RV32I-NEXT: sw a2, 12(sp)
33 ; RV32I-NEXT: sw a1, 36(sp)
34 ; RV32I-NEXT: sw a7, 32(sp)
35 ; RV32I-NEXT: addi a0, sp, 24
36 ; RV32I-NEXT: addi a1, sp, 8
37 ; RV32I-NEXT: sw a6, 28(sp)
38 ; RV32I-NEXT: call __netf2
39 ; RV32I-NEXT: snez a0, a0
40 ; RV32I-NEXT: lw ra, 44(sp)
41 ; RV32I-NEXT: addi sp, sp, 48
43 %1 = load fp128, fp128* @x, align 16
44 %2 = load fp128, fp128* @y, align 16
45 %cmp = fcmp une fp128 %1, %2
46 %3 = zext i1 %cmp to i32
50 define i32 @test_add_and_fptosi() nounwind {
51 ; RV32I-LABEL: test_add_and_fptosi:
53 ; RV32I-NEXT: addi sp, sp, -80
54 ; RV32I-NEXT: sw ra, 76(sp)
55 ; RV32I-NEXT: lui a0, %hi(x)
56 ; RV32I-NEXT: addi a1, a0, %lo(x)
57 ; RV32I-NEXT: lw a6, 4(a1)
58 ; RV32I-NEXT: lw a7, 8(a1)
59 ; RV32I-NEXT: lw a1, 12(a1)
60 ; RV32I-NEXT: lw a0, %lo(x)(a0)
61 ; RV32I-NEXT: lui a4, %hi(y)
62 ; RV32I-NEXT: addi a5, a4, %lo(y)
63 ; RV32I-NEXT: lw a3, 4(a5)
64 ; RV32I-NEXT: lw a2, 8(a5)
65 ; RV32I-NEXT: lw a5, 12(a5)
66 ; RV32I-NEXT: lw a4, %lo(y)(a4)
67 ; RV32I-NEXT: sw a4, 24(sp)
68 ; RV32I-NEXT: sw a0, 40(sp)
69 ; RV32I-NEXT: sw a5, 36(sp)
70 ; RV32I-NEXT: sw a2, 32(sp)
71 ; RV32I-NEXT: sw a3, 28(sp)
72 ; RV32I-NEXT: sw a1, 52(sp)
73 ; RV32I-NEXT: sw a7, 48(sp)
74 ; RV32I-NEXT: addi a0, sp, 56
75 ; RV32I-NEXT: addi a1, sp, 40
76 ; RV32I-NEXT: addi a2, sp, 24
77 ; RV32I-NEXT: sw a6, 44(sp)
78 ; RV32I-NEXT: call __addtf3
79 ; RV32I-NEXT: lw a1, 56(sp)
80 ; RV32I-NEXT: lw a0, 60(sp)
81 ; RV32I-NEXT: lw a2, 64(sp)
82 ; RV32I-NEXT: lw a3, 68(sp)
83 ; RV32I-NEXT: sw a3, 20(sp)
84 ; RV32I-NEXT: sw a2, 16(sp)
85 ; RV32I-NEXT: sw a0, 12(sp)
86 ; RV32I-NEXT: addi a0, sp, 8
87 ; RV32I-NEXT: sw a1, 8(sp)
88 ; RV32I-NEXT: call __fixtfsi
89 ; RV32I-NEXT: lw ra, 76(sp)
90 ; RV32I-NEXT: addi sp, sp, 80
92 %1 = load fp128, fp128* @x, align 16
93 %2 = load fp128, fp128* @y, align 16
94 %3 = fadd fp128 %1, %2
95 %4 = fptosi fp128 %3 to i32