1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \
; RUN: | FileCheck -check-prefix=RV32I %s
@x = local_unnamed_addr global fp128 0xL00000000000000007FFF000000000000, align 16
@y = local_unnamed_addr global fp128 0xL00000000000000007FFF000000000000, align 16
; Besides anything else, these tests help verify that libcall ABI lowering
; works correctly
define i32 @test_load_and_cmp() nounwind {
; RV32I-LABEL: test_load_and_cmp:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -48
; RV32I-NEXT: sw ra, 44(sp) # 4-byte Folded Spill
; RV32I-NEXT: lui a0, %hi(x)
; RV32I-NEXT: lui a1, %hi(y)
; RV32I-NEXT: lw a2, %lo(x)(a0)
; RV32I-NEXT: lw a3, %lo(x+4)(a0)
; RV32I-NEXT: lw a4, %lo(x+8)(a0)
; RV32I-NEXT: lw a5, %lo(x+12)(a0)
; RV32I-NEXT: lw a0, %lo(y)(a1)
; RV32I-NEXT: lw a6, %lo(y+4)(a1)
; RV32I-NEXT: lw a7, %lo(y+8)(a1)
; RV32I-NEXT: lw a1, %lo(y+12)(a1)
; RV32I-NEXT: sw a0, 8(sp)
; RV32I-NEXT: sw a6, 12(sp)
; RV32I-NEXT: sw a7, 16(sp)
; RV32I-NEXT: sw a1, 20(sp)
; RV32I-NEXT: addi a0, sp, 24
; RV32I-NEXT: addi a1, sp, 8
; RV32I-NEXT: sw a2, 24(sp)
; RV32I-NEXT: sw a3, 28(sp)
; RV32I-NEXT: sw a4, 32(sp)
; RV32I-NEXT: sw a5, 36(sp)
; RV32I-NEXT: call __netf2
; RV32I-NEXT: snez a0, a0
; RV32I-NEXT: lw ra, 44(sp) # 4-byte Folded Reload
; RV32I-NEXT: addi sp, sp, 48
; RV32I-NEXT: ret
%1 = load fp128, ptr @x, align 16
%2 = load fp128, ptr @y, align 16
%cmp = fcmp une fp128 %1, %2
%3 = zext i1 %cmp to i32
ret i32 %3
}
define i32 @test_add_and_fptosi() nounwind {
; RV32I-LABEL: test_add_and_fptosi:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -80
; RV32I-NEXT: sw ra, 76(sp) # 4-byte Folded Spill
; RV32I-NEXT: lui a0, %hi(x)
; RV32I-NEXT: lui a1, %hi(y)
; RV32I-NEXT: lw a3, %lo(x)(a0)
; RV32I-NEXT: lw a4, %lo(x+4)(a0)
; RV32I-NEXT: lw a5, %lo(x+8)(a0)
; RV32I-NEXT: lw a6, %lo(x+12)(a0)
; RV32I-NEXT: lw a0, %lo(y)(a1)
; RV32I-NEXT: lw a2, %lo(y+4)(a1)
; RV32I-NEXT: lw a7, %lo(y+8)(a1)
; RV32I-NEXT: lw a1, %lo(y+12)(a1)
; RV32I-NEXT: sw a0, 24(sp)
; RV32I-NEXT: sw a2, 28(sp)
; RV32I-NEXT: sw a7, 32(sp)
; RV32I-NEXT: sw a1, 36(sp)
; RV32I-NEXT: addi a0, sp, 56
; RV32I-NEXT: addi a1, sp, 40
; RV32I-NEXT: addi a2, sp, 24
; RV32I-NEXT: sw a3, 40(sp)
; RV32I-NEXT: sw a4, 44(sp)
; RV32I-NEXT: sw a5, 48(sp)
; RV32I-NEXT: sw a6, 52(sp)
; RV32I-NEXT: call __addtf3
; RV32I-NEXT: lw a1, 56(sp)
; RV32I-NEXT: lw a2, 60(sp)
; RV32I-NEXT: lw a3, 64(sp)
; RV32I-NEXT: lw a4, 68(sp)
; RV32I-NEXT: addi a0, sp, 8
; RV32I-NEXT: sw a1, 8(sp)
; RV32I-NEXT: sw a2, 12(sp)
; RV32I-NEXT: sw a3, 16(sp)
; RV32I-NEXT: sw a4, 20(sp)
; RV32I-NEXT: call __fixtfsi
; RV32I-NEXT: lw ra, 76(sp) # 4-byte Folded Reload
; RV32I-NEXT: addi sp, sp, 80
; RV32I-NEXT: ret
%1 = load fp128, ptr @x, align 16
%2 = load fp128, ptr @y, align 16
%3 = fadd fp128 %1, %2
%4 = fptosi fp128 %3 to i32
ret i32 %4
}
define fp128 @fmaximum(fp128 %x, fp128 %y) {
; RV32I-LABEL: fmaximum:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -64
; RV32I-NEXT: .cfi_def_cfa_offset 64
; RV32I-NEXT: sw ra, 60(sp) # 4-byte Folded Spill
; RV32I-NEXT: sw s0, 56(sp) # 4-byte Folded Spill
; RV32I-NEXT: .cfi_offset ra, -4
; RV32I-NEXT: .cfi_offset s0, -8
; RV32I-NEXT: lw a3, 0(a1)
; RV32I-NEXT: lw a4, 4(a1)
; RV32I-NEXT: lw a5, 8(a1)
; RV32I-NEXT: lw a6, 12(a1)
; RV32I-NEXT: lw a1, 0(a2)
; RV32I-NEXT: lw a7, 4(a2)
; RV32I-NEXT: lw t0, 8(a2)
; RV32I-NEXT: lw a2, 12(a2)
; RV32I-NEXT: mv s0, a0
; RV32I-NEXT: sw a1, 8(sp)
; RV32I-NEXT: sw a7, 12(sp)
; RV32I-NEXT: sw t0, 16(sp)
; RV32I-NEXT: sw a2, 20(sp)
; RV32I-NEXT: addi a0, sp, 40
; RV32I-NEXT: addi a1, sp, 24
; RV32I-NEXT: addi a2, sp, 8
; RV32I-NEXT: sw a3, 24(sp)
; RV32I-NEXT: sw a4, 28(sp)
; RV32I-NEXT: sw a5, 32(sp)
; RV32I-NEXT: sw a6, 36(sp)
; RV32I-NEXT: call fmaximuml
; RV32I-NEXT: lw a0, 40(sp)
; RV32I-NEXT: lw a1, 44(sp)
; RV32I-NEXT: lw a2, 48(sp)
; RV32I-NEXT: lw a3, 52(sp)
; RV32I-NEXT: sw a0, 0(s0)
; RV32I-NEXT: sw a1, 4(s0)
; RV32I-NEXT: sw a2, 8(s0)
; RV32I-NEXT: sw a3, 12(s0)
; RV32I-NEXT: lw ra, 60(sp) # 4-byte Folded Reload
; RV32I-NEXT: lw s0, 56(sp) # 4-byte Folded Reload
; RV32I-NEXT: .cfi_restore ra
; RV32I-NEXT: .cfi_restore s0
; RV32I-NEXT: addi sp, sp, 64
; RV32I-NEXT: .cfi_def_cfa_offset 0
; RV32I-NEXT: ret
%a = call fp128 @llvm.maximum.fp128(fp128 %x, fp128 %y)
ret fp128 %a
}
define fp128 @fminimum(fp128 %x, fp128 %y) {
; RV32I-LABEL: fminimum:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -64
; RV32I-NEXT: .cfi_def_cfa_offset 64
; RV32I-NEXT: sw ra, 60(sp) # 4-byte Folded Spill
; RV32I-NEXT: sw s0, 56(sp) # 4-byte Folded Spill
; RV32I-NEXT: .cfi_offset ra, -4
; RV32I-NEXT: .cfi_offset s0, -8
; RV32I-NEXT: lw a3, 0(a1)
; RV32I-NEXT: lw a4, 4(a1)
; RV32I-NEXT: lw a5, 8(a1)
; RV32I-NEXT: lw a6, 12(a1)
; RV32I-NEXT: lw a1, 0(a2)
; RV32I-NEXT: lw a7, 4(a2)
; RV32I-NEXT: lw t0, 8(a2)
; RV32I-NEXT: lw a2, 12(a2)
; RV32I-NEXT: mv s0, a0
; RV32I-NEXT: sw a1, 8(sp)
; RV32I-NEXT: sw a7, 12(sp)
; RV32I-NEXT: sw t0, 16(sp)
; RV32I-NEXT: sw a2, 20(sp)
; RV32I-NEXT: addi a0, sp, 40
; RV32I-NEXT: addi a1, sp, 24
; RV32I-NEXT: addi a2, sp, 8
; RV32I-NEXT: sw a3, 24(sp)
; RV32I-NEXT: sw a4, 28(sp)
; RV32I-NEXT: sw a5, 32(sp)
; RV32I-NEXT: sw a6, 36(sp)
; RV32I-NEXT: call fminimuml
; RV32I-NEXT: lw a0, 40(sp)
; RV32I-NEXT: lw a1, 44(sp)
; RV32I-NEXT: lw a2, 48(sp)
; RV32I-NEXT: lw a3, 52(sp)
; RV32I-NEXT: sw a0, 0(s0)
; RV32I-NEXT: sw a1, 4(s0)
; RV32I-NEXT: sw a2, 8(s0)
; RV32I-NEXT: sw a3, 12(s0)
; RV32I-NEXT: lw ra, 60(sp) # 4-byte Folded Reload
; RV32I-NEXT: lw s0, 56(sp) # 4-byte Folded Reload
; RV32I-NEXT: .cfi_restore ra
; RV32I-NEXT: .cfi_restore s0
; RV32I-NEXT: addi sp, sp, 64
; RV32I-NEXT: .cfi_def_cfa_offset 0
; RV32I-NEXT: ret
%a = call fp128 @llvm.minimum.fp128(fp128 %x, fp128 %y)
ret fp128 %a
}
|